@font-face {
  font-family: 'Vazirmatn';
  src: url('vazirmatn-regular.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('vazirmatn-medium.woff2') format('woff2');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('vazirmatn-bold.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}

:root {
  --bg: #0d1220;
  --bg2: #111832;
  --card: #171f3a;
  --card2: #1d2650;
  --line: #2a3560;
  --txt: #eef1fa;
  --muted: #9aa3c7;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --grad: linear-gradient(135deg, #38bdf8, #818cf8);
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2450 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--txt); min-height: 100vh;
}
a { color: var(--accent); }
.muted { color: var(--muted); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 18px 60px; }

/* header */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px; margin-bottom: 6px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 46px; height: 46px; border-radius: 14px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  box-shadow: 0 6px 20px rgba(56,189,248,.35);
}
.brand h1 { font-size: 20px; margin: 0; }
.brand small { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.btn {
  background: var(--card2); color: var(--txt); border: 1px solid var(--line);
  padding: 8px 16px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 13px;
  text-decoration: none; display: inline-block;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--grad); border: none; font-weight: 700; }
.warn-banner {
  background: rgba(251,191,36,.12); border: 1px solid var(--amber); color: var(--amber);
  padding: 10px 16px; border-radius: 12px; margin-bottom: 14px; font-size: 13px;
}

/* filters */
.filters {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 18px;
}
.f-group { display: flex; flex-direction: column; gap: 6px; }
.f-group label { font-size: 12px; color: var(--muted); }
.f-group select, .f-group input[type="date"] {
  background: var(--bg2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 9px 12px; font-family: inherit; font-size: 13px; min-width: 150px;
}
.range-btns { display: flex; gap: 6px; }
.range-btns a {
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  color: var(--muted); text-decoration: none; font-size: 13px; background: var(--bg2);
}
.range-btns a.active { background: var(--grad); color: #0b1020; font-weight: 700; border: none; }
.range-btns button {
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; background: var(--bg2); cursor: pointer; font-family: inherit;
}
.range-btns button.active { background: var(--grad); color: #0b1020; font-weight: 700; border: none; }
.period-note { width: 100%; font-size: 12px; color: var(--muted); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card {
  background: linear-gradient(160deg, var(--card), var(--bg2));
  border: 1px solid var(--line); border-radius: 16px; padding: 16px 14px;
  position: relative; overflow: hidden;
}
.card::after {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: var(--grad); opacity: .7;
}
.card .icon { font-size: 20px; }
.card .label { font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.card .val { font-size: 24px; font-weight: 700; }
.card .chg { font-size: 12px; margin-top: 6px; font-weight: 500; }
.chg.up { color: var(--green); }
.chg.down { color: var(--red); }
.chg.flat { color: var(--muted); }

/* panels */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; margin-bottom: 18px;
}
.panel h2 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.panel .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }

.tabs { display: flex; gap: 6px; }
.tabs button {
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted);
  padding: 7px 14px; border-radius: 9px; cursor: pointer; font-family: inherit; font-size: 12px;
}
.tabs button.active { background: var(--grad); color: #0b1020; font-weight: 700; border: none; }
.chart-box { position: relative; height: 300px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: right; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid rgba(42,53,96,.5); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(56,189,248,.05); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.url-cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; }

.bar { height: 7px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin-top: 6px; min-width: 90px; }
.bar-fill { height: 100%; background: var(--grad); border-radius: 99px; }
.bar-fill.green { background: linear-gradient(135deg, #34d399, #10b981); }
.bar-fill.amber { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.bar-fill.red { background: linear-gradient(135deg, #f87171, #ef4444); }

.dim-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(42,53,96,.5); font-size: 13px; }
.dim-row:last-child { border-bottom: none; }
.dim-row .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 65%; }
.dim-row .v { flex-shrink: 0; }
.dim-row .bar { flex: 1; margin: 0 4px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 500; }
.badge.ok { background: rgba(52,211,153,.15); color: var(--green); }
.badge.warn { background: rgba(251,191,36,.15); color: var(--amber); }
.badge.err { background: rgba(248,113,113,.15); color: var(--red); }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 26px; }

/* login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 40px 36px; width: 360px; max-width: 100%; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.login-logo { font-size: 44px; margin-bottom: 8px; }
.login-card h1 { font-size: 18px; margin: 0 0 6px; }
.login-card form { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.login-card input {
  background: var(--bg2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 12px; padding: 12px 14px; font-family: inherit; font-size: 14px; text-align: center;
}
.login-card button {
  background: var(--grad); border: none; border-radius: 12px; padding: 12px;
  font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer; color: #0b1020;
}
.alert-err { background: rgba(248,113,113,.12); border: 1px solid var(--red); color: var(--red); padding: 9px; border-radius: 10px; font-size: 13px; margin-top: 12px; }
