/* ════════════════════════════════════════════════════════════════════════
   ORCHARD HOSPITALITY — shared styles (ALT THEME)
   Palette: "Vineyard" (deep wine + antique gold · rich). Light + dark.
   Drop-in alternative to styles.css for quick theme switching: point a page's
   <link rel="stylesheet"> at styles2.css instead of styles.css.

   Dark mode follows the OS by default. To force a mode for testing, set
   data-theme on <html>:  <html data-theme="dark">  or  <html data-theme="light">
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── brand palette · LIGHT ──────────────────────────────────────── */
  --bg:          #F7EFE2;
  --surface:     #FFFEFB;
  --surface-2:   #F1E4CF;
  --ink:         #261218;
  --peach:       #6E2233;   /* accent — buttons, highlights (deep wine) */
  --peach-deep:  #561A28;   /* accent hover / deeper splash             */
  --sage:        #A8772E;   /* secondary (antique gold)                 */
  --sage-deep:   #8A6224;   /* "Orchard" second-word color              */
  --panel:       #25121A;   /* deep wine panel (CTA band)               */

  /* ── two-color wordmark ────────────────────────────────────────── */
  --word-orchard: #6E2233;           /* "Orchard" — wine, every page    */
  --word-second:  var(--sage-deep);  /* second word — gold, word varies */

  /* ── derived ───────────────────────────────────────────────────── */
  --border: color-mix(in srgb, var(--ink) 14%, transparent);
  --muted:  color-mix(in srgb, var(--ink) 58%, transparent);
  --peach-subtle: color-mix(in srgb, var(--peach) 14%, var(--bg));
  --sage-subtle:  color-mix(in srgb, var(--sage) 14%, var(--bg));

  /* ── type ──────────────────────────────────────────────────────── */
  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;

  /* ── shape & rhythm ────────────────────────────────────────────── */
  --radius:    18px;
  --radius-lg: 28px;
  --pill:      999px;
  --maxw:      1120px;
}

/* ── brand palette · DARK ─────────────────────────────────────────────
   Shared token overrides. Applied automatically when the OS prefers dark
   (unless data-theme="light" forces light), or when data-theme="dark".     */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #190E11;
    --surface:     #241419;
    --surface-2:   #2E1A20;
    --ink:         #F1E4D6;
    --peach:       #A8384B;   /* accent (brighter wine for dark)   */
    --peach-deep:  #BE4659;   /* accent hover                       */
    --sage:        #D2A24E;   /* secondary (gold)                   */
    --sage-deep:   #C2913E;   /* second-word color                  */
    --panel:       #2E1219;   /* deep wine CTA band                 */

    --word-orchard: #C9536A;  /* "Orchard" — brighter rose-wine    */
  }
}
:root[data-theme="dark"] {
  --bg:          #190E11;
  --surface:     #241419;
  --surface-2:   #2E1A20;
  --ink:         #F1E4D6;
  --peach:       #A8384B;
  --peach-deep:  #BE4659;
  --sage:        #D2A24E;
  --sage-deep:   #C2913E;
  --panel:       #2E1219;

  --word-orchard: #C9536A;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  /* vines climbing the page margins — the signature */
  background-image: url("vine-left.svg"), url("vine-right.svg");
  background-repeat: repeat-y, repeat-y;
  background-position: left 10px top 40px, right 8px top 120px;
  background-size: 118px auto, 102px auto;
  -webkit-font-smoothing: antialiased;
}
/* vines only where there's margin to spare */
@media (max-width: 1180px) { body { background-image: none; } }

a { color: inherit; }
img { max-width: 100%; display: block; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

/* ── leaf motif ──────────────────────────────────────────────────── */
.leaf {
  display: inline-block;
  width: 0.9em; height: 0.9em;
  background: var(--peach);
  border-radius: 0 70% 0 70%;
  transform: rotate(45deg);
  flex-shrink: 0;
}

/* ── two-color wordmark ──────────────────────────────────────────── */
.word-orchard { color: var(--word-orchard); }
.word-second  { color: var(--word-second);  }

/* ════ NAV ════════════════════════════════════════════════════════ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 600;
  color: var(--word-orchard);
  text-decoration: none;
}
.brand .leaf { width: 16px; height: 16px; }
.nav__links { display: flex; align-items: center; gap: 2rem; list-style: none; }
.nav__links a {
  font-size: 1rem; font-weight: 600; text-decoration: none;
  color: var(--ink); transition: color 0.15s;
}
.nav__links a:hover { color: var(--peach-deep); }
.nav__links a.active { color: var(--sage-deep); }

/* ════ BUTTONS ════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem; font-weight: 700;
  padding: 0.8rem 1.6rem;
  border: 2px solid transparent;
  border-radius: var(--pill);
  text-decoration: none; cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--peach); color: #fff; border-color: var(--peach); }
.btn--primary:hover { background: var(--peach-deep); border-color: var(--peach-deep); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--ghost:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.btn--sage { background: var(--sage); color: #fff; border-color: var(--sage); }
.btn--sage:hover { background: var(--sage-deep); border-color: var(--sage-deep); }
.btn--on-dark { background: var(--peach); color: #fff; border-color: var(--peach); }
.btn--on-dark.btn--ghost { background: transparent; color: #fff; border-color: #ffffff66; }

/* ════ SHARED BITS ════════════════════════════════════════════════ */
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--sage-deep);
}
.section { padding: 6rem 0; }
.section__head { max-width: 44ch; margin-bottom: 3rem; }
.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  font-weight: 600; line-height: 1.12; letter-spacing: -0.01em;
}
.section__lead { margin-top: 1rem; font-size: 1.2rem; color: var(--muted); }

/* ════ HERO ═══════════════════════════════════════════════════════ */
.hero { position: relative; text-align: center; padding: 5.5rem 0 5rem; overflow: hidden; }
/* hero sprigs curling up around the wordmark */
.hero__sprig { position: absolute; bottom: 16%; width: 116px; z-index: 0; pointer-events: none; opacity: 0.95; }
.hero__sprig--l { left: 7%; }
.hero__sprig--r { right: 7%; transform: scaleX(-1); }
@media (max-width: 1000px) { .hero__sprig { display: none; } }
.hero__inner { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; }
.hero__eyebrow { justify-content: center; margin-bottom: 1.5rem; }
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 6.5rem);
  font-weight: 600; line-height: 0.98; letter-spacing: -0.02em;
}
.hero__sub {
  max-width: 38ch; margin: 1.6rem auto 0;
  font-size: clamp(1.15rem, 2.2vw, 1.45rem); color: var(--ink);
}
.hero__cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 2.2rem; }
.hero__note { margin-top: 1.6rem; font-size: 0.95rem; color: var(--muted); }

/* compact hero for inner pages */
.hero--compact { padding: 4rem 0 3.5rem; }
.hero--compact .hero__title { font-size: clamp(2.6rem, 7vw, 4.5rem); }

/* ════ "WHAT WE GROW" — features ══════════════════════════════════ */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.feature__icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; margin-bottom: 1.2rem;
  background: var(--peach-subtle);
}
.feature__icon .leaf { width: 18px; height: 18px; }
.feature h3 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature p { color: var(--muted); font-size: 1.05rem; }

/* ════ PRODUCTS — arched cards ════════════════════════════════════ */
.products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; align-items: start; }
.product {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 150px 150px var(--radius) var(--radius);
  padding: 3rem 1.75rem 1.75rem;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.product:hover { transform: translateY(-4px); box-shadow: 0 14px 40px -18px color-mix(in srgb, var(--ink) 40%, transparent); }
.product__tag {
  font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.25rem 0.85rem; border-radius: var(--pill);
}
.product__tag--live   { background: var(--peach); color: #fff; }
.product__tag--soon   { background: var(--sage-subtle); color: var(--sage-deep); border: 1px solid color-mix(in srgb, var(--sage) 35%, transparent); }
.product__tag--budding{ background: transparent; color: var(--muted); border: 1px solid var(--border); }
.product h3 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.product p { color: var(--muted); font-size: 1.02rem; flex: 1; }
.product a.btn { margin-top: 0.5rem; }

/* ════ TESTIMONIAL ════════════════════════════════════════════════ */
.quote-band { background: var(--surface-2); border-block: 1px solid var(--border); }
.quote {
  max-width: 24ch + 40ch; text-align: center; margin: 0 auto; max-width: 56ch;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  font-weight: 500; line-height: 1.3;
}
.quote .leaf { width: 0.7em; height: 0.7em; margin-bottom: 1.2rem; }
.quote cite {
  display: block; margin-top: 1.5rem;
  font-family: var(--font-body); font-size: 1rem; font-weight: 600;
  font-style: normal; color: var(--muted);
}

/* ════ CTA BAND ═══════════════════════════════════════════════════ */
.cta-band { background: var(--panel); color: #F4ECE0; text-align: center; }
.cta-band .section__title { color: #fff; }
.cta-band .word-orchard { color: #D88B9A; }   /* light rose-wine on the dark band */
.cta-band .word-second { color: #D2A24E; }    /* antique gold on the dark band     */
.cta-band p { max-width: 46ch; margin: 1rem auto 2rem; color: #D6CFC4; font-size: 1.15rem; }

/* ════ FOOTER ═════════════════════════════════════════════════════ */
.footer { padding: 3rem 0; border-top: 1px solid var(--border); }
.footer__inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer__links { display: flex; gap: 1.5rem; list-style: none; }
.footer__links a { font-size: 0.95rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.footer__links a:hover { color: var(--peach-deep); }
.footer__fine { font-size: 0.9rem; color: var(--muted); }

/* simple page content block */
.page-body { max-width: 60ch; margin: 0 auto; padding: 1rem 0 5rem; }
.page-body p { font-size: 1.2rem; margin-bottom: 1.2rem; }
.mini-list { list-style: none; display: flex; flex-direction: column; gap: 0.9rem; margin: 1.5rem 0 2.5rem; }
.mini-list li { display: flex; gap: 0.8rem; font-size: 1.12rem; align-items: baseline; }
.mini-list .leaf { width: 0.7em; height: 0.7em; }

/* ════ RESPONSIVE ═════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .features, .products { grid-template-columns: 1fr; }
  .nav__links { gap: 1.1rem; }
  .nav__links .nav__hide { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .btn:hover, .product:hover { transform: none; }
}

/* ════════════════════════════════════════════════════════════════════════
   CHAT APP — Backwaiter terminal-replacement UI
   Reuses the brand tokens above (--peach, --sage, --surface, fonts, radii).
   Manager/Staff is a toggle; HITL steps render as inline widgets.
   ════════════════════════════════════════════════════════════════════════ */

/* The chat takes over the viewport; suppress the marketing vine margins here. */
body:has(.chat-app) { background-image: none; }

.chat-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── header ───────────────────────────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
/* Wordmark: { backwaiter } — the word in ink, the braces in gold. The old
   two-tone .word-orchard/.word-second split belonged to Orchard and made no
   sense splitting a single word in half; the braces give the two-tone effect
   somewhere it actually means something. */
.chat-brand {
  display: flex; align-items: center;
  font-family: var(--font-display);
  font-size: 1.4rem; font-weight: 600;
  margin-right: auto;
}
.chat-brand .brand-word { color: var(--ink); }
/* --sage-deep, not --sage: the deeper gold clears WCAG AA against the header
   surface in both light and dark. */
.chat-brand .brand-brace {
  color: var(--sage-deep);
  font-weight: 400;          /* lighter, so the braces frame rather than compete */
}
.chat-brand .brand-word { margin: 0 0.22em; }

.mode-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  padding: 3px;
}
.mode-toggle button {
  font-family: var(--font-body);
  font-size: 0.95rem; font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none; cursor: pointer;
  padding: 0.4rem 1.1rem;
  border-radius: var(--pill);
  transition: background 0.15s, color 0.15s;
}
.mode-toggle button.is-active {
  background: var(--peach);
  color: #fff;
}
.chat-new { padding: 0.5rem 1.1rem; font-size: 0.9rem; }

/* ── conversation window ──────────────────────────────────────────────── */
.chat-window {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 0;
}

.msg { display: flex; flex-direction: column; gap: 0.3rem; max-width: 80%; }
.msg--user { align-self: flex-end; align-items: flex-end; }
.msg--assistant { align-self: flex-start; }

.msg__role {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted);
}
.msg__body {
  font-size: 1.02rem; line-height: 1.55;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg--assistant .msg__body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-left-radius: 6px;
}
.msg--user .msg__body {
  background: var(--peach);
  color: #fff;
  border-top-right-radius: 6px;
}
/* streaming-in-progress bubble shows a soft pulsing caret */
.msg__body--stream::after {
  content: "▍";
  margin-left: 1px;
  animation: chat-blink 1s steps(2, start) infinite;
  color: var(--sage);
}
@keyframes chat-blink { to { opacity: 0; } }
.msg__body--error { background: var(--peach-subtle); color: var(--peach-deep); border-color: var(--peach); }

/* ── HITL widgets ─────────────────────────────────────────────────────── */
.widget {
  align-self: flex-start;
  max-width: 80%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.widget--duplicate {
  background: var(--peach-subtle);
  border-color: var(--peach);
}
.widget--producer {
  background: var(--sage-subtle);
  border-color: var(--sage);
}
.widget.is-spent { opacity: 0.55; }
.widget__title {
  font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 600;
  margin-bottom: 0.9rem;
}

.wine-grid {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 0.35rem 1rem;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.wine-grid dt { font-weight: 700; color: var(--sage-deep); }
.wine-grid dd { color: var(--ink); }

.widget__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.widget__actions .btn { padding: 0.55rem 1.2rem; font-size: 0.95rem; }

.other-input { display: none; gap: 0.5rem; margin-top: 0.8rem; }
.other-input.is-open { display: flex; }
.other-input input {
  flex: 1;
  font: inherit;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--bg);
  color: var(--ink);
}

.price-form { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.price-field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.price-field input {
  font: inherit;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  width: 12rem; max-width: 100%;
}

/* ── composer ─────────────────────────────────────────────────────────── */
.composer {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  padding: 1rem 0 1.25rem;
  border-top: 1px solid var(--border);
}
.composer textarea {
  flex: 1;
  font: inherit;
  resize: none;
  line-height: 1.5;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.composer textarea:focus { outline: none; border-color: var(--peach); }
.composer .btn { padding: 0.7rem 1.5rem; }
.composer textarea:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Discrete "New Chat" icon button, sitting to the right of Send. */
.composer-newchat {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.composer-newchat:hover { color: var(--peach-deep); border-color: var(--peach); background: var(--surface-2); }
.composer-newchat:disabled { opacity: 0.5; cursor: not-allowed; }
.composer-newchat svg { display: block; }

@media (max-width: 640px) {
  .msg, .widget { max-width: 92%; }
  .chat-brand span:last-child { display: none; }
}

/* ════════════════════════════════════════════════════════════════════════
   STAFF CATALOG — Menu/Ask tabs, wine cards, and the quick/extended sheet.
   Reuses the brand tokens; built to swap cleanly with the chat view.
   ════════════════════════════════════════════════════════════════════════ */

.is-hidden { display: none !important; }

/* ── staff sub-tabs (Menu / Ask) ──────────────────────────────────────── */
.staff-tabs {
  display: flex;
  gap: 1.25rem;
  padding: 0.75rem 0 0;
  border-bottom: 1px solid var(--border);
}
.staff-tab {
  font-family: var(--font-body);
  font-size: 1rem; font-weight: 700;
  color: var(--muted);
  background: transparent; border: none; cursor: pointer;
  padding: 0.5rem 0.15rem 0.75rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.staff-tab:hover { color: var(--ink); }
.staff-tab.is-active { color: var(--ink); border-bottom-color: var(--peach); }

/* ── main region that swaps between menu and chat ─────────────────────── */
.app-main { flex: 1; min-height: 0; display: flex; }
.menu-view, .chat-view, .winelist-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.menu-view, .winelist-view { overflow-y: auto; }

/* ── catalog controls: search + category chips (sticky atop the list) ─── */
.catalog-controls {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: 1.1rem 0 0.85rem;
  display: flex; flex-direction: column; gap: 0.85rem;
}
.catalog-search {
  flex: 1; min-width: 0;
  font: inherit;
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink);
}
.catalog-search:focus { outline: none; border-color: var(--peach); }
.cat-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-tab {
  font: inherit; font-size: 0.9rem; font-weight: 700;
  padding: 0.4rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--surface); color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cat-tab:hover { color: var(--ink); }
.cat-tab.is-active { background: var(--peach); color: #fff; border-color: var(--peach); }

/* ── wine cards ───────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  padding: 0.5rem 0 1.75rem;
}
.wine-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.35rem;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}
.wine-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px -18px color-mix(in srgb, var(--ink) 40%, transparent); }
.wine-card:focus-visible { outline: 2px solid var(--peach); outline-offset: 2px; }
.wine-card__type {
  align-self: flex-start;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.2rem 0.7rem; border-radius: var(--pill);
  background: var(--sage-subtle); color: var(--sage-deep);
}
.wine-card__name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; line-height: 1.15; }
.wine-card__producer { font-weight: 600; color: var(--ink); }
.wine-card__meta { font-size: 0.9rem; color: var(--muted); }
.wine-card__price { margin-top: 0.3rem; font-weight: 700; color: var(--peach-deep); }

.catalog-empty { color: var(--muted); padding: 2.5rem 0; font-size: 1.05rem; }

/* ── wine detail sheet (quick view -> extended view) ──────────────────── */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-overlay.is-open { display: flex; }
.sheet {
  background: var(--surface); color: var(--ink);
  width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.6rem;
  box-shadow: 0 -10px 44px -16px color-mix(in srgb, var(--ink) 60%, transparent);
}
@media (min-width: 700px) {
  .sheet-overlay { align-items: center; }
  .sheet { border-radius: var(--radius-lg); max-height: 86vh; }
}
.sheet-head { position: relative; margin-bottom: 1.2rem; padding-right: 2rem; }
.sheet-close {
  position: absolute; top: -0.4rem; right: -0.4rem;
  font-size: 1.7rem; line-height: 1;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted);
}
.sheet-close:hover { color: var(--peach-deep); }
.sheet-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; line-height: 1.12; }
.sheet-sub { color: var(--muted); font-weight: 600; margin-top: 0.25rem; }
.sheet-facts {
  display: grid; grid-template-columns: minmax(110px, auto) 1fr;
  gap: 0.45rem 1rem; margin-bottom: 1.1rem;
}
.sheet-facts dt { font-weight: 700; color: var(--sage-deep); }
.sheet-facts dd { color: var(--ink); }
.sheet-price { font-weight: 700; color: var(--peach-deep); margin-bottom: 1.2rem; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ── grid/list view toggle (search row, right-aligned) ────────────────── */
.catalog-toprow { display: flex; align-items: center; gap: 0.75rem; }
.view-toggle {
  display: flex; gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  padding: 3px;
  flex-shrink: 0;
}
.view-btn {
  display: grid; place-items: center;
  width: 38px; height: 32px;
  border: none; background: transparent;
  color: var(--muted); cursor: pointer;
  border-radius: var(--pill);
  transition: background 0.15s, color 0.15s;
}
.view-btn:hover { color: var(--ink); }
.view-btn.is-active { background: var(--peach); color: #fff; }
.view-btn svg { display: block; }

/* ── list view (accordion by wine type) ───────────────────────────────── */
.list-view { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.5rem 0 1.75rem; }

.cat-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.cat-header {
  width: 100%;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.2rem;
  background: transparent; border: none; cursor: pointer;
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 600;
  color: var(--ink); text-align: left;
}
.cat-header:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.cat-section.is-open .cat-header { background: var(--sage-subtle); }
.cat-header__caret { color: var(--peach); font-size: 0.9rem; transition: transform 0.18s; }
.cat-section.is-open .cat-header__caret { transform: rotate(90deg); }
.cat-header__name { flex: 1; }
.cat-header__count {
  font-family: var(--font-body); font-size: 0.85rem; font-weight: 700;
  color: var(--muted); background: var(--surface-2);
  padding: 0.15rem 0.6rem; border-radius: var(--pill);
}

.cat-body { display: none; flex-direction: column; border-top: 1px solid var(--border); }
.cat-section.is-open .cat-body { display: flex; }

.wine-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%;
  padding: 0.8rem 1.2rem;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  cursor: pointer; text-align: left; font: inherit; color: var(--ink);
}
.wine-row:last-child { border-bottom: none; }
.wine-row:hover { background: color-mix(in srgb, var(--sage) 10%, transparent); }
.wine-row__main { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.wine-row__name { font-weight: 700; }
.wine-row__producer { font-size: 0.9rem; color: var(--muted); }
.wine-row__right { display: flex; align-items: baseline; gap: 0.9rem; flex-shrink: 0; }
.wine-row__vintage { color: var(--muted); font-size: 0.9rem; }
.wine-row__price { font-weight: 700; color: var(--peach-deep); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .wine-card:hover { transform: none; }
  .cat-header__caret { transition: none; }
}

/* ════════════════════════════════════════════════════════════════════════
   LABELS — approval widget (manager) + label display on cards/detail (staff)
   ════════════════════════════════════════════════════════════════════════ */

/* ── label-approval widget (manager mode) ─────────────────────────────── */
.label-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.label-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  display: flex; flex-direction: column; gap: 0.4rem;
  background: var(--bg);
}
.label-card.is-best { border-color: var(--peach); box-shadow: 0 0 0 2px var(--peach); }
.label-img {
  width: 100%; height: 150px; object-fit: contain;
  background: var(--surface-2); border-radius: 8px;
}
.label-badge {
  align-self: flex-start;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: #fff; background: var(--peach);
  padding: 0.1rem 0.5rem; border-radius: var(--pill);
}
.label-src { font-size: 0.78rem; color: var(--muted); }
.label-use { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.label-empty { color: var(--muted); margin-bottom: 1rem; }

/* ── label display (staff catalog) ────────────────────────────────────── */
.wine-card__thumb {
  width: 100%; height: 120px; object-fit: contain;
  background: var(--surface-2); border-radius: 10px; margin-bottom: 0.2rem;
}
.wine-row__left { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.wine-row__thumb {
  width: 34px; height: 44px; object-fit: contain;
  background: var(--surface-2); border-radius: 6px; flex-shrink: 0;
}
.sheet-label {
  width: 100%; max-height: 320px; object-fit: contain;
  background: var(--surface-2); border-radius: 12px; margin-bottom: 1.1rem;
}

/* ── lifecycle widgets (archive / trash / restore) ────────────────────── */
.lifecycle-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; margin-bottom: 0.4rem; }
.lifecycle-note { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.9rem; }
.lifecycle-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.3rem; }
.lifecycle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
}
.lifecycle-row__meta { min-width: 0; }
.lifecycle-row__name { font-weight: 700; }
.lifecycle-row__sub { font-size: 0.85rem; color: var(--muted); }
.lifecycle-row .btn { padding: 0.4rem 1rem; font-size: 0.9rem; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════════════
   MANAGER WINE LIST — directly-editable catalog (inline edit, no LLM).
   Structured fields are click-to-edit cells (autosave); the expand row holds
   the wine_type dropdown + notes textareas (explicit Save).
   ════════════════════════════════════════════════════════════════════════ */

.wl-hint { font-size: 0.9rem; color: var(--muted); }
.wl-body { display: flex; flex-direction: column; gap: 1rem; padding: 0.5rem 0 2rem; }

.wl-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.wl-section__head {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--sage-subtle);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 600;
}
.wl-section__name { flex: 1; }

/* Horizontal scroll on narrow screens rather than overflowing the page. */
.wl-scroll { overflow-x: auto; }
.wl-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 0.95rem; }
.wl-table th {
  text-align: left; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.wl-row > td {
  padding: 0.3rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.wl-row:last-child > td { border-bottom: none; }
.wl-cell--producer { font-weight: 600; color: var(--muted); white-space: nowrap; }
.wl-cell--wine_name { font-weight: 700; min-width: 9rem; }
.wl-cell--vintage, .wl-cell--btg_price, .wl-cell--btb_price { white-space: nowrap; }
.wl-cell--btg_price .wl-val, .wl-cell--btb_price .wl-val { color: var(--peach-deep); font-weight: 700; }
.wl-cell--toggle { width: 1%; text-align: right; }

/* Click-to-edit affordance. */
.wl-editable { cursor: text; border-radius: 8px; transition: background 0.12s; }
.wl-editable:hover { background: color-mix(in srgb, var(--sage) 12%, transparent); }
.wl-val { display: inline-block; min-height: 1.2em; }
.wl-empty { color: var(--muted); }
.wl-saved { animation: wl-saved-flash 0.85s ease-out; }
@keyframes wl-saved-flash {
  0% { background: color-mix(in srgb, var(--sage) 45%, transparent); }
  100% { background: transparent; }
}
.wl-saving { opacity: 0.6; }

.wl-input {
  font: inherit; font-size: 0.95rem;
  width: 100%; min-width: 4rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--peach);
  border-radius: 8px;
  background: var(--bg); color: var(--ink);
}
.wl-input:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--peach) 35%, transparent); }
.wl-input--num { width: 6rem; }

.wl-caret {
  background: transparent; border: none; cursor: pointer;
  color: var(--peach); font-size: 0.85rem;
  padding: 0.3rem 0.4rem; border-radius: 6px;
  transition: transform 0.18s;
}
.wl-caret:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.wl-caret.is-open { transform: rotate(90deg); }

/* Expanded detail row: wine_type dropdown + notes editor. */
.wl-detail-tr { display: none; }
.wl-detail-tr.is-open { display: table-row; }
.wl-detail-td { padding: 0 !important; background: color-mix(in srgb, var(--sage) 6%, var(--surface)); }
.wl-detail { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.wl-field { display: flex; flex-direction: column; gap: 0.3rem; }
.wl-field__label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sage-deep); }
.wl-select {
  font: inherit; font-size: 0.95rem;
  padding: 0.45rem 0.6rem; max-width: 14rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--ink);
}
.wl-textarea {
  font: inherit; font-size: 0.95rem; line-height: 1.45; resize: vertical;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--ink);
}
.wl-textarea:focus, .wl-select:focus { outline: none; border-color: var(--peach); }
.wl-detail__actions { display: flex; gap: 0.6rem; margin-top: 0.2rem; }
.btn--sm { padding: 0.45rem 1.1rem; font-size: 0.9rem; }

/* ── toast (save / error notices) ─────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1.5rem);
  z-index: 200;
  background: var(--panel); color: #F4ECE0;
  font-size: 0.95rem; font-weight: 600;
  padding: 0.7rem 1.3rem; border-radius: var(--pill);
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--ink) 70%, transparent);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--peach-deep); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .wl-caret { transition: none; }
  .wl-saved { animation: none; }
  .toast { transition: opacity 0.2s; }
}

/* ── auth: manager login + the dev-bypass warning bar ─────────────────── */

/* Only rendered when the server has BACKWAITER_DEV_AUTH set. Loud on purpose:
   seeing this on a real deployment means authentication is switched off. */
.dev-auth-bar {
  position: sticky; top: 0; z-index: 200;
  background: #B3261E; color: #fff;
  font-weight: 700; font-size: 0.86rem; letter-spacing: 0.02em;
  text-align: center; padding: 0.5rem 1rem;
}
.dev-auth-bar.is-hidden { display: none; }
/* The bar eats vertical space, so the app fills what's left. */
body:has(.dev-auth-bar:not(.is-hidden)) .chat-app { height: calc(100vh - 2.1rem); }

/* Reuses .sheet-overlay / .sheet for the dimmed backdrop and card chrome. */
.login-card { max-width: 380px; }
.login-title {
  font-family: var(--font-display);
  font-size: 1.35rem; font-weight: 600;
  margin: 0 0 1.1rem;
}
.login-label {
  display: block;
  font-size: 0.82rem; font-weight: 700; color: var(--muted);
  margin-bottom: 0.3rem;
}
.login-input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.9rem;
  font: inherit; font-size: 0.98rem;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.login-input:focus { outline: 2px solid var(--sage); outline-offset: 1px; }
.login-error {
  margin: 0 0 0.9rem;
  font-size: 0.88rem; color: var(--peach-deep); font-weight: 600;
}
.login-error.is-hidden { display: none; }
.login-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

/* Manager-only notes: visually distinct from the public fields above it, so an
   internal note is never typed into a field that staff and guests can read. */
.wl-field--internal {
  border-left: 3px solid var(--sage);
  padding-left: 0.7rem;
  margin-top: 0.35rem;
}
.wl-field--internal .wl-field__label { color: var(--sage-deep); }
.wl-field--internal .wl-textarea {
  background: color-mix(in srgb, var(--sage) 7%, var(--surface));
}
