/* Kru web till: night rail (amber honeycomb marks the open screen), paper top bar, keypad and QR on the well canvas, sales. */
.kru-pos-body { overflow: hidden; }
#pos { height: 100vh; height: 100dvh; overflow: hidden; display: grid; grid-template-columns: 88px minmax(0, 1fr); background: var(--well); color: var(--ink); }

.rail { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 0 16px; background: var(--night); color: var(--lilac-line); }
.rail .mark { font-size: 20px; margin-bottom: 20px; }
.rail button { position: relative; width: 72px; min-height: var(--tap); padding: 8px 4px; display: grid; place-items: center; gap: 4px;
  border: 0; border-radius: var(--r-control); background: transparent; color: var(--lilac-line); font-size: 12px; font-weight: 600; line-height: 1.2;
  transition: background-color 150ms var(--ease); }
.rail button:hover, .rail button.on { background: var(--violet-deep); color: var(--paper); }
.rail button.on::before { content: ""; position: absolute; left: -6px; top: 50%; width: 12px; height: 14px; transform: translateY(-50%);
  background: var(--amber); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.rail .spacer { margin-top: auto; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.bar { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 0 24px; background: var(--paper); border-bottom: 1px solid var(--lilac-line); }
.bar h1 { font-size: 20px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; margin-left: auto; font-size: 14px; font-weight: 600; }
.who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: var(--r-round); background: var(--violet-deep); color: var(--paper); font-size: 14px; font-weight: 700; }
.pane { flex: 1; min-height: 0; padding: 20px 24px; overflow-y: auto; }

/* take a payment: the code on the left, the keypad on the right */
.qr-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); gap: 20px; max-width: 1080px; min-height: 100%; margin: 0 auto; }
.pad-card, .qr-card { background: var(--paper); border: 1px solid var(--lilac-line); border-radius: var(--r-sheet); padding: 20px; }
.pad-card { display: flex; flex-direction: column; gap: 12px; }
.amt-face { padding: 16px; border-radius: var(--r-panel); background: var(--well); }
.amt-face small { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.amt-face .val { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.amt-face .val.zero { color: var(--control-line); }
.amt-note { margin-top: 6px; font-size: 14px; color: var(--muted); }
.cash-wrap { max-width: 480px; margin: 0 auto; }
.lock { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(11, 4, 32, 0.92); padding: 16px; }
.lock[hidden] { display: none; }
.lock-box { width: 100%; max-width: 360px; background: var(--paper); border-radius: var(--r-sheet); padding: 24px; }
.lock-box input { width: 100%; min-height: 52px; padding: 0 14px; border: 1px solid var(--control-line); border-radius: var(--r-control); font: inherit; }
.cash-rows { margin: 12px 0; }
.cash-rows div { display: flex; justify-content: space-between; padding: 4px 0; }
.cash-big { font-size: 28px; font-weight: 800; margin: 8px 0; }
.cash-warn { color: var(--ink); background: #FFF4D6; border-radius: var(--r-control); padding: 8px 12px; }
.code-field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.code-field label span, .code-field p { font-weight: 400; color: var(--muted); }
.code-field p { font-size: 13px; margin-top: 6px; }
.code-field input { width: 100%; min-height: 52px; padding: 0 14px; border: 1px solid var(--control-line); border-radius: var(--r-control); background: var(--paper); color: var(--ink); font: 600 24px/1 ui-monospace, monospace; letter-spacing: 0.3em; text-align: center; }
.code-field input:focus { outline: 2px solid var(--violet); outline-offset: 0; border-color: var(--violet); }
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.presets button, .pad button { min-height: var(--tap); border: 1px solid var(--lilac-line); border-radius: var(--r-control); background: var(--paper);
  font-weight: 600; font-variant-numeric: tabular-nums; transition: background-color 150ms var(--ease), border-color 150ms var(--ease); }
.presets button { color: var(--violet-deep); font-size: 15px; }
.pad button { min-height: 64px; font-size: 22px; }
.presets button:hover, .pad button:hover { background: var(--well); border-color: var(--violet); }
.presets button:active, .pad button:active, .charge:active, .qr-acts button:active { transform: translateY(1px); }
.pad .fn { color: var(--muted); }
.charge { width: 100%; min-height: 64px; border: 0; border-radius: var(--r-control); background: var(--violet); color: var(--paper); font-size: 18px; font-weight: 700; transition: background-color 150ms var(--ease); }
.charge:hover:not([disabled]) { background: var(--violet-press); }
.charge[disabled] { opacity: 0.5; cursor: not-allowed; }

.qr-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; }
.qr-card > * { width: 100%; }
.qr-card h2 { font-size: 22px; font-weight: 800; }
.qr-card .sub { margin: 4px 0 12px; color: var(--muted); }
.qr-box { width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto; padding: 12px; background: var(--paper); border: 1px solid var(--lilac-line); border-radius: var(--r-panel); }
.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-idle { padding: 24px; color: var(--muted); }
.qr-idle .icon { width: 72px; height: 72px; margin-bottom: 12px; color: var(--lilac-line); stroke-width: 1.25; }
.qr-amt { margin: 12px 0 2px; font-size: 36px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.waiting { display: inline-flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.pulse { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--violet); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.qr-meta { margin-top: 8px; font-size: 14px; color: var(--muted); }
.qr-acts { display: flex; gap: 10px; margin-top: 16px; }
.qr-acts button { flex: 1; min-height: var(--tap); border: 1px solid var(--control-line); border-radius: var(--r-control); background: var(--paper);
  color: var(--violet-deep); font-size: 16px; font-weight: 600; transition: background-color 150ms var(--ease); }
.qr-acts button:hover { background: var(--well); border-color: var(--violet); }
.qr-acts .go { background: var(--violet); border-color: var(--violet); color: var(--paper); }
.qr-acts .go:hover { background: var(--violet-press); }
.done { text-align: center; }
.tick { width: 72px; height: 72px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; background: var(--mint-ink); color: var(--paper); }
.tick .icon { width: 36px; height: 36px; stroke-width: 2.5; }
.change { margin: 4px 0 8px; color: var(--muted); }
.change b { display: block; margin-top: 4px; color: var(--ink); font-size: 20px; }

/* sales */
.stats-wrap { max-width: 1080px; margin: 0 auto; display: grid; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 16px; background: var(--paper); border: 1px solid var(--lilac-line); border-radius: var(--r-panel); }
.kpi small { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.kpi b { display: block; overflow-wrap: anywhere; font-size: 25px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .delta { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.panels { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { padding: 20px; background: var(--paper); border: 1px solid var(--lilac-line); border-radius: var(--r-panel); }
.panel h2 { margin-bottom: 4px; font-size: 18px; }
.panel .hint { margin-bottom: 16px; font-size: 14px; color: var(--muted); }
.payout { background: var(--violet-deep); border-color: var(--violet-deep); color: var(--paper); }
.payout .hint, .payout .when { color: var(--lilac-line); }
.payout .amt { margin-bottom: 8px; font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.payout .when { font-size: 14px; }
.tbl-wrap { overflow-x: auto; } /* focusable (tabindex) so a keyboard can scroll it on a narrow screen */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { padding: 0 8px 10px 0; border-bottom: 1px solid var(--lilac-line); text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); }
.tbl td { padding: 12px 8px 12px 0; border-bottom: 1px solid var(--lilac-line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { padding-right: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th:last-child { padding-right: 0; }
.tbl .ref { font-family: var(--mono); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.pill { display: inline-block; padding: 2px 10px; border-radius: var(--r-round); background: var(--lilac); color: var(--violet-deep); font-size: 12.8px; font-weight: 700; white-space: nowrap; }
.empty-row { padding: 24px 0; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .qr-wrap { grid-template-columns: minmax(0, 1fr); max-width: 440px; min-height: 0; }
  .pad-card { order: -1; } /* the keypad first; app.js scrolls to the code once a charge starts */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) { /* the rail becomes a bottom tab bar, so the till gets the full width */
  #pos { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .main { grid-row: 1; }
  .rail { grid-row: 2; flex-direction: row; justify-content: space-around; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .rail .mark { display: none; }
  .rail .spacer { margin-top: 0; }
  .rail button { flex: 1; width: auto; max-width: 120px; }
  .rail button.on::before { left: 50%; top: -5px; transform: translateX(-50%); }
  .bar, .pane { padding-inline: 16px; }
  .bar h1 { font-size: 18px; }
  .who span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* the avatar stays; the name is for screen readers */
  .presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .amt-face .val { font-size: 32px; }
}
@media (max-width: 480px) { .kpis { grid-template-columns: minmax(0, 1fr); } } /* a J$1,234,567.89 balance needs the full width */
