/* Prevana Chat, web prototype (2026-11). Tokens from the landing pages (../landings/site.css);
   chat looks from the app (chat redesign, visual direction, text contrast). */

:root {
  --ink: #0A0B0D;          /* Text primary */
  --ink-2: #4B5059;        /* Text secondary */
  --ink-3: #6B717C;        /* Text tertiary */
  --line: rgba(10, 11, 13, .08);
  --line-2: rgba(10, 11, 13, .13);
  --bg: #FFFFFF;
  --bg-soft: #F5F7FA;
  --surface: #FFFFFF;
  --box: #F4F5F7;          /* Aurora surface: cards and rows on the page */
  --logo-back: #E9EBEE;    /* behind the logo's pulse */
  /* Every chat box: the page's color in light mode, found by its outline; focused, the outline is darker */
  --chat-box: var(--bg);
  --chat-shadow: inset 0 0 0 var(--hair) rgba(10, 11, 13, .4), 0 1px 2px rgba(10, 11, 13, .03), 0 10px 30px -14px rgba(16, 24, 40, .18);
  --chat-shadow-focus: inset 0 0 0 var(--hair) rgba(10, 11, 13, .72), 0 1px 2px rgba(10, 11, 13, .03), 0 10px 30px -14px rgba(16, 24, 40, .18);
  --tint: rgba(10, 11, 13, .06);
  --tint-2: rgba(10, 11, 13, .1);
  --sidebar: #F7F8FA;
  /* The conversation list: a little dimmer than body text, with quieter hover and selection */
  --sb-ink: color-mix(in srgb, var(--ink) 80%, var(--sidebar));
  --sb-hover: rgba(10, 11, 13, .045);
  --sb-active: rgba(10, 11, 13, .065);
  /* Your messages: a pale blue with navy text (12.5:1) */
  --bubble: #E5F0FE;
  --bubble-ink: #0B2A4F;
  --scrim: rgba(10, 11, 13, .36);
  --scroll-thumb: rgba(10, 11, 13, .16);
  --scroll-thumb-hover: rgba(10, 11, 13, .3);

  --blue: #0B6EF2;
  --blue-hover: #0A62D9;
  --blue-soft: #EAF2FE;
  --green: #068730;  --green-soft: #E8F5EC;
  --red: #DC2626;    --red-soft: #FDECEC;
  --gold: #F5B301;
  --c-warn: #B54708; --c-warn-soft: #FFF1E5;
  --c-ask: #0B6EF2;   --c-ask-soft: #E6F0FF;
  --c-dx: #4656D8;    --c-dx-soft: #EDEFFD;
  --c-an: #7E2DC8;    --c-an-soft: #F3EDFC;
  --c-care: #088378;  --c-care-soft: #E5F4F0;
  --c-offer: #F94D00; --c-offer-soft: #FEEFE4;
  /* The app's feature colours (AURORA features in app/ui/appearance.ts): Diagnose, Analyse, Clinics */
  --f-dx: #2563EB;   --f-dx-soft: #EEF3FF;
  --f-an: #6D28D9;   --f-an-soft: #F3EFFF;
  --f-care: #0F766E; --f-care-soft: #EAF7F2;

  --ai-1: #1F6BFF; --ai-2: #6C5CFF;   /* the AI gradient: blue to a blue-leaning violet */
  --ai: linear-gradient(135deg, var(--ai-1), var(--ai-2));

  --r-lg: 28px; --r-md: 20px; --r-sm: 14px; --r-xs: 10px;
  --shadow-1: 0 1px 2px rgba(10, 11, 13, .04), 0 8px 24px rgba(10, 11, 13, .06);
  --shadow-2: 0 2px 6px rgba(10, 11, 13, .05), 0 24px 56px rgba(16, 24, 40, .14);
  --hair: .5px;                                     /* every line: borders, outlines, rules */
  --edge: inset 0 0 0 var(--hair) rgba(10, 11, 13, .06);   /* faint edge on cards and buttons */

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 272px;
  --col: 768px;
  --gutter: 24px;
  color-scheme: light;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #F1F3F6;
  --ink-2: #AEB4BF;
  --ink-3: #8C93A0;
  --line: rgba(255, 255, 255, .085);
  --line-2: rgba(255, 255, 255, .16);
  --bg: #000000;
  --bg-soft: #12151B;
  --surface: #171A21;
  --box: #171A21;
  --logo-back: #000;
  --chat-box: var(--box);
  --chat-shadow: inset 0 0 0 var(--hair) var(--line-2), 0 10px 30px -14px rgba(0, 0, 0, .6);
  --chat-shadow-focus: inset 0 0 0 var(--hair) rgba(255, 255, 255, .44), 0 10px 30px -14px rgba(0, 0, 0, .6);
  --tint: rgba(255, 255, 255, .08);
  --tint-2: rgba(255, 255, 255, .13);
  --sidebar: #050505;
  --sb-ink: color-mix(in srgb, var(--ink) 78%, var(--sidebar));
  --sb-hover: rgba(255, 255, 255, .05);
  --sb-active: rgba(255, 255, 255, .075);
  /* A deep blue on the black page, white text (8.89:1) */
  --bubble: #1A4A85;
  --bubble-ink: #FFFFFF;
  --scrim: rgba(0, 0, 0, .55);
  --scroll-thumb: rgba(255, 255, 255, .2);
  --scroll-thumb-hover: rgba(255, 255, 255, .34);

  --blue: #5AA2FF;
  --blue-hover: #1F7BFF;
  --blue-soft: rgba(90, 162, 255, .14);
  --green: #4CCB7E;  --green-soft: rgba(76, 203, 126, .14);
  --red: #FF6B6B;    --red-soft: rgba(255, 107, 107, .12);
  --c-warn: #F59E52; --c-warn-soft: rgba(245, 158, 82, .14);
  --c-ask: #5AA2FF;   --c-ask-soft: #10203A;
  --c-dx: #8E9BFF;    --c-dx-soft: #181C3A;
  --c-an: #B98AF2;    --c-an-soft: #201733;
  --c-care: #3FC4B4;  --c-care-soft: #0D2623;
  --c-offer: #FF8A4C; --c-offer-soft: #2C190E;
  --f-dx: #7AA2FF;   --f-dx-soft: #131B2E;
  --f-an: #B69CFF;   --f-an-soft: #1B1630;
  --f-care: #5EC9B6; --f-care-soft: #0F211C;
  --ai-1: #5C9DFF; --ai-2: #9A8CFF;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .35), 0 24px 56px rgba(0, 0, 0, .55);
  --edge: inset 0 0 0 var(--hair) rgba(255, 255, 255, .08);
}
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--font);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 24px; height: 24px; }
.ico.fill { fill: currentColor; stroke: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Scrollbars like ChatGPT's: a thin rounded thumb, no track, darker on hover.
   (scrollbar-width/-color would switch these WebKit rules off in Chrome, so only Firefox gets them.)
   With a mouse only: on Chrome for Android these rules replace the phone's own scrollbars, which take
   no room, with ones that do, and the sign-in card moved off center when the keyboard made it scroll. */
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
  ::-webkit-scrollbar-thumb {
    min-height: 40px; border: 2px solid transparent; border-radius: 999px;
    background-color: var(--scroll-thumb); background-clip: padding-box;
  }
  ::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
}
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
}

.ai-text {
  background: linear-gradient(90deg, var(--ai-1) 0%, var(--ai-2) 50%, var(--ai-1) 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: ai-shimmer 10s linear infinite; padding-block: .06em;
}
@keyframes ai-shimmer { to { background-position: -200% 0; } }

.logo-back { fill: var(--logo-back); }

/* Before the first frame: only the right view shows */
.view { display: none; }
html[data-view="chat"] .view-chat,
html[data-view="shared"] .view-chat { display: flex; }
html[data-view="loading"] .boot { display: grid; }
/* Only a slow load shows the logo: a quick one, like most refreshes, goes from a blank page straight to the chat.
   The delay survives Reduce Motion, which only shortens durations. */
.boot { display: none; position: fixed; inset: 0; place-items: center; opacity: 0; animation: boot-in .2s ease-out .4s forwards; }
@keyframes boot-in { to { opacity: 1; } }
.boot .mark { width: 44px; height: 44px; border-radius: 12px; animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; transform: scale(.94); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border: 0; border-radius: 999px; white-space: nowrap;
  font-weight: 600; font-size: 16px; letter-spacing: -.01em;
  transition: background-color .15s ease, box-shadow .2s ease, transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 8px 20px -8px rgba(11, 110, 242, .6), inset 0 1px 0 rgba(255, 255, 255, .2); }
html[data-theme="dark"] .btn-primary { background: #1F7BFF; }
.btn-primary:not([disabled]):hover { background: var(--blue-hover); }
.btn-quiet { background: var(--tint); color: var(--ink); }
.btn-quiet:hover { background: var(--tint-2); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.link-btn { border: 0; background: none; padding: 0; color: var(--blue); font-weight: 600; font-size: 15px; }
.link-btn:hover { text-decoration: underline; }

/* Tonal icon buttons (header actions: surface fill, no edge) */
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink);
  transition: background-color .15s ease;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--tint); }
.icon-btn.tonal { background: var(--tint); }
.icon-btn.tonal:hover { background: var(--tint-2); }
.icon-btn.sm { width: 32px; height: 32px; }

/* Dropdowns (theme, language) and menus */
.menu {
  position: fixed; z-index: 80; min-width: 220px; max-width: calc(100vw - 32px); padding: 8px;
  border-radius: 16px; background: var(--surface); color: var(--ink);
  box-shadow: 0 0 0 var(--hair) var(--line), var(--shadow-2);
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu .menu-label { padding: 8px 12px 4px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.menu .menu-email { max-width: 260px; padding: 6px 12px; font-size: 13px; line-height: 18px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu hr { border: 0; height: var(--hair); margin: 8px 4px; background: var(--line); }
/* Rows 44 px tall, with room to breathe; every row has its icon at the same place */
.menu button {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; font-size: 15px; font-weight: 500; text-align: start;
}
.menu button:hover, .menu button:focus-visible { background: var(--tint); outline: none; }
.menu button .ico { width: 18px; height: 18px; color: var(--ink-2); }
.menu button .check { margin-inline-start: auto; color: var(--blue); visibility: hidden; stroke-width: 2.4; }
.menu button[aria-checked="true"] { font-weight: 600; }
.menu button[aria-checked="true"] .check { visibility: visible; }
.menu button.danger, .menu button.danger .ico { color: var(--red); }
/* A row with its current value (Language · Tiếng Việt ›) */
.menu button .val { margin-inline-start: auto; font-size: 14px; font-weight: 400; color: var(--ink-3); white-space: nowrap; }
.menu button .chev { width: 16px; height: 16px; margin-inline-start: -6px; color: var(--ink-3); }
/* Theme as one row: three icons in a pill, the chosen one raised */
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; padding: 0 6px 0 12px; font-size: 15px; font-weight: 500; }
.menu-row .ml { display: inline-flex; align-items: center; gap: 12px; }
.menu-row .ml .ico { width: 18px; height: 18px; color: var(--ink-2); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--tint); }
.menu .seg button { width: 36px; height: 30px; min-height: 0; padding: 0; justify-content: center; border-radius: 999px; color: var(--ink-3); }
.menu .seg button .ico { width: 17px; height: 17px; color: inherit; }
.menu .seg button:hover { background: none; color: var(--ink); }
.menu .seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(10, 11, 13, .12), inset 0 0 0 var(--hair) var(--line); }
html[data-theme="dark"] .menu .seg button[aria-checked="true"] { background: var(--tint-2); box-shadow: none; }

/* Search: a pop-up. On a phone it fills the screen and its list ends at the keyboard (--vh follows it), so every row can scroll
   into view, while Safari's see-through keyboard bar shows the pop-up's white and not the page under it. */
#search-dlg { width: min(640px, calc(100vw - 32px)); height: min(520px, calc(100dvh - 64px)); padding: 0; overflow: hidden; }
#search-dlg[open] { display: flex; flex-direction: column; }
.sd-head { flex: none; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 12px 0 20px; color: var(--ink-3); }
.sd-head input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 16px; color: var(--ink); }
.sd-head input::placeholder { color: var(--ink-3); }
.sd-head input::-webkit-search-cancel-button { display: none; }
.sd-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 10px 14px; }
.sd-list .sb-label { padding: 2px 10px 6px; }
.sd-row { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; border-radius: 10px; color: var(--ink); font-size: 14.5px; line-height: 20px; }
.sd-row:hover, .sd-row:focus-visible { background: var(--tint); text-decoration: none; outline: none; }
.sd-row .ico { width: 16px; height: 16px; flex: none; }
.sd-row span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sd-state { padding: 40px 12px; text-align: center; color: var(--ink-2); font-size: 14px; }
@media (max-width: 600px) {
  #search-dlg { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .sd-list { flex: none; height: calc(var(--vh, 100dvh) - 64px - env(safe-area-inset-top)); }
}

/* The language picker: a dialog on desktop, a sheet on a phone; every language by its own name */
#lang-dlg { width: min(420px, calc(100vw - 32px)); max-height: min(620px, 86vh); padding: 0; }
#lang-dlg[open] { display: flex; flex-direction: column; }
.lang-head { position: relative; padding: 20px 20px 14px; }
.lang-search { flex: none; margin: 0 16px 8px; }
.lang-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
.lang-opt {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; border-radius: 12px;
  background: none; text-align: start; color: var(--ink);
}
.lang-opt:hover:not([disabled]), .lang-opt:focus-visible { background: var(--tint); outline: none; }
.lang-opt .lt { flex: 1; min-width: 0; display: grid; }
.lang-opt b { font-size: 15px; font-weight: 500; }
.lang-opt .lt span { font-size: 13px; color: var(--ink-3); }
.lang-opt .check { width: 18px; height: 18px; color: var(--blue); stroke-width: 2.4; visibility: hidden; }
.lang-opt[aria-selected="true"] b { font-weight: 600; }
.lang-opt[aria-selected="true"] .check { visibility: visible; }
.lang-opt[disabled] { cursor: default; }
.lang-opt[disabled] b { color: var(--ink-3); }
.lang-opt .soon { font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 2px 8px; border-radius: 999px; background: var(--tint); white-space: nowrap; }
.lang-none { padding: 24px 12px; text-align: center; font-size: 14px; color: var(--ink-3); }
@media (max-width: 959px) {
  #lang-dlg { width: 100%; max-width: 100%; max-height: 86vh; margin: auto 0 0; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- Sign in: a pop-up over the chat ---------- */
/* The dialog is the whole visible area (--vh follows the keyboard) and scrolls; the card sits in its middle. */
#signin-dlg {
  width: 100%; max-width: 100%; height: var(--vh, 100dvh); max-height: var(--vh, 100dvh); margin: 0; padding: 16px;
  border-radius: 0; background: none; box-shadow: none; overflow-y: auto; overscroll-behavior: contain;
}
#signin-dlg[open] { display: flex; }
.signin-card {
  position: relative; width: 100%; max-width: 420px; margin: auto; padding: 32px 24px 24px; border-radius: 24px; outline: none;
  background: var(--surface); text-align: center; box-shadow: 0 0 0 var(--hair) var(--line), var(--shadow-2);
}
#phone-submit, #code-submit { scroll-margin-bottom: 16px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 18px; letter-spacing: -.03em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; }
/* The logo has no outline, in either theme */
.signin-card .app-icon { display: block; width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 14px; box-shadow: 0 14px 34px -12px rgba(108, 92, 255, .55), 0 0 44px -10px rgba(58, 176, 255, .45); }
.signin-card h2 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -.025em; font-weight: 700; }
.signin-card p.lead { margin: 10px auto 0; max-width: 340px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.signin-form { margin-top: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; text-align: start; }
.field-label { font-size: 14px; font-weight: 600; }
.phone-field {
  display: flex; align-items: center; height: 54px; border-radius: 16px; background: var(--bg);
  box-shadow: inset 0 0 0 var(--hair) var(--line-2); transition: box-shadow .15s ease;
}
.phone-field:focus-within { box-shadow: inset 0 0 0 2px var(--blue); }
/* The country: our own chevron, because the browser's sits right against the divider */
.country { position: relative; flex: none; display: flex; height: 100%; border-inline-end: var(--hair) solid var(--line-2); }
.country::after {
  content: ""; position: absolute; inset-inline-end: 16px; top: 50%; width: 7px; height: 7px; margin-top: -5px; pointer-events: none;
  border: solid var(--ink-2); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.phone-field select {
  appearance: none; -webkit-appearance: none; height: 100%; padding: 0 38px 0 16px; border: 0; background: none; color: inherit;
  font-weight: 600; font-size: 16px; outline: none; border-radius: 16px 0 0 16px;
}
.phone-field input { flex: 1; min-width: 0; height: 100%; padding: 0 16px; border: 0; background: none; font-size: 17px; outline: none; letter-spacing: .01em; }
.form-error { min-height: 20px; margin: 0; font-size: 14px; color: var(--red); }
.form-note { margin: 0; font-size: 14px; color: var(--ink-2); }
.form-note:empty { display: none; }

/* The ways in: Google and Apple in tonal, Or, then phone in black or white */
.signin-ways { margin-top: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.way { gap: 12px; height: auto; min-height: 48px; padding: 8px 14px; white-space: normal; line-height: 1.25; }
.way > svg { flex: none; }
.way .a-logo { width: 20px; height: 20px; flex: none; margin-top: -2px; }
.phone-back { display: block; margin: 16px auto 0; }
.or-divider { display: flex; align-items: center; gap: 12px; margin: 6px 0; color: var(--ink-3); font-size: 13px; font-weight: 500; line-height: 20px; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: var(--hair); background: var(--line-2); }
.google-wrap { position: relative; }
.btn-tonal { background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink); }
.btn-tonal:not([disabled]):hover { background: color-mix(in srgb, var(--ink) 13%, transparent); }
.google-face { gap: 12px; transition: background-color .15s; }
.google-face .g-logo { width: 18px; height: 18px; flex: none; }
.google-wrap:hover .google-face { background: color-mix(in srgb, var(--ink) 13%, transparent); }
/* focus can't be seen inside Google's iframe: ring the face, for the keyboard only (html.kbd) */
html.kbd .google-wrap:focus-within .google-face { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--blue); }
.google-wrap.busy { pointer-events: none; }
.google-wrap.busy .google-face, .google-wrap.waiting .google-face { opacity: .6; }
/* Google's button: nearly transparent (still clickable), centred and stretched over the 48px pill */
.google-hit { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; opacity: .01; border-radius: 999px; }
.google-hit > div { transform: scaleY(1.25); }
#ways-error { min-height: 0; text-align: center; }
#ways-error:empty { display: none; }
.signin-fine { margin: 20px auto 0; max-width: 340px; font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.signin-fine a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }

.code-boxes { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; height: 60px; }
.code-boxes span {
  display: grid; place-items: center; border-radius: 14px; background: var(--bg);
  box-shadow: inset 0 0 0 var(--hair) var(--line-2); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.code-boxes span.cur { box-shadow: inset 0 0 0 2px var(--blue); }
.code-boxes input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; font-size: 16px;
  letter-spacing: 40px; caret-color: transparent;
}
.code-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; }
.badge-proto {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--c-warn-soft); color: var(--c-warn); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge-proto::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* only the local prototype (serve.py --local) wears the tag */
html:not([data-env="local"]) .badge-proto { display: none; }
/* Get the app: a quiet gray pill as tall as the 40 px icon buttons beside it, with a download arrow */
.badge-app {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 16px 0 13px; border-radius: 999px;
  background: var(--tint); color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color .15s ease;
}
.badge-app:hover { text-decoration: none; background: var(--tint-2); }
.badge-app .ico { width: 17px; height: 17px; stroke-width: 1.8; }

/* ---------- Chat shell ---------- */
.view-chat { height: 100%; height: 100dvh; height: var(--vh, 100dvh); }
.sidebar {
  width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; min-height: 0;
  background: var(--sidebar); border-inline-end: var(--hair) solid var(--line);
  transition: margin .22s ease, transform .22s ease;
}
/* Collapsed (desktop): the sidebar gives way to a rail of icons, as in ChatGPT */
.rail { display: none; }
@media (min-width: 960px) {
  html.sidebar-hidden .sidebar { display: none; }
  html.sidebar-hidden .rail {
    display: flex; flex-direction: column; align-items: center; gap: 4px; width: 60px; flex: none; padding: 10px 0 12px;
    background: var(--sidebar); border-inline-end: var(--hair) solid var(--line);
  }
}
.rail-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--ink);
  transition: background-color .15s ease;
}
.rail-btn:hover, .rail-btn[aria-expanded="true"] { background: var(--sb-hover); }
.rail-btn .ico { width: 20px; height: 20px; }
.rail-open { margin-bottom: 10px; }
.rail-open .mark { width: 28px; height: 28px; border-radius: 8px; }
.rail-open .ico { display: none; }
.rail-open:hover .mark, .rail-open:focus-visible .mark { display: none; }
.rail-open:hover .ico, .rail-open:focus-visible .ico { display: block; }
.rail-space { flex: 1; }
.rail-me .avatar { width: 28px; height: 28px; font-size: 12px; }
.rail-group { margin-top: 10px; }
.sb-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 10px 4px 16px; height: 60px; }
.sb-top-btns { display: flex; align-items: center; gap: 2px; }
/* New chat stays in view; Features and Recent scroll under it. Rows keep 6 px clear of the scrollbar's 10 px gutter on the right. */
.sb-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 12px 10px; scrollbar-gutter: stable; }
@media (pointer: coarse) { .sb-scroll { padding-right: 10px; } } /* a phone's scrollbar takes no room */
.sb-sec-new { position: sticky; top: 0; z-index: 1; padding-block: 12px 4px; background: var(--sidebar); }
.sb-label { margin: 0; padding: 20px 10px 6px; font-size: 13px; line-height: 18px; font-weight: 500; letter-spacing: 0; color: var(--ink-3); }
/* New chat and the Features rows: 14 px medium text, 36 px rows with a little air between them */
.sb-new {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; font-size: 14px; font-weight: 500; text-align: start;
}
.sb-new:hover { background: var(--tint); }
.sb-new .ico { width: 18px; height: 18px; }
/* Diagnose, Analyze and Find care */
.sb-feature { color: var(--ink); }
.sb-feature + .sb-feature { margin-top: 4px; }
.sb-feature:hover { text-decoration: none; }
.sb-new[aria-current="page"], .rail-btn[aria-current="page"] { background: var(--sb-active); }
/* As on the app's home: the outline takes the text color, one detail takes the feature's color. */
.k-dx { color: var(--ink); --acc: var(--f-dx); }
.k-an { color: var(--ink); --acc: var(--f-an); }
.k-care { color: var(--ink); --acc: var(--f-care); }
.k-new { color: var(--ink); --acc: var(--blue); }
.sb-search {
  display: flex; align-items: center; gap: 10px; margin: 2px 10px 8px; height: 38px; padding: 0 10px 0 14px; border-radius: 999px;
  background: var(--tint); color: var(--ink-3);
}
.sb-search:focus-within { box-shadow: inset 0 0 0 2px var(--blue); background: var(--surface); }
.sb-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 14px; color: var(--ink); }
.sb-search input::placeholder { color: var(--ink-3); }
/* Recent reads as a list of titles, not a stack of buttons: a background only on hover or when open. */
.sb-item { position: relative; display: flex; align-items: center; border-radius: 10px; }
.sb-item + .sb-item { margin-top: 4px; }
.sb-item a {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 10px;
  color: var(--sb-ink); font-size: 14px; line-height: 20px; white-space: nowrap; overflow: hidden;
}
.sb-item a span {
  flex: 1; min-width: 0; overflow: hidden;
  /* The last 18 px, dense: fading fast from the start and fully gone for the last 4 px */
  --title-fog: linear-gradient(to right, #000 calc(100% - 18px), rgba(0, 0, 0, .5) calc(100% - 13px),
    rgba(0, 0, 0, .18) calc(100% - 9px), transparent calc(100% - 4px));
  -webkit-mask-image: var(--title-fog);
  mask-image: var(--title-fog);
}
/* A Diagnose check or a document explanation has a small quiet icon before its title; a chat has none. */
.sb-item a .ico { width: 16px; height: 16px; flex: none; }
.sb-item a .ico, .sd-row .ico { color: var(--ink-2); }
.sb-item a:hover { text-decoration: none; }
.sb-item:hover, .sb-item.menu-open { background: var(--sb-hover); }
.sb-item.active { background: var(--sb-active); }
.sb-item .more {
  /* Flush with the row's right end, its height and its 10 px corners: the corners line up */
  position: absolute; top: 0; inset-inline-end: 0; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px;
  background: none; color: var(--ink-2); opacity: 0;
}
/* The menu button shows on hover only (and while its menu is open or it has keyboard focus) */
.sb-item:hover .more, .sb-item.menu-open .more, .sb-item .more:focus-visible { opacity: 1; }
.sb-item:hover a, .sb-item.menu-open a { padding-inline-end: 40px; }
.sb-item .more:hover { background: var(--sb-hover); }
@media (hover: none) { .sb-item .more { opacity: 1; } .sb-item a { padding-inline-end: 40px; } }
.sb-empty { padding: 32px 12px; text-align: center; color: var(--ink-2); font-size: 14px; }
.sb-more { padding: 12px; text-align: center; color: var(--ink-3); font-size: 13px; }
.sb-foot { padding: 8px 10px 12px; border-top: var(--hair) solid var(--line); }
.account-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 10px; border: 0; border-radius: 12px;
  background: none; text-align: start;
}
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--tint); }
.avatar {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; overflow: hidden;
  background: var(--ink-3); color: #fff; font-size: 12px; font-weight: 700; /* its colour comes from the name (app.js) */
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-btn .who { flex: 1; min-width: 0; }
.account-btn .who b { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-btn .who span { display: block; font-size: 12.5px; color: var(--ink-3); }
.scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.topbar {
  height: 60px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 12px;
  position: relative; z-index: 5; /* above the scrolling thread */
}
.topbar::after { /* fade from the page colour, so text scrolls away softly */
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 16px; pointer-events: none;
  background: linear-gradient(var(--bg), color-mix(in srgb, var(--bg) 0%, transparent));
}
.topbar .title {
  flex: 1; min-width: 0; margin: 0 4px; font-size: 16px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .title.muted { color: var(--ink-3); font-weight: 500; }
.topbar .brand-sm { display: none; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; letter-spacing: -.02em; color: var(--ink); margin-inline: 4px 8px; }
.topbar .brand-sm:hover { text-decoration: none; }
.topbar .brand-sm img, .topbar .brand-sm svg { width: 26px; height: 26px; border-radius: 7px; }
.show-when-collapsed { display: none; }
/* Signed out: the chat with no sidebar, the logo in the top bar, Sign up and Sign in at its end */
html[data-auth="out"] .sidebar, html[data-auth="out"] .rail, html[data-auth="out"] .scrim,
html[data-auth="out"] [data-need="auth"] { display: none !important; }
html[data-auth="in"] [data-need="guest"] { display: none !important; }
html[data-auth="out"] .topbar .brand-sm { display: inline-flex; }
.topbar .btn-bar { flex: none; height: 40px; padding: 0 16px; font-size: 14px; }
.start .start-app { align-self: flex-start; margin-top: 24px; }

/* A feature takes the place of the thread and the chat box; features/README.md */
.feature-host { display: none; flex: 1; min-height: 0; flex-direction: column; }
html[data-feature] .feature-host { display: flex; }
html[data-feature] .scroller, html[data-feature] .composer-wrap, html[data-feature] .drop-veil { display: none; }
.feature { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; position: relative; }
.feature-status { padding: 64px 24px; text-align: center; color: var(--ink-2); font-size: 15px; line-height: 24px; }
.topbar-extra { display: contents; }
.scroller { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scroll-behavior: auto; position: relative; }
/* The scroll content: the conversation (or the chat start), then the caution line at its end */
.scroll-body { min-height: 100%; display: flex; flex-direction: column; }
.thread { flex: 1 0 auto; width: 100%; max-width: calc(var(--col) + 2 * var(--gutter)); margin: 0 auto; padding: 8px var(--gutter) 60px; }
.thread:empty { flex: 0 0 auto; padding: 0; }
.older { display: grid; place-items: center; height: 40px; color: var(--ink-3); font-size: 13px; }

/* ---------- Chat start ---------- */
.start { width: 100%; max-width: calc(var(--col) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; padding-bottom: 8vh; }
.start .spark { width: 40px; height: 40px; margin-bottom: 18px; }
.start h1 { margin: 0; font-size: 34px; line-height: 40px; font-weight: 600; letter-spacing: -.03em; }
.starters { margin-top: 28px; display: grid; gap: 4px; max-width: 420px; }
.starter {
  display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 14px 0 8px; margin-inline-start: -8px; border: 0; border-radius: 999px;
  background: none; font-size: 16px; font-weight: 500; text-align: start; color: var(--ink);
  transition: background-color .15s ease;
}
.starter:hover { background: var(--tint); }
.tile { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--soft); color: var(--c); box-shadow: inset 0 0 0 var(--hair) color-mix(in srgb, var(--c) 18%, transparent); }
.tile .ico { width: 20px; height: 20px; }
/* Feature tiles as in the app's chat start: a pale tint, the icon outline in the text colour and its
   one painted detail in the feature colour; no ring */
.ico.app { stroke-width: 1.6; }
.t-dx { --c: var(--f-dx); --soft: var(--f-dx-soft); }
.t-an { --c: var(--f-an); --soft: var(--f-an-soft); }
.t-care { --c: var(--f-care); --soft: var(--f-care-soft); }
.tile.t-dx, .tile.t-an, .tile.t-care { color: var(--ink); --acc: var(--c); box-shadow: none; }
.tile.t-dx .ico, .tile.t-an .ico, .tile.t-care .ico { width: 19px; height: 19px; }
/* An empty chat on a computer: the box in the middle of the window, in a narrower column than a chat's, the icon and greeting centered above it,
   the three features as cards below it and the caution line at the page's end. Phones have the starters above the box instead. A longer draft or
   files grow the box both ways. The scroller and .start-below split the room evenly; 60 px more under the box makes up for the top bar, so the box
   centers on the window. */
.start-below { display: none; }
@media (min-width: 960px) {
  html[data-start]:not([data-feature]) { --col: 640px; }
  html[data-start] .start { flex-direction: row; align-items: flex-end; justify-content: center; gap: 12px; padding-bottom: 44px; }
  html[data-start] .start .spark { width: 34px; height: 34px; margin: 0 0 3px; }
  html[data-start] .start .starters { display: none; }
  html[data-start] #disclaimer { display: none; }
  html[data-start] .composer-wrap { padding-bottom: 0; }
  html[data-start] .composer-wrap::before { display: none; }
  html[data-start]:not([data-feature]) .start-below {
    flex: 1 1 60px; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px;
    width: 100%; max-width: calc(var(--col) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(24px, 4vh, 40px) var(--gutter) 0;
  }
  .start-below .disclaimer { margin-top: auto; padding: 0 0 14px; }
  .feat-cards { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; transition: opacity .15s ease, visibility .15s; }
  /* A draft in the box hides the cards, and nothing else moves. They come back when the box is empty. */
  html[data-start][data-draft]:not([data-feature]) .start-below { justify-content: flex-end; overflow: hidden; }
  html[data-draft] .feat-cards { opacity: 0; visibility: hidden; }
  .feat-label { grid-column: 1 / -1; margin: 0; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-3); }
  .feat-card {
    min-width: 0; display: flex; flex-direction: column; padding: 5px 5px 12px; border: 0; border-radius: 12px; background: none; color: var(--ink); text-align: start;
    box-shadow: inset 0 0 0 var(--hair) var(--line-2); transition: background-color .15s ease;
  }
  .feat-card:hover { background: var(--tint); }
  .feat-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
  .feat-art { display: block; flex: none; width: 100%; height: 88px; margin-bottom: 10px; border-radius: 7px; background: color-mix(in srgb, var(--ink) 4%, transparent); color: var(--ink); }
  .feat-title { padding-inline: 9px; font-size: 14.5px; line-height: 20px; font-weight: 500; }
  .feat-sub { padding-inline: 9px; font-size: 13px; line-height: 18px; color: var(--ink-3); }
  /* Gray textures; only a small main element on each card has its color: the pulse's spike, one result, the location. */
  .fa-thin, .fa-rows, .fa-street, .fa-road, .fa-line { fill: none; stroke: currentColor; }
  .fa-trace, .fa-ping { fill: none; stroke: var(--c); }
  .fa-thin { stroke-width: .75; stroke-opacity: .1; }
  .fa-rows { stroke-width: 3; stroke-linecap: round; stroke-opacity: .14; }
  .fa-band { fill: currentColor; fill-opacity: .035; }
  .fa-street { stroke-width: 2.5; stroke-opacity: .1; }
  .fa-road { stroke-width: 6; stroke-opacity: .11; }
  .fa-line { stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-opacity: .2; }
  .fa-trace { stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-opacity: .8; }
  .t-an .fa-trace { stroke-width: 3; }
  .fa-ping { stroke-width: 1.5; stroke-opacity: .35; }
  .fa-dot { fill: var(--c); fill-opacity: .8; }
}
/* A short window: the cards lose their art, so they still fit */
@media (min-width: 960px) and (max-height: 600px) {
  .feat-art { display: none; }
  .feat-card { padding-block: 10px; }
}

/* ---------- Messages ---------- */
.turn { margin-top: 28px; }
.turn:first-child { margin-top: 12px; }
.turn.user { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bubble {
  max-width: min(85%, 600px); padding: 11px 18px; border-radius: 22px; background: var(--bubble); color: var(--bubble-ink);
  font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.u-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 85%; }
.u-img { width: 96px; height: 96px; border-radius: 16px; overflow: hidden; background: var(--tint); box-shadow: var(--edge); display: block; }
.u-img img { width: 100%; height: 100%; object-fit: cover; }
.file-chip {
  display: inline-flex; align-items: center; gap: 10px; max-width: 260px; height: 56px; padding: 0 14px 0 10px; border-radius: 16px;
  background: var(--surface); box-shadow: inset 0 0 0 var(--hair) var(--line-2); color: var(--ink); text-decoration: none;
}
a.file-chip:hover { text-decoration: none; background: var(--bg-soft); }
.file-chip .ft, .file-head .ft { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--c-an-soft); color: var(--c-an); font-size: 10.5px; font-weight: 700; letter-spacing: .02em; }
.file-chip .ft.pdf, .file-head .ft.pdf { background: var(--red-soft); color: var(--red); }
.file-chip .nm { min-width: 0; display: grid; text-align: start; }
.file-chip .nm b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip .nm span { font-size: 12.5px; color: var(--ink-3); }

.turn.bot { position: relative; }
.answer { font-size: 16px; line-height: 1.65; overflow-wrap: anywhere; }
.answer > * + * { margin-top: 16px; }
.md > :first-child { margin-top: 0; }
.md p, .md ul, .md ol, .md blockquote, .md .code-block, .md hr { margin: 14px 0 0; }
.md .table-wrap { margin: 14px calc(-1 * var(--gutter)) 0; }
.md > .table-wrap:first-child { margin-top: 0; }
.md h2, .md h3, .md h4, .md h5, .md h6 { margin: 26px 0 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.3; }
.md h2 { font-size: 22px; }
.md h3 { font-size: 19px; }
.md h4, .md h5, .md h6 { font-size: 17px; }
.md > h2:first-child, .md > h3:first-child, .md > h4:first-child { margin-top: 0; }
.md strong { font-weight: 650; }
.md ul, .md ol { padding-inline-start: 26px; }
.md li { margin: 6px 0 0; padding-inline-start: 2px; }
.md li > ul, .md li > ol, .md li > p { margin-top: 6px; }
.md li::marker { color: var(--ink-2); }
.md ul.tasks { list-style: none; padding-inline-start: 2px; }
.md ul.tasks > li { position: relative; padding-inline-start: 28px; }
.md ul.tasks .box { position: absolute; inset-inline-start: 0; top: .28em; width: 17px; height: 17px; border-radius: 5px; box-shadow: inset 0 0 0 var(--hair) var(--line-2); }
.md ul.tasks .box.done { background: var(--blue); box-shadow: none; }
.md ul.tasks .box.done::after { content: ""; position: absolute; left: 5.5px; top: 2.5px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.md a { color: var(--blue); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--blue) 35%, transparent); text-underline-offset: 3px; }
.md hr { border: 0; height: var(--hair); background: var(--line-2); margin: 24px 0; }
.md blockquote { padding: 2px 0 2px 16px; border-inline-start: 3px solid var(--line-2); color: var(--ink-2); }
.md code { font-family: var(--mono); font-size: .88em; padding: .12em .38em; border-radius: 6px; background: var(--tint); }
.code-block { border-radius: 14px; background: var(--bg-soft); box-shadow: inset 0 0 0 var(--hair) var(--line); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 8px 0 14px; font-size: 12.5px; color: var(--ink-3); border-bottom: var(--hair) solid var(--line); }
.code-copy { height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: none; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.code-copy:hover { background: var(--tint); }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.code-block code { padding: 0; background: none; font-size: inherit; }
/* Lean tables, like ChatGPT's: semibold header, hairlines between rows, no frame */
.table-wrap { overflow-x: auto; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
.md table { border-collapse: collapse; min-width: 100%; font-size: 15px; line-height: 1.5; }
.md th { text-align: start; font-weight: 650; padding: 8px 16px 8px 0; border-bottom: var(--hair) solid var(--line-2); white-space: nowrap; vertical-align: bottom; }
.md td { padding: 9px 16px 9px 0; border-bottom: var(--hair) solid var(--line); vertical-align: top; }
.md tr > :last-child { padding-inline-end: 0; }
.md tbody tr:last-child td { border-bottom: 0; }

/* Source pills (inline citations) */
.md a.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; margin: 0 1px; border-radius: 999px; vertical-align: 2px;
  background: var(--tint); color: var(--ink-2); font-size: 12px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap;
}
.md a.pill:hover { background: var(--tint-2); color: var(--ink); }
.pill-more { color: var(--ink-3); }

/* Steps, waiting, activity */
.steps { display: grid; gap: 12px; margin-bottom: 16px; }
.step { display: flex; gap: 12px; animation: fade .22s ease-out; }
.step .ico { width: 18px; height: 18px; margin-top: 2px; color: var(--ink-3); }
.step .s-title { font-size: 15px; font-weight: 600; }
.step .s-body { font-size: 14.5px; color: var(--ink-2); line-height: 1.5; white-space: pre-wrap; }
.step .s-body.comm { color: var(--ink); font-size: 15.5px; }
.step .s-detail { font-size: 13.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 560px; }
.steps-toggle { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; padding: 0; border: 0; background: none; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.steps-toggle .ico { width: 16px; height: 16px; transition: transform .2s ease; }
.steps-toggle[aria-expanded="true"] .ico { transform: rotate(180deg); }
.steps-folded .steps { margin-top: 0; padding-inline-start: 2px; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } }
.waiting { display: flex; align-items: center; gap: 12px; min-height: 28px; color: var(--ink-2); font-size: 15px; }
.ai-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ai); box-shadow: 0 0 0 0 rgba(108, 92, 255, .35); animation: pulse 1.4s ease-in-out infinite; flex: none; }
@keyframes pulse { 0%, 100% { transform: scale(.82); box-shadow: 0 0 0 0 rgba(108, 92, 255, .35); } 50% { transform: scale(1); box-shadow: 0 0 0 7px rgba(108, 92, 255, 0); } }
.shimmer-text { background: linear-gradient(90deg, var(--ink-2) 0%, var(--ink-2) 40%, var(--ink) 50%, var(--ink-2) 60%, var(--ink-2) 100%) 0 0 / 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: ai-shimmer 2.4s linear infinite; }

/* Panels (diagnosis, question, check): calm cards with one Why? */
.panel { border-radius: var(--r-md); padding: 16px 18px 18px; background: var(--surface); box-shadow: inset 0 0 0 var(--hair) var(--line-2); }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13.5px; font-weight: 650; color: var(--c); }
.panel-head .ico { width: 18px; height: 18px; }
.panel.q { --c: var(--c-ask); background: color-mix(in srgb, var(--c-ask-soft) 55%, var(--surface)); box-shadow: inset 0 0 0 var(--hair) color-mix(in srgb, var(--c-ask) 20%, transparent); }
.panel.dx { --c: var(--c-dx); }
.panel.ex { --c: var(--c-care); }
.panel .md { font-size: 15.5px; line-height: 1.6; }
.panel .md h2, .panel .md h3, .panel .md h4 { font-size: 17px; margin-top: 18px; }
.why { margin-top: 12px; }
.why-btn { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--blue); font-size: 14px; font-weight: 600; }
.why-body { margin-top: 8px; padding-top: 10px; border-top: var(--hair) solid var(--line); color: var(--ink-2); font-size: 14.5px; }
.quick { margin-top: 14px; display: grid; gap: 8px; }
.quick-hint { font-size: 13px; color: var(--ink-3); }
.quick button.opt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 10px 16px; border: 0; border-radius: 14px;
  background: var(--surface); box-shadow: inset 0 0 0 var(--hair) var(--line-2); font-size: 15.5px; font-weight: 500; text-align: start;
  transition: box-shadow .15s ease, background-color .15s ease;
}
.quick button.opt:hover { box-shadow: inset 0 0 0 var(--hair) color-mix(in srgb, var(--c-ask) 60%, transparent); }
.quick button.opt .box { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 6px; box-shadow: inset 0 0 0 var(--hair) var(--line-2); color: #fff; }
.quick button.opt[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--c-ask); }
.quick button.opt[aria-pressed="true"] .box { background: var(--c-ask); box-shadow: none; }
.quick button.opt .box .ico { width: 14px; height: 14px; stroke-width: 2.6; visibility: hidden; }
.quick button.opt[aria-pressed="true"] .box .ico { visibility: visible; }
.quick .send-row { display: flex; justify-content: flex-end; }

/* Sources row */
.sources-row { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 6px; border: 0; border-radius: 999px; background: var(--tint); font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.sources-row:hover { background: var(--tint-2); color: var(--ink); }
.favs { display: flex; }
.favs img { width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--bg); }
.favs img + img { margin-inline-start: -6px; }
.src-list { display: grid; gap: 2px; margin: 8px -8px 0; }
.src-list a { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 12px; color: var(--ink); }
.src-list a:hover { background: var(--tint); text-decoration: none; }
.src-list img { width: 28px; height: 28px; border-radius: 8px; background: var(--tint); flex: none; }
.src-list b { display: block; font-size: 15px; font-weight: 600; line-height: 1.35; }
.src-list span { display: block; font-size: 13px; color: var(--ink-3); }

/* Answer actions */
.actions { display: flex; align-items: center; gap: 2px; margin-top: 12px; margin-inline-start: -8px; color: var(--ink-2); }
.actions .icon-btn { width: 34px; height: 34px; color: var(--ink-2); }
.actions .icon-btn .ico { width: 18px; height: 18px; }
.actions .icon-btn:hover { color: var(--ink); }
.actions .icon-btn[aria-pressed="true"] { color: var(--ink); }
.actions .icon-btn[aria-pressed="true"] .ico { fill: currentColor; fill-opacity: .14; }
/* Sources on their own line, the answer's actions under them */
.answer-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 16px; }
.answer-foot .actions { margin-top: 0; }

.status-line { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--ink-3); }
.status-line .link-btn { font-size: 14px; }
/* A failed answer, as in the app: a surface card ringed in red, then the code, Try again as the
   inverse button and Details as a link. */
.err-card { --err: #E5482B; margin-top: 16px; padding: 16px; border-radius: var(--r-md); background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--err); }
html[data-theme="dark"] .err-card { --err: #FF6A42; }
.err-card b { display: block; font-size: 16px; font-weight: 600; }
.err-card p { margin: 4px 0 0; font-size: 15px; line-height: 1.45; }
.err-card code { display: block; margin-top: 8px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; user-select: text; }
.err-card .row { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.link-btn.quiet { color: var(--ink-2); font-size: 14px; }
.btn-inverse { background: var(--ink); color: var(--bg); }
.btn-inverse:not([disabled]):hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.err-rows { display: grid; gap: 14px; margin: 16px 0 20px; max-height: 56vh; overflow-y: auto; }
.err-row span { display: block; margin-bottom: 2px; font-size: 13px; color: var(--ink-3); }
.err-row b { font-size: 14.5px; font-weight: 500; }
.err-row code { display: block; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; user-select: text; }

/* A button waiting for an answer: it keeps its place and its word, with a turning ring. */
.btn.is-busy { pointer-events: none; opacity: .75; }
.btn.is-busy::after { content: ""; width: 14px; height: 14px; margin-inline-start: 8px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* The connection: floats over the page without moving it. */
.conn-bar { position: absolute; z-index: 30; top: 64px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-1); white-space: nowrap; }
.conn-bar[hidden] { display: none; }
.conn-bar span { overflow: hidden; text-overflow: ellipsis; }
.conn-bar .link-btn { flex: none; color: inherit; font-size: 14px; text-decoration: underline; }

/* A sent photo in its viewer, a sent file in its sheet */
#img-dlg { width: min(960px, 100vw - 32px); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; }
.img-top { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 16px; }
.img-top span { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#img-view { display: block; width: 100%; max-height: calc(100dvh - 96px); object-fit: contain; background: var(--tint); }
#file-dlg { width: min(420px, 100vw - 32px); }
.file-head { display: flex; align-items: center; gap: 12px; margin: 8px 40px 20px 0; min-width: 0; }
.file-head .ft { flex: none; }
.file-head div { min-width: 0; }
.file-head b { display: block; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.file-head div span { font-size: 13px; color: var(--ink-3); }
#file-download { display: flex; align-items: center; justify-content: center; gap: 8px; }
.skeleton .still { margin: 16px 0 0; font-size: 14px; color: var(--ink-3); }

/* Ask next: filled pills, no lines; the arrow in the accent, as on the app's Ask next cards */
.asknext { margin-top: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.asknext h4 { margin: 0 0 2px; font-size: 13.5px; font-weight: 500; color: var(--ink-3); }
.asknext button {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; min-height: 40px; padding: 9px 14px 9px 16px; border: 0;
  border-radius: 20px; background: var(--box); font-size: 15px; line-height: 1.4; text-align: start; color: var(--ink);
  transition: background-color .15s ease;
}
.asknext button:hover { background: var(--tint-2); }
.asknext button .ico { width: 17px; height: 17px; flex: none; color: var(--blue); stroke-width: 2; }

/* Cards: clinics, offers, vouchers, booking, symptom check */
.card-row {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; scroll-padding-inline: var(--gutter);
}
.card-row::-webkit-scrollbar { display: none; }
.card-label { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.clinic {
  flex: none; width: 248px; scroll-snap-align: start; display: flex; flex-direction: column; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface); box-shadow: inset 0 0 0 var(--hair) var(--line-2);
}
.clinic .ph { position: relative; height: 128px; background: var(--c-care-soft); overflow: hidden; }
.clinic .ph img { width: 100%; height: 100%; object-fit: cover; }
.clinic .ph .map { position: absolute; inset: 0; opacity: .55; background-image: radial-gradient(color-mix(in srgb, var(--c-care) 35%, transparent) 1.1px, transparent 1.5px); background-size: 12px 12px; }
.clinic .ph .pin { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--c-care); box-shadow: var(--shadow-1); }
.clinic .tag { position: absolute; left: 10px; top: 10px; height: 24px; padding: 0 9px; display: inline-flex; align-items: center; border-radius: 999px; background: rgba(255, 255, 255, .94); color: #068730; font-size: 12px; font-weight: 700; }
.clinic .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.clinic .nm { font-size: 15.5px; font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clinic .ad { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic .mt { font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 0 6px; }
.clinic .mt .star { color: var(--gold); }
.clinic .hr { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic .acts { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; }
.clinic .acts .btn { height: 34px; padding: 0 12px; font-size: 13.5px; }
.ticket {
  flex: none; width: 300px; scroll-snap-align: start; display: flex; align-items: stretch; border-radius: var(--r-sm); overflow: hidden;
  background: var(--surface); box-shadow: inset 0 0 0 var(--hair) var(--line-2); color: var(--ink);
}
.ticket .art { width: 96px; flex: none; background: var(--c-offer-soft); display: grid; place-items: center; overflow: hidden; }
.ticket .art img { width: 100%; height: 100%; object-fit: cover; }
.ticket .tb { flex: 1; min-width: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; border-inline-start: 1px dashed var(--line-2); }
.ticket .pt { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.ticket .pt img { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.ticket .tt { font-size: 14.5px; font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket .te { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.ticket .te .btn { height: 30px; padding: 0 12px; font-size: 13px; }
.ticket .st { color: var(--c-warn); font-weight: 600; }
.booking { display: flex; gap: 12px; align-items: flex-start; max-width: 420px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 var(--hair) var(--line-2); }
.booking .tile { --c: var(--green); --soft: var(--green-soft); }
.booking.failed .tile { --c: var(--red); --soft: var(--red-soft); }
.booking b { display: block; font-size: 15px; }
.booking span { display: block; font-size: 13.5px; color: var(--ink-2); }
.check-card { border-radius: var(--r-md); padding: 16px 18px; background: color-mix(in srgb, var(--c-dx-soft) 60%, var(--surface)); box-shadow: inset 0 0 0 var(--hair) color-mix(in srgb, var(--c-dx) 18%, transparent); }
.check-card .ch { display: flex; align-items: center; gap: 12px; }
.check-card .ch b { display: block; font-size: 16px; }
.check-card .ch span { display: block; font-size: 13.5px; color: var(--ink-2); }
.check-card .res { margin-top: 12px; display: grid; gap: 6px; }
.check-card .res div { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; }
.check-card .res i { width: 8px; height: 8px; border-radius: 50%; background: var(--c-dx); flex: none; }
/* Diagnose severities (symptom_check schema): today, soon, self; emergency results */
.check-card .res i.sev-today, .check-card .res i.sev-emergency { background: var(--red); }
.check-card .res i.sev-soon { background: var(--c-warn); }
.check-card .res i.sev-self { background: var(--green); }
.check-card .qa { margin-top: 12px; display: grid; gap: 10px; padding-top: 12px; border-top: var(--hair) solid var(--line); }
.check-card .qa div { font-size: 14px; }
.check-card .qa b { display: block; font-weight: 600; }
.check-card .qa span { color: var(--ink-2); }
.check-card .link-btn { margin-top: 10px; font-size: 14px; }

/* ---------- Composer ---------- */
.composer-wrap { flex: none; position: relative; width: 100%; max-width: calc(var(--col) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter) max(26px, calc(env(safe-area-inset-bottom) + 12px)); }
.composer-wrap::before { /* content fades out above the box */
  content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 6px; pointer-events: none;
  background: linear-gradient(color-mix(in srgb, var(--bg) 0%, transparent), var(--bg));
}
/* The chat box has two shapes, as in the app and ChatGPT: one row ([+] text [send]) while it's
   empty or holds one line; stacked (text above, buttons below) from two lines, or with files. */
.composer {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: end;
  grid-template-areas: "files files files files" "text text text text" "attach . hint send";
  padding: 0 10px 10px; border-radius: var(--r-lg); background: var(--chat-box);
  box-shadow: var(--chat-shadow);
  transition: box-shadow .15s ease;
}
.composer.one-row { grid-template-areas: "files files files files" "attach text hint send"; align-items: center; padding: 8px; }
.composer:focus-within { box-shadow: var(--chat-shadow-focus); }
/* The shortcut, left of Send: shown while the box is empty and the cursor is elsewhere */
.c-hint {
  grid-area: hint; align-self: center; margin-inline-end: 10px; font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  white-space: nowrap; pointer-events: none; user-select: none;
}
.composer:focus-within .c-hint, .composer.has-text .c-hint { display: none; }
@media (pointer: coarse), (max-width: 959px) { .c-hint { display: none; } }
.composer textarea {
  grid-area: text; display: block; width: 100%; max-height: 40vh; resize: none; overflow-y: auto; border: 0; background: none; outline: none;
  padding: 16px 10px 8px; font-size: 16px; line-height: 24px;
}
.composer.one-row textarea { height: 40px; padding: 8px 6px; overflow: hidden; }
/* Stacked, long text scrolls under a thin fog at the top edge instead of a hard cut. It lies
   inside the 16 px top padding, so a first line that isn't scrolled away stays fully clear. */
.composer:not(.one-row) textarea {
  /* Dense: fully hidden for the first 5 px, then clearing quickly toward the 14 px line */
  --fog: linear-gradient(to bottom, transparent 0, transparent 5px, rgba(0, 0, 0, .2) 8px, rgba(0, 0, 0, .55) 11px, #000 14px);
  -webkit-mask-image: var(--fog);
  mask-image: var(--fog);
}
.composer textarea::placeholder { color: var(--ink-3); }
.composer .c-attach { grid-area: attach; width: 40px; height: 40px; color: var(--ink); }
.composer .send-btn { grid-area: send; }
.c-measure { position: absolute; visibility: hidden; pointer-events: none; left: -9999px; top: 0; font-size: 16px; line-height: 24px; white-space: pre-wrap; overflow-wrap: break-word; }
.send-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; background: var(--ai);
  box-shadow: 0 6px 16px -6px rgba(108, 92, 255, .7); transition: opacity .15s ease, transform .15s ease;
}
.send-btn:not([disabled]):hover { transform: scale(1.05); }
.send-btn[disabled] { opacity: .3; box-shadow: none; cursor: default; }
.send-btn .ico { width: 20px; height: 20px; stroke-width: 2.2; }
.send-btn.stop { background: var(--ink); box-shadow: none; color: var(--bg); }
.send-btn.stop .ico { width: 14px; height: 14px; }
.c-files { grid-area: files; display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 0; scrollbar-width: none; }
.c-files:empty { display: none; }
.c-file { position: relative; flex: none; }
.c-file .u-img { width: 64px; height: 64px; border-radius: 14px; }
.c-file .file-chip { height: 64px; max-width: 220px; background: var(--surface); }
.c-file .x {
  position: absolute; top: -6px; inset-inline-end: -6px; width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--ink); color: var(--bg); box-shadow: 0 0 0 2px var(--chat-box);
}
.c-file .x .ico { width: 12px; height: 12px; stroke-width: 2.6; }
.c-file .veil { position: absolute; inset: 0; border-radius: 14px; display: grid; place-items: center; background: rgba(10, 11, 13, .45); color: #fff; font-size: 12px; font-weight: 600; }
.c-file .veil .ring { width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(#fff calc(var(--p, 0) * 1%), rgba(255, 255, 255, .25) 0); -webkit-mask: radial-gradient(farthest-side, transparent 9px, #000 10px); mask: radial-gradient(farthest-side, transparent 9px, #000 10px); }
.c-file.failed .veil { background: color-mix(in srgb, var(--red) 80%, transparent); }
/* Like ChatGPT's caution line: the last thing on the page, resting just above the box */
.disclaimer { flex: none; margin: 0; padding: 12px var(--gutter) 8px; text-align: center; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.to-bottom {
  position: absolute; left: 50%; bottom: calc(100% + 12px); margin-left: -18px; width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: 0 0 0 var(--hair) var(--line-2), var(--shadow-1);
  opacity: 0; pointer-events: none; transform: translateY(6px); transition: opacity .2s ease, transform .2s ease; z-index: 4;
}
.to-bottom.show { opacity: 1; pointer-events: auto; transform: none; }
.drop-veil {
  position: absolute; inset: 0; z-index: 30; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.drop-veil div { padding: 28px 36px; border-radius: var(--r-md); border: 2px dashed color-mix(in srgb, var(--ai-2) 60%, transparent); font-weight: 600; color: var(--ink); background: var(--surface); }
.main.dragging .drop-veil { display: grid; }

/* Shared view */
.shared-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--r-md); background: var(--bg-soft); }
.shared-bar b { font-size: 15px; }
html[data-view="shared"] .sidebar, html[data-view="shared"] .composer,
html[data-view="shared"] [data-need="auth"] { display: none !important; }
html[data-view="shared"] .topbar .brand-sm { display: inline-flex; }

/* State (open failed, gone) */
.state { min-height: 60vh; display: grid; place-content: center; text-align: center; gap: 8px; color: var(--ink-2); }
.state b { color: var(--ink); font-size: 18px; }
.state .btn { margin: 12px auto 0; }
.skeleton { display: grid; gap: 12px; padding-top: 24px; }
.skeleton i { display: block; height: 14px; border-radius: 7px; background: var(--tint); animation: breathe 1.4s ease-in-out infinite; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 150px; z-index: 90; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px); padding: 12px 16px 12px 18px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-size: 14.5px; font-weight: 500; box-shadow: var(--shadow-2);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: none; padding: 0; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* Dialogs */
dialog {
  width: min(440px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 24px; background: var(--surface); color: var(--ink);
  box-shadow: 0 0 0 var(--hair) var(--line), var(--shadow-2);
}
dialog::backdrop { background: var(--scrim); }
dialog[open] { animation: pop .15s ease-out; }
dialog h2 { margin: 0; font-size: 20px; letter-spacing: -.015em; }
dialog p.lead { margin: 8px 0 0; color: var(--ink-2); font-size: 15px; }
dialog .field { margin-top: 18px; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 6px 0 14px; border-radius: 14px; box-shadow: inset 0 0 0 var(--hair) var(--line-2); background: var(--bg); }
dialog .field:focus-within { box-shadow: inset 0 0 0 2px var(--blue); }
dialog .field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
dialog .x { position: absolute; top: 14px; inset-inline-end: 14px; }

/* ---------- Phone and tablet ---------- */
@media (max-width: 959px) {
  .composer-wrap { padding-bottom: max(18px, calc(env(safe-area-inset-bottom) + 8px)); }
  :root { --gutter: 16px; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(86vw, 320px); margin: 0 !important;
    transform: translateX(-100%); border: 0; visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
  }
  html.drawer-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-2); transition: transform .22s ease; }
  /* Hidden once it has faded: Safari on iPhone tints the status bar from fixed elements at the top and
     kept the scrim's grey there after the drawer closed while it only stood at opacity 0. */
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: var(--scrim); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility 0s linear .22s; }
  html.drawer-open .scrim { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .22s ease; }
  .hide-phone { display: none !important; }
  .show-when-collapsed { display: inline-grid !important; }
  .topbar { height: 56px; padding: 0 8px; }
  .topbar .title { text-align: center; font-size: 15.5px; }
  html[data-auth="out"] .topbar .title { visibility: hidden; }
  .topbar .btn-bar { padding: 0 13px; }
  .start h1 { font-size: 30px; line-height: 36px; }
  .start { justify-content: flex-start; padding-top: 12vh; }
  .composer { padding: 0 8px 8px; }
  .composer.one-row { padding: 6px; }
  .composer textarea { padding: 14px 8px 6px; }
  .bubble { max-width: 88%; }
  .md h2 { font-size: 20px; }
  .toast { bottom: 140px; }
}
@media (min-width: 960px) {
  .hide-desk { display: none !important; }
}
/* Signed out, Download app stays in the top bar wherever there's room, and moves under the greeting on a phone */
@media (min-width: 600px) {
  html[data-auth="out"] .topbar .badge-app { display: inline-flex !important; }
  html[data-auth="out"] .start .start-app { display: none !important; }
}
/* A short screen: the card without the icon, so more of it shows at once */
@media (max-height: 720px) {
  .signin-card .app-icon { display: none; }
  .signin-card { padding-top: 28px; }
  .signin-card h2 { padding-inline: 24px; }
}
/* The narrowest phones: the logo alone, so Sign up and Sign in always fit */
@media (max-width: 359px) {
  html[data-auth="out"] .topbar .brand-sm { font-size: 0; gap: 0; margin-inline-end: 0; }
}
@media (prefers-reduced-motion: reduce) {
  /* Transitions off, not shortened: a .01ms transition on every property left sizes read
     mid-change (the chat box measured its old padding when it changed shape). */
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
