/* ==========================================================================
   Queen B Herbals — Tea Concierge
   Brand system from docs/brand_style_report.md
   Playfair Display (headlines) · Crimson Text (body) · Poppins (UI)
   ========================================================================== */

:root {
  /* Palette */
  --forest:        #1d5527;
  --forest-deep:   #143d1c;
  --sage:          #c0c596;
  --sage-soft:     #d4d8b4;
  --cream:         #f3f1e3;
  --cream-card:    #fbfaf3;
  --ink:           #222529;
  --ink-soft:      #4a4d44;
  --muted:         #84897a;
  --red:           #e24e54;
  --honey:         #e6a52e;
  --line:          #e3e2d2;
  --white:         #ffffff;

  /* Type */
  --f-head: 'Playfair Display', Georgia, serif;
  --f-body: 'Crimson Text', Georgia, serif;
  --f-ui:   'Poppins', system-ui, -apple-system, sans-serif;

  /* Shape */
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 5px 25px 0 rgba(29, 47, 24, 0.10);
  --shadow-card: 0 2px 12px 0 rgba(29, 47, 24, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--f-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--sage-soft) 0%, rgba(212,216,180,0) 55%),
    linear-gradient(180deg, var(--cream) 0%, #ece9d8 100%);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: clamp(0px, 3vw, 48px);
  min-height: 100vh;
}

/* Faint botanical texture behind the card */
.bg-botanical {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 22%, rgba(29,85,39,0.05) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 70%, rgba(29,85,39,0.04) 0 2px, transparent 3px),
    radial-gradient(circle at 40% 88%, rgba(230,165,46,0.05) 0 3px, transparent 4px);
  background-size: 220px 220px, 300px 300px, 260px 260px;
  z-index: 0;
}

/* ===== Concierge card ===== */
.concierge {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  /* Cap the card to the viewport (minus body padding) so the chat log scrolls
     inside it instead of the whole card growing without bound. */
  max-height: calc(100vh - 2 * clamp(0px, 3vw, 48px));
  display: flex;
  flex-direction: column;
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  min-height: min(820px, calc(100vh - 96px));
}

/* ===== Header ===== */
.concierge__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: var(--white);
  position: relative;
}
.concierge__header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--honey), var(--sage), var(--honey));
  opacity: 0.8;
}

.header__brand { display: flex; align-items: center; gap: 14px; }

.header__avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--cream-card);
  border: 2px solid rgba(255,255,255,0.55);
  display: grid; place-items: center;
  overflow: hidden;
  flex: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.header__avatar img { width: 90%; height: 90%; object-fit: contain; }

.header__eyebrow {
  margin: 0;
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sage-soft);
}
.header__title {
  margin: 1px 0 0;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.header__status {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #7fd28a;
  box-shadow: 0 0 0 0 rgba(127,210,138,0.6);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(127,210,138,0.55); }
  70% { box-shadow: 0 0 0 7px rgba(127,210,138,0); }
  100% { box-shadow: 0 0 0 0 rgba(127,210,138,0); }
}

/* ===== Chat log ===== */
.chat {
  flex: 1 1 auto;
  /* min-height:0 lets this flex child shrink below its content height so
     overflow-y actually scrolls (without it the card just keeps growing). */
  min-height: 0;
  overflow-y: auto;
  padding: 22px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
.chat::-webkit-scrollbar { width: 8px; }
.chat::-webkit-scrollbar-thumb { background: var(--sage); border-radius: 8px; }
.chat::-webkit-scrollbar-track { background: transparent; }

/* ===== Message rows ===== */
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 92%;
  animation: rise 0.35s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg--bot  { align-self: flex-start; }
.msg--user { align-self: flex-end; flex-direction: row-reverse; }

.msg__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  flex: none;
  overflow: hidden;
  background: var(--sage-soft);
  border: 1.5px solid var(--line);
  display: grid; place-items: center;
}
.msg__avatar img { width: 92%; height: 92%; object-fit: contain; }
.msg--user .msg__avatar { display: none; }

.bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15.5px;
  line-height: 1.6;
  position: relative;
}

.msg--bot .bubble {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
  box-shadow: var(--shadow-card);
}
.msg--user .bubble {
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  color: #f4f3e8;
  border-bottom-right-radius: 5px;
}

/* Markdown inside bot bubbles */
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong { font-weight: 600; color: var(--forest); }
.msg--user .bubble strong { color: #fff; }
.bubble em { font-style: italic; }
.bubble a { color: var(--forest); text-decoration: underline; text-underline-offset: 2px; }
.bubble ul { margin: 6px 0; padding-left: 20px; }
.bubble li { margin: 3px 0; }

/* ===== Audio control on bot messages ===== */
.audio-btn {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--forest);
  background: var(--sage-soft);
  border: 1px solid var(--sage);
  border-radius: 22px;
  padding: 6px 14px 6px 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.audio-btn:hover { background: var(--sage); }
.audio-btn:active { transform: scale(0.97); }
.audio-btn__icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  display: grid; place-items: center;
  flex: none;
}
.audio-btn__icon svg { width: 12px; height: 12px; }
.audio-btn.is-playing .audio-btn__icon { background: var(--red); }
.audio-btn__bars {
  display: inline-flex; align-items: flex-end; gap: 2px; height: 12px;
}
.audio-btn__bars span {
  width: 2px; background: var(--forest); border-radius: 2px; height: 4px;
}
.audio-btn.is-playing .audio-btn__bars span { animation: eq 0.9s ease-in-out infinite; }
.audio-btn.is-playing .audio-btn__bars span:nth-child(2) { animation-delay: 0.15s; }
.audio-btn.is-playing .audio-btn__bars span:nth-child(3) { animation-delay: 0.3s; }
.audio-btn.is-playing .audio-btn__bars span:nth-child(4) { animation-delay: 0.45s; }
@keyframes eq { 0%,100% { height: 3px; } 50% { height: 12px; } }

/* ===== Product cards ===== */
.products {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}
.product {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.product:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}
.product__img {
  width: 72px; height: 72px;
  border-radius: 12px;
  object-fit: cover;
  flex: none;
  background: var(--sage-soft);
  border: 1px solid var(--line);
}
.product__body { flex: 1 1 auto; min-width: 0; }
.product__name {
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 3px;
}
.product__price {
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}
.product__shop {
  flex: none;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--forest);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.1s ease;
}
.product__shop:hover { background: var(--forest-deep); }
.product__shop:active { transform: scale(0.97); }

/* ===== Typing indicator ===== */
.typing .bubble {
  display: inline-flex;
  gap: 5px;
  padding: 14px 18px;
}
.typing__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--sage);
  animation: blink 1.3s infinite ease-in-out both;
}
.typing__dot:nth-child(2) { animation-delay: 0.18s; }
.typing__dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes blink {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== Composer ===== */
.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--cream-card);
}
.composer__input {
  flex: 1 1 auto;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 12px 18px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  /* Textarea: start one line, auto-grow (JS) to ~4 lines, then scroll. */
  resize: none;
  max-height: 118px;
  overflow-y: auto;
}
.composer__input::placeholder { color: var(--muted); font-style: italic; }
.composer__input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(29,85,39,0.12);
}
.composer__send {
  flex: none;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--forest);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.composer__send:hover { background: var(--forest-deep); }
.composer__send:active { transform: scale(0.94); }
.composer__send:disabled { opacity: 0.5; cursor: default; }

/* ===== Footer ===== */
.concierge__footer {
  padding: 12px 20px 16px;
  text-align: center;
  background: var(--cream);
  border-top: 1px solid var(--line);
}
.footer__logo {
  height: 30px;
  width: auto;
  opacity: 0.85;
  margin-bottom: 6px;
}
.footer__disclaimer {
  margin: 0;
  font-family: var(--f-ui);
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 440px;
  margin-inline: auto;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  body { padding: 0; }
  .concierge {
    max-width: 100%;
    min-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .header__title { font-size: 20px; }
  .msg { max-width: 96%; }
  .product { flex-wrap: wrap; }
  .product__shop { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- login page --- */
.login-body {
  align-items: center;
}

.login {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: center;
}

.login__card {
  width: 100%;
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 40px 34px 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* Honey/sage accent rule echoing the concierge header */
.login__card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--honey), var(--sage), var(--honey));
  opacity: 0.85;
}

.login__avatar {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  border: 3px solid var(--sage-soft);
  display: grid; place-items: center;
  overflow: hidden;
  margin: 6px auto 18px;
  box-shadow: 0 4px 16px rgba(29,47,24,0.20);
}
.login__avatar img { width: 78%; height: 78%; object-fit: contain; }

.login__eyebrow {
  margin: 0;
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.login__title {
  margin: 4px 0 0;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--forest);
}
.login__subtitle {
  margin: 10px 0 24px;
  font-family: var(--f-body);
  font-size: 16px;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-soft);
}

.login__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.login__label {
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: -4px;
}
.login__input {
  font-family: var(--f-body);
  font-size: 17px;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.login__input::placeholder { color: var(--muted); font-style: italic; }
.login__input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(29,85,39,0.12);
}

.login__submit {
  font-family: var(--f-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  border: none;
  border-radius: var(--radius-md);
  padding: 13px 20px;
  margin-top: 4px;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.1s ease;
}
.login__submit:hover { filter: brightness(1.08); }
.login__submit:active { transform: scale(0.98); }
.login__submit:disabled { opacity: 0.6; cursor: default; }
.login__submit.is-loading { color: rgba(255,255,255,0.75); }

.login__error {
  margin: 2px 0 0;
  min-height: 1.2em;
  font-family: var(--f-ui);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--red);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.login__error.is-visible { opacity: 1; }

.login__logo {
  height: 30px;
  width: auto;
  opacity: 0.8;
  margin-top: 26px;
}

/* Gentle shake on a wrong word */
.login__card.is-shaking { animation: login-shake 0.5s ease; }
@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-9px); }
  30% { transform: translateX(8px); }
  45% { transform: translateX(-6px); }
  60% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
  90% { transform: translateX(2px); }
}

@media (max-width: 600px) {
  .login-body { padding: 20px; }
  .login__card { padding: 34px 24px 26px; }
  .login__title { font-size: 24px; }
}

/* --- model selector --- */
/* Right-hand header column: the "At your service" status line stacked over the
   model picker. Existing .header__status keeps its own (unchanged) rule. */
.header__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
}

.model-select-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: 210px;
}
.model-select-wrap[hidden] { display: none; }

.model-select__label {
  font-family: var(--f-ui);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage-soft);
  cursor: default;
}

.model-select {
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--forest-deep);
  background-color: var(--cream-card);
  border: 1.5px solid var(--sage);
  border-radius: var(--radius-sm);
  padding: 4px 26px 4px 9px;
  max-width: 100%;
  cursor: pointer;
  /* custom forest chevron; native appearance stripped for cross-browser parity */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath fill='%23143d1c' d='M5 7 0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.model-select:hover { border-color: var(--forest); }
.model-select:focus-visible {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.22);
}
.model-select option {
  color: var(--ink);
  background: var(--cream-card);
}

@media (max-width: 600px) {
  /* Keep the picker compact so the header never wraps on narrow phones. */
  .model-select-wrap { max-width: 158px; }
  .model-select { font-size: 11px; padding: 4px 22px 4px 8px; }
  .model-select__label { font-size: 9px; }
}

/* --- voice selector --- */
/* Sits below the model picker in .header__meta (which stacks its children
   right-aligned). A compact trigger shows the current voice; clicking it opens
   the browsable, grouped voice panel (.voice-panel) below. */
.voice-select-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: 210px;
}
.voice-select-wrap[hidden] { display: none; }

.voice-select__label {
  font-family: var(--f-ui);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage-soft);
  cursor: default;
}

.voice-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--forest-deep);
  background-color: var(--cream-card);
  border: 1.5px solid var(--sage);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.voice-trigger:hover { border-color: var(--forest); background: var(--white); }
.voice-trigger:focus-visible {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.22);
}
.voice-trigger__icon { flex: none; color: var(--forest); }
.voice-trigger__name {
  min-width: 0;
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-trigger__chev { flex: none; color: var(--forest-deep); opacity: 0.8; }

/* Grouped voice panel — a light modal, echoing the persona card's chrome. */
.voice-panel {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 40px);
}
.voice-panel[hidden] { display: none; }
.voice-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 61, 28, 0.42);
  backdrop-filter: blur(2px);
}
body.voice-panel-lock { overflow: hidden; }

.voice-panel__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  max-height: min(84vh, 660px);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(700px 240px at 50% -20%, rgba(212, 216, 180, 0.35) 0%, rgba(212, 216, 180, 0) 60%),
    var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 20px 22px 18px;
  animation: persona-rise 0.26s ease both;
}
.voice-panel__card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--honey), var(--sage), var(--honey));
  opacity: 0.85;
}

.voice-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.voice-panel__eyebrow {
  margin: 0;
  font-family: var(--f-ui);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.voice-panel__title {
  margin: 3px 0 0;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--forest);
}
.voice-panel__close {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.voice-panel__close:hover { background: var(--sage-soft); color: var(--forest); }
.voice-panel__close:active { transform: scale(0.94); }
.voice-panel__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.22);
}

.voice-panel__helper {
  margin: 0 0 12px;
  font-family: var(--f-body);
  font-size: 14px;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-soft);
}

.voice-panel__groups {
  flex: 1 1 auto;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
}
.voice-panel__groups::-webkit-scrollbar { width: 8px; }
.voice-panel__groups::-webkit-scrollbar-thumb { background: var(--sage); border-radius: 8px; }
.voice-panel__groups::-webkit-scrollbar-track { background: transparent; }

.voice-group { margin-bottom: 14px; }
.voice-group:last-child { margin-bottom: 2px; }
.voice-group__label {
  margin: 0 0 6px;
  font-family: var(--f-ui);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  position: sticky;
  top: 0;
  background: var(--cream-card);
  padding: 4px 0;
  z-index: 1;
}
.voice-group__list { display: flex; flex-direction: column; gap: 6px; }

.voice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  padding: 4px 6px 4px 4px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.voice-row:hover { border-color: var(--sage); }
.voice-row.is-selected {
  border-color: var(--forest);
  background: var(--sage-soft);
}

.voice-row__pick {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
}
.voice-row__pick:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.18);
}
.voice-row__check {
  flex: none;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--sage);
  background: var(--cream-card);
  color: #fff;
}
.voice-row__check svg { opacity: 0; transition: opacity 0.12s ease; }
.voice-row.is-selected .voice-row__check {
  background: var(--forest);
  border-color: var(--forest);
}
.voice-row.is-selected .voice-row__check svg { opacity: 1; }

.voice-row__text { min-width: 0; display: flex; flex-direction: column; }
.voice-row__name {
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  color: var(--ink);
}
.voice-row__desc {
  font-family: var(--f-ui);
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Round preview button — forest by default, honey while playing. */
.voice-row__preview {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: var(--cream-card);
  background: var(--forest);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.voice-row__preview:hover { background: var(--honey); }
.voice-row__preview:active { transform: scale(0.92); }
.voice-row__preview:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.22);
}
.voice-row__stop { display: none; }
.voice-row__preview.is-playing { background: var(--honey); }
.voice-row__preview.is-playing .voice-row__play { display: none; }
.voice-row__preview.is-playing .voice-row__stop { display: block; }

@media (max-width: 600px) {
  /* Keep the trigger compact so the header never wraps on narrow phones. */
  .voice-select-wrap { max-width: 168px; }
  .voice-trigger { font-size: 11px; padding: 4px 8px; }
  .voice-trigger__name { max-width: 96px; }
  .voice-select__label { font-size: 9px; }
  .voice-panel__card { padding: 18px 16px 14px; border-radius: var(--radius-md); max-height: 90vh; }
  .voice-panel__title { font-size: 19px; }
}

/* --- persona studio --- */
/* Header entry point: a small, on-brand pill that opens the studio. Sits in the
   right-aligned .header__meta column with the pickers — discoverable but quiet. */
.persona-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f4f3e8;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 22px;
  padding: 5px 12px 5px 10px;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
}
.persona-open:hover { background: rgba(255, 255, 255, 0.20); border-color: rgba(255, 255, 255, 0.6); }
.persona-open:active { transform: scale(0.97); }
.persona-open:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(230, 165, 46, 0.5);
}
.persona-open svg { flex: none; }

/* Modal shell */
.persona-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 40px);
}
.persona-modal[hidden] { display: none; }
.persona-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 61, 28, 0.42);
  backdrop-filter: blur(2px);
}
body.persona-open-lock { overflow: hidden; }

.persona-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: min(88vh, 760px);
  overflow-y: auto;
  background:
    radial-gradient(900px 300px at 50% -20%, rgba(212, 216, 180, 0.35) 0%, rgba(212, 216, 180, 0) 60%),
    var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 22px 24px 24px;
  animation: persona-rise 0.28s ease both;
}
@keyframes persona-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* Honey/sage accent rule echoing the concierge header + login card. */
.persona-card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--honey), var(--sage), var(--honey));
  opacity: 0.85;
}

.persona-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.persona-card__eyebrow {
  margin: 0;
  font-family: var(--f-ui);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.persona-card__title {
  margin: 3px 0 0;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--forest);
}
.persona-card__close {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.persona-card__close:hover { background: var(--sage-soft); color: var(--forest); }
.persona-card__close:active { transform: scale(0.94); }
.persona-card__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.22);
}

.persona-helper {
  margin: 0 0 18px;
  font-family: var(--f-body);
  font-size: 15px;
  font-style: italic;
  line-height: 1.55;
  color: var(--ink-soft);
}

.persona-field { margin-bottom: 16px; }
.persona-label {
  display: block;
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.persona-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.persona-counter {
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.persona-select {
  width: 100%;
  font-family: var(--f-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--forest-deep);
  background-color: var(--white);
  border: 1.5px solid var(--sage);
  border-radius: var(--radius-md);
  padding: 11px 34px 11px 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath fill='%23143d1c' d='M5 7 0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.persona-select:hover { border-color: var(--forest); }
.persona-select:focus-visible {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.18);
}

.persona-text {
  width: 100%;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  resize: vertical;
  min-height: 150px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.persona-text::placeholder { color: var(--muted); font-style: italic; }
.persona-text:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.12);
}
/* Read-only default reads like protected parchment, not a disabled input. */
.persona-text:read-only {
  background: var(--cream);
  color: var(--ink-soft);
  border-style: dashed;
  cursor: default;
}

.persona-readonly-note {
  margin: 8px 0 0;
  font-family: var(--f-ui);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.persona-readonly-note[hidden] { display: none; }
.persona-readonly-note em { color: var(--forest); font-style: italic; font-weight: 500; }

.persona-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 4px;
}
.persona-btn {
  font-family: var(--f-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--forest);
  background: transparent;
  border: 1.5px solid var(--sage);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.1s ease;
}
.persona-btn:hover { background: var(--sage-soft); border-color: var(--forest); }
.persona-btn:active { transform: scale(0.97); }
.persona-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.2);
}
.persona-btn[hidden] { display: none; }

.persona-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  border-color: var(--forest-deep);
}
.persona-btn--primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%); }

.persona-btn--ghost {
  border-color: var(--line);
  color: var(--ink-soft);
}
.persona-btn--ghost:hover { background: var(--cream); border-color: var(--sage); color: var(--forest); }

.persona-btn--danger {
  margin-left: auto; /* nudge the destructive action away from the safe ones */
  border-color: transparent;
  color: var(--red);
}
.persona-btn--danger:hover { background: rgba(226, 78, 84, 0.10); border-color: rgba(226, 78, 84, 0.4); color: var(--red); }

.persona-status {
  margin: 14px 0 0;
  min-height: 1.2em;
  font-family: var(--f-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--forest);
}
.persona-status.is-error { color: var(--red); }

@media (max-width: 600px) {
  .persona-open span { display: inline; }
  .persona-card { padding: 20px 18px 20px; border-radius: var(--radius-md); max-height: 92vh; }
  .persona-card__title { font-size: 21px; }
  .persona-helper { font-size: 14px; }
  .persona-actions { gap: 8px; }
  .persona-btn { flex: 1 1 auto; text-align: center; padding: 11px 12px; }
  .persona-btn--danger { margin-left: 0; flex-basis: 100%; }
}

/* --- header quick-action pills --- */
/* The Personality / Leave-a-note / New-conversation controls share one tidy,
   right-aligned row that wraps gracefully so nothing crowds the header at 380px. */
.header__pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

/* Shared pill look, matching .persona-open (translucent on the forest header)
   so the new controls read as siblings, not developer tools. */
.header-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f4f3e8;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 22px;
  padding: 5px 12px 5px 10px;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.1s ease, opacity 0.18s ease;
}
.header-pill:hover { background: rgba(255, 255, 255, 0.20); border-color: rgba(255, 255, 255, 0.6); }
.header-pill:active { transform: scale(0.97); }
.header-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(230, 165, 46, 0.5);
}
.header-pill svg { flex: none; }

/* Note pill: disabled until a conversation exists (needs a session id). Reads as
   gently unavailable — a soft hint, not a hard error. */
.note-open:disabled {
  cursor: default;
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
}
.note-open:disabled:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.22); }

/* New-conversation: an icon-only round pill — quiet, always available. */
.reset-btn {
  gap: 0;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  justify-content: center;
}
.reset-btn svg { transition: transform 0.4s ease; }
.reset-btn:hover svg { transform: rotate(-90deg); }

/* --- feedback dialog ("Leave us a note") --- */
/* A lighter sibling of the persona modal: same shell, smaller footprint. */
.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vw, 40px);
}
.feedback-modal[hidden] { display: none; }
.feedback-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 61, 28, 0.42);
  backdrop-filter: blur(2px);
}
body.feedback-open-lock { overflow: hidden; }

.feedback-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  max-height: min(88vh, 620px);
  overflow-y: auto;
  background:
    radial-gradient(900px 300px at 50% -20%, rgba(212, 216, 180, 0.35) 0%, rgba(212, 216, 180, 0) 60%),
    var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 22px 24px 24px;
  animation: persona-rise 0.28s ease both;
}
.feedback-card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--honey), var(--sage), var(--honey));
  opacity: 0.85;
}

.feedback-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.feedback-card__eyebrow {
  margin: 0;
  font-family: var(--f-ui);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.feedback-card__title {
  margin: 3px 0 0;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--forest);
}
.feedback-card__close {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.feedback-card__close:hover { background: var(--sage-soft); color: var(--forest); }
.feedback-card__close:active { transform: scale(0.94); }
.feedback-card__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.22);
}

.feedback-helper {
  margin: 0 0 18px;
  font-family: var(--f-body);
  font-size: 15px;
  font-style: italic;
  line-height: 1.55;
  color: var(--ink-soft);
}

.feedback-field { margin-bottom: 16px; }
.feedback-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.feedback-label {
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.feedback-counter {
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.feedback-text {
  width: 100%;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.feedback-text::placeholder { color: var(--muted); font-style: italic; }
.feedback-text:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.12);
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 4px;
}
.feedback-btn {
  font-family: var(--f-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--forest);
  background: transparent;
  border: 1.5px solid var(--sage);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.1s ease, opacity 0.18s ease;
}
.feedback-btn:hover { background: var(--sage-soft); border-color: var(--forest); }
.feedback-btn:active { transform: scale(0.97); }
.feedback-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 85, 39, 0.2);
}
.feedback-btn:disabled { cursor: default; opacity: 0.6; }
.feedback-btn:disabled:hover { background: transparent; border-color: var(--sage); }

.feedback-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%);
  border-color: var(--forest-deep);
}
.feedback-btn--primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--forest) 0%, var(--forest-deep) 100%); }
.feedback-btn--primary:disabled { filter: none; }

.feedback-btn--ghost {
  border-color: var(--line);
  color: var(--ink-soft);
}
.feedback-btn--ghost:hover { background: var(--cream); border-color: var(--sage); color: var(--forest); }

.feedback-status {
  margin: 14px 0 0;
  min-height: 1.2em;
  font-family: var(--f-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--forest);
}
.feedback-status.is-error { color: var(--red); }

@media (max-width: 600px) {
  .feedback-card { padding: 20px 18px 20px; border-radius: var(--radius-md); max-height: 92vh; }
  .feedback-card__title { font-size: 21px; }
  .feedback-helper { font-size: 14px; }
  .feedback-btn { flex: 1 1 auto; text-align: center; padding: 11px 12px; }
}
