/* Velvet tokens (docs/engineering/VELVET_DESIGN_SPEC_2026-11-14.md §1). The
   theme follows the browser's light or dark setting. */
:root {
  --bg: #F8F7FB; --drawer: #F1EFF6; --card: #FFFFFF; --raise: #E2DDEC; --menu: #FFFFFF;
  --hair: #CFC8DC; --text: #1B1A21; --muted: #5A5466; --purple: #873CF0; --link: #873CF0;
  --error: #B3261E; --bubble: #EADFFB; --soft: #E4D5FB; --soft2: #C9B0F5; --onsoft: #34146E; --ring: #9B5DF3; --uncertain: #7A5100;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131217; --drawer: #0E0D11; --card: #1A191E; --raise: #28262F; --menu: #201E25;
    --hair: #393742; --text: #F1EFF7; --muted: #B0AABD; --link: #B897FF;
    --error: #FFB4AB; --bubble: #47297B; --soft: #3E2A6E; --soft2: #563796; --onsoft: #F1E8FF; --ring: #B897FF; --uncertain: #E6C07B;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #app { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/24px Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1 { font-size: 27px; line-height: 34px; font-weight: 600; text-align: center; margin: 16px 0 24px; }
h2 { font-size: 20px; line-height: 26px; font-weight: 600; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Jazzy's face: her portrait (jazzy-avatar.png), never tinted or redrawn */
.face { display: block; flex: none; border-radius: 50%; }
.column > .face, .empty > .face { margin: 0 auto; }

/* One centred column: login, risk terms, provider notice, other tab */
.column {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 100%; max-width: 600px; margin: 0 auto; padding: 32px 20px;
}
.column.narrow { max-width: 440px; }
label { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
input {
  height: 56px; border-radius: 28px; padding: 0 20px; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--hair);
}
input.bad { border-color: var(--error); }
.error { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 20px; color: var(--error); margin-top: 12px; }
.error .icon { margin-top: 2px; }
.note { text-align: center; color: var(--muted); margin-bottom: 8px; }
.small { font-size: 14px; line-height: 20px; color: var(--muted); text-align: center; margin-top: 16px; }

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
/* The phone's soft look (JazzyButtons.kt soft()): the main button, New chat
   and Send/Stop, a soft-to-soft2 gradient inside a 2px ring, onSoft label */
button.main, .new-chat, .send { border: 2px solid var(--ring); background: linear-gradient(to bottom right, var(--soft), var(--soft2)); color: var(--onsoft); }
button.main:disabled, .new-chat:disabled, .send:disabled { background: var(--raise); border-color: var(--hair); color: var(--muted); }
button.main {
  min-height: 48px; border-radius: 24px; padding: 8px 20px; margin-top: 24px; flex: none;
  font-size: 16px; line-height: 22px; font-weight: 600;
}
button.text {
  min-height: 48px; margin-top: 8px; border: 0; border-radius: 24px; background: none;
  font-size: 16px; line-height: 22px; font-weight: 600; color: var(--link);
}

/* Grouped list and card (Velvet §4) */
.group { background: var(--card); border: 1px solid var(--hair); border-radius: 20px; margin: 0; padding: 0; list-style: none; }
ul.group li { padding: 14px 20px; font-size: 16px; line-height: 23px; }
ul.group li + li { border-top: 1px solid var(--hair); }
ul.group b { font-weight: 600; }
.card { padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.purpose { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--link); }
.detail, .notice { font-size: 15px; line-height: 21px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.bad-text { color: var(--error); }
.notice { margin: 8px 0; padding-left: 20px; }
.notice li + li { margin-top: 6px; }
.status { font-size: 15px; line-height: 21px; font-weight: 600; }

/* Signed-in screen: sidebar, chat, and (later) the Sources panel in one row */
.shell { display: flex; height: 100%; }
.sidebar { display: flex; flex-direction: column; flex: none; width: 320px; background: var(--drawer); border-right: 1px solid var(--hair); }
.sidebar header { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 20px; flex: none; }
.brand { font-size: 22px; line-height: 28px; font-weight: 600; }
.sidebar hr { border: 0; border-top: 1px solid var(--hair); margin: 0 20px; }
.sidebar h2 { font-size: 14px; line-height: 20px; color: var(--muted); padding: 16px 20px 8px; }
.placeholder { color: var(--muted); padding: 0 20px; }
.sidebar .placeholder { font-size: 15px; padding: 0 12px; }
.rows { flex: 1; overflow-y: auto; padding: 0 8px; display: flex; flex-direction: column; }
.chat-row {
  flex: none; height: 52px; padding: 0 12px; border: 0; border-radius: 12px; background: none; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-row:hover { background: color-mix(in srgb, var(--raise) 75%, transparent); }
.chat-row.selected { background: var(--raise); font-weight: 500; }
.sidebar footer { position: relative; display: flex; align-items: center; justify-content: space-between; height: 72px; padding: 0 12px; border-top: 1px solid var(--hair); flex: none; }
.new-chat {
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: 24px;
  font-size: 16px; line-height: 22px; font-weight: 600;
}
/* The account chip, tonal as on the phone (ConversationDrawer.kt AccountChip) */
.avatar { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--raise); color: var(--text); font-size: 16px; font-weight: 600; flex: none; }
.menu { position: absolute; left: 12px; bottom: 64px; width: 224px; background: var(--menu); border: 1px solid var(--hair); border-radius: 16px; padding: 4px 0; }
.menu p { display: flex; align-items: center; height: 44px; padding: 0 16px; font-size: 14px; color: var(--muted); overflow: hidden; }
.menu .row { display: flex; align-items: center; gap: 12px; width: 100%; height: 52px; padding: 0 16px; border: 0; background: none; text-align: left; }
.menu .row:hover { background: var(--raise); }

/* The chat: top bar, the lines in a 760 reading column, the message box */
.shell main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: center; height: 56px; padding: 0 12px; flex: none; }
.title { flex: 1; padding: 0 12px; text-align: center; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ring {
  display: none; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
  border: 2px solid var(--ring); border-radius: 50%; background: none; color: var(--text);
}
.scroll { flex: 1; overflow-y: auto; }
.lines { display: flex; flex-direction: column; min-height: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px 16px; }
.lines > :first-child { margin-top: auto; }
.empty { margin-bottom: auto; text-align: center; color: var(--muted); }
.empty p { margin-top: 16px; }
.bubble {
  align-self: flex-end; max-width: 78%; margin-top: 20px; padding: 12px 16px; border-radius: 20px;
  background: var(--bubble); white-space: pre-wrap; overflow-wrap: anywhere;
}
.answer { margin-top: 20px; }
.body { margin-top: 8px; font-size: 17px; line-height: 27px; overflow-wrap: anywhere; }
/* The answer's Markdown (markdown.js): prose, lists, quotes, links and code */
.body > * { margin: 0; }
.body > * + * { margin-top: 12px; }
.body p, .body li { white-space: pre-line; }
.body h3 { font-size: 17px; line-height: 27px; font-weight: 700; }
.body h3:not(:first-child) { margin-top: 20px; }
.body ul, .body ol { padding-left: 26px; }
.body li::marker { color: var(--muted); }
.body blockquote { padding-left: 12px; border-left: 3px solid var(--purple); color: var(--muted); }
.body a { color: var(--link); text-decoration: underline dotted; text-underline-offset: 3px; }
.body code { padding: 1px 5px; border-radius: 6px; background: var(--raise); font: 15px/22px ui-monospace, "Roboto Mono", monospace; }
.body pre { overflow-x: auto; padding: 12px 16px; border: 1px solid var(--hair); border-radius: 12px; background: var(--card); }
.body pre code { padding: 0; background: none; white-space: pre; }
.body hr { border: 0; border-top: 1px solid var(--hair); }
.body .step { font-size: 14px; line-height: 20px; color: var(--muted); }
.body .step + .step { margin-top: 4px; }
.cite {
  height: 22px; margin-left: 4px; padding: 0 8px; border: 0; border-radius: 11px; background: var(--raise);
  color: var(--link); font-size: 13px; line-height: 22px; vertical-align: 2px; cursor: pointer;
}
.pills { display: flex; flex-wrap: wrap; gap: 0 8px; }
button.pill { color: var(--text); cursor: pointer; }
.pill.amber { color: var(--uncertain); }
.cursor { display: inline-block; width: 9px; height: 18px; margin-left: 2px; border-radius: 2px; background: var(--link); vertical-align: -3px; }
.pill {
  display: inline-flex; align-items: center; height: 32px; margin-top: 8px; padding: 0 12px; border: 1px solid var(--hair);
  border-radius: 16px; background: var(--card); font-size: 14px; line-height: 20px; color: var(--muted);
}
.outcome { margin-top: 8px; font-size: 14px; line-height: 20px; color: var(--muted); text-align: right; }
.composer {
  display: flex; align-items: flex-end; gap: 8px; flex: none; width: calc(100% - 24px); max-width: 736px; min-height: 56px;
  margin: 12px auto; padding: 8px 8px 8px 20px; border: 1px solid var(--hair); border-radius: 28px; background: var(--card);
}
textarea {
  flex: 1; align-self: center; min-width: 0; max-height: 200px; padding: 0; border: 0; outline: 0; resize: none;
  background: none; color: var(--text); font: inherit; field-sizing: content;
}
textarea:focus-visible { outline: 0; }
.composer:focus-within { border-color: var(--link); }
.send {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border-radius: 50%;
}
.square { width: 12px; height: 12px; border-radius: 2px; background: var(--onsoft); }
.counter, .hint { font-size: 13px; line-height: 18px; color: var(--muted); text-align: center; margin: -6px 0 8px; }
.counter.bad-text { color: var(--error); }

/* Sources (mockup 4D-a, Q1548 a): a panel beside the chat; on a phone, the app's sheet */
.sources { width: 360px; flex: none; overflow-y: auto; padding: 0 20px 20px; border-left: 1px solid var(--hair); background: var(--menu); }
.sources header { position: relative; display: flex; align-items: center; justify-content: center; height: 56px; }
.sources h2 { font-size: 19px; }
.sources h3 { margin: 16px 0 8px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--muted); }
.close { position: absolute; left: -8px; display: flex; padding: 9px; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.group { overflow: hidden; border: 1px solid var(--hair); border-radius: 20px; background: var(--bg); font-size: 14px; line-height: 20px; }
.group > p { padding: 12px 16px; }
.group > * + * { border-top: 1px solid var(--hair); }
.source { padding: 8px 16px; }
.source > :first-child { display: flex; align-items: center; gap: 12px; min-height: 56px; color: inherit; text-decoration: none; }
.source > :first-child > div { flex: 1; min-width: 0; }
.source strong { display: block; overflow: hidden; font-size: 17px; line-height: 24px; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }
.source small { display: block; font-size: 14px; color: var(--muted); }
.source q { display: block; margin: 0 0 8px 40px; color: var(--muted); overflow-wrap: anywhere; }
.letter {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none; border-radius: 50%;
  background: var(--soft); color: var(--onsoft); font-size: 13px; font-weight: 700;
}

/* Phone: the list is the whole first screen (mockup 2P-list); opening a
   chat swaps it for the chat, whose rings go back to the list or start anew */
@media (max-width: 899px) {
  .sidebar { width: 100%; border-right: 0; }
  .shell main, .shell.chatting .sidebar, .hint { display: none; }
  .shell.chatting main, .ring { display: flex; }
  .sources {
    position: fixed; inset: 150px 0 0; width: auto; border-left: 0; border-radius: 28px 28px 0 0;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5); /* the scrim behind a sheet */
  }
}
