/* ════════════════════════════════════════════════════════════════════════
   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 ──────────────────────────────────────
     The landing page's afternoon (landing/styles.css): sunlit paper, deep
     burgundy for actions, backlit ruby for prices and links, logo gold. */
  --bg:          #F9ECD3;   /* afternoon paper                            */
  --bg-2:        #F3DCB4;   /* the paper's lower edge (page gradient)     */
  --surface:     #FFFCF6;
  --surface-2:   #F5E3C4;
  --ink:         #2A0D15;
  --peach:       #59011A;   /* accent: buttons, active states (burgundy)  */
  --peach-deep:  #A8102C;   /* accent text: prices, links, errors (ruby)  */
  --sage:        #F1C763;   /* secondary: logo gold (fills, never text)   */
  --sage-deep:   #87570F;   /* gold dark enough to read as text           */
  --panel:       #24080F;   /* night: toasts, tooltips                    */
  --on-peach:    #FFF8EC;   /* text on burgundy                           */
  --on-sage:     #2A0D15;   /* text on gold                               */
  --peach-hover: #6E0A26;

  /* ── two-color wordmark ────────────────────────────────────────── */
  --word-orchard: #59011A;
  --word-second:  var(--peach-deep);

  /* ── the Assistant at work: grapes + shimmering step words ──────── */
  --grape:       #6E0A26;   /* the cluster                                */
  --grape-glint: #F1C763;   /* light catching three grapes                */
  --grape-vine:  #87570F;   /* stem + tendril                             */
  --shimmer:     #A8102C;   /* the band of color sweeping a working step  */

  /* ── derived ───────────────────────────────────────────────────── */
  --border: color-mix(in srgb, var(--ink) 13%, transparent);
  --muted:  color-mix(in srgb, var(--ink) 64%, transparent);
  --peach-subtle: color-mix(in srgb, var(--peach-deep) 10%, var(--surface));
  --sage-subtle:  color-mix(in srgb, var(--sage) 26%, var(--surface));
  --shadow: 0 1px 0 rgb(255 255 255 / .6) inset, 0 18px 40px -30px rgb(60 10 20 / .45), 0 0 0 1px rgb(42 13 21 / .04);

  /* ── 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:          #24080F;
    --bg-2:        #160509;
    --surface:     #33101A;
    --surface-2:   #3F1520;
    --ink:         #F6E7C8;
    --peach:       #F1C763;
    --peach-deep:  #F2576F;
    --sage:        #F1C763;
    --sage-deep:   #F1C763;
    --panel:       #160509;
    --on-peach:    #24080F;
    --on-sage:     #24080F;
    --peach-hover: #F6D47F;

    --word-orchard: #F6E7C8;

    --grape:       #C8506A;
    --grape-glint: #F6E7C8;
    --grape-vine:  #F1C763;
    --shimmer:     #F1C763;
  }
}
:root[data-theme="dark"] {
  --bg:          #24080F;
  --bg-2:        #160509;
  --surface:     #33101A;
  --surface-2:   #3F1520;
  --ink:         #F6E7C8;
  --peach:       #F1C763;
  --peach-deep:  #F2576F;
  --sage:        #F1C763;
  --sage-deep:   #F1C763;
  --panel:       #160509;
  --on-peach:    #24080F;
  --on-sage:     #24080F;
  --peach-hover: #F6D47F;

  --word-orchard: #F6E7C8;

  --grape:       #C8506A;
  --grape-glint: #F6E7C8;
  --grape-vine:  #F1C763;
  --shimmer:     #F1C763;
}

*, *::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__note { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.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 {
  min-width: 0;   /* let the box shrink on phones instead of wrapping the row */
  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 icon buttons in the composer: camera (left of the box), New Chat (right of Send). */
.composer-icon {
  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-icon:hover { color: var(--peach-deep); border-color: var(--peach); background: var(--surface-2); }
.composer-icon:disabled { opacity: 0.5; cursor: not-allowed; }
.composer-icon svg { display: block; }

/* ── bottle photos: staged strip above the box, thumbs in the sent bubble ── */
.composer { flex-wrap: wrap; }
.photo-strip { flex-basis: 100%; }
.photo-thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.msg__body .photo-thumbs { margin-bottom: 0.4rem; }
.photo-thumb {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb__remove {
  position: absolute; top: 3px; right: 3px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 70%, transparent);
  color: #fff; font-size: 0.75rem; line-height: 1;
  cursor: pointer;
}
.photo-intro { color: var(--muted); margin: 0 0 1.2rem; line-height: 1.5; }
.photo-choices { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.2rem; }
.photo-choices .btn { flex: 1 1 auto; }

@media (max-width: 640px) {
  .msg, .widget { max-width: 92%; }
}
/* Small phones: the header (wordmark + Manager/Staff toggle + Logout) has to fit
   ~360px, so tighten spacing and type rather than letting Logout run off-screen. */
@media (max-width: 520px) {
  .chat-header { gap: 0.5rem; }
  .chat-brand { font-size: 1.15rem; }
  .chat-brand .brand-word { margin: 0 0.12em; }
  .mode-toggle button { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
  .chat-new { padding: 0.4rem 0.75rem; font-size: 0.85rem; white-space: nowrap; }
}
@media (max-width: 360px) {   /* the smallest phones (e.g. 320px iPhone SE) */
  .chat-header { gap: 0.35rem; }
  .chat-brand { font-size: 1rem; }
  .mode-toggle button { padding: 0.3rem 0.5rem; font-size: 0.8rem; }
  .chat-new { padding: 0.35rem 0.55rem; font-size: 0.8rem; }
}

/* ════════════════════════════════════════════════════════════════════════
   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); }
/* margin-top: auto pins the price to the card's bottom, so prices line up across a row. */
.wine-card__price { display: block; margin-top: auto; padding-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); }
.glance span { display: block; }
.sheet-price { font-weight: 700; color: var(--peach-deep); margin-bottom: 1.2rem; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* Producer link (wine card) → producer card. */
.producer-link {
  background: none; border: none; padding: 0; font: inherit; text-align: left; cursor: pointer;
  color: var(--peach-deep); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.producer-link::after { content: "›"; display: inline-block; margin-left: 0.3rem; text-decoration: none; }
.producer-link:hover { color: var(--peach); }
.producer-body { margin-bottom: 1.2rem; }
.producer-h {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--sage-deep); margin: 0 0 0.4rem;
}
.producer-notes { margin: 0 0 1.3rem; line-height: 1.55; }
.producer-wines { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.producer-h__note { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--ink); }

/* ── 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; }
/* A fixed-width price slot keeps the vintages beside it in one straight column. */
.wine-row__price { font-weight: 700; font-size: 0.92rem; color: var(--peach-deep); white-space: nowrap; min-width: 6.5rem; text-align: right; }
.price-unit { font-size: 0.7em; font-weight: 600; letter-spacing: 0.03em; opacity: 0.8; }
/* Phones: the vintage tucks under the price, so the name column keeps its width. */
@media (max-width: 520px) {
  .wine-row { gap: 0.7rem; padding: 0.75rem 0.9rem; }
  .wine-row__right { flex-direction: column-reverse; align-items: flex-end; gap: 0.1rem; }
  .wine-row__vintage { font-size: 0.8rem; }
  .wine-row__price { min-width: 0; }
}

@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;
}
/* No label yet: a quiet dashed frame in the thumbnail's place, so rows stay aligned. */
.label-ph {
  display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  border: 1.5px dashed color-mix(in srgb, var(--ink) 18%, transparent);
}
.label-ph__text {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.wine-row__thumb .label-ph__text { display: none; }  /* too small for words */
.wl-cell--label { width: 1%; padding-right: 0.2rem !important; }
.wl-cell--label .wine-row__thumb { display: block; }
.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).
   ════════════════════════════════════════════════════════════════════════ */

/* Undo / Redo: their own line under the hint; small and quiet, greyed out until there's a step. */
.wl-undo { display: flex; gap: 0.35rem; margin: 0.2rem 0 0 -0.45rem; }
.wl-undo__btn {
  background: none; border: none; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--ink);
  padding: 0.2rem 0.45rem; border-radius: 6px;
}
.wl-undo__btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.wl-undo__btn:disabled { color: var(--muted); opacity: 0.45; cursor: default; }
.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; }
/* Menu view: the type heading folds its table away (like the staff list). */
.wl-section__toggle { width: 100%; border: none; border-bottom: 1px solid var(--border); color: var(--ink); text-align: left; cursor: pointer; }
.wl-section__toggle:hover { background: color-mix(in srgb, var(--sage) 22%, var(--surface)); }
.wl-section__toggle .cat-header__caret { transform: rotate(90deg); }
.wl-section.is-collapsed .wl-section__toggle { border-bottom: none; }
.wl-section.is-collapsed .wl-section__toggle .cat-header__caret { transform: none; }
.wl-section.is-collapsed .wl-scroll { display: none; }

/* 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; }
/* Set widths so a price or year box being edited fits without widening its column. */
.wl-cell--vintage { width: 4.75rem; }
.wl-cell--btg_price, .wl-cell--btb_price { width: 5.5rem; }
.wl-cell--btg_price .wl-val, .wl-cell--btb_price .wl-val { color: var(--peach-deep); font-weight: 700; }
.wl-cell--toggle { width: 1%; padding-left: 0 !important; padding-right: 0 !important; }

/* 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); }
/* While editing, the input floats over the cell; the stored text stays underneath,
   invisible, so the column keeps its width and nothing on the page moves. */
.wl-editing { position: relative; }
.wl-editing > .wl-val { visibility: hidden; }
.wl-editing > .wl-input {
  position: absolute; left: 0.2rem; right: 0.2rem; top: 50%; transform: translateY(-50%);
  width: auto; min-width: 0;
}

.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-full-btn { align-self: flex-start; }
.wl-all-btn { font-family: var(--font-body); flex-shrink: 0; }
.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; }
.toast { max-width: calc(100vw - 2rem); width: max-content; text-align: center; }
.toast--action.is-show { pointer-events: auto; display: flex; align-items: center; gap: 0.9rem; }
.toast__action {
  font: inherit; font-weight: 700;
  background: transparent; color: inherit;
  border: 1px solid currentColor; border-radius: var(--pill);
  padding: 0.25rem 0.85rem;
  cursor: pointer;
}

/* ── Wine List: tick boxes + the bulk action bar ──────────────────────── */
.wl-cell--pick { width: 1%; padding-right: 0.25rem !important; }
.wl-check { width: 18px; height: 18px; accent-color: var(--sage-deep); cursor: pointer; vertical-align: middle; }
.wl-row.is-selected > td { background: color-mix(in srgb, var(--sage) 10%, transparent); }
.wl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.6rem; }
.wl-actions__count { font-weight: 700; margin-right: 0.3rem; }

/* Wine List view switch: quiet text links under the search ("On the menu · Archived · Recently deleted"). */
.wl-views { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0.55rem 0 0.15rem; font-size: 0.88rem; }
.wl-view {
  font: inherit; color: var(--muted);
  background: none; border: none; cursor: pointer;
  padding: 0.15rem 0.05rem; border-bottom: 2px solid transparent;
}
.wl-view:hover { color: var(--ink); }
.wl-view.is-active { color: var(--ink); font-weight: 700; border-bottom-color: var(--peach); }
.wl-views__sep { color: var(--muted); opacity: 0.6; }
.wl-cell--date { white-space: nowrap; color: var(--muted); font-size: 0.88rem; }
.wl-readonly-note { margin: 0; font-size: 0.85rem; color: var(--muted); font-style: italic; }
.wl-touch-hint { display: none; flex-basis: 100%; margin: 0.1rem 0 0; font-size: 0.8rem; color: var(--muted); }
@media (hover: none) { .wl-touch-hint { display: block; } }
.choice-text { white-space: pre-line; color: var(--ink); line-height: 1.5; margin: 0 0 1.3rem; }

/* Hover / keyboard-focus explainer for a button (text from its data-tip). */
.has-tip { position: relative; }
.has-tip::after {
  content: attr(data-tip);
  position: absolute; left: 0; top: calc(100% + 0.5rem); z-index: 20;
  width: max-content; max-width: min(17rem, 80vw);
  padding: 0.55rem 0.8rem; border-radius: 10px;
  background: var(--panel); color: #F4ECE0;
  font-size: 0.85rem; font-weight: 600; line-height: 1.4; text-align: left; white-space: normal;
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--ink) 70%, transparent);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.15s 0.25s;    /* small delay so it doesn't flash on a quick pass */
}
.has-tip:hover::after, .has-tip:focus-visible::after { opacity: 1; visibility: visible; }
@media (hover: none) { .has-tip::after { display: none; } }   /* touch: no hover, the confirm explains */

@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));
}

/* ── auto mode ────────────────────────────────────────────────────────── */
/* Progress banner under the manager tabs: running / questions waiting / interrupted / finished. */
.auto-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem;
  margin-top: 0.6rem; padding: 0.55rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--sage) 45%, transparent);
  border-radius: var(--radius);
  background: var(--sage-subtle);
  font-size: 0.9rem;
}
.auto-banner__text { flex: 1 1 14rem; font-weight: 600; color: var(--ink); }
.auto-banner__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.auto-banner__close { padding-inline: 0.7rem; }

.widget--auto { background: var(--sage-subtle); border-color: color-mix(in srgb, var(--sage) 45%, transparent); }
.auto-questions { max-width: min(42rem, 100%); }
.auto-list { margin: 0 0 0.9rem; padding-left: 1.2rem; line-height: 1.55; font-size: 0.95rem; }
.auto-explain { margin: 0 0 0.9rem; font-size: 0.93rem; line-height: 1.5; }
.auto-explain p { margin: 0 0 0.35rem; }
.auto-summary { margin: 0 0 0.9rem; font-weight: 600; }
.auto-continue { min-width: 14rem; }

/* One set-aside question in the end-of-run panel. */
.q-card {
  margin: 0 0 0.8rem; padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.q-card__title { font-weight: 700; margin-bottom: 0.35rem; }
.q-card__question { margin: 0 0 0.7rem; color: var(--muted); font-size: 0.93rem; }
.q-card .widget__note { margin: 0.6rem 0 0; font-size: 0.85rem; }
.q-card__done { color: var(--sage-deep); font-weight: 600; font-size: 0.93rem; }
.q-card__change {
  margin-left: 0.5rem; font: inherit; font-weight: 600; color: var(--muted);
  background: none; border: none; text-decoration: underline; cursor: pointer;
}
/* Option buttons can carry long wine names: let them wrap rather than overflow. */
.widget__actions--stack .btn { white-space: normal; text-align: left; }

/* Send becomes Stop while auto mode is offered / running / asking. */
.composer-stop { flex-shrink: 0; }

/* Needs review: what each wine is still missing. */
.wl-cell--marks { white-space: normal; }
.wl-mark {
  display: inline-block; margin: 0.1rem 0.25rem 0.1rem 0;
  padding: 0.1rem 0.5rem; border-radius: var(--pill);
  background: var(--peach-subtle); color: var(--peach-deep);
  font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}

@media (max-width: 520px) {
  .widget { max-width: 100%; }
  .auto-continue { min-width: 0; width: 100%; }
}

/* ── Wine List label picker ───────────────────────────────────────────── */
.wl-label-btn {
  display: block; padding: 0; border: none; background: none; cursor: pointer;
  border-radius: 6px; transition: box-shadow 0.12s;
}
.wl-label-btn:hover, .wl-label-btn:focus-visible { box-shadow: 0 0 0 2px var(--peach); outline: none; }
.label-search { margin-bottom: 1rem; }
.label-wait { display: flex; align-items: center; gap: 0.6rem; }
.spinner {
  width: 1.1rem; height: 1.1rem; flex-shrink: 0; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--sage) 25%, transparent);
  border-top-color: var(--sage);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ── Photo intake: thumbnail verdicts + the confirm checklist ─────────── */
.photo-fig { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 72px; }
.photo-tag {
  font-size: 0.68rem; font-weight: 700; line-height: 1.2; text-align: center;
  color: var(--sage-deep); background: var(--surface);   /* a pill: readable on the dark "You" bubble */
  padding: 1px 6px; border-radius: 8px; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.photo-tag--skip { color: var(--peach-deep); }
.photo-retry {
  font: inherit; font-size: 0.7rem; font-weight: 700; cursor: pointer;
  padding: 2px 8px; border-radius: var(--pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
}
.photo-retry:disabled { opacity: 0.5; cursor: default; }
.pc-prices { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.7rem; font-weight: 600; font-size: 0.93rem; }
.pc-rows { display: flex; flex-direction: column; gap: 0.35rem; margin: 0 0 0.9rem; }
.pc-row {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.5rem 0.7rem; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.93rem; cursor: pointer;
}
.pc-row input[type="checkbox"] { margin-top: 0.2rem; flex-shrink: 0; }
.pc-row--unclear { border-color: color-mix(in srgb, var(--peach) 45%, var(--border)); cursor: default; }
.pc-row--changed, .pc-row--added { border-color: var(--sage); box-shadow: 0 0 0 1px var(--sage); }
.pc-flag { color: var(--peach-deep); font-weight: 700; }
.pc-body { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; min-width: 0; }
.pc-title { font-weight: 600; }
.pc-note { font-size: 0.82rem; color: var(--muted); }
.pc-price { white-space: nowrap; font-weight: 700; color: var(--peach-deep); font-size: 0.88rem; }
.pc-name {
  font: inherit; font-size: 0.9rem; padding: 0.35rem 0.55rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--ink);
}
.pc-explain {
  display: block; margin-top: 0.7rem; padding: 0; border: none; background: none;
  font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--sage-deep); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.pc-explain:disabled { opacity: 0.5; cursor: default; }

/* ════════════════════════════════════════════════════════════════════════
   LANDING LOOK — the app dressed like www.backwaiter.com (landing/styles.css).
   Style only: same layout, same words, same buttons. Later rules here win
   over the ones above without touching them.
   ════════════════════════════════════════════════════════════════════════ */

/* Paper that warms toward the bottom of the screen, like the landing's afternoon. */
body, body:has(.chat-app) { background: linear-gradient(180deg, var(--bg), var(--bg-2)) fixed var(--bg); }
::selection { background: color-mix(in srgb, var(--sage) 60%, transparent); color: var(--ink); }
:focus-visible { outline: 3px solid var(--peach-deep); outline-offset: 2px; }

/* Display type: the landing's tight, heavy Fraunces. */
.widget__title, .sheet-title, .cat-header, .wl-section__head,
.wine-card__name, .lifecycle-name, .login-title { letter-spacing: -0.015em; }
.widget__title { font-size: 1.3rem; font-weight: 650; line-height: 1.15; }
.sheet-title { font-size: 1.9rem; font-weight: 650; letter-spacing: -0.025em; line-height: 1.05; font-variation-settings: "opsz" 144; }
.cat-header { font-size: 1.35rem; font-weight: 650; }
.wl-section__head { font-size: 1.3rem; font-weight: 650; }
.wine-card__name { font-size: 1.28rem; font-weight: 650; }

/* Wordmark: ink word, ruby braces (as on the landing header). */
.chat-brand { font-weight: 550; letter-spacing: -0.01em; }
.chat-brand .brand-word { color: var(--ink); }
.chat-brand .brand-brace { color: var(--peach-deep); }

/* Buttons: burgundy pills with the landing's soft shadow; gold is the second button. */
.btn { transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary, .btn--on-dark {
  background: var(--peach); border-color: var(--peach); color: var(--on-peach);
  box-shadow: 0 1px 0 rgb(255 255 255 / .18) inset, 0 6px 18px -8px rgb(89 1 26 / .6);
}
.btn--primary:hover { background: var(--peach-hover); border-color: var(--peach-hover); }
.btn--sage {
  background: var(--sage); border-color: var(--sage); color: var(--on-sage);
  box-shadow: 0 6px 18px -10px rgb(160 110 20 / .7);
}
.btn--sage:hover { background: #F6D47F; border-color: #F6D47F; }
/* A quieter gold for a third choice next to a strong pair (the review's "Other"):
   the same tone, as a tint instead of a fill. */
.btn--soft-gold {
  background: var(--sage-subtle); color: var(--on-sage); box-shadow: none;
  border-color: color-mix(in srgb, var(--sage) 70%, transparent);
}
.btn--soft-gold:hover { background: color-mix(in srgb, var(--sage) 40%, var(--surface)); border-color: var(--sage); }
.btn--ghost { border-color: color-mix(in srgb, var(--ink) 55%, transparent); }
.btn--ghost:hover { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }

/* Header toggle + tabs: burgundy for "you are here", a ruby underline like the landing's. */
.mode-toggle { background: var(--surface-2); }
.mode-toggle button.is-active, .view-btn.is-active, .cat-tab.is-active {
  background: var(--peach); border-color: var(--peach); color: var(--on-peach);
  box-shadow: 0 4px 12px -6px rgb(89 1 26 / .6);
}
.staff-tab { border-bottom-width: 3px; }
.staff-tab.is-active { border-bottom-color: var(--peach-deep); }
.wl-view.is-active { border-bottom-color: var(--peach-deep); }

/* Small labels: the same words, in the landing's quiet italic instead of caps. */
.msg__role {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 0.9rem; text-transform: none; letter-spacing: 0;
}
.wine-grid dt, .sheet-facts dt {
  font-family: var(--font-display); font-style: italic; font-weight: 400; color: var(--muted);
}
.wl-table th, .wl-field__label, .producer-h, .wine-card__type, .label-badge, .label-ph__text {
  text-transform: none; letter-spacing: 0;
}
.wl-table th { font-size: 0.85rem; font-weight: 600; }
.wl-field__label, .producer-h { font-size: 0.88rem; }
.wine-card__type { font-size: 0.78rem; background: var(--sage-subtle); color: var(--sage-deep); }

/* Chat bubbles: your messages in burgundy, backwaiter's on paper. */
.msg--user .msg__body { background: var(--peach); color: var(--on-peach); }
.msg--assistant .msg__body, .widget { box-shadow: var(--shadow); }
.widget { border-radius: var(--radius-lg); padding: 1.3rem 1.45rem; }
.widget--duplicate { background: var(--peach-subtle); border-color: color-mix(in srgb, var(--peach-deep) 45%, transparent); }
.widget--producer, .widget--auto { background: var(--sage-subtle); border-color: color-mix(in srgb, var(--sage) 70%, transparent); }

/* Cards, lists, tables: crisp paper on the warm page. */
.wine-card, .cat-section, .wl-section { box-shadow: var(--shadow); }
.cat-section.is-open .cat-header, .wl-section__head { background: var(--sage-subtle); }
.cat-header__caret, .wl-caret { color: var(--peach-deep); }
.cat-header__count { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--muted); }
.wine-row__name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.wine-row:hover, .wl-editable:hover { background: color-mix(in srgb, var(--sage) 20%, transparent); }
.wl-cell--wine_name { font-family: var(--font-display); font-weight: 600; }
.catalog-search, .composer textarea { box-shadow: var(--shadow); }
.catalog-search:focus, .composer textarea:focus { border-color: var(--peach-deep); }

/* Gold for "look at this", ruby for "this is missing". */
.auto-banner {
  background: var(--sage-subtle);
  border-color: color-mix(in srgb, var(--sage) 75%, transparent);
  box-shadow: var(--shadow);
}
.wl-mark { background: var(--peach-subtle); color: var(--peach-deep); }
.wl-check { accent-color: var(--peach); }
.label-card.is-best { border-color: var(--peach-deep); box-shadow: 0 0 0 2px var(--peach-deep); }
.label-badge, .toast--error { background: var(--peach-deep); color: #fff; }

/* Producer links: the landing's underline. */
.producer-link { text-decoration-thickness: 1.5px; text-underline-offset: 4px; }

/* Toasts + tooltips: night, with candle-gold actions. */
.toast, .has-tip::after { background: var(--panel); color: #F6E7C8; }
.toast__action { color: var(--sage); }

/* Wine sheet: lifted like the landing's phone frame. */
.sheet { box-shadow: 0 -10px 60px -20px rgb(22 5 9 / .55); }
.sheet-overlay { background: color-mix(in srgb, #24080F 55%, transparent); }

/* Prices in the burgundy of the buttons: ruby stays for links and warnings. */
.wine-row__price, .wine-card__price, .sheet-price, .pc-price,
.wl-cell--btg_price .wl-val, .wl-cell--btb_price .wl-val { color: var(--peach); }

/* Wine List "Help" right after Redo: the old hint paragraph, shown on hover or tap. */
/* The explainer hangs from the start of the whole Undo line, so it never runs off a phone screen. */
.wl-undo { position: relative; }
.wl-help { position: static; color: var(--muted); }
.wl-help:hover, .wl-help.is-open { color: var(--ink); }
.wl-help::after { left: 0.45rem; max-width: min(24rem, calc(100% - 0.45rem)); }
.has-tip.is-open::after { display: block; opacity: 1; visibility: visible; transition: none; }

/* ── In-app camera: full screen, the viewfinder fills it ───────────────── */
.camera-overlay {
  position: fixed; inset: 0; z-index: 300; display: none;
  background: #000; color: #fff;
}
.camera-overlay.is-open { display: block; }
.camera-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.camera-flash.is-flashing { animation: camera-flash 0.35s ease-out; }
@keyframes camera-flash { from { opacity: 0.85; } to { opacity: 0; } }

.camera-top, .camera-bottom {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 0.8rem;
  padding: max(0.9rem, env(safe-area-inset-top)) 1rem 0.9rem;
}
.camera-top { top: 0; background: linear-gradient(rgb(0 0 0 / .55), transparent); }
.camera-bottom {
  bottom: 0; justify-content: space-between;
  padding: 1rem 1.1rem max(1.3rem, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgb(0 0 0 / .6));
}
.camera-close {
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: rgb(0 0 0 / .45); color: #fff; font-size: 1.2rem;
}
.camera-count { font-weight: 600; font-size: 0.95rem; text-shadow: 0 1px 4px rgb(0 0 0 / .6); }

/* The shutter: a white ring around a white disc, centred between the shots and Done. */
.camera-shutter {
  position: absolute; left: 50%; bottom: max(1.1rem, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: 74px; height: 74px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 5px solid rgb(255 255 255 / .45); background-clip: padding-box;
  box-shadow: 0 0 0 3px #fff;
}
.camera-shutter:active { transform: translateX(-50%) scale(0.92); }
.camera-shots { display: flex; gap: 0.35rem; max-width: calc(50% - 62px); overflow-x: auto; scrollbar-width: none; }
.camera-shot { flex: none; width: 40px; height: 52px; padding: 0; border: 2px solid #fff; border-radius: 6px; overflow: hidden; background: #000; cursor: pointer; }
.camera-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-done { flex: none; min-width: 6.5rem; justify-content: center; }

@media (prefers-reduced-motion: reduce) { .camera-flash.is-flashing { animation-duration: 0.01s; } }


/* ════════════════════════════════════════════════════════════════════════
   THE ASSISTANT AT WORK — typed greeting, Add Wine / Learn More, the step
   line (grapes + a shimmering lowercase word), the step trail, the glowing
   pressed button, and "Begin New Chat".
   ════════════════════════════════════════════════════════════════════════ */

/* Add Wine / Learn More: suggested starts under the greeting, stacked like a chat
   app's starter prompts, all in the same quiet outline. */
.widget--intro { background: none; border: 0; box-shadow: none; padding: 0; }
.suggestions { flex-direction: column; align-items: stretch; width: min(100%, 17rem); gap: 0.5rem; }
.widget__actions .btn.suggestion { justify-content: flex-start; text-align: left; padding: 0.6rem 1.15rem; }

@keyframes intro-in { from { opacity: 0; transform: translateY(6px); } }

/* One turn: messages as paragraphs, progress as steps. */
.msg__body--turn { display: flex; flex-direction: column; gap: 0.45rem; min-width: 12rem; }
.msg__body--turn:empty { display: none; }
.turn-text { margin: 0; white-space: pre-wrap; }
.turn-text--error { color: var(--peach-deep); }

/* The step on screen: grapes + a lowercase italic word with a band of color
   sweeping through it (Cloudflare's agent was the inspiration). */
.step-live { display: flex; align-items: flex-start; gap: 0.5rem; }
.step-live__words { display: flex; flex-direction: column; min-width: 0; }
.step-live__label {
  font-family: var(--font-display); font-style: italic; font-size: 1rem; line-height: 1.35;
  color: transparent;
  background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 38%, var(--shimmer) 50%,
                              var(--muted) 62%, var(--muted) 100%) 0 0 / 250% 100%;
  -webkit-background-clip: text; background-clip: text;
  animation: step-shimmer 1.6s linear infinite;
}
@keyframes step-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.step-live__detail {
  font-size: 0.8rem; line-height: 1.35; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32rem;
}
.step-live__detail.is-hidden { display: none; }

.grapes { width: 1.4rem; height: 1.4rem; flex-shrink: 0; transform-origin: 54% 10%;
          animation: grapes-sway 3.2s ease-in-out infinite; }
.grapes__fruit circle { fill: var(--grape); stroke: var(--surface); stroke-width: 0.7; }
.grapes__glint circle { fill: var(--grape-glint); opacity: 0.9; }
.grapes__vine { fill: none; stroke: var(--grape-vine); stroke-width: 1.3; stroke-linecap: round; }
@keyframes grapes-sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

/* The wine bottle (wine proposal / new-vintage cards): same palette as the grapes. */
.bottle { width: 1.3em; height: 1.3em; flex-shrink: 0; vertical-align: -0.2em; margin-right: 0.35em; }
.bottle__glass { fill: var(--grape); }
.bottle__foil { fill: var(--grape-glint); }
.bottle__label { fill: var(--surface); }   /* white, like the message bubbles */
.bottle__label-rule { fill: none; stroke: var(--grape); stroke-width: 0.7; stroke-linecap: round; opacity: 0.6; }
.bottle__shine { fill: none; stroke: var(--surface); stroke-width: 0.9; stroke-linecap: round; opacity: 0.55; }

/* Finished steps: a quiet trail, one line each (hover for the whole line). */
.step-trail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.step-trail li {
  font-size: 0.8rem; line-height: 1.4; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34rem;
}
.step-trail li::before { content: "→ "; opacity: 0.7; }

/* The button you tapped: greyed out, with light slowly passing across it until
   the turn is done; then it stays grey so you can see what you picked. */
.widget.is-spent:has(.is-working) { opacity: 0.85; }
.btn.is-working, .btn.is-working:disabled {
  opacity: 1; cursor: progress; color: var(--muted); border-color: var(--border); box-shadow: none;
  background: linear-gradient(100deg,
      color-mix(in srgb, var(--ink) 9%, var(--surface)) 32%,
      color-mix(in srgb, var(--sage) 75%, var(--surface)) 50%,
      color-mix(in srgb, var(--ink) 9%, var(--surface)) 68%) 0 0 / 300% 100%;
  animation: btn-glint 2.2s ease-in-out infinite;
}
@keyframes btn-glint { from { background-position: 100% 0; } to { background-position: 0 0; } }
.btn.is-chosen, .btn.is-chosen:disabled {
  opacity: 1; color: var(--muted); border-color: var(--border); box-shadow: none;
  background: color-mix(in srgb, var(--ink) 8%, var(--surface));
}

/* "Begin New Chat": a quiet link-style button under a finished task. */
.fresh-offer { align-self: flex-start; animation: intro-in 0.5s ease-out both; }
.fresh-offer__btn {
  font: inherit; font-size: 0.88rem; color: var(--peach-deep); background: none;
  border: 1px dashed color-mix(in srgb, var(--peach-deep) 45%, transparent);
  border-radius: var(--pill); padding: 0.35rem 0.95rem; cursor: pointer;
}
.fresh-offer__btn:hover { background: var(--peach-subtle); border-style: solid; }

@media (prefers-reduced-motion: reduce) {
  .step-live__label { animation: none; color: var(--muted); background: none; }
  .grapes, .btn.is-working, .fresh-offer { animation: none; }
}
