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

:root {
  color-scheme: light;
  --bg: #f4f3ef; --surface: #fcfcfb; --surface-2: #ffffff; --line: #e6e5e1; --line-2: #d6d5cf;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #8a8984;
  --series: #2a78d6; --series-soft: #e3eefb; --track: #eef1f5;
  --accent: #2a78d6; --accent-ink: #ffffff;
  --good: #0a7a3d; --good-bg: #e2f4ea; --warn: #9a6100; --warn-bg: #fdf0d8; --bad: #b42318; --bad-bg: #fde4e1;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #20201f; --line: #2c2c2a; --line-2: #3a3a37;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #8d8c85;
    --series: #3987e5; --series-soft: #1d2a3a; --track: #262b31;
    --accent: #3987e5; --accent-ink: #ffffff;
    --good: #5fd08f; --good-bg: #16301f; --warn: #f0b44c; --warn-bg: #33270f; --bad: #ff8a7a; --bad-bg: #3a1b17;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #20201f; --line: #2c2c2a; --line-2: #3a3a37;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #8d8c85;
  --series: #3987e5; --series-soft: #1d2a3a; --track: #262b31;
  --accent: #3987e5; --accent-ink: #ffffff;
  --good: #5fd08f; --good-bg: #16301f; --warn: #f0b44c; --warn-bg: #33270f; --bad: #ff8a7a; --bad-bg: #3a1b17;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.6 'Vazirmatn', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
[hidden] { display: none !important; }

/* ── login ── */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 20px; color: var(--ink-2); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface-2); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--series-soft); }
.input.ltr { direction: ltr; text-align: left; letter-spacing: 1px; }
.err { color: var(--bad); font-size: 13px; min-height: 20px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }

/* ── shell ── */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--surface); border-left: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { padding: 4px 10px 16px; }
.brand b { display: block; font-size: 16px; }
.brand span { color: var(--muted); font-size: 12.5px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--ink-2); }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--series-soft); color: var(--ink); font-weight: 700; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.dots { display: flex; gap: 12px; flex-wrap: wrap; }
.dot { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.ok i { background: var(--good); }
.dot.down i { background: var(--bad); }
.side-foot .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.main { padding: 22px 28px 40px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { font-size: 22px; margin: 0; }
.head .sub { color: var(--muted); font-size: 13px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chips { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.chips button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.chips button.on { background: var(--accent); color: var(--accent-ink); }

/* ── cards ── */
.grid { display: grid; gap: 14px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.tile .lbl { color: var(--ink-2); font-size: 13px; }
.tile .val { font-size: 24px; font-weight: 800; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .dl { font-size: 12.5px; color: var(--ink-2); }
.tile .dl b { color: var(--ink); }
.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-bottom: 14px; }
.halves { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 14px; }

/* ── chart ── */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-l { stroke: var(--line); }
.chart .axis-l { stroke: var(--line-2); }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .bar { fill: var(--series); }
.chart .hit:hover + .bar, .chart .bar.hover { filter: brightness(1.12); }
.chart .val { fill: var(--ink); font-weight: 700; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); padding: 6px 10px; border-radius: 8px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; }

/* ── bars/progress ── */
.share { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.track { flex: 1; height: 8px; background: var(--track); border-radius: 5px; overflow: hidden; }
.fill { height: 100%; background: var(--series); border-radius: 5px; }
.share span { width: 38px; font-size: 12px; color: var(--ink-2); }
.rank-list { display: grid; gap: 12px; }
.rank-item .top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.rank-item .top b { font-weight: 700; }

/* ── tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: right; font-weight: 600; font-size: 12.5px; color: var(--ink-2); padding: 9px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }
tr.fresh td { animation: fresh 2.5s ease-out; }
@keyframes fresh { from { background: var(--series-soft); } to { background: transparent; } }
.empty { text-align: center; color: var(--muted); padding: 28px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: var(--track); color: var(--ink-2); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters .input { width: auto; min-width: 120px; padding: 6px 10px; }
.filters .search { min-width: 220px; }
.strip { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 12px; color: var(--ink-2); }
.strip b { color: var(--ink); }

/* ── feed ── */
.feed { display: grid; gap: 2px; }
.feed-item { display: flex; justify-content: space-between; gap: 8px; padding: 8px 6px; border-radius: 8px; cursor: pointer; }
.feed-item:hover { background: var(--bg); }
.feed-item.fresh { animation: fresh 3s ease-out; }
.feed-item .t { font-size: 12px; color: var(--muted); }

/* ── drawer ── */
.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(560px, 100vw); background: var(--surface); z-index: 21; overflow-y: auto; padding: 20px 22px; box-shadow: 0 0 40px rgba(0,0,0,.2); }
.drawer h2 { margin: 0; font-size: 19px; }
.drawer .close { position: sticky; top: 0; float: left; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }

/* ── seller cards ── */
.sellers { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.seller .name { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.seller .name b { font-size: 16px; }
.seller .big { font-size: 22px; font-weight: 800; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 10px 0; font-size: 13px; }
.stats span { color: var(--ink-2); }
.target { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.target .track { height: 10px; }
.target .fill.done { background: var(--good); }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 8px; }
.inline-form .input { padding: 5px 8px; min-width: 0; width: 100%; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 8px 14px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 16px; }
.logo-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.logo-box img { max-height: 70px; max-width: 200px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
td .input { padding: 5px 8px; min-width: 80px; }

.toast-wrap { position: fixed; bottom: 18px; left: 18px; display: grid; gap: 8px; z-index: 30; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: 340px; animation: in .25s ease-out; }
@keyframes in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on i { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }

/* ── mobile ── */
.menu-btn { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; right: 0; top: 0; z-index: 25; width: 250px; transform: translateX(100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .menu-btn { display: inline-flex; }
  .main { padding: 14px 16px 40px; }
  .two { grid-template-columns: 1fr; }
  .tile .val { font-size: 20px; }
}
