/* Umumiy dizayn: admin panel va kassa. Ranglar faqat shu o'zgaruvchilardan olinadi. */
:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --field: #ffffff;
  --border: #e2e7eb;
  --border-strong: #cfd7dd;
  --text: #15202b;
  --muted: #66727f;
  --faint: #98a3ad;
  --accent: #1597a6;
  --accent-strong: #0e7f8c;
  --accent-soft: #e2f4f6;
  --on-accent: #ffffff;
  --green: #1d8a4e;
  --green-soft: #e3f4ea;
  --red: #c8372d;
  --red-soft: #fbe7e5;
  --amber: #b26a00;
  --amber-soft: #fdf1dc;
  --blue: #2f6fd6;
  --blue-soft: #e5eefc;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 4px 16px rgba(16, 24, 32, .06);
  --radius: 12px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --num: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1418; --surface: #171e23; --surface-2: #1c242a; --field: #11171b;
    --border: #263039; --border-strong: #33404a; --text: #e8eef2; --muted: #9aa7b2; --faint: #6c7884;
    --accent: #2bb5c4; --accent-strong: #44c6d4; --accent-soft: #143238; --on-accent: #06181b;
    --green: #3fbf78; --green-soft: #15301f; --red: #f0675c; --red-soft: #3a1a18;
    --amber: #f0b44c; --amber-soft: #382a12; --blue: #6f9ff0; --blue-soft: #17263d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1418; --surface: #171e23; --surface-2: #1c242a; --field: #11171b;
  --border: #263039; --border-strong: #33404a; --text: #e8eef2; --muted: #9aa7b2; --faint: #6c7884;
  --accent: #2bb5c4; --accent-strong: #44c6d4; --accent-soft: #143238; --on-accent: #06181b;
  --green: #3fbf78; --green-soft: #15301f; --red: #f0675c; --red-soft: #3a1a18;
  --amber: #f0b44c; --amber-soft: #382a12; --blue: #6f9ff0; --blue-soft: #17263d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .money { font-family: var(--num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* tugmalar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }

/* maydonlar */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.in, select.in, textarea.in {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--field); outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.in { height: auto; padding: 10px 12px; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* kartalar */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 650; flex: 1; }
.card-b { padding: 16px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.accent { background: var(--accent-soft); color: var(--accent-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* jadval */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--surface-2); }
.tbl-wrap { overflow-x: auto; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 14, 18, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: fade .12s; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .14s; }
.modal.wide { max-width: 640px; }
.modal-h { display: flex; align-items: center; padding: 16px 18px 8px; }
.modal-h h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-b { padding: 8px 18px 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } }

/* xabar */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); animation: pop .15s; max-width: 90vw; }
.toast.err { background: var(--red); color: #fff; }
.toast.ok { background: var(--green); color: #fff; }

/* statistikalar */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .v { font: 650 26px/1.2 var(--num); font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -.01em; }
.kpi .s { font-size: 12px; color: var(--faint); margin-top: 2px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; position: relative; }
.bars .b i { display: block; width: 100%; max-width: 26px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.bars .b.zero i { background: var(--border); height: 2px !important; }
.bars .b span { font-size: 10px; color: var(--faint); margin-top: 4px; }
.bars .b:hover i { background: var(--accent-strong); }
.bars .b[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; }
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.empty { padding: 40px 16px; text-align: center; color: var(--faint); }
.spin { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg) } }

/* kirish oynasi */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; padding: 28px 24px; }
.login .logo { width: 56px; height: 56px; border-radius: 14px; display: block; margin: 0 auto 14px; }
.login h1 { text-align: center; font-size: 21px; margin: 0 0 4px; }
.login p.sub { text-align: center; color: var(--muted); margin: 0 0 20px; }
.err-box { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; font-weight: 500; }

/* admin qobig'i */
.shell { display: flex; min-height: 100%; }
.side { width: 232px; flex: none; background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; }
.side .brand img { width: 32px; height: 32px; border-radius: 8px; }
.nav-a { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--muted); cursor: pointer; font-weight: 550; border: 0; background: none; width: 100%; text-align: left; }
.nav-a:hover { background: var(--surface-2); color: var(--text); }
.nav-a.on { background: var(--accent-soft); color: var(--accent-strong); }
.main { flex: 1; min-width: 0; padding: 22px 28px 40px; }
.page-h { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h h2 { margin: 0; font-size: 22px; flex: 1; letter-spacing: -.01em; white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; height: 32px; padding: 0 12px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.swatch { width: 18px; height: 18px; border-radius: 5px; display: inline-block; vertical-align: middle; border: 1px solid rgba(0,0,0,.08); }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors button { width: 32px; height: 32px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.colors button.on { border-color: var(--text); }
.tokenbox { font-family: Consolas, monospace; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: 12px; border-radius: 10px; word-break: break-all; font-size: 14px; user-select: all; }

.bottom-nav { display: none; }
@media (max-width: 860px) {
  .side { display: none; }
  .main { padding: 16px 16px 90px; }
  .grid2 { grid-template-columns: 1fr; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 40; overflow-x: auto; }
  .bottom-nav .nav-a { flex-direction: column; height: auto; gap: 3px; padding: 6px 4px; font-size: 11px; justify-content: center; align-items: center; min-width: 64px; text-align: center; }
  .page-h h2 { font-size: 19px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 20px; }
  .page-h .row { width: 100%; }
  .page-h .row .in { flex: 1; width: auto !important; }
  .hide-m { display: none; }
}
