@font-face { font-family: "Vazirmatn"; src: url(Vazirmatn.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #f5f4f0; --card: #fff; --ink: #1c2226; --muted: #67717a; --line: #e5e3dd; --soft: #f0eee9; --hover: #f7f6f2;
  --accent: #0f766e; --accent-ink: #fff; --accent-soft: #d8eeeb; --accent-2: #14b8a6;
  --bad: #b42318; --bad-soft: #fde6e3; --warn: #a96a07; --warn-soft: #fbefd5; --good: #15803d; --good-soft: #def3e4; --info: #1d5fd1; --info-soft: #e2ecfc;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,25,30,.05), 0 6px 22px rgba(20,25,30,.06);
  --side: 232px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121518; --card: #1b1f23; --ink: #e9ebed; --muted: #97a1aa; --line: #2a3036; --soft: #22272c; --hover: #20252a;
    --accent: #2dd4bf; --accent-ink: #052e2b; --accent-soft: #11393a; --accent-2: #5eead4;
    --bad: #f97066; --bad-soft: #3b1d1a; --warn: #fbbf24; --warn-soft: #392f14; --good: #4ade80; --good-soft: #15321f; --info: #7cb0ff; --info-soft: #172a4a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 26px rgba(0,0,0,.35); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.85 "Vazirmatn", system-ui, sans-serif; }
h1 { font-size: 21px; margin: 0; font-weight: 800; } h2 { font-size: 15.5px; margin: 0 0 12px; font-weight: 700; } h3 { font-size: 14px; margin: 0 0 8px; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; } .bold { font-weight: 700; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: left; } .num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; } .grow { flex: 1; min-width: 0; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: 10px; }
.between { justify-content: space-between; } .end { margin-inline-start: auto; }
.mt { margin-top: 14px; } .mt2 { margin-top: 22px; } .mb { margin-bottom: 14px; }

/* controls */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 6px 15px; cursor: pointer; line-height: 1.7; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--soft); } .btn:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); } .btn.danger:hover { background: var(--bad-soft); }
.btn svg { width: 16px; height: 16px; vertical-align: -3px; }
.btn.sm { padding: 1px 11px; font-size: 12.5px; } .btn.ghost { border-color: transparent; background: transparent; } .btn.ghost:hover { background: var(--soft); }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 7px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
textarea { resize: vertical; min-height: 130px; line-height: 1.9; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
label.f > span { font-weight: 600; } label.f .hint { font-weight: 400; font-size: 11.5px; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.chk input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + i { background: var(--accent); } .switch input:checked + i::after { transform: translateX(-16px); }
.switch input:focus-visible + i { outline: 3px solid var(--accent-soft); }

/* layout */
#app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--card); border-inline-end: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 800; font-size: 16px; }
.brand b { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 17px; }
.brand small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--hover); } .nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; } .nav .cnt { margin-inline-start: auto; font-size: 11.5px; background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: 0 8px; font-weight: 700; }
.side .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.main { padding: 22px 26px 60px; min-width: 0; max-width: 1240px; width: 100%; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top .sub { color: var(--muted); font-size: 13px; }
.burger { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 40; transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; } .burger { display: inline-flex; } .main { padding: 16px 14px 60px; }
}

/* cards & kpis */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card.flat { box-shadow: none; } .card h2 .sub { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-inline-start: 8px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } .g6 { grid-template-columns: repeat(6, 1fr); }
.g21 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) { .g6 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) { .g2, .g3, .g21 { grid-template-columns: 1fr; } .g6 { grid-template-columns: repeat(2, 1fr); } }
.kpi { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); text-align: start; cursor: default; display: block; width: 100%; }
button.kpi { cursor: pointer; } button.kpi:hover { border-color: var(--accent); }
.kpi .v { font-size: 25px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; } .kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .d { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.kpi.good .v { color: var(--good); } .kpi.warn .v { color: var(--warn); } .kpi.bad .v { color: var(--bad); } .kpi.acc .v { color: var(--accent); }

/* badges, chips */
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 0 10px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; line-height: 1.8; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active { background: var(--good-soft); color: var(--good); } .badge.trial { background: var(--info-soft); color: var(--info); }
.badge.expired { background: var(--bad-soft); color: var(--bad); } .badge.none { background: var(--soft); color: var(--muted); }
.badge.admin { background: var(--accent-soft); color: var(--accent); } .badge.disabled { background: var(--bad-soft); color: var(--bad); }
.badge.soon { background: var(--warn-soft); color: var(--warn); } .badge.plain::before { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 1px 13px; cursor: pointer; font-size: 13px; }
.chip:hover { background: var(--soft); } .chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chip .n { opacity: .75; font-size: 11.5px; margin-inline-start: 4px; }

/* table */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12px; padding: 9px 14px; background: var(--soft); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; } .tbl tbody tr:hover td { background: var(--hover); } .tbl tr.click { cursor: pointer; }
.tbl td.act { text-align: end; white-space: nowrap; }
.empty { text-align: center; padding: 38px 16px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 14px; color: var(--muted); font-size: 13px; }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 8px; }
.bars .b { flex: 1; min-width: 3px; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85; position: relative; min-height: 2px; }
.bars .b:hover { opacity: 1; background: var(--accent-2); } .bars .b.zero { background: var(--line); opacity: 1; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 4px; }
.line { width: 100%; height: 130px; display: block; } .line .ln { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.line .a { stroke: var(--accent); } .line .b { stroke: var(--info); } .line .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; } .legend .lgd-a { background: var(--accent); } .legend .lgd-b { background: var(--info); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 74px 1fr 66px; gap: 10px; align-items: center; margin: 7px 0; font-size: 13px; }
.hbar .tr { height: 10px; background: var(--soft); border-radius: 99px; overflow: hidden; } .hbar .fl { height: 100%; background: var(--accent); border-radius: 99px; }

/* plan picker */
.plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.plan { border: 1.5px solid var(--line); background: var(--card); border-radius: 11px; padding: 9px 6px; text-align: center; cursor: pointer; line-height: 1.5; }
.plan:hover { border-color: var(--accent); } .plan.on { border-color: var(--accent); background: var(--accent-soft); }
.plan b { display: block; font-size: 15px; } .plan span { display: block; font-size: 11.5px; color: var(--muted); }
@media (max-width: 520px) { .plans { grid-template-columns: repeat(2, 1fr); } }

/* drawer, modal, toast */
.scrim { position: fixed; inset: 0; background: rgba(10,14,18,.45); z-index: 50; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } } @keyframes slide { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer { position: fixed; inset-block: 0; inset-inline-end: auto; left: 0; width: min(560px, 100vw); background: var(--bg); z-index: 51; box-shadow: var(--shadow); overflow-y: auto; animation: slide .18s; display: flex; flex-direction: column; }
.drawer header { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; align-items: center; gap: 12px; }
.drawer .body { padding: 16px 18px 40px; display: flex; flex-direction: column; gap: 14px; }
.modal { position: fixed; z-index: 51; inset-inline: 0; top: 7vh; margin: 0 auto; width: min(620px, calc(100vw - 24px)); max-height: 86vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 20px 22px; animation: fade .15s; }
.modal h2 { font-size: 17px; } .modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
#toasts { position: fixed; bottom: 18px; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 80; pointer-events: none; }
.toast { background: #1c2226; color: #fff; border-radius: 11px; padding: 8px 18px; box-shadow: var(--shadow); animation: fade .15s; max-width: min(520px, 92vw); }
.toast.bad { background: var(--bad); } .toast.good { background: var(--good); color: #fff; }
.note { border-radius: 10px; padding: 9px 13px; font-size: 13px; background: var(--info-soft); color: var(--info); }
.note.warn { background: var(--warn-soft); color: var(--warn); } .note.bad { background: var(--bad-soft); color: var(--bad); } .note.good { background: var(--good-soft); color: var(--good); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; font-size: 13.5px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.list .it { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); } .list .it:last-child { border-bottom: 0; }
.stick { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(6px); padding: 12px 0; margin-top: 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; z-index: 5; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); } .dot.on { background: var(--good); } .dot.off { background: var(--bad); }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--soft), var(--hover), var(--soft)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 26px; box-shadow: var(--shadow); }
.login .brand { padding: 0 0 18px; font-size: 19px; justify-content: center; flex-direction: column; text-align: center; }
.login .brand b { width: 52px; height: 52px; font-size: 25px; border-radius: 15px; }
@media print { .side, .burger, .btn { display: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
