:root {
  --bg: #f3f4f8;
  --bg-2: #eceef4;
  --card: #ffffff;
  --card-2: #f7f8fb;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --border: #e6e8ef;
  --primary: #5b5bf6;
  --primary-2: #7c5cf6;
  --primary-soft: rgba(91, 91, 246, .1);
  --green: #12a150;
  --green-soft: rgba(18, 161, 80, .1);
  --red: #e5484d;
  --red-soft: rgba(229, 72, 77, .1);
  --amber: #e38a00;
  --amber-soft: rgba(227, 138, 0, .12);
  --blue: #0b84e0;
  --blue-soft: rgba(11, 132, 224, .1);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .18);
  --radius: 18px;
  --radius-sm: 12px;
  --hero-1: #4f46e5;
  --hero-2: #7c3aed;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg: #0c0f16;
  --bg-2: #121722;
  --card: #151b26;
  --card-2: #1b2230;
  --text: #eef1f7;
  --text-2: #cbd3e1;
  --muted: #8e98ab;
  --faint: #667085;
  --border: #242c3b;
  --primary: #7b7bff;
  --primary-2: #9d7bff;
  --primary-soft: rgba(123, 123, 255, .14);
  --green: #3ccf7a;
  --green-soft: rgba(60, 207, 122, .13);
  --red: #ff6b70;
  --red-soft: rgba(255, 107, 112, .13);
  --amber: #ffb224;
  --amber-soft: rgba(255, 178, 36, .13);
  --blue: #45a8ff;
  --blue-soft: rgba(69, 168, 255, .13);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .2);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  --hero-1: #4338ca;
  --hero-2: #6d28d9;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.green { color: var(--green); }
.red { color: var(--red); }
.amber { color: var(--amber); }
.hidden { display: none !important; }

/* ── boot / loading ─────────────────────────── */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; }
.boot-logo {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); color: #fff; font-weight: 800; font-size: 22px;
  box-shadow: 0 10px 30px rgba(91, 91, 246, .35);
}
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, var(--card-2) 25%, var(--border) 50%, var(--card-2) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); }
@keyframes sk { to { background-position: -200% 0; } }

/* ── layout ─────────────────────────────────── */
.page { padding: 12px 16px calc(var(--nav-h) + var(--safe-b) + 24px); max-width: 640px; margin: 0 auto; animation: fade .18s ease; }
.page.no-nav { padding-bottom: calc(var(--safe-b) + 28px); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; gap: 12px; padding: 6px 0 14px; }
.topbar .t-main { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--card);
  box-shadow: var(--shadow); color: var(--text-2); flex: none;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { transform: scale(.94); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--primary-soft); color: var(--primary); }
.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.gray { background: var(--card-2); color: var(--muted); }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; font-size: 15px; font-weight: 700; }
.section-title .link { color: var(--primary); font-size: 13.5px; font-weight: 600; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 12px; }
.card.flat { box-shadow: none; border: 1px solid var(--border); }
.card-title { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }

/* ── hero ───────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.16), transparent 50%), linear-gradient(135deg, var(--hero-1), var(--hero-2));
  box-shadow: 0 12px 30px rgba(79, 70, 229, .28);
}
.hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.07); }
.hero .h-label { font-size: 13px; opacity: .82; font-weight: 500; }
.hero .h-value { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin: 4px 0 14px; line-height: 1.1; }
.hero .h-value small { font-size: 15px; font-weight: 600; opacity: .8; margin-left: 4px; }
.hero .h-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; z-index: 1; }
.hero .h-cell { background: rgba(255,255,255,.13); border-radius: 12px; padding: 9px 10px; min-width: 0; }
.hero .h-cell .l { font-size: 11.5px; opacity: .8; }
.hero .h-cell .v { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .h-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.18); font-size: 13.5px; position: relative; z-index: 1; }
.hero .h-foot b { font-size: 15.5px; }

/* ── stats grid ─────────────────────────────── */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: 16px; padding: 13px 14px; box-shadow: var(--shadow); min-width: 0; }
.stat .s-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .s-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; }
.stat .s-val { font-size: 18px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.wide { grid-column: span 2; }
.ico-green { background: var(--green-soft); color: var(--green); }
.ico-red { background: var(--red-soft); color: var(--red); }
.ico-amber { background: var(--amber-soft); color: var(--amber); }
.ico-blue { background: var(--blue-soft); color: var(--blue); }
.ico-primary { background: var(--primary-soft); color: var(--primary); }

/* ── buttons ────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px;
  border-radius: 14px; font-weight: 700; font-size: 15px; background: var(--primary); color: #fff; transition: transform .1s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.block { width: 100%; }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.soft-green { background: var(--green-soft); color: var(--green); }
.btn.soft-red { background: var(--red-soft); color: var(--red); }
.btn.ghost { background: var(--card-2); color: var(--text-2); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 11px; }
.btn .plus { font-size: 20px; line-height: 0; font-weight: 600; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.btn-row.three { grid-template-columns: repeat(3, 1fr); }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.quick button { background: var(--card); border-radius: 16px; padding: 12px 4px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.quick button:active { transform: scale(.96); }
.quick .q-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; }

/* ── segmented / chips ──────────────────────── */
.seg { display: flex; background: var(--bg-2); padding: 4px; border-radius: 14px; gap: 4px; }
.seg button { flex: 1; height: 38px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .15s, color .15s; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
[data-theme="dark"] .seg { background: var(--card); }
[data-theme="dark"] .seg button.on { background: var(--card-2); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--text); color: var(--bg); }
.gap { height: 12px; }

/* ── period navigator ───────────────────────── */
.pnav { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.pnav .pn-title { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }
.pnav .pn-title small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.pnav button.arrow { width: 40px; height: 40px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; }
.pnav button.arrow:disabled { opacity: .35; }
.pnav button.arrow svg { width: 18px; height: 18px; }
.pnav .pn-title { position: relative; }
.pnav .date-overlay { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }

/* ── lists ──────────────────────────────────── */
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; position: relative; width: 100%; text-align: left; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; height: 1px; background: var(--border); }
button.item:active, .item.tap:active { background: var(--card-2); }
.item .i-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; flex: none; }
.item .i-main { flex: 1; min-width: 0; }
.item .i-title { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .i-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .i-end { text-align: right; flex: none; }
.item .i-amt { font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.item .i-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty .e-ico { font-size: 38px; margin-bottom: 8px; opacity: .9; }
.empty .e-title { font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.empty .e-text { font-size: 13.5px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; font-size: 14.5px; }
.row + .row { border-top: 1px dashed var(--border); }
.row .r-l { color: var(--text-2); display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .r-v { font-weight: 700; white-space: nowrap; }
.row.sub .r-l { padding-left: 14px; color: var(--muted); font-size: 13.5px; }
.row.sub .r-v { font-weight: 600; font-size: 13.5px; color: var(--muted); }
.row.total { font-size: 16px; }
.row.total .r-l { font-weight: 700; color: var(--text); }

/* ── bars (category breakdown) ──────────────── */
.hbar { padding: 8px 0; }
.hbar + .hbar { border-top: 1px dashed var(--border); }
.hbar .hb-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 6px; }
.hbar .hb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-weight: 500; }
.hbar .hb-val { font-weight: 700; white-space: nowrap; }
.hbar .hb-track { height: 7px; background: var(--card-2); border-radius: 99px; overflow: hidden; }
.hbar .hb-fill { height: 100%; border-radius: 99px; background: var(--primary); }
.hbar .hb-pct { font-size: 11.5px; color: var(--muted); margin-left: 6px; font-weight: 500; }

/* ── chart ──────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-info { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; min-height: 36px; align-items: center; }
.chart-info b { color: var(--text); font-size: 13.5px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
svg.chart { width: 100%; height: 170px; display: block; overflow: visible; }
svg.chart text { fill: var(--faint); font-size: 10px; font-family: inherit; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }

/* ── branch cards ───────────────────────────── */
.branch-card { display: block; width: 100%; text-align: left; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.branch-card + .branch-card { margin-top: 10px; }
.branch-card:active { transform: scale(.99); }
.branch-card .bc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.branch-card .bc-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 17px; background: var(--primary-soft); }
.branch-card .bc-name { font-weight: 700; flex: 1; }
.branch-card .bc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.branch-card .bc-cell { background: var(--card-2); border-radius: 11px; padding: 8px 10px; min-width: 0; }
.branch-card .bc-cell .l { font-size: 11px; color: var(--muted); font-weight: 600; }
.branch-card .bc-cell .v { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.branch-card .bc-foot { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 10px; gap: 8px; }

/* ── bar products ───────────────────────────── */
.search { position: relative; flex: 1; }
.search input { width: 100%; height: 44px; border-radius: 13px; border: 1px solid var(--border); background: var(--card); padding: 0 14px 0 40px; font-size: 15px; outline: none; }
.search input:focus { border-color: var(--primary); }
.search svg { position: absolute; left: 13px; top: 13px; width: 18px; height: 18px; color: var(--faint); }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 14px 0 12px; }
.prod { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.prod + .prod { margin-top: 10px; }
.prod.done { box-shadow: var(--shadow), inset 3px 0 0 var(--green); }
.prod .p-head { display: flex; align-items: flex-start; gap: 10px; }
.prod .p-name { flex: 1; min-width: 0; text-align: left; }
.prod .p-name b { font-size: 15.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod .p-name span { font-size: 12.5px; color: var(--muted); }
.prod .p-sum { text-align: right; }
.prod .p-sum b { font-size: 15.5px; display: block; }
.prod .p-sum span { font-size: 12px; color: var(--muted); }
.prod .p-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.prod .p-cell { background: var(--card-2); border-radius: 11px; padding: 7px 4px; text-align: center; }
.prod .p-cell .l { font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.prod .p-cell .v { font-weight: 800; font-size: 17px; margin-top: 1px; }
.prod .p-cell.hl { background: var(--green-soft); }
.prod .p-cell.hl .v { color: var(--green); }
.prod .p-cell.warn .v { color: var(--faint); }
.prod .p-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; }
.prod .p-moves { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.prod .p-moves button { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.prod.archived { opacity: .6; }

/* ── bottom nav ─────────────────────────────── */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border); padding: 6px 6px calc(6px + var(--safe-b));
}
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; font-size: 11px; font-weight: 600; color: var(--faint); border-radius: 12px; max-width: 110px; }
.nav button svg { width: 23px; height: 23px; }
.nav button.on { color: var(--primary); }

/* ── sheets (bottom modal) ──────────────────── */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 18, .45); animation: bdin .2s ease; }
.sheet {
  position: relative; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--card);
  border-radius: 24px 24px 0 0; padding: 8px 18px calc(18px + var(--safe-b)); animation: up .26s cubic-bezier(.2,.9,.3,1);
  box-shadow: var(--shadow-lg); overscroll-behavior: contain;
}
.sheet-wrap.closing .sheet { animation: down .2s ease forwards; }
.sheet-wrap.closing .sheet-backdrop { animation: bdout .2s ease forwards; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes bdin { from { opacity: 0; } }
@keyframes bdout { to { opacity: 0; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--border); margin: 0 auto 10px; }
.sheet .s-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet .s-head h2 { margin: 0; font-size: 19px; font-weight: 800; flex: 1; letter-spacing: -.01em; }
.sheet .s-close { width: 34px; height: 34px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; color: var(--muted); }
.sheet .s-close svg { width: 16px; height: 16px; }
.sheet .s-foot { position: sticky; bottom: calc(-18px - var(--safe-b)); background: var(--card); padding: 12px 0 calc(4px); margin-top: 8px; }

/* ── forms ──────────────────────────────────── */
.field { margin-bottom: 14px; }
.field > label, .f-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.input, .select, textarea.input {
  width: 100%; height: 48px; border-radius: 13px; border: 1.5px solid var(--border); background: var(--card-2);
  padding: 0 14px; font-size: 16px; outline: none; transition: border-color .15s, background .15s; appearance: none; -webkit-appearance: none;
}
textarea.input { height: auto; min-height: 76px; padding: 12px 14px; resize: none; line-height: 1.4; }
.input:focus, .select:focus { border-color: var(--primary); background: var(--card); }
.input.error { border-color: var(--red); }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.amount-box { background: var(--card-2); border: 1.5px solid var(--border); border-radius: 16px; padding: 12px 14px 10px; transition: border-color .15s; }
.amount-box:focus-within { border-color: var(--primary); background: var(--card); }
.amount-box .a-row { display: flex; align-items: baseline; gap: 6px; }
.amount-box input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 30px; font-weight: 800; letter-spacing: -.02em; padding: 0; font-variant-numeric: tabular-nums; }
.amount-box .cur { font-weight: 700; color: var(--muted); font-size: 16px; }
.amount-box .a-quick { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.amount-box .a-quick::-webkit-scrollbar { display: none; }
.amount-box .a-quick button { flex: none; font-size: 12.5px; font-weight: 700; padding: 6px 10px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); }
.amount-box .a-words { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 16px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.cat-grid button { border: 1.5px solid var(--border); border-radius: 13px; padding: 9px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--card); text-align: center; line-height: 1.2; min-height: 64px; justify-content: center; }
.cat-grid button .ce { font-size: 20px; }
.cat-grid button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 52px; height: 52px; border-radius: 15px; background: var(--card-2); font-size: 26px; font-weight: 600; color: var(--text-2); flex: none; border: 1.5px solid var(--border); }
.stepper button:active { transform: scale(.94); }
.stepper input { flex: 1; min-width: 0; height: 52px; text-align: center; font-size: 26px; font-weight: 800; border-radius: 15px; border: 1.5px solid var(--border); background: var(--card-2); outline: none; font-variant-numeric: tabular-nums; }
.stepper input:focus { border-color: var(--primary); background: var(--card); }
.calc { background: var(--card-2); border-radius: 14px; padding: 4px 14px; margin: 12px 0 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.note-box { background: var(--amber-soft); color: var(--text-2); border-radius: 13px; padding: 11px 13px; font-size: 13.5px; margin-bottom: 14px; display: flex; gap: 8px; }
.note-box.blue { background: var(--blue-soft); }
.note-box.red { background: var(--red-soft); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 14px; }
.switch-row .sw-t { font-weight: 600; font-size: 14.5px; }
.switch-row .sw-s { font-size: 12.5px; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }

/* action menu */
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list button { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--card-2); font-weight: 600; font-size: 15px; text-align: left; }
.menu-list button .m-ico { font-size: 19px; width: 24px; text-align: center; }
.menu-list button.danger { color: var(--red); }
.detail { background: var(--card-2); border-radius: 14px; padding: 4px 14px; margin-bottom: 14px; }

/* ── login ──────────────────────────────────── */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 22px calc(24px + var(--safe-b)); max-width: 420px; margin: 0 auto; text-align: center; }
.login .boot-logo { margin: 0 auto 18px; }
.login h1 { margin: 0 0 8px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.login p { color: var(--muted); margin: 0 0 26px; font-size: 14.5px; }
.code-input { width: 100%; height: 64px; text-align: center; font-size: 30px; letter-spacing: .35em; font-weight: 800; text-transform: uppercase; border-radius: 18px; border: 2px solid var(--border); background: var(--card); outline: none; padding-left: .35em; }
.code-input:focus { border-color: var(--primary); }
.login .err { color: var(--red); font-size: 13.5px; min-height: 20px; margin: 10px 0 12px; }

/* ── toast ──────────────────────────────────── */
#toasts { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 10px); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: tin .25s ease; max-width: 100%; pointer-events: auto; }
.toast.error { background: var(--red); color: #fff; }
.toast.ok { background: var(--green); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }

/* ── code cards (settings) ──────────────────── */
.code-pill { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 800; font-size: 17px; letter-spacing: .12em; background: var(--primary-soft); color: var(--primary); padding: 6px 10px; border-radius: 10px; }
.prof-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.prof-card + .prof-card { margin-top: 10px; }
.prof-card .pc-head { display: flex; align-items: center; gap: 10px; }
.prof-card .pc-users { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.prof-card .pc-user { display: flex; align-items: center; gap: 8px; background: var(--card-2); border-radius: 11px; padding: 8px 10px; font-size: 13.5px; }
.prof-card .pc-user span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-card .pc-actions { display: flex; gap: 8px; margin-top: 10px; }

.progress { height: 9px; border-radius: 99px; background: var(--card-2); overflow: hidden; margin: 10px 0 4px; }
.progress > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), #34d399); transition: width .4s; }

.fab-space { height: 8px; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.small { font-size: 12.5px; }
.flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }

/* ── to'lov turlari jadvali ─────────────────── */
.mtable { padding: 6px 14px; }
.mt-row { display: grid; grid-template-columns: 58px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; padding: 10px 0; font-size: 14px; }
.mt-row + .mt-row { border-top: 1px dashed var(--border); }
.mt-row > span:first-child { color: var(--text-2); font-weight: 600; }
.mt-row > span:not(:first-child) { text-align: right; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-head { font-size: 12px; padding: 8px 0 6px; }
.mt-head > span:not(:first-child) { color: var(--muted); font-weight: 600; }

/* 5 ta davr tugmasi tor ekranga sig'sin */
[data-seg="period"] button { font-size: 13.5px; padding: 0 2px; }

/* ── sana tanlash (ko'rinmas input ustiga) ──── */
.date-overlay { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
.pick { position: relative; overflow: hidden; }
.btn-row.three .btn { padding: 0 6px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
button.pn-title { width: 100%; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.range .input { padding: 0 8px; font-size: 15px; min-width: 0; }
.range > span { color: var(--muted); }

/* ── solishtirish ───────────────────────────── */
[data-seg="cmptab"] button { font-size: 13.5px; padding: 0 2px; }
.vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
.vs-card { background: var(--card); border-radius: 16px; padding: 11px 12px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vs-card.a { box-shadow: var(--shadow), inset 0 3px 0 var(--primary); }
.vs-card.b { box-shadow: var(--shadow), inset 0 3px 0 var(--faint); }
.vs-card b { font-size: 14px; line-height: 1.25; }
.vs-card small { font-size: 12px; color: var(--muted); }
.vs-tag { font-size: 13px; }
.vs-mid { align-self: center; font-weight: 800; color: var(--muted); font-size: 13px; }
.cmp-item .i-sub b { color: var(--text); }
.cmp-item .i-end .badge { margin-bottom: 2px; }
.cmp-sub { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cmp-sub .badge { padding: 2px 6px; font-size: 11px; }
.stat.tap { text-align: left; width: 100%; }
.stat.tap:active { transform: scale(.98); }
.row.tap-row { width: 100%; text-align: left; }
.row.tap-row .r-v { color: var(--primary); }
.pbar { padding: 8px 0; }
.pbar + .pbar { border-top: 1px dashed var(--border); }
.pbar .hb-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 4px; }
.pbar .hb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-weight: 500; }
.pb-line { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.pb-trk { flex: 1; height: 7px; background: var(--card-2); border-radius: 99px; overflow: hidden; }
.pb-trk i { display: block; height: 100%; border-radius: 99px; }
.pb-trk i.a { background: var(--primary); }
.pb-trk i.b { background: var(--faint); opacity: .7; }
.pb-line span { width: 96px; flex: none; text-align: right; font-size: 12.5px; font-weight: 600; color: var(--text-2); }

/* hidden atributi har doim ishlasin (display: flex li elementlarda ham) */
[hidden] { display: none !important; }
.bar-pay-btn { white-space: normal; height: auto; min-height: 44px; padding: 9px 14px; font-size: 14px; font-weight: 600; line-height: 1.3; }

/* savdosiz chiqarish (bar) */
.prod .p-grid.five { grid-template-columns: repeat(5, 1fr); }
.prod .p-cell.out { background: var(--red-soft); }
.prod .p-cell.out .v { color: var(--red); }
.prod .p-actions.three { grid-template-columns: 1fr 1fr 1.25fr; }
.prod .p-moves button.out { background: var(--red-soft); color: var(--red); }
