/* Za_manic analitika: dizayn tizimi.
   Palitra: aubergin matn + olcha-binafsha urg'u; holat ranglari yumshoq fon bilan. Shrift: Onest (kirill + lotin). */
:root {
  --bg: #f5f3f7; --surface: #ffffff; --surface-2: #faf8fb; --ink: #241b2d; --ink-2: #5a5065; --ink-3: #857b90;
  --line: #e6e1ec; --line-2: #d6cfdf;
  --brand: #6d2a63; --brand-ink: #ffffff; --brand-soft: #f3e8f1; --focus: #6d2a63;
  --good: #17794f; --good-bg: #e0f3e8; --warn: #85560a; --warn-bg: #fbeecf; --bad: #a42540; --bad-bg: #fbe2e8;
  --shadow: 0 1px 2px rgba(36, 27, 45, .06), 0 4px 14px rgba(36, 27, 45, .05);
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15111a; --surface: #1e1824; --surface-2: #251e2c; --ink: #f1ebf5; --ink-2: #bcb1c7; --ink-3: #8f849b;
    --line: #322a3a; --line-2: #43394d; --brand: #d9a0d0; --brand-ink: #2a1228; --brand-soft: #33203a; --focus: #e6b8de;
    --good: #66d6a1; --good-bg: #16382a; --warn: #f0c35e; --warn-bg: #3d3114; --bad: #ff8fa5; --bad-bg: #431c27;
    --shadow: 0 1px 2px 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: 15px/1.5 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; }
.mute { color: var(--ink-3); }

/* ---------- Qobiq: yon panel + asosiy maydon ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px;
  background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; text-decoration: none; color: var(--ink); font-weight: 650; font-size: 17px; line-height: 1.1; }
.brand small { display: block; font-weight: 450; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 18px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.nav-a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav-a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-a:hover { background: var(--surface-2); color: var(--ink); }
.nav-a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--warn-bg); color: var(--warn); font-size: 12px; font-weight: 600; text-align: center; }
.side-foot { margin-top: auto; display: grid; gap: 12px; padding: 12px 8px 2px; border-top: 1px solid var(--line); font-size: 13px; }
.sync { display: grid; gap: 5px; }
.sync div { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ink-3); }
.dot.good { background: var(--good); } .dot.warn { background: #d99a1d; } .dot.bad { background: var(--bad); }
.who { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-2); }
.who form { margin: 0; }
.linkbtn { border: 0; background: none; padding: 4px 6px; font: inherit; color: var(--brand); cursor: pointer; border-radius: 6px; }
.linkbtn:hover { background: var(--brand-soft); }

.main { min-width: 0; padding: 22px clamp(14px, 3vw, 32px) 48px; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.top h1 { font-size: 22px; }
.top .sub { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }

/* ---------- Komponentlar ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.card + .card, .card + .grid, .grid + .card, .ribbon + .card, .notice + .card { margin-top: 16px; }
.card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 500 14px var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r-md); background: var(--warn-bg); color: var(--warn); margin-bottom: 14px; font-size: 14px; }
.notice a { color: inherit; font-weight: 600; }

/* Filtrlar */
.filters { display: grid; gap: 12px; margin-bottom: 16px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip[aria-current="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.fbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.field { display: grid; gap: 4px; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.field input, .field select { height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 14px var(--font); min-width: 0; }
.field select { max-width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; height: 36px; }
.seg label { display: grid; place-items: center; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; border-left: 1px solid var(--line-2); }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--brand); font-weight: 650; }
.seg label:has(input:checked) { background: var(--brand-soft); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.fbar .spacer { flex: 1; }

/* ---------- Lenta: Расход -> odamlar -> pul ---------- */
.ribbon { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.rb-end { display: grid; align-content: center; gap: 3px; padding: 16px 22px; min-width: 150px; }
.rb-end.left { background: var(--surface-2); border-right: 1px solid var(--line); }
.rb-end.right { background: var(--brand); color: var(--brand-ink); }
.rb-k { font-size: 12px; opacity: .8; }
.rb-v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.rb-sub { font-size: 13px; opacity: .9; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 650; }
.pill.g { background: var(--good-bg); color: var(--good); } .pill.y { background: var(--warn-bg); color: var(--warn); } .pill.r { background: var(--bad-bg); color: var(--bad); }
.rb-end.right .pill { background: rgba(255, 255, 255, .22); color: inherit; }
.rb-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rb-step { position: relative; display: grid; align-content: center; gap: 2px; padding: 14px 16px 18px; border-left: 1px solid var(--line); }
.rb-step:first-child { border-left: 0; }
.rb-step b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.rb-step span { font-size: 13px; color: var(--ink-2); }
.rb-step em { position: absolute; top: 10px; right: 12px; font-size: 12px; font-style: normal; color: var(--ink-3); }
.rb-bar { position: absolute; left: 0; bottom: 0; height: 5px; width: var(--w, 0%); background: var(--brand); opacity: .85; border-radius: 0 4px 0 0; }
.rb-empty { grid-column: 1 / -1; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 14px; }

/* ---------- A/B ---------- */
.verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.vbadge { padding: 5px 12px; border-radius: 99px; font-weight: 650; font-size: 14px; }
.vbadge.winner { background: var(--good-bg); color: var(--good); } .vbadge.mixed { background: var(--warn-bg); color: var(--warn); } .vbadge.insufficient { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ab { width: 100%; border-collapse: collapse; font-size: 14px; }
.ab th, .ab td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.ab th:first-child, .ab td:first-child { text-align: left; color: var(--ink-2); }
.ab thead th { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.ab td.better { font-weight: 700; color: var(--good); }
.ab td.better::after { content: " ✓"; font-size: 12px; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.chart { height: 280px; }

/* ---------- Jadvallar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.toolbar input[type="search"] { height: 36px; width: min(260px, 100%); padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 14px var(--font); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.scroll { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: var(--r-md); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.t th, .t td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); background: var(--surface); }
.t thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: 12.5px; cursor: pointer; user-select: none; }
.t thead th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; } .t thead th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
.t th:first-child, .t td:first-child { position: sticky; left: 0; z-index: 1; text-align: left; border-right: 1px solid var(--line); min-width: 210px; max-width: 280px; white-space: normal; }
.t thead th:first-child { z-index: 3; }
.t tbody tr:hover td { background: var(--surface-2); }
.t tr.tot td { background: var(--brand-soft); font-weight: 700; color: var(--ink); }
.t td small { display: block; margin-top: 1px; color: var(--ink-3); font-weight: 400; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.t td.g { background: var(--good-bg); color: var(--good); font-weight: 600; } .t td.y { background: var(--warn-bg); color: var(--warn); font-weight: 600; } .t td.r { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.t .none { color: var(--ink-3); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 12.5px; color: var(--ink-3); }
.legend b { color: var(--ink-2); font-weight: 600; }
.empty { display: grid; justify-items: center; gap: 6px; padding: 38px 16px; text-align: center; color: var(--ink-2); }
.empty b { font-size: 16px; color: var(--ink); }

/* ---------- Kirish sahifasi ---------- */
.auth { display: grid; grid-template-columns: minmax(300px, 5fr) minmax(320px, 6fr); min-height: 100vh; }
.auth-brand { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: clamp(24px, 5vw, 56px); background: #52204a; color: #fff; }
.auth-brand .mark { background: #fff; color: #52204a; }
.auth-brand .brand { color: inherit; padding: 0; }
.auth-brand .brand small { color: inherit; opacity: .8; }
.auth-brand h2 { font-size: clamp(26px, 3.2vw, 38px); line-height: 1.12; letter-spacing: -.025em; font-weight: 700; max-width: 13ch; }
.path { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.path li { position: relative; padding: 0 0 18px 28px; font-size: 15px; opacity: .92; }
.path li:last-child { padding-bottom: 0; }
.path li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.path li::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: -4px; width: 2px; background: #fff; opacity: .35; }
.path li:last-child::after { display: none; }
.auth-form { display: grid; place-items: center; padding: 28px 20px; }
.auth-card { width: min(100%, 380px); display: grid; gap: 18px; }
.auth-card h1 { font-size: 26px; }
.auth-card p { margin: 4px 0 0; color: var(--ink-2); }
.af { display: grid; gap: 6px; }
.af label { font-size: 14px; font-weight: 600; }
.af input { height: 46px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: 16px var(--font); width: 100%; }
.af .hint { font-size: 12.5px; color: var(--ink-3); min-height: 18px; }
.af .hint.warn { color: var(--warn); font-weight: 600; }
.pw { position: relative; }
.pw input { padding-right: 78px; }
.pw button { position: absolute; right: 6px; top: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); font: 500 13px var(--font); cursor: pointer; }
.auth-err { padding: 11px 14px; border-radius: var(--r-md); background: var(--bad-bg); color: var(--bad); font-size: 14px; font-weight: 500; }
.auth-card .btn.primary { height: 48px; justify-content: center; font-size: 16px; width: 100%; }

/* ---------- Mobil ---------- */
@media (max-width: 960px) {
  .shell { display: block; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 0; } .brand small { display: none; }
  .side nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .side-foot { margin: 0; border: 0; padding: 0; flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .sync { grid-auto-flow: column; gap: 14px; }
  .grid { grid-template-columns: 1fr; }
  .ribbon { grid-template-columns: 1fr; }
  .rb-end.left { border-right: 0; border-bottom: 1px solid var(--line); }
  .rb-steps { grid-template-columns: repeat(5, minmax(88px, 1fr)); overflow-x: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { gap: 20px; } .auth-brand .path { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .side, .filters, .toolbar { display: none; } .shell { display: block; } }

/* Til almashtirgich (dashboard) */
.zm-lang { display: inline-flex; margin: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.zm-lang button { border: 0; background: var(--surface); color: var(--ink-2); padding: 4px 10px; font: 600 12px var(--font); cursor: pointer; }
.zm-lang button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.zm-lang button:hover { background: var(--surface-2); }
/* Xabarlar va oddiy formalar */
.msgs { display: grid; gap: 8px; margin-bottom: 14px; }
.msg { padding: 11px 14px; border-radius: var(--r-md); font-size: 14px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); }
.msg.success { background: var(--good-bg); color: var(--good); border-color: transparent; }
.msg.error { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.sgrid { display: grid; gap: 16px; }
.sgrid .card + .card { margin-top: 0; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.lead-in { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.sf { display: grid; gap: 12px; }
.sf .field input[type="text"], .sf .field input[type="time"], .sf .field input[type="number"], .sf .field input[type="date"] { width: 100%; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.inline { display: inline; margin: 0; }
.list { display: grid; gap: 10px; margin-top: 12px; }
.item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.item b { font-weight: 600; }
.item .meta { color: var(--ink-3); font-size: 13px; }
.item .acts { display: flex; gap: 6px; }
.qbtn { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); padding: 4px 10px; border-radius: 99px; font: 500 13px var(--font); cursor: pointer; }
.qbtn.on { background: var(--good-bg); color: var(--good); border-color: transparent; font-weight: 650; }
.link-form { display: flex; gap: 6px; align-items: center; }
.link-form select { height: 34px; max-width: 360px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 13px var(--font); }
.run { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }