:root {
  --bg: #f6f1e6;
  --surface: #ffffff;
  --surface-2: #fbf6ec;
  --text: #241a10;
  --text-muted: #75634c;
  --line: #e6dac3;
  --accent: #b4692b;
  --accent-ink: #ffffff;
  --accent-soft: #f1ddc4;
  --herb: #6b7f4f;
  --herb-soft: #e3e9d7;
  --beer: #9c6a12;
  --beer-soft: #f0e0b8;
  --danger: #b23b3b;
  --danger-soft: #f6dcdc;
  --ok: #4c7a4c;
  --shadow: 0 12px 28px -16px rgba(36, 26, 16, 0.35);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b140d;
    --surface: #241b12;
    --surface-2: #2c2116;
    --text: #f3ead9;
    --text-muted: #b8a48a;
    --line: #3b2e20;
    --accent: #e0954b;
    --accent-ink: #241a10;
    --accent-soft: #3a2a17;
    --herb: #9bbb7c;
    --herb-soft: #2c3324;
    --beer: #e0ab47;
    --beer-soft: #3a2f14;
    --danger: #e07272;
    --danger-soft: #3a1f1f;
    --ok: #8fbf7f;
    --shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; margin: 0; text-wrap: balance; }
button { font: inherit; color: inherit; }
svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 0 140px;
}

/* header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  margin-inline: -16px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px;
  border-bottom: 1px solid var(--line);
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand svg { width: 34px; height: 34px; flex: none; }
.logo-ring { stroke: var(--accent); }
.logo-hop { fill: var(--accent); stroke: none; }
.logo-vein { stroke: var(--bg); stroke-width: 1.4; }
.brand-name { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 1.45rem; line-height: 1; letter-spacing: 0.04em; text-transform: uppercase; }
.brand-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }
.shop-line { font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; }
.shop-line strong { color: var(--text); font-weight: 600; }
#shopHours { white-space: nowrap; }

.account-btn {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 55vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-btn:hover { border-color: var(--accent); }
.account-btn.logged { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

.chips { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .age { color: var(--danger); margin-left: 4px; }
.chip.active .age { color: inherit; opacity: 0.8; }

/* notices */
.notice, .progress-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 16px;
  font-size: 0.86rem;
}
.notice { background: var(--surface-2); border: 1px dashed var(--line); color: var(--text-muted); }
.notice svg { flex: none; width: 18px; height: 18px; color: var(--accent); margin-top: 1px; }
.progress-card { background: var(--surface); border: 1px solid var(--line); flex-direction: column; gap: 8px; }
.progress-card .row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.progress-card strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; }
.bar { align-self: stretch; height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.muted { color: var(--text-muted); }

/* catalog */
.state-msg { padding: 48px 8px; text-align: center; color: var(--text-muted); }
.state-msg button { margin-top: 12px; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { font-size: 1.35rem; }
.section-title .count { font-size: 0.8rem; color: var(--text-muted); }
.section-title .age-badge { align-self: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 170px;
}
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-icon { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.card-icon svg { width: 21px; height: 21px; stroke-width: 1.8; }
.tone-a .card-icon { background: var(--accent-soft); color: var(--accent); }
.tone-b .card-icon { background: var(--herb-soft); color: var(--herb); }
.tone-beer .card-icon { background: var(--beer-soft); color: var(--beer); }
.badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.age-badge { font-size: 0.68rem; font-weight: 800; padding: 3px 7px; border-radius: 999px; background: var(--danger); color: #fff; }
.tap-badge { font-size: 0.68rem; font-weight: 800; padding: 3px 7px; border-radius: 999px; background: var(--beer-soft); color: var(--beer); text-transform: uppercase; letter-spacing: 0.04em; }
.card-name { font-family: Georgia, "Times New Roman", serif; font-size: 1.02rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.card-meta { font-size: 0.76rem; color: var(--text-muted); }
.card-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.02rem; white-space: nowrap; }
.price small { font-weight: 600; color: var(--text-muted); font-size: 0.75rem; }

.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface-2); flex: none; }
.stepper button { width: 32px; height: 32px; border: none; background: transparent; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.stepper button:disabled { opacity: 0.35; cursor: default; }
.stepper button:hover:not(:disabled) { background: var(--accent-soft); }
.stepper .qty { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.85rem; }

.add-btn { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.85rem; padding: 6px 14px; border-radius: 999px; cursor: pointer; flex: none; }
.add-btn:hover { background: var(--accent); color: var(--accent-ink); }

/* cart pill */
.cart-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.cart-pill { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--text); color: var(--bg); border-radius: 999px; padding: 9px 9px 9px 20px; box-shadow: var(--shadow); width: 100%; max-width: 460px; transform: translateY(160%); transition: transform 0.25s ease; }
.cart-pill.show { transform: translateY(0); }
.cart-pill .info { flex: 1; min-width: 0; }
.cart-pill .count { font-size: 0.72rem; opacity: 0.75; }
.cart-pill .total { font-variant-numeric: tabular-nums; font-weight: 700; }
.open-cart { border: none; background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 10px 18px; border-radius: 999px; cursor: pointer; }

/* drawer */
.backdrop { position: fixed; inset: 0; background: rgba(20, 14, 8, 0.45); z-index: 49; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.backdrop.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; z-index: 50; right: 0; top: 0; bottom: 0; width: min(430px, 100vw); background: var(--surface); box-shadow: var(--shadow); transform: translateX(100%); transition: transform 0.25s ease; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.drawer.show { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.25rem; }
.icon-btn { width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.drawer-foot:empty { display: none; }

.cart-line { display: flex; align-items: center; gap: 10px; }
.li-info { flex: 1; min-width: 0; }
.li-name { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.li-sub { font-size: 0.74rem; color: var(--text-muted); }
.li-price { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.88rem; min-width: 72px; text-align: right; }
.totals-row { display: flex; justify-content: space-between; font-size: 1.05rem; font-weight: 800; }
.totals-row span:last-child { font-variant-numeric: tabular-nums; }

.btn-primary, .btn-ghost, .btn-link { border-radius: 999px; padding: 13px 18px; font-weight: 700; font-size: 0.95rem; cursor: pointer; width: 100%; text-align: center; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border: none; }
.btn-primary:disabled { opacity: 0.45; cursor: default; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-link { background: #1f9d55; color: #fff; border: none; }
.text-btn { background: none; border: none; color: var(--text-muted); font-size: 0.85rem; cursor: pointer; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; }
.text-btn:disabled { text-decoration: none; cursor: default; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); }
.field input, .field select, .field textarea { font: inherit; font-size: 1rem; padding: 11px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--text); width: 100%; }
.field textarea { resize: vertical; min-height: 64px; }
.field input.code { letter-spacing: 0.5em; text-align: center; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.field .readonly { padding: 11px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--line); }

.note { display: flex; gap: 8px; align-items: flex-start; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.84rem; }
.note svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.note.info { background: var(--herb-soft); color: var(--herb); }
.note.warn { background: var(--beer-soft); color: var(--beer); }
.note.error { background: var(--danger-soft); color: var(--danger); }
.note.demo { background: var(--accent-soft); color: var(--accent); }

.center { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding-top: 18px; }
.center .big-icon { width: 54px; height: 54px; color: var(--ok); }
.center .order-no { font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; }
.center p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
pre.order-text { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font: 0.8rem/1.45 ui-monospace, Menlo, Consolas, monospace; margin: 0; overflow-x: auto; text-align: left; width: 100%; }
details { width: 100%; text-align: left; }
summary { cursor: pointer; color: var(--text-muted); font-size: 0.85rem; }

.profile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; }
.stat .v { font-family: Georgia, "Times New Roman", serif; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 0.75rem; color: var(--text-muted); }

/* modal & toast */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(20, 14, 8, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; max-width: 360px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.modal p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.age-big { font-family: Georgia, "Times New Roman", serif; font-size: 2.4rem; font-weight: 700; color: var(--danger); line-height: 1; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 70; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 0.86rem; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

.foot { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.78rem; color: var(--text-muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

@media (max-width: 480px) {
  .brand-name { font-size: 1.25rem; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 12px; min-height: 0; }
  .card-bottom { flex-direction: column; align-items: stretch; }
  .card-bottom .add-btn, .card-bottom .stepper { width: 100%; justify-content: space-between; }
  .add-btn { padding: 8px 12px; }
}
@media (max-width: 340px) { .grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .cart-pill, .drawer, .backdrop { transition: none; } }

/* уведомления и брони */
.notify-box { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.nb-title { font-weight: 700; font-size: 0.86rem; }
.chan-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chan { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.chan svg { width: 16px; height: 16px; }
.chan:hover { border-color: var(--accent); }
.chan.on { background: var(--herb-soft); color: var(--herb); border-color: transparent; cursor: default; }
.order-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.status { font-size: 0.74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.status.s-ready { background: var(--herb-soft); color: var(--herb); }
.status.s-done { background: var(--surface); color: var(--text-muted); border: 1px solid var(--line); }
.status.s-cancelled { background: var(--danger-soft); color: var(--danger); }
