/* The Behavioral Scientist AI. Fonts are self-hosted: the CSP allows only this origin. */
@font-face {
  font-family: "Proxima Nova"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ProximaNova-Regular-latin.woff2") format("woff2");
  unicode-range: U+0-24F, U+3??, U+1E??, U+2000-206F, U+20A0-20CF, U+2100-214F, U+2190-22FF, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Proxima Nova"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/ProximaNova-Bold-latin.woff2") format("woff2");
  unicode-range: U+0-24F, U+3??, U+1E??, U+2000-206F, U+20A0-20CF, U+2100-214F, U+2190-22FF, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Proxima Nova"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("fonts/ProximaNova-Extrabld-latin.woff2") format("woff2");
  unicode-range: U+0-24F, U+3??, U+1E??, U+2000-206F, U+20A0-20CF, U+2100-214F, U+2190-22FF, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Merriweather"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/Merriweather-Regular-latin.woff2") format("woff2");
  unicode-range: U+0-24F, U+3??, U+1E??, U+2000-206F, U+20A0-20CF, U+2100-214F, U+2190-22FF, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Merriweather"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/Merriweather-Italic-latin.woff2") format("woff2");
  unicode-range: U+0-24F, U+3??, U+1E??, U+2000-206F, U+20A0-20CF, U+2100-214F, U+2190-22FF, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Merriweather"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/Merriweather-Bold-latin.woff2") format("woff2");
  unicode-range: U+0-24F, U+3??, U+1E??, U+2000-206F, U+20A0-20CF, U+2100-214F, U+2190-22FF, U+FEFF, U+FFFD;
}

:root {
  --paper: #ffffff; --wash: #f4f6fa; --ink: #191b20; --ink-2: #424751; --muted: #565b65;
  --line: #dcdfe5;          /* dividers only */
  --control-line: #8b93a0;  /* composer and field borders */
  --accent: #1238cf; --accent-hover: #082caa; --accent-soft: #eef2ff;
  --danger: #a61c1c;        /* the bar on failure messages only */
  --font-sans: "Proxima Nova", "Figtree", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Merriweather", Georgia, serif;
  --measure: 720px; --radius: 4px; --radius-lg: 8px; --ease: 0.15s;
  --shadow-box: 0 2px 10px rgba(25, 27, 32, 0.06);
  --shadow-pop: 0 10px 28px rgba(25, 27, 32, 0.14);
  --scrim: rgba(25, 27, 32, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column; background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
svg { flex: none; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; } /* headings and the conversation take focus only for screen readers */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 8px; top: 8px; z-index: 50; background: var(--paper); padding: 6px 10px; }

/* The mark: a static file, because the CSP blocks data: images. */
.mark {
  display: inline-block; flex: none; width: 28px; height: 28px;
  background: url("tbs-mark.png") center / contain no-repeat;
}

.banner {
  padding: 8px 16px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 600;
  text-align: center;
}

/* Shared controls */
.btn-outline {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--control-line); border-radius: var(--radius); background: var(--paper); color: var(--ink);
  font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}
.btn-outline:hover, .btn-outline[aria-expanded="true"] {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
}
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0;
  border-radius: var(--radius); background: none; color: var(--ink);
}
.icon-btn:hover { background: var(--wash); }
.eyebrow {
  margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
}
.link-btn {
  padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}

.layout { flex: 1; display: flex; min-height: 0; }

/* Sidebar */
.sidebar {
  width: 260px; flex: none; display: flex; flex-direction: column; padding: 20px 14px 14px;
  background: var(--wash); border-right: 1px solid var(--line); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.wordmark { flex: 1; font-size: 17px; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.wordmark .ai { color: var(--accent); }
.byline { margin: 6px 0 18px 44px; font-size: 12px; color: var(--muted); }
.btn-new {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--paper); color: var(--accent);
  font-weight: 700; transition: background var(--ease);
}
.btn-new:hover { background: var(--accent-soft); }
.nav-label {
  margin: 22px 6px 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}
.chat-list { flex: 1; margin: 0; padding: 0; list-style: none; overflow-y: auto; }
.chat-item { position: relative; border-radius: var(--radius); }
.chat-item:hover { background: var(--paper); }
.chat-item.current { background: var(--paper); box-shadow: inset 2px 0 0 var(--accent); }
.chat-open {
  display: block; padding: 10px 40px 10px 12px; color: var(--ink); font-size: 15px; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item.current .chat-open { font-weight: 600; }
.chat-delete {
  position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 32px; height: 32px;
  padding: 0; border: 0; border-radius: var(--radius); background: var(--paper); color: var(--muted);
}
.chat-delete:hover { color: var(--danger); }
.sidebar-foot { padding: 10px 6px 0; border-top: 1px solid var(--line); }
.pref { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--muted); }
.pref input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.sidebar-scrim { display: none; }

/* Header */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-header {
  flex: none; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px 0 28px;
  border-bottom: 1px solid var(--line);
}
.chat-title {
  flex: 1; min-width: 0; margin: 0; font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Conversation: one centered column */
.messages { flex: 1; overflow-y: auto; padding: 32px 32px 24px; }
.messages > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.turn + .turn { margin-top: 44px; }
.msg.user {
  width: fit-content; max-width: 85%; margin-left: auto; padding: 12px 16px; background: var(--wash);
  border-radius: var(--radius-lg); line-height: 1.55;
}
.msg.user .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.reply { margin-top: 28px; }

/* Answer: serif, no box and no label */
.answer, .streaming {
  font-family: var(--font-serif); font-size: 17px; line-height: 1.75; overflow-wrap: break-word; color: var(--ink);
}
.streaming { white-space: pre-wrap; }
.progress-box + .streaming:not(:empty) { margin-top: 16px; }
.answer p { margin: 0 0 16px; }
.answer ul, .answer ol { margin: 0 0 16px; padding-left: 22px; }
.answer li { margin-bottom: 6px; padding-left: 2px; }
.answer h1, .answer h2, .answer h3, .answer h4, .answer h5, .answer h6 {
  margin: 28px 0 8px; font-family: var(--font-sans); font-size: 19px; font-weight: 800; line-height: 1.25;
  letter-spacing: -0.015em;
}
.answer > :first-child { margin-top: 0; }
.answer table {
  width: 100%; margin: 4px 0 16px; border-collapse: collapse; font-family: var(--font-sans); font-size: 15px;
  line-height: 1.45;
}
.answer th { padding: 10px 12px; background: var(--ink); color: var(--paper); font-weight: 700; text-align: left; }
.answer td { padding: 10px 12px; border: 1px solid var(--line); vertical-align: top; }
.answer pre { overflow-x: auto; padding: 10px 12px; background: var(--wash); border-radius: var(--radius); font-size: 14px; }
.answer code { padding: 0 3px; background: var(--wash); border-radius: 3px; font-size: 0.9em; }
.answer pre code { padding: 0; }
.answer blockquote { margin: 0 0 16px; padding: 2px 0 2px 16px; border-left: 2px solid var(--accent); color: var(--ink-2); }

/* Details: a native <details> row between hairlines */
.answer-details { margin-top: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.answer-details > summary {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 4px; list-style: none;
  font-family: var(--font-sans); font-size: 16px; font-weight: 700; color: var(--accent); cursor: pointer;
}
.answer-details > summary::-webkit-details-marker { display: none; }
.answer-details > summary::after {
  content: ""; width: 8px; height: 8px; margin: 0 6px 4px auto; border: solid var(--accent);
  border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform var(--ease);
}
.answer-details[open] > summary::after { margin-bottom: -4px; transform: rotate(-135deg); }
.answer-details > summary:hover { text-decoration: underline; text-underline-offset: 0.18em; }
.answer-details > :nth-child(2) { margin-top: 12px; }

/* Citation pills (the number is server-rendered) */
.answer button.cite {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px;
  margin: 0 1px 0 4px; padding: 0 6px; border: 1px solid transparent; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font: 700 12px/1 var(--font-sans); vertical-align: 0.15em;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.answer button.cite:hover { border-color: var(--accent); }
.answer button.cite.is-open { background: var(--accent); color: var(--paper); }
.cite-invalid {
  display: inline-block; margin: 0 1px 0 4px; padding: 0 6px; border: 1px dotted var(--control-line);
  border-radius: 999px; color: var(--muted); font: 600 12px/18px var(--font-sans); vertical-align: 0.15em; cursor: help;
}

/* Running turn: the turning mark, one phrase, the time */
.progress { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 16px; font-weight: 600; }
.progress .mark { width: 22px; height: 22px; animation: turn 2.4s linear infinite; }
.progress-time { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-note { margin: 4px 0 0 32px; font-size: 14px; color: var(--muted); }
@keyframes turn { to { transform: rotate(360deg); } }

/* Unfinished turns */
.status-label {
  margin: 0 0 10px; padding: 12px 16px; background: var(--wash); border-left: 2px solid var(--accent);
  font-size: 15px; line-height: 1.5;
}
.status-failed .status-label, .status-incomplete .status-label { border-left-color: var(--danger); }
.memory { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.notes-updated { margin: 10px 0 0; font-size: 14px; color: var(--muted); }

/* Answer actions: quiet icons */
.turn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 10px 0 0 -8px; }
.turn-actions .retry { margin: 0 8px 0 8px; }
.act {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0;
  border-radius: var(--radius); background: none; color: var(--muted);
}
.act:hover { background: var(--wash); color: var(--ink); }
.act[aria-pressed="true"], .act[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.act-status { font-size: 14px; color: var(--muted); } /* stays rendered when empty, so a screen reader hears "Copied" */
.act-status:not(:empty) { margin-left: 8px; }
.feedback-details {
  flex-basis: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 8px 0 0 8px;
}
.fb-label { margin: 0; font-size: 15px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-outline.chip { min-height: 36px; border-radius: 999px; font-size: 14px; }
.btn-outline.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.feedback-details label { font-size: 14px; font-weight: 600; }
.feedback-details textarea, .brief-form textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--control-line);
  border-radius: var(--radius); background: var(--paper); font-size: 15px; line-height: 1.45; resize: vertical;
}

/* Composer: same edges as the column */
.composer-wrap { flex: none; width: 100%; max-width: calc(var(--measure) + 64px); margin: 0 auto; padding: 8px 32px 14px; }
.notice {
  margin: 0 0 8px; padding: 10px 14px; background: var(--wash); border-left: 2px solid var(--danger); font-size: 14px;
}
.composer {
  display: flex; align-items: flex-end; gap: 10px; padding: 8px 8px 8px 16px; background: var(--paper);
  border: 1px solid var(--control-line); border-radius: var(--radius-lg); box-shadow: var(--shadow-box);
}
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-box); }
.composer textarea {
  flex: 1; min-width: 0; min-height: 44px; max-height: 200px; padding: 10px 0; border: 0; outline: 0;
  background: none; font-size: 16px; line-height: 1.5; resize: none;
}
.composer textarea::placeholder { color: var(--muted); }
.send {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--paper);
}
.send:hover { background: var(--accent-hover); }
.send:disabled { background: #c5cad4; }
.stop {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 14px;
  border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--ink); font-weight: 700;
}
.stop:hover { background: var(--wash); }
.composer-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

/* Empty chat: one centered block */
.main.is-empty { overflow-y: auto; }
.main.is-empty .chat-header { display: none; }
.main.is-empty .messages { flex: none; overflow: visible; margin-top: auto; padding-bottom: 0; }
.main.is-empty .composer-wrap, .examples-block { max-width: calc(640px + 64px); }
.empty-state { max-width: 640px; }
.empty-state .mark { display: block; width: 40px; height: 40px; margin-bottom: 20px; }
.empty-title { margin: 0 0 12px; font-size: 40px; font-weight: 800; line-height: 1.08; letter-spacing: -0.03em; }
.lede { margin: 0 0 8px; font-size: 18px; line-height: 1.6; color: var(--ink-2); }
.main.is-empty .composer-wrap { padding-top: 16px; padding-bottom: 8px; } /* 24 px under the lede, 28 px over Examples */
.main.is-empty .composer textarea { min-height: 72px; }
.examples-block { width: 100%; margin: 0 auto auto; padding: 20px 32px 32px; }
.examples-block .eyebrow { margin-bottom: 6px; }
.examples { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.examples li { border-bottom: 1px solid var(--line); }
.examples button {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 52px; padding: 10px 4px; border: 0;
  background: none; color: var(--ink); font-size: 16px; text-align: left; transition: color var(--ease);
}
.examples button::after {
  content: "\2192"; margin-left: auto; padding-left: 16px; color: var(--accent); font: 700 16px/1.5 var(--font-sans);
  transition: transform var(--ease);
}
.examples button:hover { color: var(--accent); }
.examples button:hover::after { transform: translateX(3px); }

/* Sheets: case notes and the study sheet, one at a time, over the chat */
.backdrop { position: fixed; inset: 0; z-index: 20; background: var(--scrim); }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 21; width: min(400px, 100%); overflow-y: auto;
  background: var(--paper); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop);
}
.sheet-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 12px 0 24px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.sheet-close {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 0;
  border-radius: var(--radius); background: none; color: var(--ink); font-size: 15px; font-weight: 600;
}
.sheet-close:hover { background: var(--wash); }
.sheet-body { padding: 20px 24px 32px; }
.sheet-meta { margin: 0 0 18px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.brief-form .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.brief-form label { font-size: 14px; font-weight: 600; }
.brief-form textarea { font-family: var(--font-sans); }
.brief-form textarea::placeholder { color: var(--muted); }
.notes-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.saved { font-size: 14px; color: var(--muted); }

/* Study sheet content (written by openSource and renderCard) */
.drawer-body { font-size: 15px; line-height: 1.5; }
.drawer-body h3 { margin: 24px 0 8px; font-size: 15px; font-weight: 800; }
.drawer-body > :first-child { margin-top: 0; }
.card-label { margin: 0 0 8px; font-weight: 600; }
.status-line, .warning {
  margin: 0 0 12px; padding: 10px 14px; background: var(--wash); border-left: 2px solid var(--accent); font-size: 14px;
}
.warning { border-left-color: var(--danger); }
.excerpt {
  margin: 0; padding: 10px 14px; background: var(--wash); white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--font-serif); font-size: 14px; line-height: 1.6;
}
.facts { display: grid; grid-template-columns: 8.5em 1fr; gap: 8px 14px; margin: 0; }
.facts dt { font-weight: 600; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.pin { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.files { margin: 4px 0; padding-left: 18px; font-size: 13px; overflow-wrap: anywhere; }
.meta, .hash { color: var(--muted); }
.meta { margin: 4px 0; font-size: 14px; }

.only-small { display: none; }

@media (hover: hover) {
  .chat-delete { visibility: hidden; }
  .chat-open { padding-right: 12px; }
  .chat-item:hover .chat-open, .chat-item:focus-within .chat-open { padding-right: 40px; }
  .chat-item:hover .chat-delete, .chat-item:focus-within .chat-delete { visibility: visible; }
}

@media (max-width: 760px) {
  .only-small { display: grid; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 15; width: min(300px, 85vw);
    transform: translateX(-100%); box-shadow: var(--shadow-pop);
    visibility: hidden; /* a closed sidebar is out of the tab order */
    transition: transform var(--ease) ease, visibility 0s linear var(--ease);
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform var(--ease) ease, visibility 0s; }
  .sidebar.open + .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 14; background: var(--scrim); }
  .brand { padding-right: 0; }
  .brand .icon-btn { margin: -8px -8px -8px 0; }
  .chat-header, .main.is-empty .chat-header { display: flex; height: 52px; gap: 4px; padding: 0 8px 0 4px; }
  .main.is-empty #toggle-brief { display: none; }
  .chat-title { font-size: 15px; }
  .btn-outline { min-height: 44px; padding: 0 12px; font-size: 14px; }
  .messages { padding: 20px 16px 16px; }
  .msg.user { max-width: 92%; }
  .msg.reply { margin-top: 22px; }
  .answer, .streaming { font-size: 16px; line-height: 1.7; }
  .answer h1, .answer h2, .answer h3, .answer h4, .answer h5, .answer h6 { font-size: 18px; }
  .answer table { display: block; overflow-x: auto; }
  .answer td, .answer th { min-width: 150px; }
  .answer td:first-child, .answer th:first-child { min-width: 0; }
  .act { width: 44px; height: 44px; }
  .btn-outline.chip { min-height: 44px; }
  .chat-open, .chat-item:hover .chat-open, .chat-item:focus-within .chat-open { padding: 11px 48px 11px 12px; }
  .chat-delete { top: 0; right: 0; width: 44px; height: 44px; }
  .composer-wrap { padding: 6px 12px calc(12px + env(safe-area-inset-bottom)); }
  .composer-note { font-size: 12px; }
  .main.is-empty .messages { margin-top: 0; padding: 24px 16px 0; }
  .main.is-empty .composer-wrap { padding: 16px; }
  .examples-block { padding: 12px 16px 24px; }
  .empty-title { font-size: 30px; }
  .lede { font-size: 17px; }
  .sheet { inset: 0; width: auto; border-left: 0; box-shadow: none; }
  .sheet-head { padding-left: 16px; }
  .sheet-body { padding: 18px 16px 28px; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dt { margin-top: 10px; }
}

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

/* Signed-in account, in the sidebar footer */
.account { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 13px; }
.account-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.account-month { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* Sign-in page (signin.html) */
.signin-page { justify-content: center; align-items: center; background: var(--wash); }
.signin {
  width: 100%; max-width: 400px; padding: 40px 32px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-box);
}
.signin .brand { padding: 0; margin-bottom: 28px; }
.signin-title { margin: 0 0 20px; font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.signin .notice { margin: 0 0 16px; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px;
  border: 1px solid var(--control-line); border-radius: var(--radius); background: var(--paper); color: var(--ink);
  font-weight: 600; text-decoration: none; transition: background var(--ease);
}
.btn-google:hover { background: var(--wash); }
.signin-or { display: flex; align-items: center; gap: 12px; margin: 20px 0; font-size: 13px; color: var(--muted); }
.signin-or::before, .signin-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.signin-form { display: flex; flex-direction: column; gap: 8px; }
.signin-form label { font-size: 14px; font-weight: 700; }
.signin-form input {
  min-height: 44px; padding: 10px 12px; border: 1px solid var(--control-line); border-radius: var(--radius);
  background: var(--paper); font-size: 16px;
}
.signin-form input:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.signin-check { margin-top: 16px; min-height: 65px; }
.signin-legal { margin: 20px 0 0; font-size: 13px; color: var(--muted); }
/* Legal pages (/privacy, /terms) */
.legal { max-width: 760px; line-height: 1.6; }
.legal h1 { margin: 0 0 12px; font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.legal h2 { margin: 28px 0 8px; font-size: 19px; font-weight: 800; }
.legal p, .legal li { margin: 0 0 8px; }
#code { font-size: 22px; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.btn-primary {
  min-height: 44px; margin-top: 8px; border: 0; border-radius: var(--radius); background: var(--accent);
  color: var(--paper); font-weight: 700; transition: background var(--ease);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: #c5cad4; }
.signin-meta { margin: 0 0 8px; color: var(--ink-2); }
.signin-links { display: flex; justify-content: space-between; gap: 12px; margin: 12px 0 0; font-size: 14px; }
@media (max-width: 480px) {
  .signin-page { background: var(--paper); }
  .signin { border: 0; box-shadow: none; padding: 32px 20px; }
}

/* Owner page (admin.html) */
.admin-page { overflow-y: auto; background: var(--wash); }
.admin { width: 100%; max-width: 920px; margin: 0 auto; padding: 28px 32px 64px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.admin-head .brand { padding: 0; }
.admin-title { margin: 0 0 16px; font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.admin-section {
  margin: 0 0 16px; padding: 20px 24px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.admin-section h2 { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
.admin-section p { margin: 0 0 6px; }
.admin-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.admin-form label { flex-basis: 100%; font-size: 14px; font-weight: 700; }
.admin-form input, .admin-table input {
  min-height: 40px; padding: 8px 10px; border: 1px solid var(--control-line); border-radius: var(--radius);
  background: var(--paper); font-size: 15px;
}
.admin-form input[type="email"], .admin-form input[type="text"] { flex: 1 1 260px; }
.admin-form input[type="number"], .admin-table input { width: 120px; }
.admin-form .btn-primary { margin-top: 0; padding: 0 16px; }
.admin-form label + input + label { margin-top: 6px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.admin-table th { padding: 8px 10px; border-bottom: 1px solid var(--control-line); text-align: left; font-size: 13px; color: var(--muted); }
.admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table .cell-row { display: flex; align-items: center; gap: 8px; }
.admin-list { margin: 14px 0 0; padding: 0; list-style: none; }
.admin-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.admin-section .admin-subtitle { margin: 14px 0 6px; font-size: 15px; font-weight: 800; }
.admin-section .admin-subtitle + p, .admin-subtitle + p + .admin-list { margin-top: 0; }
.confirm .admin-form { margin: 4px 0 10px; }
@media (max-width: 480px) {
  .admin { padding: 20px 14px 48px; }
  .admin-section { padding: 16px; }
}

/* Plan and funds in the chat: one banner over the message box (chat.js, billing design 8.2) */
.billing-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 8px; padding: 10px 14px;
  background: var(--accent-soft); border-left: 2px solid var(--accent); font-size: 14px;
}
.billing-banner p { flex: 1 1 280px; margin: 0; }
.billing-banner-actions { display: flex; align-items: center; gap: 14px; }
.billing-banner .btn-outline { min-height: 36px; font-size: 14px; }
.btn-outline:disabled, .btn-outline:disabled:hover { border-color: var(--line); background: var(--wash); color: var(--muted); }

/* Plan and billing page (billing.html), on the owner page's layout */
.admin-section .billing-plan { font-weight: 700; }
.admin-section .status-line, .admin-section .warning { margin: 12px 0 0; }
.admin-section .warning .btn-outline { margin-top: 10px; }
.admin > .status-line, .admin > .notice { margin: 0 0 16px; }
.plan-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0 0 14px; padding: 0;
  list-style: none;
}
.plan-card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.plan-card.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-card h3 { margin: 0; font-size: 16px; font-weight: 800; }
.admin-section .plan-card p { margin: 0; font-size: 14px; color: var(--ink-2); }
.admin-section .plan-card .plan-price { margin: 2px 0 6px; font-size: 22px; font-weight: 800; color: var(--ink); }
.plan-act { margin-top: auto; padding-top: 12px; }
.plan-act button { width: 100%; justify-content: center; padding: 6px 12px; white-space: normal; text-align: center; }
.plan-act .btn-primary { margin-top: 0; }
.billing-foot, .billing-note { font-size: 13px; color: var(--muted); }
#credit-form .chips { margin-bottom: 12px; }
.credit-other input {
  width: min(280px, 100%); min-height: 44px; padding: 8px 10px; border: 1px solid var(--control-line);
  border-radius: var(--radius); background: var(--paper); font-size: 16px;
}
#credit-form .btn-primary { margin-top: 6px; padding: 0 18px; }
.billing-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.billing-actions .btn-primary { margin-top: 0; padding: 0 18px; }
.pricing > summary { font-size: 18px; font-weight: 800; color: var(--accent); cursor: pointer; }
.pricing ol { margin: 12px 0 0; padding-left: 22px; }
.pricing li { margin-bottom: 8px; }
.recent li { justify-content: flex-start; }
.confirm {
  width: min(460px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); color: var(--ink);
}
.confirm::backdrop { background: var(--scrim); }
.confirm p { margin: 0 0 8px; line-height: 1.55; }
