:root {
  color-scheme: light;
  --cream: #faf9f4;
  --paper: #fffefa;
  --ink: #182e28;
  --ink-soft: #4a5d56;
  --green: #1f5141;
  --green-deep: #173f33;
  --green-accent: #3f8a6c;
  --on-green: #f7f1dc;
  --line: #e3e0d4;
  --peach: #f5c3ac;  --peach-soft: #ffe4d6;
  --mint: #ace0ce;   --mint-soft: #d9f2e8;
  --gold: #f6d37c;   --gold-soft: #fcecc0;
  --red: #b3372b;
  --red-soft: #fbe3df;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(24, 46, 40, .08), 0 6px 18px rgba(24, 46, 40, .06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  padding-bottom: env(safe-area-inset-bottom);
}
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 520px; padding-top: 32px; }
a { color: var(--green); }
button, input { font: inherit; color: inherit; }
.muted { color: var(--ink-soft); }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--green-accent); outline-offset: 2px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: 14px; }
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.account { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 230px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 8px;
}
.menu .who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 14px; }
.menu .who strong { display: block; font-size: 16px; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 10px; background: none; border: 0; color: var(--ink); text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--cream); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-weight: 650; text-decoration: none; color: var(--ink);
}
.btn.primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn.primary:hover { background: var(--green-deep); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.outline-danger { color: var(--red); border-color: #e9b8b0; background: transparent; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.pill-account { min-height: 40px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.stack > * + * { margin-top: 14px; }

/* balance card */
.balance {
  position: relative; overflow: hidden; background: var(--green); color: var(--on-green);
  border-radius: 26px; padding: 26px 22px 24px; min-height: 190px; display: grid; grid-template-columns: 1fr auto; align-items: center;
}
.balance::after { /* subtle dot texture */
  content: ""; position: absolute; inset: 0 0 0 50%; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.07) 1.2px, transparent 1.3px); background-size: 9px 9px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%); mask-image: linear-gradient(90deg, transparent, #000 40%);
}
.balance .label { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.balance .amount { display: flex; align-items: baseline; gap: 12px; margin: 14px 0 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.balance .amount .cur { font-size: 22px; font-weight: 500; opacity: .9; }
.balance .amount .num { font-size: clamp(44px, 12vw, 76px); font-weight: 800; letter-spacing: -.045em; line-height: 1; }
.balance.negative .amount .num { color: #ffc9b8; }
.balance .btn { background: transparent; color: var(--on-green); border-color: rgba(247, 241, 220, .45); min-height: 40px; font-size: 15px; }
.balance .btn:hover { background: rgba(255,255,255,.08); }
.balance img { position: relative; z-index: 1; width: clamp(96px, 26vw, 250px); height: auto; margin: -10px -6px -10px 0; }
.balance .left { position: relative; z-index: 1; min-width: 0; }

/* drinks */
.h2 { font-size: clamp(34px, 7vw, 52px); font-weight: 850; letter-spacing: -.05em; line-height: 1.05; margin: 34px 0 10px; }
.h2 .dot { color: var(--green-accent); }
.h3 { font-size: 22px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 12px; }
.instructions { white-space: pre-line; color: var(--ink-soft); margin: 0 0 22px; font-size: 16px; overflow-wrap: anywhere; }
.drinks { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 40px; }
.drink {
  position: relative; display: grid; grid-template-columns: 116px 1fr auto; align-items: center; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow);
  padding: 0; overflow: hidden; cursor: pointer; min-height: 116px; -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, box-shadow .12s ease;
}
.drink:active:not([disabled]) { transform: scale(.98); }
.drink[disabled] { cursor: default; }
.drink[disabled]:not(.busy) { opacity: .6; }
.drink .photo { align-self: stretch; display: grid; place-items: center; }
.drink .photo img { width: 100%; height: 100%; max-height: 132px; object-fit: contain; }
.drink .info { padding: 14px 8px 14px 16px; min-width: 0; }
.drink .name { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; overflow-wrap: anywhere; }
.drink .price { display: block; margin-top: 4px; color: var(--ink-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.drink .plus {
  width: 50px; height: 50px; margin-right: 16px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(24,46,40,.18); font-size: 28px; font-weight: 300; line-height: 1;
}
.drink.peach .photo { background: var(--peach); } .drink.peach .plus { background: var(--peach-soft); }
.drink.mint .photo { background: var(--mint); }  .drink.mint .plus { background: var(--mint-soft); }
.drink.gold .photo { background: var(--gold); }  .drink.gold .plus { background: var(--gold-soft); }
.drink.busy .plus { color: transparent; position: relative; }
.drink.busy .plus::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--green); border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 760px) {
  .wrap { padding: 0 28px; }
  .balance { padding: 34px 40px; min-height: 300px; }
  .drinks { grid-template-columns: repeat(3, 1fr); gap: 24px; }
  .drink { grid-template-columns: 1fr auto; grid-template-rows: 250px auto; }
  .drink .photo { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .drink .photo img { max-height: 250px; width: auto; }
  .drink .info { padding: 22px 8px 26px 26px; }
  .drink .name { font-size: 26px; }
  .drink .plus { margin-right: 26px; }
}

/* notices */
.notice { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.notice.error { border-color: #e9b8b0; background: var(--red-soft); }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 0 16px; padding: 12px 16px; border-radius: 14px; background: var(--red-soft); color: var(--red); font-weight: 600; }
.signin { text-align: center; padding: 30px 0 60px; }
.signin img { width: min(240px, 60vw); }
.signin h1 { font-size: clamp(36px, 9vw, 56px); font-weight: 850; letter-spacing: -.05em; margin: 12px 0 8px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  width: min(520px, calc(100% - 32px)); display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--ink); color: #fff; padding: 12px 12px 12px 18px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast .btn { background: transparent; color: #ffe39a; border-color: rgba(255,255,255,.3); min-height: 40px; flex: none; }
.toast.error { background: var(--red); }
.toast.error .btn { color: #fff; }

/* sheets / dialogs */
.sheet {
  width: min(640px, 100%); max-height: min(92vh, 900px); border: 0; padding: 0; border-radius: 24px;
  background: var(--cream); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.sheet.small { width: min(420px, calc(100% - 32px)); padding: 22px; }
.sheet::backdrop { background: rgba(24, 46, 40, .45); }
@media (max-width: 640px) {
  .sheet:not(.small) { margin: auto 0 0; max-width: 100%; width: 100%; max-height: 94vh; border-radius: 24px 24px 0 0; }
}
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 12px; background: var(--cream); border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.03em; overflow-wrap: anywhere; }
.sheet-body { padding: 16px 20px 28px; }
.close { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 20px; flex: none; }
.confirm-text { font-size: 17px; margin: 0; }

/* history */
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hist .what { font-weight: 650; overflow-wrap: anywhere; }
.hist .when { color: var(--ink-soft); font-size: 14px; }
.hist .amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hist .amt.pos { color: var(--green-accent); }
.hist .tag { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 650; color: var(--ink-soft); background: var(--line); border-radius: 999px; padding: 1px 8px; vertical-align: 2px; }
.hist .act { grid-column: 1 / -1; }
.empty { color: var(--ink-soft); padding: 18px 0; }

/* admin */
.admin-grid { display: grid; gap: 22px; padding-bottom: 50px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 650; color: var(--ink-soft); }
.input { width: 100%; min-height: 46px; border: 1px solid #cfcbbd; border-radius: 12px; background: #fff; padding: 0 14px; font-size: 17px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form .input { flex: 1 1 160px; }
.search { margin-bottom: 8px; }
.mlist { list-style: none; margin: 0; padding: 0; }
.mlist button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 6px;
  background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; border-radius: 0;
}
.mlist button:hover { background: var(--cream); }
.mlist .nm { font-weight: 650; overflow-wrap: anywhere; min-width: 0; }
.mlist .bal { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.neg { color: var(--red); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--mint-soft); color: var(--green); vertical-align: 2px; }
.badge.warn { background: var(--gold-soft); color: #7a5a00; }
.big-bal { font-size: 40px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.seg { display: inline-flex; background: var(--line); border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 12px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 8px 14px; font-weight: 650; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--paper); box-shadow: var(--shadow); }
.hint { font-size: 14px; color: var(--ink-soft); margin: 8px 0 0; }
.msg { margin: 10px 0 0; font-weight: 600; }
.msg.ok { color: var(--green-accent); }
.msg.err { color: var(--red); }
.linkbox { word-break: break-all; font-size: 14px; background: var(--cream); border: 1px dashed #cfcbbd; border-radius: 12px; padding: 10px 12px; }
.section-gap { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.stock-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.stock-row:last-child { border-bottom: 0; }
.stock-row .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.stock-row .qty { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stock-row .qty.none { font-size: 16px; font-weight: 600; color: var(--ink-soft); }
.stock-row .meta { font-size: 13px; color: var(--ink-soft); margin: 2px 0 10px; }
.stock-row .warn { color: var(--red); font-weight: 650; font-size: 14px; margin: 2px 0 8px; }
@media (min-width: 900px) {
  .admin-grid { grid-template-columns: 1.3fr 1fr; align-items: start; }
  .admin-grid .span-all { grid-column: 1 / -1; }
}
.col { display: grid; gap: 22px; min-width: 0; }
.toast[hidden], [hidden] { display: none !important; }
.instructions { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
@media (max-width: 759px) {
  .drink { grid-template-columns: 100px 1fr auto; min-height: 104px; }
  .drink .name { font-size: 19px; overflow-wrap: normal; hyphens: auto; }
  .drink .plus { width: 44px; height: 44px; margin-right: 14px; font-size: 24px; }
  .drink .info { padding-right: 6px; }
}
.login { max-width: 380px; margin: 18px auto 0; text-align: left; }
.login .btn { width: 100%; }
.mlist .nm small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.h4 { font-size: 16px; font-weight: 750; margin: 0 0 4px; }
.signin img { width: min(150px, 40vw); border-radius: 26px; }
.signin { padding-top: 12px; }
