/* self-hosted (OFL): the page makes no third-party requests */
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- tokens ----------
   Look: pale blue-grey page, white / frosted surfaces, a dark «ink» pill for the main action, light aqua for
   selected things, large radii and soft shadows. The client's palette is three colors: --brand (icons, links),
   --brand-2 (aqua tints) and --brand-ink (dark pill, monogram letters). */
:root {
  /* defaults only: the page injects :root{--brand;--brand-2;--brand-ink} after this file, so everything below
     derives from these three and must never redeclare them */
  --brand: #1a5fe0;
  --brand-2: #19b5d9;
  --brand-ink: #242a3a;

  /* common.js replaces these with contrast-checked values when the client's palette needs it */
  --ink-l: var(--brand-ink);
  --on-ink-l: #ffffff;
  --brand-text-l: var(--brand);
  --brand-text-d: #b9d3ff;

  /* surfaces and text, light */
  --bg: #edf2f5;
  --card: #ffffff;
  --glass: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.95);
  --panel: #f3f7f9;
  --border: #e0e8ed;
  --field-border: #8493a6;
  --text: #1c2738;
  --muted: #566274;
  --ink: var(--ink-l);
  --on-ink: var(--on-ink-l);
  --brand-text: var(--brand-text-l);
  --focus: var(--brand-text-l);
  --danger: #c0262d;
  --danger-bg: #fdecec;
  --ok: #0b7a47;
  --ok-bg: #e0f4ea;
  --warn: #7a4b00;
  --warn-bg: #fff2d2;
  --shadow: 0 12px 32px rgba(36, 42, 58, 0.08);
  --shadow-sm: 0 4px 16px rgba(36, 42, 58, 0.06);
  --shadow-btn: 0 6px 16px rgba(36, 42, 58, 0.1);
  --ring: rgba(36, 42, 58, 0.28);
  --mono-hi: rgba(255, 255, 255, 0.42);
  --mono-ring: rgba(255, 255, 255, 0.6);
  --haze: rgba(25, 181, 217, 0.2);

  /* shapes */
  --r-card: 28px;
  --r-tile: 20px;
  --r-field: 18px;

  /* plain fallbacks; the color-mix versions below upgrade them */
  --sel: var(--panel);
  --sel-border: var(--border);
  --tint: var(--panel);
  --hero-a: var(--panel);
  --hero-b: var(--panel);

  /* old names the chat code and the visualizer read */
  --primary: var(--ink);
  --primary-ink: var(--on-ink);
  --accent: var(--brand-2);
  --user-bubble: var(--sel);
  --user-border: var(--sel-border);
  --bot-bubble: var(--panel);
  --chip-border: var(--border);
  --orb-bg: #ffffff;
  --orb-shadow: 0 10px 30px rgba(36, 42, 58, 0.12), inset 0 -6px 16px rgba(36, 42, 58, 0.05);
  --viz-a: var(--brand);
  --viz-b: var(--brand-2);
  --viz-glow: 0;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1520;
  --card: #172030;
  --glass: rgba(23, 32, 48, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
  --panel: #1c2739;
  --border: #2a3649;
  --field-border: #6f7f98;
  --text: #e8edf5;
  --muted: #9fabbf;
  --ink: #e8eff6;
  --on-ink: #101828;
  --brand-text: var(--brand-text-d);
  --focus: var(--brand-text-d);
  --danger: #ff8a8a;
  --danger-bg: #3a1a1e;
  --ok: #6ee7a0;
  --ok-bg: #12301f;
  --warn: #ffd37a;
  --warn-bg: #3a2d10;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-btn: 0 6px 16px rgba(0, 0, 0, 0.35);
  --ring: rgba(0, 0, 0, 0.5);
  --mono-hi: rgba(255, 255, 255, 0.07);
  --mono-ring: rgba(255, 255, 255, 0.14);
  --haze: rgba(25, 181, 217, 0.12);
  --orb-bg: #f4f7fb;
  --orb-shadow: 0 0 40px rgba(98, 199, 209, 0.3);
  --viz-glow: 1;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1520; --card: #172030; --glass: rgba(23, 32, 48, 0.8); --glass-border: rgba(255, 255, 255, 0.1);
    --panel: #1c2739; --border: #2a3649; --field-border: #6f7f98; --text: #e8edf5; --muted: #9fabbf;
    --ink: #e8eff6; --on-ink: #101828; --brand-text: var(--brand-text-d); --focus: var(--brand-text-d);
    --danger: #ff8a8a; --danger-bg: #3a1a1e; --ok: #6ee7a0; --ok-bg: #12301f; --warn: #ffd37a; --warn-bg: #3a2d10;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.4); --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-btn: 0 6px 16px rgba(0, 0, 0, 0.35); --ring: rgba(0, 0, 0, 0.5);
    --mono-hi: rgba(255, 255, 255, 0.07); --mono-ring: rgba(255, 255, 255, 0.14); --haze: rgba(25, 181, 217, 0.12);
    --orb-bg: #f4f7fb; --orb-shadow: 0 0 40px rgba(98, 199, 209, 0.3); --viz-glow: 1;
    color-scheme: dark;
  }
}

/* brand-aware tints: one recipe for both themes, because they mix with whatever --card / --bg currently are */
@supports (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --sel: color-mix(in srgb, var(--brand-2) 26%, var(--card));
    --sel-border: color-mix(in srgb, var(--brand-2) 52%, var(--card));
    --tint: color-mix(in srgb, var(--brand-2) 13%, var(--card));
    --hero-a: color-mix(in srgb, var(--brand-2) 32%, var(--card));
    --hero-b: color-mix(in srgb, var(--brand-2) 8%, var(--bg));
    --brand-text-l: color-mix(in srgb, var(--brand) 84%, #000);
    --brand-text-d: color-mix(in srgb, var(--brand) 50%, #fff);
    --haze: color-mix(in srgb, var(--brand-2) 22%, transparent);
    --orb-shadow: 0 10px 30px color-mix(in srgb, var(--brand-ink) 14%, transparent), inset 0 -6px 16px rgba(36, 42, 58, 0.05);
  }
  :root[data-theme="dark"] {
    --sel: color-mix(in srgb, var(--brand-2) 17%, var(--card));
    --sel-border: color-mix(in srgb, var(--brand-2) 38%, var(--card));
    --hero-a: color-mix(in srgb, var(--brand-2) 17%, var(--card));
    --hero-b: color-mix(in srgb, var(--brand-2) 5%, var(--bg));
    --haze: color-mix(in srgb, var(--brand-2) 13%, transparent);
    --orb-shadow: 0 0 40px color-mix(in srgb, var(--brand-2) 32%, transparent);
  }
}
@media (prefers-color-scheme: dark) {
  @supports (color: color-mix(in srgb, red 50%, blue)) {
    :root:not([data-theme="light"]) {
      --sel: color-mix(in srgb, var(--brand-2) 17%, var(--card));
      --sel-border: color-mix(in srgb, var(--brand-2) 38%, var(--card));
      --hero-a: color-mix(in srgb, var(--brand-2) 17%, var(--card));
      --hero-b: color-mix(in srgb, var(--brand-2) 5%, var(--bg));
      --haze: color-mix(in srgb, var(--brand-2) 13%, transparent);
      --orb-shadow: 0 0 40px color-mix(in srgb, var(--brand-2) 32%, transparent);
    }
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.8 "Vazirmatn", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-text); text-underline-offset: 3px; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- shared components ---------- */

/* round white icon button with a soft shadow */
.round-btn, .icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: inline-grid; place-items: center; padding: 0;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-btn); text-decoration: none;
  transition: background-color 160ms ease, transform 120ms ease, border-color 160ms ease;
}
.round-btn svg, .icon-btn svg { width: 21px; height: 21px; }
.round-btn:hover, .icon-btn:hover { background: var(--sel); border-color: var(--sel-border); }
.round-btn:active, .icon-btn:active { transform: scale(0.94); }
.round-btn--ink { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.round-btn--ink:hover { background: var(--ink); filter: brightness(1.2); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.i-muted { display: none; }
#sound[aria-pressed="false"] .i-sound { display: none; }
#sound[aria-pressed="false"] .i-muted { display: block; }

/* pill buttons: dark ink for the main action, aqua tint for the quiet one */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  font-size: 14.5px; font-weight: 500; line-height: 1.3; text-decoration: none; text-align: center;
  box-shadow: var(--shadow-btn);
  transition: background-color 160ms ease, border-color 160ms ease, transform 120ms ease, filter 160ms ease;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:hover { background: var(--sel); border-color: var(--sel-border); }
.btn:active { transform: scale(0.98); }
.btn--ink { background: var(--ink); color: var(--on-ink); border-color: transparent; box-shadow: 0 10px 22px var(--ring); }
.btn--ink:hover { background: var(--ink); border-color: transparent; filter: brightness(1.2); }
.btn--soft { background: var(--sel); border-color: var(--sel-border); box-shadow: none; }
.btn--soft:hover { filter: brightness(0.97); }
.btn--sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn--block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* a doctor's picture: photo when it exists, otherwise a monogram tile that is meant to look designed */
.mono {
  position: relative; flex: none; display: grid; place-items: center; overflow: hidden; isolation: isolate;
  width: 56px; height: 56px; border-radius: 18px; font-size: 26px;
  background: var(--tint);
  background: linear-gradient(155deg, color-mix(in srgb, var(--brand-2) 40%, var(--card)), color-mix(in srgb, var(--brand-2) 12%, var(--bg)));
  color: var(--ink);
}
.mono::before, .mono::after { content: ""; position: absolute; border-radius: 50%; z-index: -1; pointer-events: none; }
.mono::before { width: 90%; aspect-ratio: 1; inset-inline-end: -30%; inset-block-start: -32%; background: var(--mono-hi); }
.mono::after { width: 62%; aspect-ratio: 1; inset-inline-start: -16%; inset-block-end: -24%; border: 1.5px solid var(--mono-ring); }
.mono[data-v="1"] { background: linear-gradient(200deg, color-mix(in srgb, var(--brand) 14%, var(--card)), color-mix(in srgb, var(--brand-2) 22%, var(--bg))); }
.mono[data-v="1"]::before { inset-inline-end: auto; inset-inline-start: -28%; inset-block-start: auto; inset-block-end: -36%; }
.mono[data-v="1"]::after { inset-inline-start: auto; inset-inline-end: -14%; inset-block-end: auto; inset-block-start: -22%; }
.mono[data-v="2"] { background: linear-gradient(160deg, color-mix(in srgb, var(--brand-2) 24%, var(--card)), color-mix(in srgb, var(--brand) 12%, var(--bg))); }
.mono[data-v="2"]::before { width: 70%; inset-inline-end: -12%; inset-block-start: auto; inset-block-end: -30%; }
.mono[data-v="2"]::after { width: 78%; inset-inline-start: -30%; inset-block-end: auto; inset-block-start: -34%; }
.mono[data-v="3"] { background: linear-gradient(130deg, color-mix(in srgb, var(--brand-2) 32%, var(--bg)), color-mix(in srgb, var(--brand-2) 8%, var(--card))); }
.mono[data-v="3"]::before { width: 100%; inset-inline-end: auto; inset-inline-start: -40%; inset-block-start: -40%; }
.mono[data-v="3"]::after { width: 54%; inset-inline-start: auto; inset-inline-end: -12%; inset-block-end: -18%; }
.mono__ini { font-weight: 400; line-height: 1; padding-block-end: 0.06em; }
.mono img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mono.has-photo .mono__ini { visibility: hidden; }
.mono--sm { width: 44px; height: 44px; border-radius: 15px; font-size: 20px; }
.mono--lg { width: 100%; height: 100%; border-radius: inherit; font-size: 92px; }
.mono--lg .mono__ini, .mono--hero .mono__ini { font-weight: 300; }
.mono--hero { width: 132px; height: 164px; border-radius: var(--r-card); font-size: 84px; }

/* text fields: a 3:1 border so the field is findable, generous radius and height */
.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.fld__label { font-size: 13.5px; font-weight: 500; }
.fld__label .opt { color: var(--muted); font-weight: 400; }
.input {
  width: 100%; min-height: 50px; padding: 0 16px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--field-border); border-radius: var(--r-field);
  font-size: 15px; line-height: 1.5;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[dir="ltr"] { text-align: right; }
.fld__hint { font-size: 12.5px; color: var(--muted); }
.fld__err { font-size: 13px; color: var(--danger); font-weight: 500; }

/* ---------- chat ---------- */
.chat {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 14px;
}

.voice { flex: none; display: flex; flex-direction: column; align-items: center; }
.viz { position: relative; width: min(280px, 66vw, 36vh); aspect-ratio: 1; transition: width 300ms ease; }
.viz canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.orb {
  position: absolute; inset: 29%; border-radius: 50%; border: 0;
  display: grid; place-items: center; color: var(--brand-text-l);
  background: radial-gradient(circle at 50% 35%, var(--orb-bg), #e3ebf0 85%);
  box-shadow: var(--orb-shadow);
  transition: transform 200ms ease;
}
.orb:hover { transform: scale(1.03); }
.orb:active { transform: scale(0.97); }
.orb svg { width: 38%; height: 38%; stroke-width: 2.2; }
.status { margin: 2px 0 6px; font-size: 14.5px; font-weight: 500; color: var(--muted); min-height: 1.75em; text-align: center; }
body[data-state="listening"] .status,
body[data-state="thinking"] .status,
body[data-state="answering"] .status { color: var(--brand-text); }
body[data-state="error"] .status { color: var(--danger); }

.thread {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 14px; padding: 6px 4px 12px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}

.msg { display: flex; align-items: flex-start; gap: 10px; max-width: 88%; }
.msg--user { align-self: flex-start; }      /* RTL: start = right */
.msg--bot { align-self: flex-end; flex-direction: row-reverse; }
.bubble {
  padding: 12px 16px 8px; border-radius: 22px; font-size: 15px; line-height: 1.9;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg--user .bubble { background: var(--user-bubble); border: 1px solid var(--user-border); border-start-start-radius: 8px; }
.msg--bot .bubble { background: var(--bot-bubble); border: 1px solid var(--border); border-start-end-radius: 8px; }
.bubble a { color: var(--brand-text); text-underline-offset: 3px; }
.sources { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; white-space: normal; }
.source-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--sel-border); background: var(--sel);
  color: var(--text) !important; text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: filter 200ms ease;
}
.source-btn:hover { filter: brightness(0.96); }
.source-btn svg { width: 16px; height: 16px; flex: none; color: var(--brand-text); }
.meta { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.msg--bot .meta { justify-content: flex-start; }
.meta svg { width: 16px; height: 16px; color: var(--brand-text); }
.bot-icon {
  flex: none; width: 36px; height: 36px; margin-top: 8px; border-radius: 50%; display: grid; place-items: center;
  color: var(--brand-text); border: 1px solid var(--border); background: var(--card);
}
.bot-icon svg { width: 20px; height: 20px; }
.typing .text::after {
  content: ""; display: inline-block; width: 2px; height: 1.05em; margin-inline-start: 2px; vertical-align: -0.18em;
  background: var(--ink); animation: caret 0.9s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.dots { display: inline-flex; gap: 4px; padding: 6px 2px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-2); animation: dot 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* what the assistant attaches to an answer: a doctor card and / or a booking button */
.extras { margin-top: 12px; white-space: normal; }
.dcard {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center;
  padding: 12px; border-radius: var(--r-tile); background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.dcard__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.6; }
.dcard__name { font-size: 14.5px; font-weight: 600; }
.dcard__spec { font-size: 13px; color: var(--brand-text); }
.dcard__role { font-size: 12.5px; color: var(--muted); }
.dcard__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.dcard__actions .btn { flex: 1 1 130px; }
.extras > .btn { width: 100%; }

.chips { flex: none; display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 44px; padding: 0 18px; font-size: 13.5px; font-weight: 500;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-btn);
  transition: border-color 200ms ease, background-color 200ms ease;
}
.chip:hover { border-color: var(--sel-border); background: var(--sel); }

.composer {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 6px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border);
}
.composer input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 10px; border: 0; background: transparent;
  font: inherit; font-size: 15px; color: var(--text);
}
.composer input::placeholder { color: var(--muted); opacity: 1; }
.composer input:focus { outline: none; }
.composer:focus-within { border-color: var(--field-border); background: var(--card); }
.send {
  flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-btn);
  transition: background-color 200ms ease;
}
.send:hover { background: var(--sel); }
.send:disabled { opacity: .5; cursor: not-allowed; }
.send svg { width: 20px; height: 20px; transform: scaleX(-1); }
.mic {
  flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 0;
  background: var(--ink); color: var(--on-ink);
  box-shadow: 0 8px 20px var(--ring);
  transition: transform 150ms ease, box-shadow 200ms ease;
}
.mic:hover { transform: scale(1.04); }
.mic svg { width: 23px; height: 23px; stroke-width: 2; }
.mic[aria-pressed="true"] { animation: ring 1.4s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 var(--ring); } 100% { box-shadow: 0 0 0 14px transparent; } }

/* rating under each answer */
.rate { display: inline-flex; gap: 0; margin-block: -10px; margin-inline-start: auto; }
.rate button {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  background: transparent; border: 0; color: var(--muted); transition: background-color 200ms ease, color 200ms ease;
}
.rate button:hover { background: var(--panel); color: var(--text); }
.rate button[aria-pressed="true"] { color: var(--brand-text); background: var(--sel); }
.rate svg { width: 16px; height: 16px; color: inherit; }
.msg--bot .meta { gap: 8px; }

/* «ویرایش» on questions that came from the microphone; negative margins keep the row short, the hit area 44px */
.edit {
  min-height: 44px; margin-block: -14px; margin-inline-end: auto; padding: 0 8px;
  background: transparent; border: 0; border-radius: 8px; font-size: 12px; font-weight: 500; text-underline-offset: 3px;
  color: var(--muted);
}
.edit:hover { color: var(--text); text-decoration: underline; }
.edit:focus-visible { outline-offset: -2px; } /* stays inside the bubble */

/* ---------- sheets (feedback, microphone) ---------- */
.sheet {
  width: min(480px, calc(100% - 32px)); padding: 0; border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--card); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}
.sheet::backdrop { background: rgba(14, 21, 32, 0.5); backdrop-filter: blur(3px); }
.sheet form { padding: 20px 22px 22px; display: flex; flex-direction: column; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet h2 { margin: 0; font-size: 18px; font-weight: 500; }
.kinds { border: 0; padding: 0; margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.kinds legend { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; padding: 0; }
.kinds label { position: relative; }
.kinds input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.kinds span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); font-size: 14px; transition: all 200ms ease;
}
.kinds input:checked + span { border-color: var(--sel-border); background: var(--sel); font-weight: 600; }
.kinds input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.field { font-size: 13.5px; font-weight: 500; margin: 10px 0 6px; }
.opt { font-size: 12px; color: var(--muted); font-weight: 400; }
.sheet textarea, .sheet input[type="text"] {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: var(--card);
  border: 1px solid var(--field-border); border-radius: var(--r-field); padding: 10px 14px; resize: vertical;
}
.sheet input[type="text"] { min-height: 50px; }
.sheet textarea:focus, .sheet input[type="text"]:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.fb-msg { font-size: 14px; margin: 8px 0 0; min-height: 1.5em; }
.fb-msg.ok { color: var(--ok); } .fb-msg.err { color: var(--danger); }
.primary {
  margin-top: 10px; min-height: 52px; border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink);
  font-weight: 500; font-size: 15px; box-shadow: 0 10px 22px var(--ring); transition: filter 200ms ease;
}
.primary:hover { filter: brightness(1.2); }
.primary:disabled { opacity: .6; cursor: progress; }

.sheet--mic { width: min(420px, calc(100% - 32px)); }
.mic-sheet { padding: 28px 24px 22px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.mic-sheet__icon {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px;
  color: var(--on-ink); background: var(--ink);
  box-shadow: 0 0 0 10px var(--sel), 0 10px 30px var(--ring);
}
.mic-sheet__icon svg { width: 34px; height: 34px; stroke-width: 2; }
.mic-sheet h2 { margin: 6px 0 8px; font-size: 19px; }
.mic-sheet p { margin: 0; font-size: 15px; line-height: 1.9; color: var(--text); }
.mic-sheet__steps { margin: 12px 0 0; padding-inline-start: 22px; text-align: start; font-size: 14.5px; line-height: 1.9; align-self: stretch; }
.mic-sheet__note { margin-top: 12px !important; font-size: 12.5px !important; color: var(--muted) !important; }
.mic-sheet__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; align-self: stretch; }
.mic-sheet__actions .primary { margin-top: 0; }
.ghost {
  min-height: 50px; border: 1px solid var(--border); border-radius: 999px; background: transparent;
  color: var(--text); font-size: 15px; transition: background-color 200ms ease;
}
.ghost:hover { background: var(--panel); }

/* ---------- recent questions (desktop) ---------- */
.recent {
  display: none; flex: none; width: 300px; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 18px 14px;
}
.recent h2 { display: flex; align-items: center; gap: 8px; margin: 0 6px 10px; font-size: 16px; font-weight: 500; }
.recent h2 svg { width: 20px; height: 20px; color: var(--muted); }
.recent__list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.recent__list li + li { border-top: 1px solid var(--border); }
.recent__item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 8px; text-align: start;
  background: transparent; border: 0; border-radius: 14px; transition: background-color 200ms ease;
}
.recent__item:hover { background: var(--panel); }
.recent__item .q { flex: 1; min-width: 0; font-size: 14px; line-height: 1.7; }
.recent__item .when { display: block; font-size: 11.5px; color: var(--muted); }
.recent__item svg { flex: none; width: 18px; height: 18px; color: var(--muted); }
.recent__all {
  margin-top: 10px; min-height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px;
  background: transparent; border: 1px solid var(--border); border-radius: 999px; font-size: 14px;
}
.recent__all svg { width: 18px; height: 18px; }
.recent__all:hover { background: var(--panel); }

/* ---------- desktop chat: thread on top, voice under it, recent questions on the side ---------- */
@media (min-width: 1100px) {
  .recent { display: flex; }
  .chat { padding: 20px 28px 24px; }
  .thread { order: 1; }
  .voice { order: 2; }
  #live { order: 3; }
  .chips { display: none; }
  .composer { order: 4; max-width: 560px; width: 100%; align-self: center; }
  .viz { width: 240px; }
}

/* ---------- smaller screens: once the conversation starts, shrink the visualizer to give the thread room ---------- */
@media (max-width: 1099px) {
  .chat { padding: 12px; }
  body.has-chat .viz { width: 124px; }
  body.has-chat .status { font-size: 13px; margin-bottom: 2px; }
  .msg { max-width: 94%; }
}
@media (max-width: 1099px) and (max-height: 700px) {
  .viz { width: min(190px, 56vw, 30vh); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0ms !important; scroll-behavior: auto !important; }
}
