@font-face { font-family: "Vazirmatn"; src: url("/fonts/Vazirmatn.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f4f6fa; --card: #fff; --line: #e4e8f0; --text: #1c2433; --muted: #6b7690;
  --primary: #2563eb; --primary-d: #1d4ed8; --primary-l: #e8f0ff;
  --green: #16a34a; --green-l: #e6f6ec; --red: #dc2626; --red-l: #fdeaea; --amber: #d97706; --amber-l: #fff3df;
  --side: #0f172a; --side-t: #a8b3cf; --radius: 12px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.7; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; text-align: left; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.center { text-align: center; } .grow { flex: 1; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; flex: none; }

/* ---------- ورود ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 80% -10%, #dbe7ff 0, transparent 60%), var(--bg); }
.login { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; padding: 32px 28px; box-shadow: var(--shadow); }
.login h1 { margin: 12px 0 4px; font-size: 22px; } .login p { margin: 0 0 22px; color: var(--muted); }
.logo { width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; display: grid; place-items: center; }
.logo svg.i { width: 26px; height: 26px; }

/* ---------- چیدمان ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100%; }
.side { background: var(--side); color: var(--side-t); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 18px; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; } .brand .logo svg.i { width: 19px; height: 19px; }
.nav a { display: flex; align-items: center; gap: 11px; color: var(--side-t); padding: 9px 12px; border-radius: 9px; transition: .15s; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.side .foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 12px 8px 0; font-size: 13px; }
.side .foot b { color: #fff; display: block; } .side .foot a { color: var(--side-t); cursor: pointer; display: inline-flex; gap: 6px; margin-top: 6px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: none; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
#view { padding: 24px 28px 120px; max-width: 1280px; width: 100%; }
.page-h { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h h2 { margin: 0; font-size: 20px; }

/* ---------- اجزا ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-weight: 600; }
.card .card-b { padding: 16px 18px; }
.grid { display: grid; gap: 16px; } .g4 { grid-template-columns: repeat(4, 1fr); } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: 1.4fr 1fr; }
.tile { padding: 16px 18px; } .tile .n { font-size: 28px; font-weight: 700; line-height: 1.2; } .tile .l { color: var(--muted); font-size: 12.5px; }
.tile .ic { float: left; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-l); color: var(--primary); }
.tile.green .ic { background: var(--green-l); color: var(--green); } .tile.red .ic { background: var(--red-l); color: var(--red); } .tile.amber .ic { background: var(--amber-l); color: var(--amber); }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 9px; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { background: #f1f4fa; } .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-d); }
.btn.danger { color: var(--red); } .btn.danger:hover { background: var(--red-l); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: #eef1f7; color: var(--text); } .icon-btn.danger:hover { background: var(--red-l); color: var(--red); }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; background: #fff; outline: none; transition: .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
label.f { display: block; margin-bottom: 13px; } label.f > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
label.chk { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.row { display: flex; gap: 12px; } .row > * { flex: 1; min-width: 0; }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; } .bar input, .bar select { width: auto; min-width: 120px; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: right; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
table.t td { padding: 10px 14px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; } table.t tbody tr:hover td { background: #fafcff; }
.tbl-wrap { overflow-x: auto; } .empty { padding: 40px 10px; text-align: center; color: var(--muted); }
.acts { display: flex; gap: 2px; justify-content: flex-end; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 10px; border-radius: 20px; font-size: 12px; background: #eef1f7; color: #44506b; white-space: nowrap; }
.chip.green { background: var(--green-l); color: var(--green); } .chip.red { background: var(--red-l); color: var(--red); }
.chip.amber { background: var(--amber-l); color: var(--amber); } .chip.blue { background: var(--primary-l); color: var(--primary); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #b9c2d6; display: inline-block; flex: none; } .dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-l); } .dot.bad { background: var(--red); }
.cdr-ic { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--primary-l); color: var(--primary); }
.cdr-ic.in { background: var(--green-l); color: var(--green); } .cdr-ic.miss { background: var(--red-l); color: var(--red); } .cdr-ic.int { background: #eef1f7; color: #5b6784; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 14px; }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 11px; color: var(--muted); }
.bars .b i { width: 100%; max-width: 38px; border-radius: 6px 6px 2px 2px; background: #cfdcff; position: relative; display: block; min-height: 3px; }
.bars .b i s { position: absolute; inset: auto 0 0 0; background: var(--primary); border-radius: 6px 6px 2px 2px; text-decoration: none; }
.list { display: flex; flex-direction: column; } .list .li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eef1f6; } .list .li:last-child { border: 0; }

/* ---------- مودال و toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 100; padding: 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(15,23,42,.3); animation: pop .15s ease-out; }
.modal.wide { max-width: 680px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
.modal-b { padding: 18px; max-height: 76vh; overflow-y: auto; } .modal-f { display: flex; justify-content: flex-start; gap: 8px; margin-top: 8px; }
.form-err { background: var(--red-l); color: var(--red); border-radius: 9px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }
.note { background: var(--primary-l); color: #1e40af; border-radius: 10px; padding: 10px 13px; font-size: 13px; margin-bottom: 14px; }
.note.warn { background: var(--amber-l); color: #92400e; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
#toasts { position: fixed; top: 16px; left: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1e293b; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; animation: pop .2s; }
.toast.ok { background: #15803d; } .toast.err { background: #b91c1c; }

/* ---------- سافت‌فون ---------- */
.sp { position: fixed; left: 18px; bottom: 18px; z-index: 60; direction: rtl; }
.sp-fab { width: 58px; height: 58px; border-radius: 50%; border: 0; background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; cursor: pointer; box-shadow: 0 8px 24px rgba(21,128,61,.4); display: grid; place-items: center; position: relative; }
.sp-fab svg.i { width: 26px; height: 26px; } .sp-fab .st { position: absolute; top: 3px; right: 3px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; background: #f59e0b; }
.sp-fab .st.ok { background: #22c55e; } .sp-fab .st.off { background: #ef4444; }
.sp-fab.ring { animation: ring 1s infinite; background: linear-gradient(135deg, #f97316, #dc2626); }
@keyframes ring { 0%,100% { transform: rotate(0) scale(1); } 20% { transform: rotate(-14deg) scale(1.08); } 40% { transform: rotate(14deg) scale(1.08); } 60% { transform: rotate(-8deg); } }
.sp-panel { position: absolute; left: 0; bottom: 70px; width: 318px; background: #fff; border-radius: 18px; box-shadow: 0 16px 50px rgba(15,23,42,.28); border: 1px solid var(--line); overflow: hidden; display: none; }
.sp.open .sp-panel { display: block; animation: pop .15s; }
.sp-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: #0f172a; color: #fff; font-size: 13px; }
.sp-head .dot { margin-inline-end: 2px; } .sp-head .icon-btn { color: #aab6d3; } .sp-head .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; } .sp-head .icon-btn.on { color: #fbbf24; }
.sp-body { padding: 14px; }
.sp-num { width: 100%; direction: ltr; text-align: center; font-size: 22px; letter-spacing: .5px; border: 0; border-bottom: 2px solid var(--line); border-radius: 0; padding: 8px 4px; background: transparent; }
.sp-num:focus { box-shadow: none; border-color: var(--primary); }
.sp-hint { min-height: 22px; text-align: center; font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; } .sp-hint.bad { color: var(--red); } .sp-hint.ok { color: var(--green); }
.sp-trunk { margin-bottom: 8px; font-size: 12.5px; } .sp-trunk select { padding: 5px 8px; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; direction: ltr; }
.key { border: 1px solid var(--line); background: #f8fafc; border-radius: 12px; padding: 9px 0; font-size: 19px; cursor: pointer; line-height: 1.2; user-select: none; }
.key small { display: block; font-size: 9px; color: var(--muted); letter-spacing: 1.5px; } .key:hover { background: #eef2fa; } .key:active { background: #dfe7f5; }
.sp-actions { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 8px; margin-top: 10px; direction: ltr; }
.call-btn { border: 0; border-radius: 28px; padding: 11px; background: var(--green); color: #fff; cursor: pointer; display: grid; place-items: center; }
.call-btn:hover { filter: brightness(1.08); } .call-btn:disabled { background: #b6c2d6; cursor: not-allowed; } .call-btn.end { background: var(--red); }
.sp-who { text-align: center; padding: 8px 0 4px; } .sp-who .nm { font-size: 18px; font-weight: 700; } .sp-who .no { color: var(--muted); direction: ltr; unicode-bidi: isolate; }
.sp-who .tm { font-size: 22px; font-variant-numeric: tabular-nums; margin-top: 4px; direction: ltr; } .sp-who .stt { color: var(--muted); font-size: 12.5px; }
.sp-ctl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.ctl { border: 1px solid var(--line); background: #f8fafc; border-radius: 12px; padding: 9px 2px 6px; cursor: pointer; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text); }
.ctl:hover { background: #eef2fa; } .ctl.on { background: var(--primary); color: #fff; border-color: var(--primary); } .ctl:disabled { opacity: .45; }
.sp-in { background: linear-gradient(180deg, #fff7ed, #fff); } .sp-in .acts2 { display: flex; gap: 14px; justify-content: center; margin-top: 12px; }
.sp-in .call-btn { width: 64px; height: 64px; border-radius: 50%; }
.sp-msg { padding: 8px 0; text-align: center; color: var(--muted); }

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 980px) {
  .g4 { grid-template-columns: repeat(2, 1fr); } .g3, .g2 { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: 250px; z-index: 50; transform: translateX(105%); transition: transform .2s; } .side.open { transform: none; }
  .top { display: flex; } #view { padding: 16px 14px 120px; }
  .sp { left: 10px; bottom: 10px; } .sp-panel { width: min(318px, calc(100vw - 20px)); }
  .row { flex-direction: column; gap: 0; }
}

/* تب‌ها و کمکی‌های فرم */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 9px 16px; cursor: pointer; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; max-height: 190px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }
