/* PosEngine till — design tokens first, then layout, components, screens. --accent / --ink come from the profile theme. */
:root {
  --ink: #0f2a4a; --accent: #c8a24a;
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f7f8fa; --surface-3: #eef0f3; --line: #e3e6eb; --line-2: #d3d8e0;
  --text: #121826; --text-2: #3b4352; --muted: #6b7380;
  --ok: #12805c; --ok-bg: #e5f5ee; --bad: #c4342d; --bad-bg: #fdecea; --warn: #b26a00; --warn-bg: #fff3dc; --info-bg: #eaf1fb;
  --on-accent: #1b1406; --on-ink: #ffffff;
  --primary: var(--ink); --on-primary: var(--on-ink);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --ink-soft: color-mix(in srgb, var(--ink) 9%, var(--surface));
  --r-xl: 22px; --r-lg: 16px; --r: 12px; --r-sm: 9px;
  --sh-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 1px rgba(16, 24, 40, .04);
  --sh-2: 0 4px 14px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --sh-3: 0 18px 48px rgba(16, 24, 40, .22);
  --rail: 88px; --tap: 48px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --surface: #161b22; --surface-2: #1b2129; --surface-3: #232a33; --line: #2a313b; --line-2: #39414d;
    --text: #e9edf2; --text-2: #c3cad4; --muted: #8b95a3;
    --ok: #3ccf91; --ok-bg: #12291f; --bad: #ff6b62; --bad-bg: #331816; --warn: #f2b14a; --warn-bg: #30230d; --info-bg: #15243a;
    --ink-soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
    --primary: var(--accent); --on-primary: var(--on-accent);
    --sh-1: 0 1px 2px rgba(0, 0, 0, .4); --sh-2: 0 6px 18px rgba(0, 0, 0, .45); --sh-3: 0 22px 60px rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.4 var(--font); background: var(--bg); color: var(--text); overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-font-smoothing: antialiased; }
input, select, textarea { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: .2em 0; letter-spacing: -.01em; }
h3 { font-size: 1rem; font-weight: 650; }
h4 { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 1em 0 .45em; font-weight: 600; }
.muted { color: var(--muted); } .sp { flex: 1; } .ok { color: var(--ok); } .bad { color: var(--bad); } .r { text-align: right; } .dim { opacity: .5; }
code { font-size: .8em; word-break: break-all; color: var(--text-2); }
.ico { flex: none; display: block; }
b, .num, .pr, .grand, .kpi b, .due b, .ln-price, .tbl td.r { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ app shell: side rail (tablet/desktop) or bottom bar (phone) */
#app { height: 100%; display: grid; grid-template-columns: var(--rail) 1fr; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
#app:has(> .login), #app:has(> .boot) { display: flex; }
.boot { margin: auto; color: var(--muted); }
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
nav.tabs { background: var(--ink); color: var(--on-ink); display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 14px 10px; overflow-y: auto; }
.rail-brand { width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; letter-spacing: .02em; box-shadow: var(--sh-2); }
nav.tabs > button { border: 0; background: transparent; color: color-mix(in srgb, var(--on-ink) 70%, transparent); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; font-size: .7rem; font-weight: 600; transition: background .15s, color .15s; }
nav.tabs > button:hover { background: rgba(255, 255, 255, .07); color: var(--on-ink); }
nav.tabs > button.on { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
nav.tabs .more-btn { display: none; }
header.top { display: flex; align-items: center; gap: 10px; padding: 12px 18px 8px; min-height: 64px; }
.screen-title { font-size: 1.45rem; font-weight: 750; margin: 0; }
.conn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600; box-shadow: var(--sh-1); }
.conn.ok { color: var(--ok); } .conn.local { color: var(--text-2); background: var(--info-bg); border-color: transparent; } .conn.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; } .conn.off { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.banner { border: 0; background: var(--warn); color: #1d1300; padding: 6px 12px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.till-pill { background: var(--ink-soft); color: var(--text-2); padding: 6px 12px; border-radius: 999px; font-size: .78rem; font-weight: 650; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 4px 12px 4px 4px; border-radius: 999px; box-shadow: var(--sh-1); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; font-size: .75rem; font-weight: 750; }
.user-btn .who { font-weight: 600; font-size: .86rem; }
main.screen { flex: 1; min-height: 0; overflow: auto; padding: 4px 18px 18px; -webkit-overflow-scrolling: touch; }
main.screen.sell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); gap: 16px; overflow: hidden; }

@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  #app > nav.tabs { order: 2; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 2px; overflow: visible; }
  #app > .main-col { order: 1; min-height: 0; }
  .rail-brand { display: none; }
  nav.tabs > button { flex: 1; padding: 7px 2px; font-size: .64rem; border-radius: 12px; }
  #app:not(.few-tabs) nav.tabs > button.overflow { display: none; }
  #app:not(.few-tabs) nav.tabs .more-btn { display: flex; }
  header.top { padding: 10px 14px 6px; min-height: 54px; }
  .screen-title { font-size: 1.2rem; }
  .user-btn .who, .conn span { display: none; }
  .conn { padding: 7px; } .user-btn { padding: 3px; }
  main.screen { padding: 4px 12px 12px; }
  main.screen.sell { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------ controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 16px; border-radius: var(--r); font-weight: 650; box-shadow: var(--sh-1); transition: transform .08s, background .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn:disabled { opacity: .45; box-shadow: none; transform: none; cursor: default; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .86rem; }
.btn.big { min-height: 56px; font-size: 1.08rem; width: 100%; border-radius: var(--r-lg); }
.btn.wide { width: 100%; }
.mini { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border: 0; background: var(--surface-3); border-radius: 10px; margin-left: 4px; color: var(--text-2); font-size: .9rem; }
.mini:hover { background: var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 0 14px; font-size: .88rem; font-weight: 600; color: var(--text-2); transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chips.big .chip { min-height: 48px; padding: 0 18px; font-size: 1rem; border-radius: 14px; }
.chip.dim { opacity: .5; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 3px; gap: 3px; }
.seg > button { border: 0; background: transparent; border-radius: 9px; padding: 8px 14px; font-weight: 650; font-size: .88rem; color: var(--text-2); min-height: 38px; }
.seg > button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.row { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; } .row.center { justify-content: center; } .row.wrap { flex-wrap: wrap; } .row.wrap > .btn { flex: 0 0 auto; white-space: nowrap; }
.field { display: block; margin: 10px 0; }
.field > span { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field > small { display: block; color: var(--muted); margin-top: 4px; font-size: .78rem; }
input, select { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.reports input[type=date] { width: auto; flex: 1 1 140px; min-width: 140px; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.check { display: flex; gap: 10px; align-items: center; margin: 10px 0; font-weight: 550; }
.row input, .row select { flex: 1; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin: 10px 0; box-shadow: var(--sh-1); }
.note-box { display: flex; gap: 8px; align-items: center; background: var(--info-bg); border-radius: var(--r); padding: 10px 14px; margin: 8px 0; font-size: .9rem; font-weight: 550; }
.note-box.warn { background: var(--warn-bg); color: color-mix(in srgb, var(--warn) 80%, var(--text)); }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-3); color: var(--text-2); border-radius: 7px; padding: 2px 8px; font-size: .74rem; font-weight: 650; margin-left: 6px; }
.tag.ready { background: var(--ok-bg); color: var(--ok); } .tag.preparing, .tag.accepted { background: var(--warn-bg); color: var(--warn); } .tag.new { background: var(--info-bg); color: var(--ink); } .tag.comp { background: #fde7f3; color: #a3195b; }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); display: inline-grid; place-items: center; font-size: .74rem; font-weight: 750; }
.list { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow: auto; }
.row-btn { text-align: left; border: 1px solid var(--line); background: var(--surface); padding: 12px 14px; border-radius: var(--r); }
.row-btn:hover { background: var(--surface-2); }
.empty { text-align: center; padding: 2.5rem 1rem; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 28px 16px; height: 100%; }
.empty-state .ico { color: var(--line-2); }
.empty-state b { color: var(--text-2); font-size: 1rem; }
.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; border: 0; background: var(--surface-2); padding: 14px; border-radius: var(--r); font-weight: 600; text-align: left; }
.menu-item:hover { background: var(--surface-3); }
.menu-item .end { margin-left: auto; color: var(--muted); }
.menu-item.danger { color: var(--bad); }
.menu-label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .8rem; font-weight: 600; margin-top: 4px; }

/* tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tbody tr:hover td { background: var(--surface-2); }
tr.low td { background: var(--warn-bg); } tr.neg td { background: var(--bad-bg); }
.voided { text-decoration: line-through; opacity: .5; }

/* ------------------------------------------------------------ login */
.login { max-width: 380px; margin: auto; padding: 28px 22px; text-align: center; width: 100%; }
.login h1 { font-size: 1.8rem; font-weight: 800; }
.login-logo { width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 22px; background: var(--ink); color: var(--accent); display: grid; place-items: center; font-size: 1.5rem; font-weight: 850; box-shadow: var(--sh-2); }
.login .chips.big { justify-content: center; }
.login .chip { flex-direction: column; min-height: 0; padding: 10px 14px; border-radius: 16px; gap: 6px; min-width: 88px; }
.login .chip .avatar { width: 44px; height: 44px; font-size: .95rem; }
.login .chip.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.login .chip.on .avatar { background: var(--accent); color: var(--on-accent); }
.dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0 8px; min-height: 16px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); transition: background .12s, border-color .12s, transform .12s; }
.dots i.on { background: var(--primary); border-color: var(--primary); transform: scale(1.1); }
.err { color: var(--bad); min-height: 1.4em; font-size: .9rem; font-weight: 600; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.key { min-height: 58px; font-size: 1.45rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; box-shadow: var(--sh-1); transition: transform .06s, background .1s; }
.sheet .keypad { gap: 8px; margin: 8px 0; } .sheet .key { min-height: 50px; font-size: 1.25rem; }
.key:active { transform: scale(.94); background: var(--surface-3); }

/* ------------------------------------------------------------ sell */
.menu { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.menu-top { display: flex; gap: 10px; align-items: center; flex: none; margin-bottom: 12px; }
.cats { display: flex; gap: 8px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; padding: 2px; }
.cats::-webkit-scrollbar { display: none; }
.cat { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 16px; border-radius: 999px; white-space: nowrap; font-weight: 650; color: var(--text-2); }
.cat.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--sh-2); }
.search-wrap { position: relative; flex: none; width: 210px; }
.search-wrap .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search { padding-left: 38px; border-radius: 999px; background: var(--surface); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; overflow: auto; align-content: start; flex: 1; padding: 2px 2px 12px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 0; padding: 0; min-height: 168px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-1); transition: transform .1s, box-shadow .15s, border-color .15s; }
.tile:hover { box-shadow: var(--sh-2); border-color: var(--line-2); }
.tile:active { transform: scale(.97); }
.tile .media { height: 96px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-soft), var(--ink-soft)); }
.tile .emo { font-size: 2.8rem; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .12)); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.tile .nm { font-weight: 650; font-size: .95rem; line-height: 1.25; }
.tile .pr { color: var(--muted); font-size: .88rem; font-weight: 600; margin-top: auto; }
.tile .in-cart { position: absolute; top: 8px; right: 8px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: .85rem; display: grid; place-items: center; box-shadow: var(--sh-2); animation: pop .2s; }
.tile.has { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
@keyframes pop { from { transform: scale(.5); } }
.cart { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); min-height: 0; box-shadow: var(--sh-2); overflow: hidden; }
.cart-head { flex: none; padding: 14px 14px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cart-head .seg { width: 100%; } .cart-head .seg > button { flex: 1; }
.cart-head .chips { margin: 10px 0 6px; gap: 6px; }
.cart-head .chip { min-height: 36px; padding: 0 11px; font-size: .83rem; background: var(--surface); }
.cart-head .chip.on { background: var(--ink-soft); color: var(--text); border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.cart .note-box { margin: 10px 14px 0; }
.lines { flex: 1; overflow: auto; min-height: 80px; padding: 4px 14px; }
.line { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); animation: fadein .18s; }
.line:last-child { border-bottom: 0; }
.line.comped { background: linear-gradient(90deg, color-mix(in srgb, #e0569b 14%, transparent) 0, transparent 70%); border-radius: 10px; padding-left: 8px; margin: 2px -8px; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
.ln-main b { font-weight: 650; }
.ln-main .muted { font-size: .82rem; margin-top: 2px; }
.qty { display: flex; align-items: center; gap: 2px; background: var(--surface-3); border-radius: 999px; padding: 3px; }
.qty button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface); display: grid; place-items: center; box-shadow: var(--sh-1); font-weight: 700; }
.qty span { min-width: 26px; text-align: center; font-weight: 750; }
.qty.big { padding: 4px; } .qty.big button { width: 46px; height: 46px; font-size: 1.3rem; } .qty.big span { min-width: 40px; font-size: 1.2rem; }
.ln-price { text-align: right; min-width: 74px; font-weight: 650; display: flex; align-items: center; justify-content: flex-end; }
.totals { flex: none; padding: 12px 16px 4px; border-top: 1px solid var(--line); background: var(--surface-2); }
.totals > div { display: flex; justify-content: space-between; font-size: .9rem; padding: 2px 0; }
.totals .disc { color: var(--ok); font-weight: 600; }
.totals .grand { font-size: 1.6rem; font-weight: 800; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line-2); letter-spacing: -.02em; }
.actions { flex: none; display: flex; gap: 8px; padding: 10px 14px 14px; background: var(--surface-2); }
.actions .primary { flex: 1; }
.actions .btn { min-height: 56px; border-radius: var(--r-lg); font-size: 1.02rem; }
.cart-fab { display: none; }
.cart-close { display: none !important; }
@media (max-width: 760px) {
  .search-wrap { width: 46px; } .search-wrap:focus-within { width: 60vw; }
  .search::placeholder { color: transparent; }
  .cart { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 88vh; border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); padding-bottom: env(safe-area-inset-bottom); }
  .screen.sell.cart-open .cart { transform: none; }
  .screen.sell.cart-open::after { content: ''; position: fixed; inset: 0; background: rgba(8, 12, 20, .45); z-index: 39; }
  .cart-fab { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30; align-items: center; gap: 10px; min-height: 58px; border: 0; border-radius: var(--r-lg); background: var(--primary); color: var(--on-primary); padding: 0 18px; font-weight: 750; font-size: 1.02rem; box-shadow: var(--sh-3); }
  .cart-fab .badge { background: var(--on-primary); color: var(--primary); }
  .cart-fab .sp { flex: 1; }
  .grid { padding-bottom: 90px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .cart-close { display: inline-grid !important; }
}
.opts h4:first-child { margin-top: 0; }

/* ------------------------------------------------------------ pay */
.due { display: flex; justify-content: space-between; align-items: baseline; font-size: 1rem; color: var(--muted); font-weight: 600; }
.due b { font-size: 2.2rem; color: var(--text); font-weight: 850; letter-spacing: -.02em; }
.tender { display: flex; justify-content: space-between; align-items: baseline; font-size: 1rem; margin: 6px 0; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r); }
.tender b { font-size: 1.5rem; }
.change { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 1.3rem; font-weight: 800; color: var(--ok); background: var(--ok-bg); text-align: center; margin: 8px 0; padding: 14px; border-radius: var(--r-lg); }
.change.big { font-size: 1.9rem; } .change.bad { color: var(--bad); background: var(--bad-bg); } .change.ok { color: var(--ok); }
.receipt { background: #fff; color: #000; padding: 18px; border-radius: 10px; font: 13px/1.35 ui-monospace, Menlo, monospace; white-space: pre; overflow: auto; margin: 10px 0; box-shadow: inset 0 0 0 1px #e8e8e8, var(--sh-1); max-height: 52vh; }

/* ------------------------------------------------------------ sheets & toasts */
.scrim { position: fixed; inset: 0; background: rgba(8, 12, 20, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fade .15s; }
.sheet { background: var(--surface); width: min(540px, 100%); max-height: 92vh; overflow: auto; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--sh-3); animation: up .22s cubic-bezier(.2, .8, .2, 1); }
.sheet::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 6px; }
.sheet.wide { width: min(720px, 100%); }
@media (min-width: 761px) { .scrim { align-items: center; padding: 20px; } .sheet { border-radius: var(--r-xl); padding-top: 14px; } .sheet::before { display: none; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; position: sticky; top: -8px; background: var(--surface); padding: 6px 0 10px; z-index: 1; }
.sheet-head h2 { font-size: 1.2rem; font-weight: 750; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-3); font-size: 1.4rem; line-height: 1; color: var(--text-2); display: grid; place-items: center; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); background: #1d2433; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 99; max-width: min(90vw, 520px); box-shadow: var(--sh-3); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--bad); } #toast.warn { background: var(--warn); color: #1d1300; }

/* ------------------------------------------------------------ orders */
.orders section { margin-bottom: 18px; }
.orders section > h3 { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card.order, .card.pending { position: relative; margin: 0; padding-top: 18px; overflow: hidden; }
.card.order::before, .card.pending::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--ink); }
.card.pending::before { background: var(--warn); }
.card.pending { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.oline { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.oline:last-child { border-bottom: 0; }
.sales-box { margin-top: 18px; }

/* ------------------------------------------------------------ kitchen */
.kcols { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow: auto; align-items: start; }
.kcol { background: var(--surface-2); border-radius: var(--r-lg); padding: 10px; min-height: 60vh; }
.kcol h3 { display: flex; align-items: center; justify-content: space-between; text-transform: capitalize; padding: 4px 6px 8px; }
.kcol h3 small { background: var(--surface); border-radius: 999px; padding: 2px 10px; font-size: .8rem; }
.ticket { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--ok); border-radius: var(--r); padding: 12px; margin: 0 0 10px; cursor: pointer; box-shadow: var(--sh-1); transition: transform .08s; }
.ticket:active { transform: scale(.98); }
.ticket.warm { border-left-color: var(--warn); }
.ticket.slow { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--surface)); }
.ticket .age { font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-size: .82rem; }
.ticket.warm .age { background: var(--warn-bg); color: var(--warn); } .ticket.slow .age { background: var(--bad-bg); color: var(--bad); }
.tl { font-size: 1.08rem; font-weight: 600; margin: 4px 0; }
.tl small { color: var(--muted); font-weight: 500; } .tl em { color: var(--warn); }
.next-step { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border-radius: 10px; background: var(--surface-3); font-weight: 700; font-size: .88rem; color: var(--text-2); }

/* ------------------------------------------------------------ cash / reports / admin */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--sh-1); }
.kpi small { color: var(--muted); display: block; font-size: .76rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.kpi small .ok, .kpi small .bad { text-transform: none; letter-spacing: 0; font-weight: 750; }
.kpi b { display: block; font-size: 1.35rem; font-weight: 800; margin-top: 4px; letter-spacing: -.01em; }
.kpi.big { background: var(--primary); border-color: var(--primary); color: var(--on-primary); } .kpi.big small { color: color-mix(in srgb, var(--on-primary) 70%, transparent); }
.kpi.bad b { color: var(--bad); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 8px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; font-size: .58rem; text-align: center; color: var(--muted); gap: 4px; }
.bar i { display: block; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--ink))); border-radius: 5px 5px 2px 2px; min-height: 2px; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: .68rem; }
.heat td { width: 22px; height: 18px; border-radius: 4px; background: var(--surface-3); }
.heat th { font-weight: 600; color: var(--muted); padding: 0 4px; }
.denoms { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.denrow { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--surface-2); border-radius: var(--r); padding: 6px 6px 6px 12px; font-weight: 650; }
.denrow input { width: 84px; flex: none; text-align: center; }
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.admin-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px; box-shadow: var(--sh-1); }
.admin-nav button { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 11px 12px; border-radius: 10px; font-weight: 600; text-align: left; color: var(--text-2); }
.admin-nav button:hover { background: var(--surface-2); }
.admin-nav button.on { background: var(--primary); color: var(--on-primary); }
@media (max-width: 900px) { .admin-layout { grid-template-columns: 1fr; } .admin-nav { position: static; flex-direction: row; overflow-x: auto; } .admin-nav button { white-space: nowrap; } }
.setting { display: grid; grid-template-columns: 1fr minmax(160px, 280px); gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-of-type { border-bottom: 0; }
.setting b { display: block; font-weight: 650; } .setting small { color: var(--muted); }
@media (max-width: 600px) { .setting { grid-template-columns: 1fr; } }
.card.module { margin: 0; } .card.module.on { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.switch { width: 50px; height: 30px; border-radius: 99px; border: 0; background: var(--line-2); position: relative; flex: none; padding: 0; transition: background .15s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .15s; }
.switch.on { background: var(--ok); } .switch.on i { left: 23px; } .switch:disabled { opacity: .4; }
@media print { body * { visibility: hidden; } .print-area, .print-area * { visibility: visible; } .print-area { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; margin: 0; max-height: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Animated receipt printer (js/printer.js). The machine takes the brand ink; the spinner the accent. ── */
.rp { --rp-feed: 1400ms; --rp-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 384px; margin: 6px auto 4px; }
.rp-machine { position: relative; isolation: isolate; width: 100%; overflow: hidden; color: #fff; border-radius: 24px; padding: 12px 12px 32px;
  background: linear-gradient(165deg, color-mix(in srgb, var(--ink) 72%, #fff) 0%, var(--ink) 55%, color-mix(in srgb, var(--ink) 80%, #000) 100%);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 20px 36px -20px rgba(14,22,48,.6), 0 6px 14px -8px rgba(14,22,48,.3), inset 0 1px 0 rgba(255,255,255,.16), inset 0 -1px 0 rgba(8,13,30,.5); }
.rp-machine::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: var(--rp-noise); opacity: .07; z-index: 0; }
.rp-header { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 6px; }
.rp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.rp-model { font: 700 10px/1 ui-monospace, Menlo, monospace; letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.55); }
.rp-screen { position: relative; z-index: 1; border-radius: 14px; padding: 14px 16px; background: color-mix(in srgb, var(--ink) 45%, #05070d);
  border: 1px solid rgba(255,255,255,.1); box-shadow: inset 0 0 24px 4px rgba(0,0,0,.45); }
.rp-screen-body { font-size: 14px; line-height: 1.4; }
.rp-total { font-size: 28px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rp-sub { font-size: 12.5px; color: rgba(255,255,255,.62); margin-top: 2px; }
.rp-change { margin-top: 8px; display: inline-flex; gap: 8px; align-items: baseline; padding: 4px 10px; border-radius: 999px; background: rgba(52,196,122,.16); color: #5be0a0; font-weight: 700; font-variant-numeric: tabular-nums; }
.rp-status { display: flex; align-items: center; gap: 8px; margin-top: 12px; min-height: 20px; font-size: 12px; font-weight: 700; color: rgba(255,255,255,.82); }
.rp-screen-body:empty + .rp-status { margin-top: 0; }
.rp-ind { flex: none; display: grid; place-items: center; width: 18px; height: 18px; color: var(--accent); }
.rp-ind.rp-done { color: #34c47a; }
.rp-spin { display: block; width: 15px; height: 15px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 28%, transparent); border-top-color: var(--accent); animation: rp-spin .8s linear infinite; }
.rp-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-swap { animation: rp-in .18s cubic-bezier(.23,1,.32,1) both; }
.rp-slot { position: absolute; z-index: 4; left: 24px; right: 24px; bottom: 12px; height: 8px; border-radius: 4px; background: #05091a; border: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 2px 4px rgba(0,0,0,.8); }
.rp-output { position: relative; z-index: 5; width: calc(100% - 2.5rem); margin-top: -16px; overflow: hidden; }
.rp-output::before { content: ""; position: absolute; z-index: 3; left: 0; right: 0; top: -4px; height: 8px; pointer-events: none; background: rgba(8,13,30,.7); filter: blur(6px); opacity: 0; transition: opacity .16s; }
.rp:not([data-stage="processing"]) .rp-output::before { opacity: 1; }
.rp-feed { position: relative; opacity: 0; transform: translateY(calc(-100% + 2px)); }
.rp[data-stage="printing"] .rp-feed { opacity: 1; animation: rp-feed var(--rp-feed) linear forwards; animation-delay: var(--rp-skip, 0ms); }
.rp[data-stage="complete"] .rp-feed { opacity: 1; transform: none; }
.rp-paper { position: relative; min-height: 120px; padding: 22px 16px 26px; background-color: #fffdf7; color: #111; filter: drop-shadow(0 8px 14px rgba(14,22,48,.25)); }
.rp-paper::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--rp-noise); opacity: .05; }
.rp-paper .receipt { margin: 0; padding: 0; background: transparent; box-shadow: none; border-radius: 0; max-height: 46vh; font-family: "Courier New", ui-monospace, Menlo, monospace; }
@keyframes rp-feed {
  0% { transform: translateY(calc(-100% + 2px)); }
  7.5% { transform: translateY(-91%); } 10.5% { transform: translateY(-91%); }
  18% { transform: translateY(-81%); } 21% { transform: translateY(-81%); }
  28.5% { transform: translateY(-70%); } 31.5% { transform: translateY(-70%); }
  39% { transform: translateY(-58%); } 42% { transform: translateY(-58%); }
  49.5% { transform: translateY(-45%); } 52.5% { transform: translateY(-45%); }
  60% { transform: translateY(-32%); } 63% { transform: translateY(-32%); }
  70.5% { transform: translateY(-20%); } 73.5% { transform: translateY(-20%); }
  81% { transform: translateY(-10%); } 84% { transform: translateY(-10%); }
  91.5% { transform: translateY(-3%); } 94.5% { transform: translateY(-3%); }
  100% { transform: translateY(0); }
}
@keyframes rp-spin { to { transform: rotate(360deg); } }
@keyframes rp-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rp-spin, .rp-swap { animation: none; } .rp[data-stage="printing"] .rp-feed { animation: none; transform: none; } }
/* The animated paper is clipped and moving: a plain copy is what actually prints. */
.rp-printdup { display: none; }
@media print { .rp { display: none !important; } .rp-printdup { display: block !important; } }

/* ── Checkout (js/pay.js): summary always on top, charge button always at the bottom, nothing to scroll for. ── */
.sheet.fit { display: flex; flex-direction: column; overflow: hidden; }
.sheet.fit .sheet-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pay { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.pay-sum { flex: none; display: grid; grid-template-columns: 1fr; gap: 8px; }
.pay-sum.cash { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pay-sum.cash > div { padding: 8px 9px; }
.pay-sum.cash b { font-size: clamp(.95rem, 4.9vw, 1.35rem); }
.pay-sum > div { display: flex; flex-direction: column; justify-content: center; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); min-width: 0; }
.pay-sum small { font-size: .72rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pay-sum b { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pay-sum .ps-total { background: var(--ink-soft); }
.pay-sum:not(.cash) .ps-total { flex-direction: row; align-items: baseline; justify-content: space-between; }
.pay-sum:not(.cash) .ps-total b { font-size: 2.1rem; }
.pay-sum .ps-change.ok { background: var(--ok-bg); } .pay-sum .ps-change.ok b, .pay-sum .ps-change.ok small { color: var(--ok); }
.pay-sum .ps-change.bad { background: var(--bad-bg); } .pay-sum .ps-change.bad b, .pay-sum .ps-change.bad small { color: var(--bad); }
.pay-mid { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.pay-opts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.pay-opts .seg { align-self: flex-start; }
.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.method { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 10px; border: 2px solid var(--line); background: var(--surface); border-radius: var(--r); font-weight: 700; font-size: .95rem; color: var(--text-2); transition: border-color .12s, background .12s; }
.method .ico { color: var(--muted); }
.method.on { border-color: var(--primary); background: var(--ink-soft); color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 16%, transparent); }
.method.on .ico { color: var(--primary); }
.cash-grid { display: flex; flex-direction: column; gap: 8px; }
.quick { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.quick::-webkit-scrollbar { display: none; }
.q { flex: 1 1 0; min-width: max-content; min-height: 44px; padding: 0 8px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pay .keypad { margin: 0; gap: 6px; }
.pay .key { min-height: clamp(40px, 6.4vh, 58px); font-size: 1.25rem; border-radius: 12px; }
.pay-foot { flex: none; padding-top: 2px; }
.pay-foot .btn.big { width: 100%; }
.pay-foot .btn.short:disabled { background: var(--bad-bg); color: var(--bad); opacity: 1; border-color: transparent; }
.pay-split .row { gap: 8px; }
/* Tablet / desktop: quick amounts as a column beside the keypad, everything visible at once. */
@media (min-width: 761px) {
  .pay-sum b { font-size: 1.7rem; }
  .cash-grid { display: grid; grid-template-columns: minmax(150px, 1fr) 1.6fr; gap: 12px; align-items: start; }
  .cash-grid .quick { flex-direction: column; overflow: visible; }
  .cash-grid .q { min-height: 52px; font-size: 1.05rem; border-radius: var(--r); }
  .pay .key { min-height: clamp(48px, 7vh, 64px); }
}
/* Very short screens (iPhone SE landscape, small Android): tighter. */
@media (max-height: 600px) { .pay-sum > div { padding: 6px 10px; } .method { min-height: 44px; } .pay .key { min-height: 38px; } }
/* Phone held sideways (wide but very short): two columns — methods and quick notes left, keypad right. */
@media (max-height: 500px) and (min-width: 560px) {
  .sheet.fit { max-height: 100vh; max-height: 100dvh; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-top: 2px; }
  .sheet.fit::before { display: none; }
  .sheet.fit .sheet-head { padding: 4px 0; } .sheet.fit .sheet-head h2 { font-size: 1rem; }
  .pay { gap: 6px; }
  .pay-sum > div { padding: 4px 10px; } .pay-sum b, .pay-sum:not(.cash) .ps-total b { font-size: 1.15rem; }
  .pay-mid { gap: 6px; }
  .pay-single.cash { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; align-items: start; }
  .pay-single.cash .cash-grid { display: contents; }
  .pay-single.cash .methods { grid-column: 1; grid-row: 1; grid-template-columns: repeat(3, 1fr); }
  .pay-single.cash .quick { grid-column: 1; grid-row: 2; flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .pay-single.cash .keypad { grid-column: 2; grid-row: 1 / span 2; }
  .method { min-height: 40px; font-size: .85rem; gap: 4px; padding: 0 4px; }
  .q, .cash-grid .q { min-height: 36px; font-size: .9rem; border-radius: 999px; }
  .pay .keypad { gap: 5px; } .pay .key { min-height: 33px; font-size: 1.05rem; }
  .pay-foot .btn.big { min-height: 44px; }
}
/* Phone order sheet: the four slots (table, guests, customer, discount) in one swipeable row → more room for the lines. */
@media (max-width: 760px) { .cart .chips.slots { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .cart .chips.slots::-webkit-scrollbar { display: none; } .cart .chips.slots > * { flex: none; } }
/* てんべろ coins and pay-with selector */
.tag.coin { background: var(--accent-soft); color: var(--text); border-color: transparent; font-weight: 700; }
.tag.coin.warn, .chip.coins.warn { background: var(--bad-bg); color: var(--bad); }
.chip.coins { cursor: default; background: var(--accent-soft); border-color: transparent; font-weight: 700; }
.seg.pay-with { width: 100%; margin-bottom: 10px; } .seg.pay-with button { flex: 1; }
.display-link { display: block; margin: 8px 0; padding: 10px; border-radius: var(--r-sm); background: var(--surface-2); word-break: break-all; user-select: text; -webkit-user-select: text; }
