:root, [data-theme="dark"] {
  --bg: #0a0c10;
  --card: #141820;
  --card2: #1c222c;
  --border: #2a3140;
  --text: #f4f6fa;
  --muted: #8b93a7;
  --accent: #ff4d2e;
  --accent2: #ff7a45;
  --ok: #2dd4a0;
  --warn: #f5c542;
  --info: #5eb1ff;
  --door: #ffb020;
  --purple: #a78bfa;
  --hdr-grad: linear-gradient(180deg, #12161d 0%, transparent 100%);
  --banner-bg: #121820;
  --extra-bg: rgba(245,197,66,.08);
  --extra-border: rgba(245,197,66,.35);
  --cell-bg: rgba(45,212,160,.06);
  --cell-border: rgba(45,212,160,.28);
  --ws-bg: var(--card);
  --shadow: 0 10px 28px rgba(0,0,0,.32);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --r: 18px;
  --r-sm: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f2f3f7;
  --card: #ffffff;
  --card2: #eef0f5;
  --border: #d8dce6;
  --text: #141820;
  --muted: #667085;
  --accent: #e63b1f;
  --accent2: #ff6a3a;
  --ok: #0f9f6e;
  --warn: #c48a00;
  --info: #1a7fd4;
  --door: #d48900;
  --purple: #7c5cbf;
  --hdr-grad: linear-gradient(180deg, #ffffff, transparent);
  --banner-bg: #e8eef8;
  --extra-bg: rgba(196,138,0,.08);
  --extra-border: rgba(196,138,0,.35);
  --cell-bg: rgba(15,159,110,.06);
  --cell-border: rgba(15,159,110,.28);
  --ws-bg: #ffffff;
  --shadow: 0 8px 24px rgba(20,24,40,.08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; background: var(--bg); color: var(--text);
  min-height: 100%; -webkit-tap-highlight-color: transparent;
  transition: background .2s ease, color .15s ease;
}
button {
  font: inherit; font-weight: 650; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--card2); color: var(--text); padding: 11px 12px; cursor: pointer;
}
button:active { transform: scale(.985); }
button:disabled { opacity: .38; }
button.primary {
  background: linear-gradient(160deg, var(--accent), var(--accent2));
  border: 0; color: #fff; box-shadow: 0 8px 20px rgba(255,77,46,.22);
}
button.ok { background: var(--ok); border: 0; color: #042; font-weight: 800; }
button.ghost { background: transparent; }
button.warn { background: #2a2414; border-color: #5a4a22; color: var(--warn); }
input {
  width: 100%; padding: 13px 14px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 16px;
}
input:focus { outline: none; border-color: rgba(255,122,69,.55); }

#app { min-height: 100dvh; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.banner-sim {
  background: var(--banner-bg); color: var(--info); font-size: .68rem; font-weight: 700;
  text-align: center; padding: 5px 8px; letter-spacing: .08em;
  border-bottom: 1px solid var(--border); text-transform: uppercase;
}
.banner-sim.live {
  background: #3a120c; color: #ffb4a4; border-bottom-color: #a33;
}
.mode-seg { margin: 0 0 12px; }
.mode-seg button { flex: 1; }
.mode-seg button.on {
  background: rgba(255,77,46,.18); border-color: rgba(255,77,46,.5); color: var(--accent2);
}
.code-row { display: flex; gap: 8px; align-items: stretch; }
.code-row input { flex: 1; }
.code-row #btnSms { flex: 0 0 auto; min-width: 72px; padding: 0 14px; }
.login code {
  font-size: .78em; background: var(--card2); padding: 1px 5px; border-radius: 4px;
}
.live-err {
  margin: 8px 0 0; padding: 8px 10px; border-radius: 10px;
  background: rgba(255,80,80,.1); border: 1px solid rgba(255,80,80,.35);
  color: #ff9a9a; font-size: .72rem; line-height: 1.35; white-space: pre-wrap;
}
.blog-box {
  max-height: 46vh; overflow: auto; margin-top: 10px;
  font-family: ui-monospace, Menlo, monospace; font-size: .68rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 8px;
}
.blog-row { padding: 3px 0; border-bottom: 1px solid var(--border); line-height: 1.35; }
.blog-t { color: var(--muted); }
.blog-x { color: var(--muted); word-break: break-all; }
.hdr {
  padding: 12px 16px 14px; border-bottom: 1px solid var(--border);
  background: var(--hdr-grad);
}
.hdr .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hdr h1 { margin: 0; font-size: 1.22rem; letter-spacing: -.02em; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--card);
}
.pill.on { color: #9dffc0; border-color: #2a6; }
.pill.warn { color: var(--warn); border-color: #665; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: .72rem; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 9px; color: var(--muted);
}
.chip b { color: var(--text); }
.chip.warn {
  color: var(--warn); border-color: rgba(245,197,66,.45);
  background: rgba(245,197,66,.12);
}
.chip.offline {
  color: #ff8a8a; border-color: rgba(255,80,80,.4);
  background: rgba(255,60,60,.12);
  font-weight: 700;
}

.body { flex: 1; overflow-y: auto; padding: 14px 14px calc(76px + var(--safe-b)); }
.center {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 22px 18px; text-align: center;
}
.center h2 { margin: 0 0 8px; font-size: 1.2rem; letter-spacing: -.02em; }
.center p { color: var(--muted); font-size: .9rem; line-height: 1.45; margin: 0 0 14px; }
.big { font-size: 3.4rem; font-weight: 820; margin: 4px 0 2px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.timer { font-variant-numeric: tabular-nums; font-size: 2.6rem; font-weight: 820; color: var(--accent2); letter-spacing: -.03em; line-height: 1; }
.timer small { display: block; font-size: .72rem; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }
.timer.urgent { color: #ff6b6b; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .5; } }

.offer {
  background: linear-gradient(165deg, #4a160e 0%, #2a100c 55%, #1a1210 100%);
  border: 1px solid #c24a32; border-radius: var(--r); padding: 16px 16px 14px; margin-bottom: 12px;
  box-shadow: 0 12px 32px rgba(194, 40, 20, .18);
}
.offer-kicker {
  font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: #ffb4a4; margin-bottom: 8px;
}
.offer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.offer h3 { margin: 0 0 4px; color: #fff; font-size: 1.45rem; letter-spacing: -.02em; }
.offer p { margin: 0; color: #f0d0c8; font-size: .9rem; }
.acts { display: flex; gap: 8px; }
.acts button { flex: 1; }

.switch {
  display: flex; gap: 4px; padding: 0 0 10px; position: sticky; top: 0; z-index: 2;
  background: var(--bg);
}
.switch button {
  flex: 1; min-width: 0; padding: 10px 4px; font-size: .7rem; background: var(--card);
  color: var(--muted);
}
.switch button.active {
  background: #252b38; color: var(--text); border-color: #4a5568;
}
.switch button .n { display: block; font-size: 1rem; font-weight: 800; }
.switch button .s { display: block; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch button.done { opacity: .5; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px;
  margin-bottom: 10px;
}
.card.door {
  border-color: rgba(255,176,32,.5);
  background: linear-gradient(180deg, rgba(255,176,32,.1), var(--card) 45%);
}
.oh { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.oid { font-weight: 800; }
.oid small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.badge {
  font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
  padding: 3px 7px; border-radius: 7px;
}
.badge.door { background: rgba(255,176,32,.15); color: var(--door); border: 1px solid rgba(255,176,32,.4); }
.badge.cash { background: rgba(45,212,160,.12); color: var(--ok); }
.badge.online { background: rgba(94,177,255,.12); color: var(--info); }
.badge.card { background: rgba(167,139,250,.12); color: var(--purple); }
.badge.dc { background: rgba(255,100,50,.15); color: #ff9a70; }
.badge.sync { background: rgba(245,197,66,.12); color: var(--warn); }
.addr { font-size: 1.38rem; font-weight: 800; line-height: 1.22; margin: 4px 0 12px; letter-spacing: -.025em; }
.sub { color: var(--muted); font-size: .8rem; margin: 0 0 10px; }
.box {
  background: var(--card2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 10px;
}
.box .lab {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; margin-bottom: 4px;
}
.hl-door {
  background: rgba(255,176,32,.35); color: #ffe6a8; border-radius: 4px; padding: 0 3px; font-weight: 700;
}
.phone-chip {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: rgba(94,177,255,.14); color: #b6dcff; border: 1px solid rgba(94,177,255,.4);
  border-radius: 10px; padding: 6px 8px; margin: 3px 4px 3px 0; font-size: .82rem; font-weight: 700;
  font-family: ui-monospace, Menlo, monospace;
}
.phone-chip .ext { color: #ffd27a; }
.phone-chip .mini {
  display: inline-flex; gap: 4px;
}
.phone-chip .mini button {
  padding: 3px 7px; font-size: .65rem; border-radius: 7px; background: rgba(0,0,0,.25);
}

.items .group-title {
  font-size: .72rem; font-weight: 800; color: var(--muted); margin: 8px 0 4px;
  text-transform: uppercase; letter-spacing: .04em;
}
.items .group-title.extra { color: var(--warn); }
.items li {
  list-style: none; display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .88rem;
}
.items ul { margin: 0; padding: 0; }

.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.pay-grid .box { margin: 0; }
.pay-grid .val { font-size: 1.05rem; font-weight: 800; }

.nav-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.nav-row button { font-size: .72rem; padding: 10px 6px; }

.actions { display: grid; gap: 8px; }
.actions .photo {
  background: linear-gradient(135deg, #2a2110, #3d3018);
  border: 1px solid rgba(255,176,32,.45); color: #ffd27a; padding: 14px;
}
.card.door .actions .photo,
.order-card.door #btnPhoto {
  background: linear-gradient(135deg, #5a3d08, #c47a00); color: #fff;
  border-color: rgba(255,176,32,.45);
}
.actions .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.mini {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px;
}
.mini .l { font-weight: 700; font-size: .9rem; }
.mini .l small { display: block; color: var(--muted); font-weight: 500; margin-top: 3px; }
.mini .t { font-variant-numeric: tabular-nums; color: var(--accent2); font-weight: 800; text-align: right; }
.hist-row { cursor: pointer; align-items: flex-start; }
.hist-row.open { border-color: var(--info); }
.hist-cmt {
  display: block; margin-top: 6px; color: var(--text); font-weight: 500;
  white-space: pre-wrap; line-height: 1.35;
}
.hist-phones { margin-top: 8px; }
.phone-row .ext { color: var(--warn); font-weight: 800; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; border-top: 1px solid var(--border);
  background: rgba(12,14,18,.96); backdrop-filter: blur(10px);
  padding: 6px 4px calc(8px + var(--safe-b)); z-index: 10;
}
.tabbar button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  font-size: .65rem; padding: 8px 2px; display: flex; flex-direction: column; gap: 3px; align-items: center;
}
.tabbar button.active { color: var(--accent2); }
.timers {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-bottom: 14px;
}
.timers > div {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 10px 8px;
}
.timers span { display: block; font-size: .58rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.timers b { font-size: .95rem; font-variant-numeric: tabular-nums; }
.sec-title { font-size: 1rem; margin: 0 0 10px; }
.row-btns { display: flex; gap: 8px; margin-bottom: 10px; }
.row-btns button { flex: 1; }
.hint-close, .muted-hint, .ok-hint {
  font-size: .8rem; color: var(--muted); margin: 10px 0 0; line-height: 1.35;
}
.ok-hint { color: var(--ok); font-weight: 600; }
.card-hi { border-color: rgba(45,212,160,.5) !important; }
.subline { font-size: .9rem; margin-top: 6px; }
.big small { font-size: 1.1rem; color: var(--muted); font-weight: 600; }

.cam-wrap {
  position: relative; border-radius: 14px; overflow: hidden;
  background: #000; margin-bottom: 10px; min-height: 220px;
}
.cam-wrap video, .cam-wrap img {
  width: 100%; display: block; max-height: 320px; object-fit: cover;
}
.field-lab {
  display: block; font-size: .78rem; color: var(--muted); margin: 10px 0 4px;
}
#closeCash, #closeChecks {
  width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card2); color: var(--text); font-size: 16px;
}

.toast {
  position: fixed; left: 14px; right: 14px; bottom: calc(80px + var(--safe-b));
  background: #1e2430; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; font-size: .85rem; z-index: 20;
  transform: translateY(140%); opacity: 0; transition: .22s; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 30;
  display: none; align-items: flex-end;
}
.modal.open { display: flex; }
.sheet {
  width: 100%; background: var(--card); border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + var(--safe-b)); border-top: 1px solid var(--border);
}
.sheet h3 { margin: 0 0 6px; }
.sheet p { color: var(--muted); font-size: .85rem; margin: 0 0 10px; }
.caption {
  font-family: ui-monospace, Menlo, monospace; font-size: .78rem;
  background: var(--card2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; margin-bottom: 10px; word-break: break-word;
}
.sheet .row { display: flex; gap: 8px; }
.sheet .row button { flex: 1; }

.settings-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 8px;
}
.settings-item small { display: block; color: var(--muted); font-size: .72rem; margin-top: 3px; }
.toggle {
  width: 46px; height: 28px; border-radius: 999px; background: #333; border: 0; position: relative; flex-shrink: 0;
}
.toggle.on { background: #2a7; }
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: .15s;
}
.toggle.on::after { left: 21px; }
.log-box {
  background: #0a0c10; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px; font-family: ui-monospace, Menlo, monospace; font-size: .68rem;
  color: #9fb; max-height: 40vh; overflow: auto; white-space: pre-wrap; display: none;
}
.log-box.show { display: block; }

.login { max-width: 400px; margin: 36px auto 24px; padding: 0 20px; }
.brand {
  font-size: .72rem; font-weight: 800; letter-spacing: .22em;
  color: var(--accent2); margin-bottom: 8px;
}
.login h1 { font-size: 2rem; margin: 0 0 16px; letter-spacing: -.03em; }
.login p { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.login label { display: block; font-size: .75rem; color: var(--muted); margin: 14px 0 6px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

button.pulse {
  animation: glow 1.4s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255,77,46,.5);
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,77,46,.45); }
  50% { box-shadow: 0 0 0 10px rgba(255,77,46,0); }
}

.stat-hero {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  margin-bottom: 12px;
}
.stat-hero > div {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 10px; text-align: center;
}
.stat-hero span {
  display: block; font-size: .68rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
}
.stat-hero b { display: block; font-size: 1.35rem; margin: 4px 0 0; }
.stat-hero small { color: var(--muted); font-size: .75rem; }
.chart-card .oid { margin-bottom: 8px; }
.chart-svg { width: 100%; height: 128px; display: block; }
.chart-lab { fill: var(--muted); font-size: 9px; font-family: inherit; }
.hbar { margin: 8px 0; }
.hbar-meta {
  display: flex; justify-content: space-between; font-size: .8rem;
  margin-bottom: 4px; color: var(--text);
}
.hbar-track {
  height: 8px; border-radius: 99px; background: var(--card2);
  overflow: hidden;
}
.hbar-track i { display: block; height: 100%; border-radius: 99px; }
#histQ {
  margin-bottom: 10px;
}
.hist-cmt { display: block; margin-top: 4px; color: var(--text); }
.chart {
  display: flex; align-items: flex-end; gap: 2px; height: 120px;
  padding-top: 8px;
}
.bar-col {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  height: 100%; justify-content: flex-end; min-width: 0;
}
.bar-col .bar {
  width: 100%; max-width: 12px; border-radius: 3px 3px 0 0;
  background: var(--info); min-height: 2px;
}
.bar-col .bar.night { background: var(--purple); }
.bar-col span {
  font-size: .55rem; color: var(--muted); margin-top: 3px;
}

.tabbar button span { display: block; }
.tabbar { font-size: .6rem; }
.tabbar button { font-size: .58rem; padding: 6px 1px; }

.lab { font-size: .65rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; }

/* v1.4 one-screen */
.body-one { padding-bottom: calc(24px + var(--safe-b)) !important; }
.cab-btn {
  width: 48px; height: 48px; border-radius: 14px; font-size: 1.25rem;
  background: var(--card2); border: 1px solid var(--border); flex-shrink: 0;
}
.hdr-left { min-width: 0; }
.hdr-sub { font-size: .78rem; color: var(--muted); margin-top: 2px; font-weight: 600; }
.big-tap {
  min-height: 52px !important; padding: 14px 16px !important; font-size: .95rem !important;
  margin-bottom: 10px;
}
.big-tap.sm { min-height: 48px !important; padding: 12px !important; flex: 1; }
.corner-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px;
}
.oc-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0;
}
.oc-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.order-card { padding: 16px; }
.order-row {
  width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 12px;
  padding: 16px; margin-bottom: 12px; min-height: 72px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
}
.or-main { font-weight: 700; font-size: .95rem; }
.or-main small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; }
.or-side { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.phone-row {
  display: flex; flex-direction: column; gap: 10px; margin: 8px 0; font-weight: 700;
}
.phone-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big-badge { font-size: .75rem !important; padding: 8px 10px !important; }
.lead { text-align: left; color: var(--muted); font-size: .9rem; }
.comment-box { font-size: 1.02rem; line-height: 1.45; min-height: 52px; }
.door-tag {
  color: var(--door); font-weight: 800; font-size: .75rem; align-self: center;
  letter-spacing: .06em; text-transform: uppercase;
  pointer-events: none;
}
/* full-screen cabinet (feels like screen, not bottom sheet) */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: flex; flex-direction: column;
  animation: cabIn .22s ease;
}
.overlay[hidden] { display: none !important; }
@keyframes cabIn {
  from { transform: translateX(12%); opacity: .6; }
  to { transform: translateX(0); opacity: 1; }
}
.overlay-panel {
  width: 100%; max-width: 560px; margin: 0 auto;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  padding: calc(10px + var(--safe-t)) 0 0;
  background: var(--bg);
}
.cab-sticky {
  flex-shrink: 0;
  background: var(--bg);
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--border);
  z-index: 6;
}
.overlay-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; background: var(--bg);
  padding: 4px 0 0; z-index: 2;
}
.overlay-head h2 { margin: 0; font-size: 1.25rem; }
.cab-tabs {
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cab-tabs::-webkit-scrollbar { display: none; }
.cab-tabs button {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 9px 12px;
}
#cabBody {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px calc(24px + var(--safe-b));
}

.map-dock { width: 100%; }
.map-slot { margin-bottom: 12px; min-height: 240px; }
.map-box {
  height: 240px !important; min-height: 240px !important;
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border); background: var(--card2);
  z-index: 1; position: relative;
}
.map-box .leaflet-container {
  height: 240px !important; width: 100% !important;
  background: var(--card2);
}
.map-pin {
  background: transparent !important; border: 0 !important;
}
.map-pin span {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: #ff4d2e; color: #fff; font-weight: 800; font-size: .85rem;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.map-pin.done span { background: #2dd4a0; }
.ord-num { color: var(--accent2); margin-right: 4px; }

.swipe-threshold {
  position: absolute; right: 8%; top: 6px; bottom: 6px; width: 2px;
  background: rgba(45,212,160,.45); border-radius: 2px; pointer-events: none;
}
.swipe-track.swipe-ready { border-color: var(--ok); }
.swipe-track.swipe-done { opacity: .7; }
.swipe-track { touch-action: none; user-select: none; -webkit-user-select: none; }
.swipe-knob {
  will-change: transform;
  touch-action: none;
}

/* cash emphasis */
.cash-hot {
  border-color: #e8a317 !important;
  background: linear-gradient(135deg, rgba(232,163,23,.2), var(--card) 55%) !important;
  box-shadow: inset 0 0 0 1px rgba(232,163,23,.35);
}
.cash-line {
  margin-top: 6px;
  color: #ffc857;
  font-weight: 800;
  font-size: .82rem;
}
.cash-banner {
  background: linear-gradient(135deg, #5a3d08, #c47a00);
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 12px;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.35;
}
.cash-warn { color: #ffc857; }
.offer-has-cash {
  border-color: #e8a317 !important;
  box-shadow: 0 0 0 1px rgba(232,163,23,.4);
}
.offer-preview { margin: 10px 0; text-align: left; }
.offer-line {
  background: rgba(0,0,0,.2);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: .85rem;
  line-height: 1.3;
}
.offer-line.cash-hot { background: rgba(232,163,23,.18); }
.offer-pay { margin-top: 6px; }

.assembly-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 14px; font-weight: 700;
  position: sticky; top: 0; z-index: 3;
}
.assembly-bar.over { border-color: #f66; background: rgba(255,80,80,.12); }
.assembly-bar b { font-variant-numeric: tabular-nums; font-size: 1.4rem; color: var(--accent2); }
.assembly-bar b.neg, #assemblyTimer.neg { color: #ff6b6b; }
.assembly-bar b.urgent { animation: blink 1s infinite; }

.stage-card .stage-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .88rem;
}
.stage-card .stage-row.total { font-weight: 800; border-bottom: 0; margin-top: 4px; }
.stage-comment {
  font-size: .78rem; color: #ffd27a; padding: 2px 0 6px; line-height: 1.3;
}
.stage-row .neg { color: #ff6b6b; font-size: .75rem; }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.items-ul { list-style: none; padding: 0; margin: 0; }
.items-ul li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.muted { color: var(--muted); font-size: .8rem; }

/* ===== Assembly / composition — clean, checkable ===== */
.asm-order { padding: 12px !important; margin-bottom: 14px; }
.asm-order-h {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--border);
}
.asm-order-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cell-chip {
  font-size: .78rem; font-weight: 800; letter-spacing: .02em;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(94,177,255,.14); color: var(--info);
  border: 1px solid rgba(94,177,255,.4);
}
.cell-chip.self-chip {
  background: rgba(245,197,66,.16); color: var(--warn);
  border-color: rgba(245,197,66,.45);
}
.asm-body { display: flex; flex-direction: column; gap: 10px; }

.kit-block {
  border-radius: 12px; padding: 10px 10px 8px;
  border: 1px solid var(--border);
}
.kit-block.kit-extra {
  background: var(--extra-bg);
  border-color: var(--extra-border);
  border-left: 4px solid var(--warn);
  box-shadow: 0 0 0 1px rgba(245,197,66,.08);
}
.kit-block.kit-cell {
  background: var(--cell-bg);
  border-color: var(--cell-border);
  border-left: 4px solid var(--ok);
}
.kit-block-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 4px;
}
.kit-block-h small { color: var(--muted); font-weight: 700; font-size: .72rem; }
.kit-hint {
  margin: 0 0 8px; font-size: .78rem; font-weight: 700; color: var(--warn);
}
.kit-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 8px; border-radius: 7px;
}
.kit-pill.extra {
  color: var(--warn); background: rgba(245,197,66,.18);
  border: 1px solid var(--extra-border);
}
.kit-pill.cell {
  color: var(--ok); background: rgba(45,212,160,.12);
  border: 1px solid var(--cell-border);
}
[data-theme="light"] .kit-pill.cell { background: rgba(15,159,110,.1); }
[data-theme="light"] .kit-pill.extra { background: rgba(196,138,0,.1); }

.kit-ws-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 700; color: var(--muted);
  margin: 8px 0 2px; padding-top: 6px; border-top: 1px dashed var(--border);
}
.kit-ws-label:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.ws-mini { font-size: .95rem; line-height: 1; }

.item-row {
  display: flex !important; align-items: center; gap: 10px;
  padding: 10px 6px !important; border-bottom: 1px solid var(--border) !important;
  cursor: pointer; border-radius: 8px; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.item-row:last-child { border-bottom: 0 !important; }
.item-row:active { background: rgba(127,127,127,.08); }
.item-check {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  border: 2px solid var(--border); background: var(--card2);
  display: grid; place-items: center; font-size: .85rem; font-weight: 900;
  color: var(--ok);
}
.item-row.checked .item-check {
  background: rgba(45,212,160,.2); border-color: var(--ok);
}
.item-row.checked .item-name {
  text-decoration: line-through; opacity: .5;
}
.item-row.self-pick .item-check {
  border-color: rgba(245,197,66,.55);
}
.item-row.self-pick.checked .item-check {
  background: rgba(245,197,66,.22); border-color: var(--warn); color: var(--warn);
}
.item-name {
  flex: 1; min-width: 0; font-size: .92rem; font-weight: 650; line-height: 1.3;
  display: flex; align-items: center; gap: 8px;
}
.item-qty {
  font-variant-numeric: tabular-nums; font-size: .95rem;
  color: var(--text); min-width: 2rem; text-align: right;
}
.item-row.checked .item-qty { opacity: .45; }
.th-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}
.th-dot.hot { background: #ff7a45; box-shadow: 0 0 0 2px rgba(255,122,69,.25); }
.th-dot.cold { background: #5eb1ff; box-shadow: 0 0 0 2px rgba(94,177,255,.25); }

.comp-fold {
  margin: 12px 0; border: 1px solid var(--border); border-radius: 14px;
  background: var(--card); overflow: hidden;
}
.comp-fold > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 12px 14px; font-weight: 800; font-size: .92rem;
  display: flex; align-items: center; justify-content: space-between;
}
.comp-fold > summary::-webkit-details-marker { display: none; }
.comp-fold > summary::after {
  content: "▸"; color: var(--muted); font-size: .9rem; transition: transform .15s;
}
.comp-fold[open] > summary::after { transform: rotate(90deg); }
.comp-fold-body {
  padding: 0 10px 12px; display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.gain-dest {
  font-size: 1.15rem; font-weight: 800; margin: 8px 0 0 !important; color: var(--text) !important;
}
.gain-banner.return { border-color: rgba(94,177,255,.4); background: rgba(94,177,255,.08); }
.pending-close.wait-open { border-color: rgba(245,197,66,.4); }
.pending-close.wait-open h2 { color: var(--warn); }

.cab-section {
  font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 14px 0 8px;
}
.cab-section:first-child { margin-top: 0; }

/* light-theme polish for a few hard-coded dark bits */
[data-theme="light"] .offer {
  background: linear-gradient(135deg, #fff0eb, #ffe4d6);
  border-color: #f0a890;
}
[data-theme="light"] .offer h3 { color: #b53a20; }
[data-theme="light"] .offer p { color: #5a3a30; }
[data-theme="light"] button.warn { background: #fff6e0; border-color: #e0c070; color: #9a6b00; }
[data-theme="light"] .toggle { background: #c8cdd8; }
[data-theme="light"] .toggle.on { background: #0f9f6e; }
[data-theme="light"] .log-box { background: #f7f8fb; color: #0a6b48; }
[data-theme="light"] .banner-sim { color: #1a5a9a; }
[data-theme="light"] .banner-sim.live {
  background: #fde8e4; color: #9a2a18; border-bottom-color: #f0b0a0;
}
[data-theme="light"] .toast {
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
[data-theme="light"] .sheet { background: var(--card); color: var(--text); }
[data-theme="light"] .modal { background: rgba(30, 34, 44, .35); }
[data-theme="light"] .hl-door {
  background: #ffe08a; color: #6a4a00;
}
[data-theme="light"] .cash-line,
[data-theme="light"] .cash-warn,
[data-theme="light"] .stage-comment,
[data-theme="light"] .phone-chip .ext {
  color: #8a5a00;
}
[data-theme="light"] .phone-chip {
  background: #e3f0ff; color: #0b4f8a; border-color: #9bb8d4;
}
[data-theme="light"] .phone-chip .mini button {
  background: #d5e6f8; color: #0b4f8a;
}
[data-theme="light"] .pay-cash {
  background: #d9f5ea !important; color: #0a6b48 !important; border-color: #8fd4b6 !important;
}
[data-theme="light"] .pay-card {
  background: #eee6ff !important; color: #4c3480 !important; border-color: #c4b5fd !important;
}
[data-theme="light"] .pay-online {
  background: #e3f0ff !important; color: #0b4f8a !important; border-color: #93c5fd !important;
}
[data-theme="light"] .pill.on { color: #0a6b48; border-color: #0f9f6e; }
[data-theme="light"] .live-err {
  color: #9a2a18; background: #fde8e4; border-color: #f0b0a0;
}
[data-theme="light"] .err { color: #c23030; }
[data-theme="light"] .gain-banner {
  background: #e8f2fb; border-color: #9bb8d4;
}
[data-theme="light"] .gain-banner h3 { color: #1a4a7a; }
[data-theme="light"] .offer-line { background: rgba(0,0,0,.05); color: var(--text); }
[data-theme="light"] .cash-hot {
  background: linear-gradient(135deg, #fff3cc, var(--card) 55%) !important;
}
[data-theme="light"] .actions .photo {
  background: #fff6e0; border-color: #e0c070; color: #8a5a00;
}
[data-theme="light"] .chip.offline {
  color: #9a2a18; background: #fde8e4; border-color: #f0b0a0;
}

/* v1.3 leftovers */
.tabbar-2 button { font-size: .85rem !important; flex-direction: row !important; gap: 8px !important; }
.err { color: #f88; font-size: .85rem; }
.sheet-sm { max-width: 420px; margin: 0 auto; }
.pay-cash { background: rgba(45,212,160,.18) !important; color: #5dffb0 !important; border-color: rgba(45,212,160,.45) !important; }
.pay-card { background: rgba(167,139,250,.18) !important; color: #c4b5fd !important; border-color: rgba(167,139,250,.45) !important; }
.pay-online { background: rgba(94,177,255,.15) !important; color: #93c5fd !important; border-color: rgba(94,177,255,.4) !important; }
.swipe-track {
  position: relative; height: 58px; border-radius: 16px;
  background: var(--card2); border: 1px solid var(--border);
  overflow: hidden; user-select: none; touch-action: none; margin-top: 12px;
}
.swipe-track.ok-track { background: rgba(45,212,160,.12); border-color: rgba(45,212,160,.4); }
.swipe-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(45,212,160,.25); pointer-events: none;
}
.swipe-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .82rem; font-weight: 700; color: var(--muted); pointer-events: none;
}
.swipe-knob {
  position: absolute; left: 4px; top: 4px; width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: 0 4px 12px rgba(0,0,0,.3); z-index: 2;
}
.gain-banner {
  background: linear-gradient(135deg, #1e3a5f, #2a4a6f);
  border: 1px solid #3b6ea5; border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.gain-banner h3 { margin: 0 0 6px; color: #9fd0ff; }
.kicker {
  font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 2px;
}
.queue-hero { padding-top: 18px; padding-bottom: 22px; }
.queue-cap { margin: 2px 0 16px !important; font-size: .8rem !important; }

textarea {
  width: 100%; padding: 13px 14px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--card); color: var(--text); font: inherit; font-size: 16px; resize: vertical;
}
textarea:focus { outline: none; border-color: rgba(255,122,69,.55); }

.queue-strip {
  display: flex; justify-content: center; align-items: flex-end;
  gap: 6px; overflow-x: auto; padding: 2px 0 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.queue-strip::-webkit-scrollbar { display: none; }
.q-person {
  flex: 0 0 auto; width: auto; padding: 0 !important; border: 0 !important;
  background: transparent !important; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  box-shadow: none !important;
}
.q-person .av { width: 30px; height: 30px; font-size: .62rem; }
.q-person.mine .av { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.q-person.stub { opacity: .38; }
.q-you { font-size: .58rem; font-weight: 800; color: var(--accent2); line-height: 1; }
.av {
  width: 40px; height: 40px; border-radius: 50%;
  background: hsl(var(--h, 20) 55% 42%);
  display: grid; place-items: center; position: relative; overflow: hidden;
  color: #fff; font-size: .78rem; font-weight: 800;
}
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av b { position: relative; z-index: 0; }

.contact-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  text-align: left; padding: 10px 10px; margin-bottom: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
}
.contact-row .cr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.contact-row .cr-main b { font-size: .95rem; }
.contact-row .cr-main small { color: var(--muted); font-weight: 600; }
.now-badge { color: var(--info) !important; font-weight: 700; }
.now-badge.on { color: var(--ok) !important; }
.dot-on {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 4px rgba(45,212,160,.18);
}
.contact-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.contact-head .av { width: 52px; height: 52px; font-size: .95rem; }

.shift-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  margin-bottom: 10px; overflow: hidden;
}
.shift-head {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  gap: 10px; text-align: left; background: transparent; border: 0; padding: 12px 12px;
}
.shift-head small { display: block; color: var(--muted); font-weight: 600; margin-top: 2px; }
.shift-kpis { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.shift-kpis span {
  font-size: .68rem; color: var(--muted); background: var(--card2);
  border: 1px solid var(--border); border-radius: 8px; padding: 3px 6px;
}
.shift-kpis b { color: var(--text); }
.shift-kpis .night { color: var(--purple); }
.shift-body { border-top: 1px solid var(--border); padding: 4px 8px 8px; }
.shift-card.open { border-color: rgba(255,122,69,.35); }

.places-box .place-code {
  background: rgba(245,197,66,.1); border: 1px solid rgba(245,197,66,.35);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: .92rem;
}
.place-sec { margin-bottom: 8px; }
.place-sec .lab { margin-bottom: 4px; }
.place-note {
  font-size: .86rem; padding: 6px 0; border-bottom: 1px dashed var(--border);
}
.place-note b { font-weight: 750; }
.place-note small { display: block; color: var(--muted); font-size: .68rem; }
.place-sec .big-tap { width: 100%; margin-top: 8px; }
.place-notes-list { margin: 0 0 10px; }
.place-hit { margin-bottom: 8px; }

#cabBody:has(.places-map-wrap) { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.places-map-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.places-map { flex: 1; min-height: 280px; background: var(--card2); }
.places-map-bar {
  padding: 10px 14px calc(12px + var(--safe-b));
  border-top: 1px solid var(--border); background: var(--bg);
}
.places-map-bar .primary { width: 100%; }
.places-map-bar .muted-hint { margin: 8px 0 0; }
.place-pin {
  background: none !important; border: 0 !important;
}
.place-pin span {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; background: var(--card); box-shadow: var(--shadow);
  font-size: 15px;
}
.place-pin.has-code span { background: #fff3c4; }

[data-theme="light"] .q-person.mine .av { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
[data-theme="light"] .places-box .place-code {
  background: #fff6e0; border-color: #e0c070;
}
.wait-card { padding: 36px 20px; }
.wait-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--warn);
  margin: 0 auto 14px; animation: blink 1.2s infinite;
  box-shadow: 0 0 0 8px rgba(245,197,66,.12);
}

.cab-section { margin: 18px 0 8px; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); font-weight: 800; }
.seg {
  display: flex; gap: 4px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px; margin-bottom: 10px;
}
.seg button { flex: 1; border: 0; background: transparent; padding: 10px 6px; font-size: .78rem; }
.seg button.on { background: var(--card2); border-radius: 9px; color: var(--text); }
.pending-close {
  background: rgba(245,197,66,.12); border: 1px solid rgba(245,197,66,.4);
  border-radius: 14px; padding: 14px; text-align: center; margin-bottom: 12px;
}
