/* Bidani Ledger Mobile - one stylesheet, phone first.
   Legibility first (the owner's preference): black text on white, gold only as an accent.
   Text is never smaller than 16 px in inputs (iOS would zoom), touch targets are at least 44 px,
   and the notch / home indicator areas are respected with env(safe-area-inset-*). */

:root {
  color-scheme: light;
  --ink: #030302;
  --ink-2: #2e2e2b;
  --muted: #5f5f59;
  --disabled: #9c9c96;
  --page: #f6f6f3;
  --surface: #ffffff;
  --surface-alt: #fafaf8;
  --header: #f1f1ee;
  --border: #e2e2dd;
  --input-border: #8e8e88;
  --gold: #f8b81c;
  --gold-hover: #ffc845;
  --gold-pressed: #e0a40f;
  --gold-dark: #b07800;
  --gold-soft: #fff3d1;
  --warn-bg: #fff0c2;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --chart-ink: #1a1a18;
  --chart-gray: #8d8d87;
  --grid: #e6e6e1;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(3, 3, 2, .06), 0 4px 14px rgba(3, 3, 2, .06);
  --tabbar-h: 64px;
  --appbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", "Courier New", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.45 var(--font);
  color: var(--ink);
  background: var(--page);
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0 0 8px; }
a { color: var(--ink); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.strong { font-weight: 700; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.spacer { height: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--gold-dark); outline-offset: 2px; }

/* ------------------------------------------------------------------ app frame */
#app { min-height: 100%; }
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  min-height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) calc(12px + var(--safe-right)) 0 calc(12px + var(--safe-left));
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  backdrop-filter: saturate(1.2) blur(8px);
}
.appbar h1 { font-size: 20px; font-weight: 750; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar .logo { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding: 0 10px; border: 0; border-radius: 12px;
  background: transparent; cursor: pointer; gap: 6px;
}
.icon-btn:active { background: var(--header); }
.icon-btn svg { width: 24px; height: 24px; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); flex: none; }
.sync-dot.pending { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.sync-dot.saving { background: var(--gold); animation: pulse 1s infinite alternate; }
.sync-dot.error { background: var(--danger); }
@keyframes pulse { to { opacity: .35; } }

main.view {
  padding: 14px calc(14px + var(--safe-right)) calc(var(--tabbar-h) + var(--safe-bottom) + 24px) calc(14px + var(--safe-left));
  max-width: 1180px; margin: 0 auto;
}
main.view.with-cartbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 96px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: #fff; border-top: 1px solid var(--border);
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
  min-height: 48px;
}
.tabbar button svg { width: 26px; height: 26px; }
.tabbar button[aria-current="page"] { color: var(--ink); }
.tabbar button[aria-current="page"] .tab-icon { background: var(--gold-soft); }
.tab-icon { display: inline-flex; padding: 3px 16px; border-radius: 16px; }

/* Tablets and landscape: a side rail replaces the bottom bar */
.rail { display: none; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 2px;
    position: fixed; top: 0; bottom: 0; left: 0; width: 232px; z-index: 25;
    padding: calc(16px + var(--safe-top)) 10px calc(16px + var(--safe-bottom)) calc(10px + var(--safe-left));
    background: #fff; border-right: 1px solid var(--border); overflow-y: auto;
  }
  .rail .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 800; font-size: 18px; }
  .rail .brand img { width: 44px; height: 44px; border-radius: 50%; }
  .rail button {
    display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px;
    border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; font-weight: 600;
  }
  .rail button svg { width: 22px; height: 22px; flex: none; }
  .rail button[aria-current="page"] { background: var(--gold-soft); }
  .rail .rail-foot { margin-top: auto; padding: 10px 12px 0; font-size: 13px; color: var(--muted); }
  .appbar, main.view { margin-left: 232px; }
  main.view { padding-bottom: 32px; }
  main.view.with-cartbar { padding-bottom: 32px; }
  .appbar .logo { display: none; }
}

/* ------------------------------------------------------------------ surfaces */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card.tight { padding: 10px 12px; }
.card h2 { font-size: 18px; margin-bottom: 8px; }
.card h3 { font-size: 16px; margin-bottom: 6px; }
.section-title { font-size: 18px; font-weight: 750; margin: 6px 0 2px; }
.page-intro { color: var(--muted); font-size: 15px; margin: -2px 0 2px; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (min-width: 700px) { .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.split { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.split > *, .stack > * { min-width: 0; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; } }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 22px; font-weight: 800; margin: 2px 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .sub { font-size: 13px; color: var(--muted); }
.kpi.hero { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.hero .label, .kpi.hero .sub { color: #e8e8e2; }
.kpi.hero .value { color: var(--gold); font-size: 26px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 700; background: var(--header); color: var(--ink); white-space: nowrap;
}
.badge.ok { background: #fff; border: 1px solid var(--border); }
.badge.warn { background: var(--warn-bg); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.gold { background: var(--gold-soft); }
.badge.dark { background: var(--ink); color: #fff; }

.note { background: var(--surface-alt); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--ink-2); font-size: 14px; }
.note.warn { background: var(--warn-bg); border: 1px solid #f1d586; }
.note.danger { background: var(--danger-soft); border: 1px solid #f3c1bc; color: #7a1a12; }
.divider { height: 1px; background: var(--border); margin: 8px 0; }
.empty { text-align: center; color: var(--muted); padding: 24px 12px; }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--input-border);
  background: #fff; font-weight: 700; cursor: pointer; text-align: center; line-height: 1.15;
  touch-action: manipulation; user-select: none;
}
.btn:active { background: var(--header); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.primary:active { background: var(--gold-pressed); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 15px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; font-size: 18px; }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--border);
  background: #fff; font-weight: 650; cursor: pointer; white-space: nowrap; font-size: 15px;
}
.chip[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold-dark); }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--header); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  flex: 1 0 auto; min-height: 40px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent;
  font-weight: 700; color: var(--ink-2); cursor: pointer; white-space: nowrap; font-size: 15px;
}
.segmented button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label { font-size: 14px; font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 12px; font-size: 16px;
  border: 1.5px solid var(--input-border); border-radius: 12px; background: #fff;
}
select.input { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px; background-repeat: no-repeat; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--gold-dark); outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.input[readonly] { background: var(--surface-alt); }
.input.big { font-size: 22px; font-weight: 750; min-height: 56px; }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { padding-right: 46px; }
.input-affix .affix { position: absolute; right: 14px; color: var(--muted); font-weight: 700; pointer-events: none; }
.input-affix.prefix .input { padding-left: 30px; padding-right: 12px; }
.input-affix.prefix .affix { left: 12px; right: auto; }
.form-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } .form-grid .span2 { grid-column: 1 / -1; } }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 16px; background: #c9c9c3; position: relative; flex: none; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked { background: var(--gold-dark); }
.switch input:checked::after { transform: translateX(20px); }
.search { position: relative; }
.search .input { padding-left: 42px; }
.search svg { position: absolute; left: 12px; top: 12px; width: 22px; height: 22px; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--input-border); border-radius: 12px; overflow: hidden; background: #fff; }
.stepper button { width: 44px; height: 44px; border: 0; background: #fff; font-size: 22px; font-weight: 700; cursor: pointer; }
.stepper button:active { background: var(--header); }
.stepper .value { min-width: 40px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; background: #fff; }
.radio-card input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--gold-dark); flex: none; }
.radio-card.selected { border-color: var(--gold-dark); background: var(--gold-soft); }

/* ------------------------------------------------------------------ lists */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--border); min-height: 56px; background: #fff; width: 100%; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; }
.list-item:first-child { border-top: 0; }
button.list-item { cursor: pointer; }
button.list-item:active { background: var(--surface-alt); }
.list-item .title { font-weight: 700; overflow-wrap: anywhere; }
.list-item .meta { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.list-item .amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.list-item.void .title, .list-item.void .amount { text-decoration: line-through; color: var(--muted); }
.list-item .chev { color: var(--disabled); flex: none; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: baseline; }
.kv .k { color: var(--ink-2); }
.kv .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv .total { font-weight: 800; font-size: 18px; }
.kv .rule { grid-column: 1 / -1; height: 1px; background: var(--border); }
.pnl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 64px; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--border); align-items: baseline; }
.pnl-row:first-child { border-top: 0; }
.pnl-row.total { background: var(--gold-soft); font-weight: 800; }
.pnl-row.header { font-weight: 800; background: var(--header); }
.pnl-row.muted { color: var(--muted); }
.pnl-row .v, .pnl-row .p { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pnl-row .p { color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; -webkit-overflow-scrolling: touch; }
table.data { border-collapse: collapse; width: 100%; font-size: 15px; }
table.data th { background: var(--header); text-align: left; font-size: 13px; padding: 9px 10px; white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 9px 10px; border-top: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data td.r, table.data th.r { text-align: right; }
table.data tr.target td { background: var(--gold-soft); font-weight: 750; }

/* ------------------------------------------------------------------ POS */
.pos-top { display: flex; flex-direction: column; gap: 10px; }
.shift-chip { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--border); font-size: 14px; }
.shift-chip.closed { background: var(--warn-bg); border-color: #f1d586; }
.shift-chip .btn { white-space: nowrap; flex: none; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  min-height: 104px; padding: 12px; border-radius: var(--radius); border: 1.5px solid var(--border);
  background: #fff; text-align: left; cursor: pointer; touch-action: manipulation; user-select: none;
}
.tile:active { background: var(--gold-soft); border-color: var(--gold-dark); transform: scale(.98); }
.tile .name { font-weight: 750; font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile .price { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.tile .code { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile .count { position: absolute; top: 8px; right: 8px; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 14px; background: var(--ink); color: var(--gold); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.cartbar {
  position: fixed; left: calc(10px + var(--safe-left)); right: calc(10px + var(--safe-right));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px); z-index: 28;
  display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 8px 8px 8px 16px;
  border-radius: 18px; background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.cartbar .total { font-size: 20px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.cartbar .btn { min-height: 46px; }
@media (min-width: 900px) { .cartbar { display: none; } }
.cart-panel { display: none; }
@media (min-width: 900px) { .cart-panel { display: block; position: sticky; top: calc(var(--appbar-h) + 14px); } }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 10px 0; border-top: 1px solid var(--border); align-items: center; }
.cart-line:first-child { border-top: 0; }
.cart-line .name { font-weight: 700; overflow-wrap: anywhere; }
.cart-line .unit { font-size: 13px; color: var(--muted); }
.cart-line .line-total { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.cart-line > .btn { justify-self: end; }
.cart-line > .stepper { justify-self: start; }
.pay-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 420px) { .pay-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pay-grid .chip { width: 100%; border-radius: 12px; min-height: 46px; white-space: normal; line-height: 1.1; }
.change { font-size: 18px; font-weight: 800; }
.change.short { color: var(--danger); }
.receipt-text { font-family: var(--mono); font-size: 12.5px; line-height: 1.35; white-space: pre; overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
@media (max-width: 380px) { .receipt-text { font-size: 11px; } }

/* ------------------------------------------------------------------ sheets, dialogs, toast */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(3, 3, 2, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--page); border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
  animation: rise .2s ease-out; padding-bottom: var(--safe-bottom);
}
@keyframes rise { from { transform: translateY(40px); opacity: .6; } }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 22px; max-height: 88vh; padding-bottom: 0; } }
.sheet.wide { max-width: 860px; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 18px; background: #fff; border-radius: 22px 22px 0 0; border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-size: 19px; flex: 1 1 auto; min-width: 0; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: #d4d4ce; margin: 8px auto 0; }
.sheet-body { padding: 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 12px; }
.sheet-foot { padding: 10px 16px 14px; background: #fff; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-foot .btn { flex: 1 1 140px; }
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 84px); z-index: 90; display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
@media (min-width: 900px) { .toast-wrap { bottom: 24px; } }
.toast { max-width: 520px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: rise .2s ease-out; }
.toast.error { background: var(--danger); }
.pin-display { font-size: 32px; letter-spacing: 12px; text-align: center; min-height: 48px; font-weight: 800; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { min-height: 60px; font-size: 24px; font-weight: 700; border-radius: 14px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; }
.keypad button:active { background: var(--gold-soft); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--gold-soft); border-top-color: var(--gold-dark); animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ boot / first run */
.boot { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom)); text-align: center; background: #fff; }
.boot img { width: 132px; height: 132px; border-radius: 50%; }
.boot h1 { font-size: 26px; }
.boot .progress { width: min(320px, 80vw); height: 8px; border-radius: 4px; background: var(--header); overflow: hidden; }
.boot .progress > div { height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.welcome { max-width: 560px; width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; }
/* «Bidani» (bottom of Más and of the first-run screen): opens the password-locked ledger the owner published */
.key-btn { letter-spacing: .3em; font-weight: 750; color: var(--ink-2); margin-top: 24px; }
.boot .key-btn { max-width: 560px; margin-top: 6px; }
.option { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 16px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; text-align: left; width: 100%; }
.option:active { background: var(--gold-soft); }
.option.recommended { border-color: var(--gold-dark); }
.option .o-title { font-weight: 800; font-size: 17px; }
.option .o-text { color: var(--muted); font-size: 14px; }
.option svg { width: 30px; height: 30px; flex: none; }

/* ------------------------------------------------------------------ charts */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { font-size: 11px; fill: var(--muted); }
.chart .value-label { font-size: 11px; fill: var(--ink); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar .top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.hbar .top .l { font-weight: 650; overflow-wrap: anywhere; }
.hbar .top .v { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar .track { height: 12px; border-radius: 6px; background: var(--header); margin-top: 4px; overflow: hidden; }
.hbar .bar { height: 100%; border-radius: 6px; background: var(--gold); }
.hbar .note { font-size: 13px; color: var(--muted); margin-top: 2px; background: none; border: 0; padding: 0; }
.chart-tip { position: fixed; z-index: 95; max-width: 260px; padding: 8px 10px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------------ more menu */
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .menu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.menu-tile { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 16px; min-height: 112px; border-radius: 16px; border: 1px solid var(--border); background: #fff; cursor: pointer; text-align: left; box-shadow: var(--shadow); }
.menu-tile:active { background: var(--gold-soft); }
.menu-tile svg { width: 30px; height: 30px; }
.menu-tile .t { font-weight: 800; font-size: 16px; }
.menu-tile .d { font-size: 13px; color: var(--muted); }
