/* ===== Freshly brendbuk (v1.0), 12-sahifa — HoReCa yo'nalishi: Black Rose #65002a + Illusion #fa9dc5.
   (Family — Green Pea #005840 + laym #c1ec30; Office — qora + Linen.) Fon — Linen #fbeee5. Shrift — DM Sans. ===== */
:root {
  --brand: #65002a;          /* Black Rose — HoReCa asosiy */
  --pink: #fa9dc5;           /* Illusion — HoReCa urg'u */
  --linen: #fbeee5;
  --bg: #ffffff;
  --bg2: #f8efe9;            /* Linen'ga yaqin, ko'zni charchatmaydigan fon */
  --text: #2a0c18;
  --hint: #7c6870;
  --link: #65002a;
  --btn: #65002a;
  --btn-text: #ffffff;
  --accent: #fa9dc5;
  --hdr: #65002a;            /* sarlavha paneli */
  --hdr-text: #ffffff;
  --hdr-accent: #fa9dc5;     /* logotip, kassa summasi */
  --green: #2e9d4f;          /* holat ranglari funksional bo'lib qoladi */
  --amber: #e0a100;
  --red: #c62828;
  --line: color-mix(in srgb, var(--hint) 25%, transparent);
  --radius: 14px;
}
[data-theme="dark"] {
  --bg: #3a0d20;
  --bg2: #22050f;
  --text: #fbeee5;
  --hint: #c3a7b1;
  --link: #fa9dc5;
  --btn: #fa9dc5;
  --btn-text: #4a0020;
  --hdr: #17030a;
  --hdr-accent: #fa9dc5;
  --green: #52c26f;
  --amber: #f0b429;
  --red: #ff6b6b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg2); color: var(--text);
  font: 16px/1.4 "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-optical-sizing: auto; }
h1, h2, h3, .title, .card-h, .big, .tab.active, .seg button.on, .hero-v, .t-value, .big-num { font-weight: 600; }
body { padding-bottom: 84px; }
.hidden { display: none !important; }

header { position: sticky; top: 0; z-index: 5; background: var(--hdr); color: var(--hdr-text); padding: 12px 16px 10px; }
.brand-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { color: var(--hdr-accent); flex: 0 0 auto; display: flex; }
.brand-mark svg { height: 30px; width: auto; display: block; }
.brand-logo { color: var(--hdr-accent); display: flex; margin-bottom: 4px; }
.brand-logo svg { height: 22px; width: auto; display: block; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.title { font-size: 18px; letter-spacing: -.2px; }
.subtitle { color: color-mix(in srgb, var(--hdr-text) 72%, transparent); font-size: 13px; }
.cash { text-align: right; font-size: 13px; color: color-mix(in srgb, var(--hdr-text) 72%, transparent); white-space: nowrap; }
.cash b { display: block; color: var(--hdr-accent); font-size: 15px; }
.offline { margin-top: 8px; padding: 8px 10px; border-radius: 10px; font-size: 13px;
  background: color-mix(in srgb, var(--amber) 18%, var(--bg)); }

main { padding: 12px 12px 24px; }

/* sotuvchi tanlash */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1.5px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 12px; padding: 8px 12px; text-align: left; font: inherit; min-width: 120px; }
.chip small { display: block; color: var(--hint); font-size: 12px; }
.chip.active { border-color: var(--btn); background: color-mix(in srgb, var(--btn) 12%, var(--bg)); }
.pick-hint { background: color-mix(in srgb, var(--accent) 22%, var(--bg)); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; font-size: 14px; }

.search { width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 12px; padding: 12px 14px; font: inherit; margin-bottom: 10px; }

.card { background: var(--bg); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px 6px;
  font-weight: 600; font-size: 14px; }
.card-h span { color: var(--hint); font-weight: 500; }
.row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line);
  width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; color: inherit;
  font: inherit; text-align: left; min-height: 52px; }
.row:first-of-type { border-top: 0; }
.row:active { background: var(--bg2); }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.row .meta { color: var(--hint); font-size: 13px; }
.row .right { text-align: right; white-space: nowrap; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; background: var(--line); }
.dot.partial { background: var(--amber); } .dot.done { background: var(--green); } .dot.missing { background: var(--red); } .dot.short { background: var(--green); opacity: .6; } .dot.road { background: var(--amber); }
.empty { color: var(--hint); padding: 14px; font-size: 14px; }
.collapse { color: var(--link); font-size: 14px; padding: 10px 14px; background: none; border: 0; font: inherit; }

/* yuklash */
.progress { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; margin: 4px 0 12px; }
.progress div { height: 100%; background: var(--green); transition: width .2s; }
.check { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); flex: 0 0 28px;
  display: grid; place-items: center; font-size: 16px; color: #fff; }
.check.on { background: var(--green); border-color: var(--green); }
.row.loaded .name { color: var(--hint); text-decoration: line-through; }

/* yetkazish */
.qty-in { width: 92px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text);
  border-radius: 10px; padding: 9px 8px; font: inherit; font-weight: 600; text-align: right; }
.qty-in.changed { border-color: var(--amber); }

.big { display: block; width: 100%; border: 0; border-radius: var(--radius); padding: 15px; font: inherit;
  font-weight: 600; background: var(--btn); color: var(--btn-text); margin-top: 6px; }
.big.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.big.danger { background: none; color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); }
.big:disabled { opacity: .5; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--bg);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tab { flex: 1; border: 0; background: none; color: var(--hint); font: inherit; font-size: 12px; padding: 8px 0 10px; }
.tab span { display: block; font-size: 22px; }
.tab.active { color: var(--link); box-shadow: inset 0 3px 0 var(--accent); }

/* pastdan chiquvchi oyna */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--bg);
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto; }
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.sheet .info { color: var(--hint); font-size: 14px; margin-bottom: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--hint); margin-bottom: 4px; }
.field input, .field select { width: 100%; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text);
  border-radius: 12px; padding: 13px 14px; font: inherit; font-size: 20px; font-weight: 600; }
.field input:focus { outline: none; border-color: var(--btn); }
.field .hint { font-size: 12px; color: var(--hint); margin-top: 4px; }
.sum { font-size: 15px; margin: 4px 0 8px; } .sum b { font-size: 20px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  max-width: 90vw; text-align: center; }
.center { text-align: center; padding: 40px 20px; color: var(--hint); }
.center .big-emoji { font-size: 48px; }

/* --- 2-versiya: rollar, ro'yxat, kassa, admin --- */
.title-box { min-width: 0; }
.title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.mode { border: 0; background: color-mix(in srgb, var(--hdr-text) 14%, transparent); color: var(--hdr-accent); border-radius: 10px;
  padding: 5px 9px; font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tab { font-size: 11px; padding: 7px 0 9px; }
.tab span { font-size: 20px; }
.pad { padding: 12px 14px; }
.card.pad .big:first-of-type { margin-top: 8px; }
.note { color: var(--hint); font-size: 13px; }
.big-num { font-size: 28px; font-weight: 700; margin: 2px 0 4px; } .big-num small { font-size: 14px; color: var(--hint); }
.pill { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 18px;
  padding: 7px 12px; font: inherit; font-size: 14px; white-space: nowrap; }
.pill.ghost { background: none; color: var(--hint); }
.choice { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pend { padding: 10px 14px; border-top: 1px solid var(--line); } .pend:first-of-type { border-top: 0; }
.pend .name { font-weight: 600; } .pend .meta { color: var(--hint); font-size: 13px; }
.lbl { display: block; font-size: 13px; color: var(--hint); margin: 4px 0 6px; }
.unit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.unit { border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 12px; padding: 12px 6px; font: inherit; font-weight: 600; }
.unit.active { border-color: var(--btn); background: color-mix(in srgb, var(--btn) 14%, var(--bg)); }
textarea { width: 100%; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 12px;
  padding: 12px; font: inherit; margin-bottom: 8px; resize: vertical; }
.field input.small-in, input.small-in { font-size: 16px; font-weight: 500; }
.steps { padding: 4px 14px 10px; }
.st { padding: 6px 0; font-size: 14px; border-top: 1px dashed var(--line); } .st:first-child { border-top: 0; }
.sub { color: var(--hint); font-size: 13px; padding-left: 22px; margin-top: 2px; }
.totals { background: var(--bg2); border-radius: 10px; padding: 8px 10px; margin: 8px 0; font-size: 14px; display: grid; gap: 2px; }
.actions { padding: 0 14px 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.row-flex { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 10px; }
.toggle { font-size: 14px; color: var(--hint); display: flex; align-items: center; gap: 6px; }
.row.muted .name { color: var(--hint); }
.red { color: var(--red) !important; } .green { color: var(--green) !important; }
.search.as-btn { text-align: left; color: var(--hint); }

/* --- 3-versiya: bir nechta mijoz, sotuvchi turlari --- */
.back { border: 0; background: none; color: var(--link); font: inherit; font-size: 15px; padding: 2px 4px 10px; }
.sup-bar { background: var(--bg); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sup-bar .pill { margin-left: auto; }
.chip.add { border-style: dashed; color: var(--link); }
.tag { display: inline-block; background: color-mix(in srgb, var(--btn) 14%, var(--bg)); color: var(--text);
  border-radius: 6px; padding: 0 6px; font-size: 12px; font-weight: 600; }
.alloc { display: grid; gap: 8px; margin-bottom: 8px; }
.alloc-row { display: flex; align-items: center; gap: 10px; background: var(--bg2); border-radius: 12px; padding: 8px 10px; }
.alloc-row .who { flex: 1; font-weight: 600; } .alloc-row .who small { display: block; font-weight: 400; color: var(--hint); font-size: 12px; }
.alloc-row input { width: 110px; border: 1.5px solid var(--line); background: var(--bg); color: var(--text); border-radius: 10px;
  padding: 10px; font: inherit; font-size: 19px; font-weight: 600; text-align: right; }
.alloc-row input:focus { outline: none; border-color: var(--btn); }
.unit-grid.two-col { grid-template-columns: 1fr 1fr; }
.info.warn { color: var(--text); background: color-mix(in srgb, var(--amber) 18%, var(--bg)); border-radius: 10px; padding: 8px 10px; }
.pill.on { border-color: var(--btn); background: color-mix(in srgb, var(--btn) 14%, var(--bg)); font-weight: 600; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: none; color: var(--hint); font: inherit; padding: 8px; border-radius: 10px; }
.seg button.on { background: var(--btn); color: var(--btn-text); font-weight: 600; }

/* --- statistika --- */
/* grafik ranglari — brend oilasidan, validate_palette.js tekshiruvidan o'tgan (kunduz / tun) */
:root { --s1: #1a8a5e; --s2: #d6559a; }
[data-theme="dark"] { --s1: #76a40d; --s2: #cf5a97; }
.chips.small { padding-bottom: 8px; } .chips.small .pill { flex: 0 0 auto; }
.hero { background: var(--bg); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.hero-v { font-size: 30px; font-weight: 700; margin: 2px 0; } .hero-v small { font-size: 14px; color: var(--hint); font-weight: 500; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.tile { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.t-label { color: var(--hint); font-size: 12px; } .t-value { font-size: 18px; font-weight: 700; margin-top: 2px; }
.t-sub { color: var(--hint); font-size: 11px; margin-top: 2px; }
.share { height: 6px; background: var(--bg2); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.share div { height: 100%; background: var(--s1); border-radius: 4px; }
.kv { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; border-top: 1px dashed var(--line); }
.kv:first-of-type { border-top: 0; } .kv span { color: var(--hint); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--hint); font-size: 9px; }
.chart .s1 { fill: var(--s1); } .chart .s2 { fill: var(--s2); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; } .chart .s1l { stroke: var(--s1); }
.chart .dot { fill: var(--s1); stroke: var(--bg); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: pointer; } .chart .hit.on { fill: color-mix(in srgb, var(--hint) 12%, transparent); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--hint); margin: 2px 0 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.s1 { background: var(--s1); } .sw.s2 { background: var(--s2); }
.tip { background: var(--bg2); border-radius: 10px; padding: 8px 10px; font-size: 13px; margin-top: 6px; line-height: 1.6; }
.tab { font-size: 10px; } .tab span { font-size: 19px; }
/* hujjat rasmi: label tugma ko'rinishida (kamera ochiladi) */
label.file-btn { display: block; text-align: center; cursor: pointer; margin-top: 10px; }
label.file-btn.busy { opacity: .6; pointer-events: none; }
.doc-img { width: 100%; border-radius: 10px; margin: 8px 0; background: var(--bg2, #0001); min-height: 120px; object-fit: contain; }
/* restoran egasi ilovasi */
.st.muted { color: var(--hint); }
.warn-card { box-shadow: inset 3px 0 0 var(--red); }
.field textarea { width: 100%; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font: inherit; resize: vertical; }
.field textarea:focus { outline: none; border-color: var(--btn); }
.tile.warn .t-value { color: var(--red); }
/* bozor: kategoriyalar, narx tarixi, sotuvchini almashtirish */
.row-flex { gap: 8px; }
.row-flex .search.as-btn { flex: 1; margin-bottom: 0; }
.row-flex .search.as-btn.narrow { flex: 0 0 auto; width: auto; color: var(--text); }
.chips.cats .chip { min-width: 0; padding: 7px 10px; }
.chips.cats .chip small { font-weight: 600; }
.chip.full:not(.active) { border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.cat-h { padding: 10px 14px 4px; font-size: 12px; font-weight: 600; color: var(--hint); text-transform: uppercase;
  letter-spacing: .3px; border-top: 1px solid var(--line); background: var(--bg2); }
.card > .cat-h:first-of-type, .card-h + .cat-h { border-top: 0; }
.price-hint { font-size: 12px; }
.hist { background: var(--bg2); border-radius: 12px; padding: 10px 12px; margin: 4px 0 12px; font-size: 14px; }
.hist-top { margin-bottom: 4px; }
.hist-h { color: var(--hint); font-size: 12px; margin: 6px 0 2px; }
.hist-row { display: flex; gap: 10px; padding: 3px 0; border-top: 1px dashed var(--line); }
.hist-row span:first-child { width: 42px; color: var(--hint); }
.hist-row .hist-sup { flex: 1; color: var(--hint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips.sup-pick .chip { min-width: 0; padding: 7px 10px; }
.price-item { background: var(--bg); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; }
.pi-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pi-days { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 4px; font-size: 14px; font-weight: 600; }
.pi-days span small { display: block; font-size: 11px; color: var(--hint); font-weight: 400; }
#pr-list .cat-h { border-radius: 8px; margin: 10px 0 6px; border-top: 0; }
label.row.chk { cursor: pointer; }
label.row.chk input { width: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--btn); }
.sup-now { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border-radius: 12px; padding: 10px 12px; margin: 6px 0 8px;
  background: color-mix(in srgb, var(--btn) 12%, var(--bg)); border: 1.5px solid var(--btn); }
.sup-now small { width: 100%; color: var(--hint); font-size: 12px; }
.sup-now.pay-karta { background: color-mix(in srgb, var(--amber) 14%, var(--bg)); border-color: var(--amber); }
/* ro'yxat filtri, narxlar sahifasi */
.st-chips { gap: 6px; padding-bottom: 8px; }
.st-chips .pill { flex: 0 0 auto; white-space: nowrap; }
.cat-h.price-cat { border-radius: 8px; margin: 10px 0 6px; border-top: 0; }
.price-item { cursor: pointer; }
.tabs .tab { min-width: 0; }
/* yo'lda olinadi, yuklash filtri */
.road-card { box-shadow: inset 3px 0 0 var(--amber); }
.road-card .right { color: var(--link); font-weight: 600; }
.chips.wrap { flex-wrap: wrap; }
.row-flex { flex-wrap: wrap; }
/* yetkazish: izoh, qaytarish */
.cnote { color: var(--link) !important; font-weight: 500; }
.dl-row { align-items: flex-start; }
.dl-acts { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.dl-acts .pill { font-size: 12px; padding: 4px 10px; }
.alloc-row .who small.cnote { display: block; }
/* yetkazish: qabul qilindi ✅, kechagidan */
.check-btn { background: none; border: 0; padding: 0; margin-right: 2px; align-self: center; }
.check-btn:disabled { opacity: .4; }
.dl-row.loaded .name { color: var(--hint); }
.tag.carried { background: color-mix(in srgb, var(--amber) 22%, var(--bg)); font-size: 11px; font-weight: 600; }
.dl-row.loaded .name { text-decoration: none; }
.close-steps { padding: 6px 0 4px; } .close-steps .st { font-size: 13px; }
.sheet select { width: 100%; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 10px; padding: 8px; font: inherit; }
/* kunduzgi/tungi rejim tugmasi */
.theme-btn { border: 0; background: color-mix(in srgb, var(--hdr-text) 14%, transparent); border-radius: 10px;
  width: 34px; height: 30px; font-size: 16px; line-height: 1; padding: 0; cursor: pointer; }
.theme-btn:active { transform: scale(.94); }
.head-right { flex-direction: row; align-items: center; gap: 8px; }
.head-right .cash { order: 2; }
header .title { white-space: normal; overflow: visible; text-overflow: clip; font-size: 17px; line-height: 1.15; }
header .title-box { flex: 1; min-width: 0; }
.brand-row { flex: 1; }
.alloc-row.stock-row { border-top: 1px dashed var(--hint); padding-top: 8px; }
.ok-card { border: 1px solid var(--green); }
.lang-btn { font-size: 12px; font-weight: 600; min-width: 34px; }
