/* =====================================================================
   Coffee tab · Floor 12
   Style: warm minimal (one style, flat surfaces, single elevation scale)
   Brand cue: the espresso machine's black control panel + amber display
   All text pairs verified ≥ 4.5:1 in light and dark.
   ===================================================================== */

:root {
  /* primitives */
  --cream-50: #FAF6F0;
  --cream-100: #F3ECE3;
  --cream-200: #E6DCD0;
  --brown-700: #92400E;
  --brown-800: #7A350B;
  --brown-100: #F7EADB;
  --ink-900: #1F1712;
  --ink-600: #5C4A3D;
  --ink-450: #8F7B6B;
  --panel-900: #17120F;
  --panel-800: #241C17;
  --amber-400: #F3A64A;
  --mint-300: #7BD3A0;

  /* semantic tokens (light) */
  --bg: var(--cream-50);
  --surface: #FFFFFF;
  --surface-2: var(--cream-100);
  --text: var(--ink-900);
  --text-2: var(--ink-600);
  --border: var(--cream-200);
  --border-strong: var(--ink-450);
  --primary: var(--brown-700);
  --primary-hover: var(--brown-800);
  --on-primary: #FFFFFF;
  --primary-soft: var(--brown-100);
  --success: #166534;
  --success-soft: #E7F4EC;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --warning-soft: #FFF4DC;
  --wa: #157A42;
  --panel: var(--panel-900);
  --panel-2: var(--panel-800);
  --on-panel: #F5EEE6;
  --on-panel-2: #B9AA9C;
  --display: #F4F1EC;          /* machine readout: warm white */
  --led: var(--amber-400);       /* active indicator */
  --display-ok: var(--mint-300);
  --focus: #1D5FD1;

  /* type */
  --font-body: "IBM Plex Sans Hebrew", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-display: "Noto Serif Hebrew", "IBM Plex Sans Hebrew", Georgia, serif;
  --fs-xs: 0.8125rem;  /* 13 */
  --fs-sm: 0.875rem;   /* 14 */
  --fs-md: 1rem;       /* 16 */
  --fs-lg: 1.125rem;   /* 18 */
  --fs-xl: 1.375rem;   /* 22 */
  --fs-2xl: 1.75rem;   /* 28 */
  --fs-3xl: 2.25rem;   /* 36 */
  --fs-num: 3rem;      /* 48 */

  /* space (4pt) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;

  /* shape + elevation */
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-full: 999px;
  --e1: 0 1px 2px rgba(31, 23, 18, .06), 0 1px 1px rgba(31, 23, 18, .04);
  --e2: 0 1px 2px rgba(31, 23, 18, .05), 0 8px 24px -12px rgba(31, 23, 18, .18);

  /* motion */
  --dur-1: 120ms; --dur-2: 220ms; --dur-3: 320ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);

  /* layers */
  --z-sticky: 20; --z-nav: 30; --z-toast: 40; --z-skip: 100;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120E0B;
    --surface: #1C1612;
    --surface-2: #261E18;
    --text: #F4EDE6;
    --text-2: #BBAA9B;
    --border: #382C23;
    --border-strong: #7A6656;
    --primary: #E0975A;
    --primary-hover: #EBA770;
    --on-primary: #1A0F08;
    --primary-soft: #3A2617;
    --success: #7BD3A0;
    --success-soft: #173326;
    --danger: #FF9B8F;
    --danger-soft: #3A1D17;
    --warning-soft: #352A17;
    --wa: #3FBF77;
    --panel: #0B0907;
    --panel-2: #1A1410;
    --focus: #8AB4FF;
    --e1: none;
    --e2: 0 0 0 1px var(--border);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; }
a { color: var(--primary); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, [role="button"], summary, label.choice, a { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
main:focus { outline: none; }

.icon { flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }
.ltr-inline { direction: ltr; unicode-bidi: isolate; }
.center { text-align: center; }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }

.skip {
  position: fixed; inset-inline-start: var(--s3); top: var(--s3); z-index: var(--z-skip);
  transform: translateY(-200%);
  background: var(--panel); color: var(--on-panel); padding: var(--s3) var(--s4); border-radius: var(--r-md);
}
.skip:focus { transform: none; }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  max-width: 560px; margin: 0 auto; padding: var(--s3) var(--s4);
  padding-top: max(var(--s3), env(safe-area-inset-top));
}
.is-admin .topbar, .is-admin .subnav { max-width: 1040px; }
main { max-width: 560px; margin: 0 auto; padding: var(--s2) var(--s4) var(--s10); }
main.wide { max-width: 1040px; }
.has-tabbar main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

.brand { display: inline-flex; align-items: center; gap: var(--s3); text-decoration: none; color: var(--text); min-height: 44px; }
.brand-name { font-weight: 700; font-size: var(--fs-md); }
.brand-mark {
  --s: 40px;
  display: grid; place-items: center; width: var(--s); height: var(--s); border-radius: calc(var(--s) * .28);
  background: var(--panel); color: var(--display);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.logout { margin: 0; }
.btn-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: background var(--dur-1), color var(--dur-1);
}
.btn-icon:hover { color: var(--text); background: var(--surface-2); }

/* bottom navigation (≤3 items, icon + label) */
.tabbar {
  position: fixed; z-index: var(--z-nav); inset-inline: 0; bottom: 0;
  display: flex; justify-content: center; gap: var(--s1);
  padding: var(--s2) var(--s3) calc(var(--s2) + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.nav-item {
  flex: 0 1 140px; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-2); text-decoration: none; font-size: var(--fs-xs); font-weight: 500;
  border-radius: var(--r-md);
}
.nav-ic { display: grid; place-items: center; width: 56px; height: 30px; border-radius: var(--r-full); transition: background var(--dur-2) var(--ease-out); }
.nav-item.on { color: var(--text); font-weight: 600; }
.nav-item.on .nav-ic { background: var(--primary-soft); color: var(--primary); }
.nav-item:hover:not(.on) { color: var(--text); }

.subnav { display: flex; gap: var(--s2); overflow-x: auto; margin: 0 auto; padding: 0 var(--s4) var(--s3); scrollbar-width: none; }
.subnav a {
  flex: none; min-height: 40px; display: inline-flex; align-items: center; padding: 0 var(--s4);
  border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); text-decoration: none; font-size: var(--fs-sm); font-weight: 500;
}

/* ---------- type ---------- */
.page-head { margin: var(--s2) 0 var(--s5); }
.eyebrow { color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.display { font-family: var(--font-display); font-size: var(--fs-3xl); line-height: 1.2; font-weight: 700; }
.title { font-family: var(--font-display); font-size: var(--fs-2xl); line-height: 1.25; font-weight: 700; margin-bottom: var(--s1); }
.lead { color: var(--text-2); font-size: var(--fs-md); }
.page-head .lead { margin-top: var(--s2); }
.section-title { font-size: var(--fs-lg); font-weight: 600; margin-bottom: var(--s3); }
.help { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.5; }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s5); margin-bottom: var(--s4); box-shadow: var(--e1);
}
.card.center { margin-top: var(--s6); }
.chip {
  display: inline-flex; align-items: center; gap: var(--s1);
  padding: var(--s1) var(--s3); border-radius: var(--r-full);
  background: var(--primary-soft); color: var(--primary); font-size: var(--fs-sm); font-weight: 600;
}

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5); border-radius: var(--r-md); border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-md); line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-1), border-color var(--dur-1), transform var(--dur-1) var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { min-height: 56px; font-size: var(--fs-lg); border-radius: var(--r-md); }
.btn-sm { min-height: 36px; padding: 0 var(--s3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-light { background: var(--on-panel); color: var(--panel); }
.btn-light:hover { background: #fff; }
.btn-panel { background: transparent; color: var(--on-panel); border-color: rgba(245, 238, 230, .28); }
.btn-panel:hover { background: rgba(245, 238, 230, .08); }
button.link { background: none; border: 0; padding: var(--s1) 0; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
button.link.danger { color: var(--danger); }

.btn-sep { width: 1px; height: 20px; background: currentColor; opacity: .35; }
.spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite;
}
.is-loading .spinner { display: block; }
.is-loading .btn-sep, .is-loading [data-total] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: var(--s4); margin-top: var(--s5); }
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field label, .stack > label, .grid2 label { font-weight: 600; font-size: var(--fs-sm); }
.input, .stack input, .stack select, .stack textarea, .grid2 input, .inline-form input, .inline-form select, textarea {
  width: 100%; min-height: 48px; padding: var(--s3) var(--s4);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md); font-size: var(--fs-md);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.input:focus, .stack input:focus, .stack select:focus, textarea:focus, .inline-form input:focus, .inline-form select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent);
}
.input::placeholder { color: var(--text-2); opacity: .8; }
.ltr-input, input[type="tel"] { direction: ltr; text-align: right; }
.has-error .input { border-color: var(--danger); }
.field-error { display: flex; align-items: center; gap: var(--s2); color: var(--danger); font-size: var(--fs-sm); font-weight: 500; }
.form-foot { text-align: center; margin-top: var(--s4); font-size: var(--fs-sm); }
.pin-wrap { position: relative; }
.pin { text-align: center; font-size: var(--fs-xl); letter-spacing: .5em; padding-inline: 56px; direction: ltr; font-variant-numeric: tabular-nums; }
.pin-toggle {
  position: absolute; inset-inline-end: 2px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--text-2); border-radius: var(--r-sm);
}

.alert { display: flex; gap: var(--s2); padding: var(--s3) var(--s4); border-radius: var(--r-md); margin-bottom: var(--s4); font-weight: 500; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--success-soft); color: var(--success); }
.alert.warn { background: var(--warning-soft); color: var(--text); }

/* ---------- auth ---------- */
.auth-wrap { display: flex; flex-direction: column; gap: var(--s5); padding-top: var(--s6); }
.auth .topbar { display: none; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: var(--s4); }
.auth-card { padding: var(--s6) var(--s5); margin: 0; }
.link-row {
  display: flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 48px;
  color: var(--text); font-weight: 600; text-decoration: none;
}
.link-row:hover { color: var(--primary); }

/* ---------- balance panel (machine control panel) ---------- */
.panel {
  background: var(--panel); color: var(--on-panel);
  border-radius: var(--r-lg); padding: var(--s5); margin-bottom: var(--s4);
  box-shadow: var(--e2), inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.panel-label { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; }
.panel-meta { color: var(--on-panel-2); font-size: var(--fs-sm); }
.panel-amount {
  display: flex; align-items: flex-end; justify-content: flex-end; gap: 6px;
  margin: var(--s3) 0 var(--s1); color: var(--display); direction: ltr;
}
.panel-amount .cur { font-size: var(--fs-2xl); font-weight: 700; line-height: 1; }
.is-clear .panel-amount, .is-clear .panel-label { color: var(--display-ok); }
.panel-actions { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s4); }
.panel-note { display: flex; gap: var(--s2); align-items: flex-start; margin-top: var(--s4); color: var(--on-panel-2); font-size: var(--fs-sm); line-height: 1.5; }
.panel-note .icon { margin-top: 2px; }

/* =====================================================================
   The machine console (home). Modeled on the real machine:
   brushed stainless body · black glossy top band · digital readout ·
   round keys · central dial · group head, glass cup, drip tray.
   ===================================================================== */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.page-head.compact { margin: 0 0 var(--s4); }
.page-head.compact .eyebrow b { color: var(--text); font-weight: 600; }

.machine {
  --steel: linear-gradient(90deg, #aeb5bb 0%, #eef1f3 18%, #c3c9ce 42%, #f6f7f8 62%, #b5bcc2 84%, #dde1e4 100%);
  --brush: repeating-linear-gradient(0deg, rgba(255,255,255,.10) 0 1px, rgba(0,0,0,.025) 1px 2px, transparent 2px 4px);
  position: relative; margin-bottom: var(--s4);
  border-radius: 26px; padding: 10px 10px var(--s4);
  background: var(--brush), var(--steel);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 -2px 0 rgba(0,0,0,.08) inset, 0 18px 36px -18px rgba(31,23,18,.45), 0 0 0 1px rgba(31,23,18,.12);
}
@media (prefers-color-scheme: dark) {
  .machine { --steel: linear-gradient(90deg, #6c737a 0%, #b9c0c6 18%, #8a9298 42%, #c8ced2 62%, #7d858c 84%, #a9b0b5 100%); }
}

/* top band */
.m-band {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s3); align-items: center;
  padding: 12px; border-radius: 18px;
  background: linear-gradient(180deg, #2b2b2f 0%, #121214 55%, #0b0b0c 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -1px 0 rgba(0,0,0,.6);
}
.m-screen {
  position: relative; overflow: hidden; border-radius: 10px; padding: 8px 10px 6px;
  background: radial-gradient(120% 140% at 30% 0%, #111316, #030304);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), inset 0 4px 10px rgba(0,0,0,.7);
  color: var(--display);
}
.m-screen::after { /* glass reflection */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.07) 0 30%, transparent 30%);
}
.m-screen-row { display: flex; align-items: center; gap: 8px; height: 16px; }
.m-ind { display: inline-flex; color: rgba(244,241,236,.16); transition: color var(--dur-2); }
.m-ind.on { color: var(--led); filter: drop-shadow(0 0 3px rgba(243,166,74,.7)); }
.m-status { margin-inline-start: auto; font: 600 10px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .14em; color: rgba(244,241,236,.55); direction: ltr; }
.m-status.busy { color: var(--led); animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.m-readout { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 4px; }
.m-val { display: inline-flex; align-items: flex-end; gap: 4px; }
.m-unit { font-size: 11px; font-weight: 600; color: rgba(244,241,236,.6); line-height: 1; margin-bottom: 3px; }

/* seven-segment digits */
.m-digits { display: inline-flex; gap: 3px; direction: ltr; transform: skewX(-6deg); }
.seg { width: 20px; height: 34px; display: block; }
.seg polygon, .seg circle { fill: currentColor; opacity: .08; transition: opacity 90ms; }
.seg .on { opacity: 1; filter: drop-shadow(0 0 2px rgba(244,241,236,.55)); }
.seg-dot { width: 6px; }
.m-digits.small .seg { width: 13px; height: 22px; }
.m-digits.big .seg { width: 30px; height: 50px; }
.m-digits.big .seg-dot { width: 9px; }
.m-digits.tick { animation: tick 160ms ease-out; }
@keyframes tick { 0% { opacity: .35; } 100% { opacity: 1; } }

/* round keys (drink type) */
.m-keys { display: flex; gap: 10px; border: 0; margin: 0; padding: 0; min-width: 0; }
.m-key { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; }
.m-key input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.m-key-cap {
  position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  color: rgba(244,241,236,.75);
  background: radial-gradient(circle at 50% 35%, #2f2f33, #0d0d0f 70%);
  box-shadow: 0 0 0 2px #4a4a50, 0 0 0 3px #0a0a0b, 0 3px 6px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.12);
  transition: box-shadow var(--dur-2) var(--ease-out), color var(--dur-2), transform var(--dur-1) var(--ease-out);
}
.m-key:active .m-key-cap { transform: scale(.94); }
.m-key input:checked + .m-key-cap {
  color: var(--led);
  box-shadow: 0 0 0 2px var(--led), 0 0 0 3px #0a0a0b, 0 0 14px rgba(243,166,74,.45), inset 0 1px 0 rgba(255,255,255,.12);
}
.m-key input:focus-visible + .m-key-cap { outline: 3px solid var(--focus); outline-offset: 4px; }
.m-key-x2 { position: absolute; bottom: 6px; inset-inline-end: 7px; font-size: 10px; font-weight: 700; line-height: 1; }
.m-key-label { color: rgba(244,241,236,.85); font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.2; }
.m-key input:checked ~ .m-key-label { color: #fff; }

/* face: dial + front */
.m-face { padding: 14px 6px 0; }
.m-dial-row { display: flex; align-items: center; justify-content: center; gap: 22px; direction: ltr; } /* − left, + right: matches clockwise = more */
.m-step {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 0; color: #1d1f21;
  background: radial-gradient(circle at 40% 30%, #ffffff, #d5dade 55%, #9aa2a8);
  box-shadow: 0 2px 5px rgba(0,0,0,.25), inset 0 -2px 3px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.15);
  transition: transform var(--dur-1) var(--ease-out), opacity var(--dur-1);
}
.m-step:active:not(:disabled) { transform: scale(.92); }
.m-step:disabled { opacity: .4; cursor: not-allowed; }
.m-dial-wrap { position: relative; }
.m-dial {
  position: relative; width: 112px; height: 112px; border-radius: 50%; cursor: grab; touch-action: none;
  background: radial-gradient(circle, transparent 57%, rgba(0,0,0,.08) 58%, rgba(0,0,0,.0) 72%);
}
.m-dial:active { cursor: grabbing; }
.m-dial:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 50%; }
.m-dial-ticks i {
  position: absolute; left: 50%; top: 50%; width: 3px; height: 7px; margin: -3.5px 0 0 -1.5px; border-radius: 2px;
  background: rgba(31,23,18,.28);
  transform: rotate(var(--a)) translateY(-50px);
  transition: background var(--dur-2);
}
.m-dial-ticks i.lit { background: var(--primary); }
.m-knob {
  position: absolute; inset: 16px; border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255,255,255,.18) 0 4deg, rgba(0,0,0,.05) 4deg 8deg),
    radial-gradient(circle at 38% 30%, #ffffff, #d7dce0 45%, #8f979e 100%);
  box-shadow: 0 6px 12px rgba(0,0,0,.28), 0 0 0 1px rgba(0,0,0,.2), inset 0 2px 2px rgba(255,255,255,.8), inset 0 -3px 5px rgba(0,0,0,.18);
  transform: rotate(var(--rot, -135deg));
  transition: transform 260ms cubic-bezier(.3, 1.4, .5, 1);
}
.m-dial.dragging .m-knob { transition: none; }
.m-knob-mark { position: absolute; left: 50%; top: 7px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px; background: #1d1f21; }
.m-hint { text-align: center; color: #3b3430; font-size: var(--fs-xs); font-weight: 500; margin: 8px 0 2px; }
@media (prefers-color-scheme: dark) { .m-hint { color: #1c1714; } .m-dial-ticks i { background: rgba(10,8,6,.35); } }

.m-front { display: block; width: 100%; height: auto; margin-top: 4px; }
.m-stream { transform-box: fill-box; transform-origin: top; transform: scaleY(0); opacity: 0; }
.m-fill { transform: translateY(62px); transition: transform 300ms var(--ease-out); }
.m-cup.has-coffee .m-fill { transform: translateY(14px); }
.m-puff circle { fill: rgba(255,255,255,.9); opacity: 0; }

.m-start { margin-top: var(--s3); }

/* brewing sequence (JS toggles .is-brewing while the request runs) */
.machine.is-brewing .m-stream-1 { animation: pour 1100ms ease-in-out both; }
.machine.is-brewing.kind-double .m-stream-2 { animation: pour 1100ms 60ms ease-in-out both; }
.machine.is-brewing .m-fill { animation: fill 1000ms 150ms var(--ease-out) both; }
.machine.is-brewing .m-dial-ticks i.lit { animation: blink .4s steps(2) infinite; }
.machine.is-served .m-puff circle { animation: puff 900ms ease-out both; }
.machine.is-served .m-puff circle:nth-child(2) { animation-delay: 120ms; }
.machine.is-served .m-puff circle:nth-child(3) { animation-delay: 220ms; }
@keyframes pour { 0% { transform: scaleY(0); opacity: 1; } 20%, 80% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1) translateY(30px); opacity: 0; } }
@keyframes fill { from { transform: translateY(62px); } to { transform: translateY(14px); } }
@keyframes puff { 0% { opacity: 0; transform: translateY(0) scale(.6); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-22px) scale(1.6); } }
.panel.is-updated { animation: panel-flash 700ms ease-out; }
@keyframes panel-flash { 0% { box-shadow: 0 0 0 3px var(--led); } 100% { box-shadow: var(--e2); } }

@media (max-width: 370px) {
  .m-key { width: 56px; } .m-key-cap { width: 46px; height: 46px; }
  .seg { width: 17px; height: 29px; }
  .m-dial { width: 100px; height: 100px; } .m-dial-ticks i { transform: rotate(var(--a)) translateY(-45px); }
  .m-dial-row { gap: 14px; }
}

/* ---------- history ---------- */
.history { list-style: none; margin: 0; padding: 0; }
.h-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--border); }
.h-row:first-child { border-top: 0; padding-top: 0; }
.h-ic { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); }
.is-pay .h-ic { background: var(--success-soft); color: var(--success); }
.h-text { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.h-title { font-weight: 500; }
.h-when { color: var(--text-2); font-size: var(--fs-sm); }
.h-amt { font-weight: 600; direction: ltr; }
.is-pay .h-amt { color: var(--success); }
.h-undo { margin: 0; }
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s2); padding: var(--s6) 0; color: var(--text-2); text-align: center; }

/* ---------- toast ---------- */
.toast {
  position: sticky; top: var(--s2); z-index: var(--z-toast);
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s4); padding-inline-start: var(--s3);
  margin-bottom: var(--s4); border-radius: var(--r-md);
  background: var(--panel); color: var(--on-panel); box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .5);
  animation: toast-in var(--dur-3) var(--ease-out) both;
}
.toast-ic { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--display-ok); color: var(--panel); }
.toast-text { flex: 1; font-weight: 500; line-height: 1.4; }
.toast form { margin: 0; }
.toast-btn {
  min-height: 44px; padding: 0 var(--s4); border: 0; border-radius: var(--r-sm);
  background: rgba(245, 238, 230, .12); color: var(--display); font-weight: 700;
}
.toast-btn:hover { background: rgba(245, 238, 230, .2); }
.toast.is-leaving { animation: toast-out calc(var(--dur-3) * .65) var(--ease-in) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); } }

/* ---------- guide ---------- */
.accordion { display: flex; flex-direction: column; gap: var(--s3); margin-bottom: var(--s6); }
.acc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--e1); overflow: hidden; }
.acc[open] { border-color: var(--border-strong); }
.acc-head { display: flex; align-items: center; gap: var(--s4); min-height: 80px; padding: var(--s4); list-style: none; }
.acc-head::-webkit-details-marker { display: none; }
.acc-head:focus-visible { outline-offset: -3px; border-radius: var(--r-lg); }
.acc-ic { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: var(--r-md); background: var(--panel); color: var(--display); }
.acc-text { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.acc-step { color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; }
.acc-title { font-weight: 700; font-size: var(--fs-lg); }
.acc-sub { color: var(--text-2); font-size: var(--fs-sm); }
.acc-caret { display: grid; place-items: center; width: 32px; height: 32px; color: var(--text-2); transition: transform var(--dur-2) var(--ease-out); }
.acc[open] .acc-caret { transform: rotate(180deg); }
.acc-body { padding: 0 var(--s4) var(--s5); border-top: 1px solid var(--border); padding-top: var(--s4); animation: reveal var(--dur-2) var(--ease-out); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }

.steps { list-style: none; margin: 0 0 var(--s4); padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: var(--s3); }
.steps li { counter-increment: step; position: relative; padding-inline-start: 40px; line-height: 1.6; }
.steps li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: 0;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); color: var(--text); font-weight: 700; font-size: var(--fs-sm);
}
.note { display: flex; gap: var(--s2); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-sm); line-height: 1.55; }
.note .icon { color: var(--primary); margin-top: 1px; }
.wait {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s3);
  margin-top: var(--s3); padding: var(--s4); border-radius: var(--r-md);
  background: var(--primary-soft);
}
.wait-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); color: var(--primary); }
.wait-text { font-size: var(--fs-sm); line-height: 1.55; }
.wait-title { font-weight: 700; font-size: var(--fs-md); margin-bottom: 2px; }
.wait-cta { grid-column: 2; justify-self: start; }

/* ---------- admin ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s4); box-shadow: var(--e1); }
.stat-v { font-size: var(--fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-l { color: var(--text-2); font-size: var(--fs-sm); }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.card h1 { font-family: var(--font-display); font-size: var(--fs-2xl); }
.card h2 { font-size: var(--fs-lg); font-weight: 600; margin-bottom: var(--s3); }
.card > p { margin-bottom: var(--s3); }
.table-wrap { overflow-x: auto; margin: 0 calc(var(--s5) * -1); padding: 0 var(--s5); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: start; color: var(--text-2); font-weight: 600; padding: var(--s2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: var(--s3) var(--s2); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr.hot td { background: var(--danger-soft); }
.table tr.inactive td { opacity: .55; }
.num, td.num { font-variant-numeric: tabular-nums; }
td.num { font-weight: 700; direction: ltr; text-align: right; }
.neg { color: var(--danger); }
.pos { color: var(--success); }
.badge { display: inline-block; padding: 0 var(--s2); border-radius: var(--r-full); background: var(--primary-soft); color: var(--primary); font-size: var(--fs-xs); font-weight: 600; }
.badge.warn { background: var(--warning-soft); color: var(--text); }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack > label, .grid2 label { display: flex; flex-direction: column; gap: var(--s2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.inline { display: inline; margin: 0 var(--s1); }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-top: var(--s2); }
.inline-form input, .inline-form select { width: auto; flex: 1 1 140px; }
.inline-form.compact { flex-wrap: nowrap; margin: 0 0 var(--s1); }
.inline-form.compact select { min-height: 36px; padding: var(--s1) var(--s2); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.actions form { margin: 0; }
.plain { list-style: none; padding: 0; margin: 0 0 var(--s2); }
.plain li { padding: var(--s1) 0; }
ol.steps.small, .card ol { color: var(--text-2); }
.warn-text { color: var(--danger); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }

/* ---------- printable QR sign ---------- */
body.print { background: #fff; color: #1F1712; }
.sign { max-width: 560px; margin: var(--s8) auto; padding: var(--s6) var(--s4); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s3); }
.sign .brand-mark { color: #F3A64A; background: #17120F; }
.sign h1 { font-family: var(--font-display); font-size: 2.75rem; line-height: 1.15; }
.sign-floor { font-size: var(--fs-xl); font-weight: 700; color: #92400E; }
.sign-sub { font-size: var(--fs-xl); }
.qr { padding: var(--s4); border: 2px solid #1F1712; border-radius: var(--r-lg); margin: var(--s2) 0; }
.qr svg { display: block; width: min(70vw, 300px); height: auto; }
.sign-prices { font-size: var(--fs-xl); font-weight: 700; }
.sign-url { color: #5C4A3D; }
@media print { .no-print { display: none; } .sign { margin: 0 auto; } }

/* ---------- responsive ---------- */
@media (max-width: 360px) {
  .display { font-size: var(--fs-2xl); }
  .panel-amount { font-size: 2.5rem; }
  .choice-title { font-size: var(--fs-md); }
}
@media (min-width: 768px) {
  main { padding-top: var(--s4); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .spinner { animation: none; border-inline-end-color: currentColor; opacity: .6; }
}
