@font-face { font-family: Vazirmatn; src: url(vazirmatn.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #f5f6fa; --surface: #fff; --line: #e6e8ef; --ink: #161a2b; --muted: #6b7189; --royal: #2f4bff; --royal-soft: #eef1ff;
  --ok: #16a34a; --ok-soft: #e8f7ee; --warn: #d97706; --warn-soft: #fdf3e2; --bad: #dc2626; --bad-soft: #fdecec; --gold: #c08a1a;
  --c1: #2f4bff; --c2: #e0662d; --c3: #16a34a; --c4: #9b51e0; --c5: #0ea5b7; --c6: #d63384;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,24,50,.05), 0 4px 16px rgba(20,24,50,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f111a; --surface: #171a26; --line: #262a3a; --ink: #e8eaf3; --muted: #9096ad; --royal: #6c80ff; --royal-soft: #1e2440;
    --ok-soft: #10291b; --warn-soft: #2b2010; --bad-soft: #2d1416; --shadow: none; --c1: #6c80ff; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.7 Vazirmatn, Tahoma, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .error { color: var(--bad); min-height: 1.4em; margin: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; } code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; direction: ltr; unicode-bidi: isolate; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; padding: 6px 8px 18px; }
.brand.big { font-size: 22px; padding: 0 0 6px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--royal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 22l5-7 4 4 7-10' stroke='white' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100%; }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-inline-start: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.side a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.side a:hover { background: var(--bg); } .side a.active { background: var(--royal-soft); color: var(--royal); }
.side a .badge { margin-inline-start: auto; }
main { min-width: 0; padding: 20px 28px 40px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.top h1 { font-size: 22px; margin: 0; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select, input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; min-height: 38px; }
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--royal); outline-offset: 2px; }
.btn { font: inherit; font-weight: 700; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 16px; cursor: pointer; min-height: 38px; }
.btn.primary { background: var(--royal); border-color: var(--royal); color: #fff; } .btn.ghost { background: transparent; } .btn.small { padding: 4px 12px; min-height: 32px; font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; } .stat .value { font-size: 26px; font-weight: 800; line-height: 1.4; }
.stat .sub { color: var(--muted); font-size: 12px; } .stat.bad .value { color: var(--bad); } .stat.warn .value { color: var(--warn); } .stat.ok .value { color: var(--ok); }
.badge { display: inline-block; border-radius: 999px; padding: 0 9px; font-size: 12px; font-weight: 700; line-height: 22px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.info { background: var(--royal-soft); color: var(--royal); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); } .dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.tablewrap { overflow: auto; max-height: 560px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; position: sticky; top: 0; background: var(--surface); cursor: pointer; white-space: nowrap; user-select: none; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--bg); }
.cell-wrap { max-width: 520px; overflow-wrap: anywhere; }
.chart { position: relative; height: 220px; } .chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; z-index: 2; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; } .legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-inline-end: 5px; vertical-align: middle; }
.empty { color: var(--muted); text-align: center; padding: 28px 8px; }
.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; min-width: 80px; } .bar > span { display: block; height: 100%; background: var(--royal); border-radius: 99px; }
.bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; } .toolbar input[type=search] { min-width: 240px; flex: 1; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border-radius: 10px; padding: 12px; font-size: 12px; direction: ltr; text-align: left; max-height: 420px; overflow: auto; margin: 8px 0; }
.waterfall .row { display: grid; grid-template-columns: minmax(180px, 36%) 1fr 80px; gap: 10px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 12px; cursor: pointer; }
.waterfall .track { position: relative; height: 14px; background: var(--bg); border-radius: 4px; direction: ltr; } .waterfall .span { position: absolute; top: 0; height: 100%; border-radius: 4px; background: var(--royal); min-width: 2px; }
.waterfall .span.err { background: var(--bad); } .waterfall .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; }
.lvl { font-weight: 700; } .lvl-5, .lvl-4 { color: var(--bad); } .lvl-3 { color: var(--warn); } .lvl-2 { color: var(--royal); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; } .login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 28px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.modal { position: fixed; inset: 0; background: rgba(10,12,25,.45); display: grid; place-items: center; padding: 20px; z-index: 10; }
.modal-card { width: min(980px, 100%); max-height: 88vh; overflow: auto; position: relative; } .modal-close { position: absolute; top: 10px; left: 10px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.alerts-strip { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.alert { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--ink); } .alert.critical { background: var(--bad-soft); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border: 0; border-bottom: 1px solid var(--line); }
  .side nav { flex-direction: row; overflow-x: auto; } .side .brand { padding: 4px 8px; } main { padding: 14px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } .waterfall .row { grid-template-columns: 1fr 70px; } .waterfall .track { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: no-preference) { .side a, .btn, tr.click td { transition: background .15s; } }
