/* Console chrome (login gate, generate box, schedule strip, library,
 * detail). Internal tool; deliberately plain, but on the app's warm
 * Foundation palette and type so the surface feels like Simple Bible.
 *
 * Palette hexes are MIRRORED from design-system.md section 2 (Foundation
 * mode); the canonical values live in the Figma variables and the Flutter
 * app's resource system (lib/) — this file follows, never leads.
 */

/* The HTML `hidden` attribute only sets display:none at UA-stylesheet
 * priority, so ANY author `display:` rule on the same element silently
 * defeats it. Every show/hide in app.js toggles `hidden`, and #gate/#main
 * carry their own display rules — without this override the login gate
 * never visually leaves (the exact bug that shipped in W1). Keep this
 * rule first and never remove it. */
[hidden] {
  display: none !important;
}

:root {
  --c-brand-purple: #6E4C9C;         /* Brand/Primary */
  --c-brand-purple-pressed: #573C7E; /* Brand/Primary Pressed */
  --c-brand-orange: #E0603A;         /* Brand/Secondary */
  --c-ui-0: #FFFFFF;
  --c-ui-50: #FFFDFA;
  --c-ui-100: #FAF4EA;
  --c-ui-150: #F3EBDD;
  --c-ui-200: #ECE1D2;
  --c-ui-300: #DDD0BD;
  --c-ui-400: #BCAB92;
  --c-text-primary: #2A1E14;
  --c-text-secondary: #6B5A4A;
  --c-text-tertiary: #9A8E86;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--c-ui-100);
  color: var(--c-text-primary);
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-weight: 600;
  margin: 0 0 12px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
  margin-top: 20px;
}

.muted {
  color: var(--c-text-tertiary);
}

button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-secondary);
  background: var(--c-ui-50);
  border: 1px solid var(--c-ui-300);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
}

button:hover {
  background: var(--c-ui-150);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--c-brand-purple);
  border-color: var(--c-brand-purple);
  color: var(--c-ui-0);
}

.btn-primary:hover {
  background: var(--c-brand-purple-pressed);
}

input[type="text"],
input[type="date"],
input[type="password"],
textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--c-text-primary);
  background: var(--c-ui-50);
  border: 1px solid var(--c-ui-300);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--c-brand-purple);
}

/* ---- login gate ---- */

#gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-card {
  background: var(--c-ui-50);
  border: 1px solid var(--c-ui-200);
  border-radius: 16px;
  padding: 36px;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.gate-card h1 {
  font-size: 24px;
  margin: 0;
}

.gate-card p {
  margin: 0;
}

.gate-error {
  color: var(--c-brand-orange);
  font-size: 14px;
  min-height: 20px;
}

/* ---- shell ---- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--c-ui-50);
  border-bottom: 1px solid var(--c-ui-200);
}

.topbar-title {
  font-weight: 600;
  font-size: 17px;
}

/* Authed shell: a left tab column beside the content area. Morning and
 * Evening are fully separate screens; the sidebar switches between their
 * panels. Kept on the same warm palette/type as the rest of the console. */
.shell {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 200px;
  align-self: flex-start;
  min-height: calc(100vh - 62px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 14px;
  background: var(--c-ui-50);
  border-right: 1px solid var(--c-ui-200);
}

.content {
  flex: 1 1 auto;
  min-width: 0;
}

/* Vertical tab item: a full-width, left-aligned pill that overrides the
 * rounded button base. The active tab carries the brand fill. */
.tab-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--c-text-secondary);
}

.tab-item:hover {
  background: var(--c-ui-150);
}

.tab-item.active {
  background: var(--c-brand-purple);
  border-color: var(--c-brand-purple);
  color: var(--c-ui-0);
}

.tab-item.active:hover {
  background: var(--c-brand-purple-pressed);
}

.panel {
  max-width: 1180px;
  margin: 24px auto;
  background: var(--c-ui-50);
  border: 1px solid var(--c-ui-200);
  border-radius: 16px;
  padding: 24px 28px;
}

/* Theme group headers: the visible seam between the Evening and Morning
 * sections (the two daily slots). */
.theme-header {
  max-width: 1180px;
  margin: 44px auto -10px;
  padding: 0 4px;
  border-bottom: 2px solid var(--c-ui-300);
}

.theme-header h2 {
  font-size: 24px;
  margin: 0;
}

.theme-header .muted {
  margin: 2px 0 10px;
  font-size: 14px;
}

/* Morning placeholder note (no generate box there on purpose). */
.theme-note {
  margin: 0;
  font-size: 14px;
  color: var(--c-text-secondary);
  background: var(--c-ui-150);
  border-radius: 12px;
  padding: 12px 16px;
}

.notice {
  max-width: 1180px;
  margin: 16px auto -8px;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
}

.notice.ok {
  background: var(--c-ui-150);
  color: var(--c-text-primary);
  border: 1px solid var(--c-ui-300);
}

.notice.error {
  background: #FBEAE3;
  color: #8C3418;
  border: 1px solid var(--c-brand-orange);
}

/* ---- generate ---- */

#gen-text {
  width: 100%;
  resize: vertical;
  min-height: 180px;
  font-size: 15px;
  line-height: 1.55;
}

.gen-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin-top: 14px;
}

.gen-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-secondary);
}

.file-label {
  justify-content: flex-end;
}

.file-label input[type="file"] {
  font-size: 13px;
  font-weight: 400;
}

.gen-note {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--c-text-secondary);
  background: var(--c-ui-150);
  border-radius: 12px;
  padding: 10px 14px;
}

.job-panel {
  margin-top: 18px;
  border-top: 1px solid var(--c-ui-200);
  padding-top: 16px;
}

.job-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 10px;
}

.job-steps li {
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 14px;
  border: 1px solid var(--c-ui-300);
}

.job-steps li.step-pending {
  color: var(--c-text-tertiary);
}

.job-steps li.step-active {
  color: var(--c-ui-0);
  background: var(--c-brand-purple);
  border-color: var(--c-brand-purple);
}

.job-steps li.step-done {
  color: var(--c-text-primary);
  background: var(--c-ui-150);
}

.job-status {
  font-size: 14px;
  color: var(--c-text-secondary);
}

.job-error {
  margin-top: 8px;
  font-size: 14px;
  color: #8C3418;
}

/* ---- schedule strip ---- */

.schedule-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.day-card {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.day-card.scheduled {
  background: var(--c-ui-150);
  border: 1px solid var(--c-ui-300);
  cursor: pointer;
}

.day-card.gap {
  border: 1px dashed var(--c-ui-300);
  color: var(--c-text-tertiary);
}

.day-label {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-tertiary);
}

.day-flow {
  font-weight: 600;
  color: var(--c-text-primary);
  word-break: break-all;
}

.day-version {
  color: var(--c-text-secondary);
}

.day-fallback {
  font-size: 12px;
  word-break: break-word;
}

.day-remove {
  margin-top: auto;
  align-self: flex-start;
  font-size: 12px;
  padding: 3px 12px;
}

/* ---- library ---- */

.library-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.library-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-tertiary);
  border-bottom: 1px solid var(--c-ui-200);
  padding: 8px 10px;
}

.library-table td {
  border-bottom: 1px solid var(--c-ui-200);
  padding: 10px;
  vertical-align: top;
}

.library-row {
  cursor: pointer;
}

.library-row:hover td {
  background: var(--c-ui-100);
}

.lib-title {
  font-weight: 600;
}

.lib-id {
  font-size: 12px;
  color: var(--c-text-tertiary);
  word-break: break-all;
}

/* Per-row delete (housekeeping). Orange = destructive accent; the row's
 * own hover still applies underneath. */
.lib-delete {
  font-size: 12px;
  padding: 3px 12px;
  color: var(--c-brand-orange);
  border-color: var(--c-ui-300);
}

.lib-delete:hover {
  background: #FBEAE3;
  border-color: var(--c-brand-orange);
}

.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chip-draft {
  border: 1px solid var(--c-ui-300);
  color: var(--c-text-secondary);
}

.chip-approved {
  background: #FBEAE3;
  color: #A5471F;
}

.chip-published {
  background: var(--c-brand-purple);
  color: var(--c-ui-0);
}

.chip-archived {
  border: 1px solid var(--c-ui-200);
  color: var(--c-text-tertiary);
}

/* App-slot chip (evening/morning) on the detail head. */
.chip-theme {
  background: #FBEAE3;
  color: #8C3418;
}

/* ---- detail ---- */

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.publish-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--c-text-secondary);
}

.publish-note {
  background: var(--c-ui-150);
  border: 1px solid var(--c-ui-300);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 14px;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-start;
}

.detail-preview {
  flex: 0 0 auto;
}

.detail-side {
  flex: 1 1 380px;
  min-width: 320px;
}

.detail-outline {
  max-height: 480px;
  overflow: auto;
  border: 1px solid var(--c-ui-200);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
}

.detail-outline p {
  margin: 6px 0;
}

.outline-table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}

.outline-table th,
.outline-table td {
  border: 1px solid var(--c-ui-200);
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
}

.outline-table th {
  background: var(--c-ui-150);
}

.detail-validation {
  font-size: 14px;
}

.v-label {
  font-weight: 600;
  margin-top: 8px;
}

.v-errors,
.v-warnings {
  margin: 6px 0;
  padding-left: 22px;
}

.v-errors li {
  color: #8C3418;
}

.v-warnings li {
  color: var(--c-text-secondary);
}

/* ---- morning authoring (prompt + intro-config editors) ---- */

.morning-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
  margin-top: 12px;
}

.morning-list {
  flex: 0 0 260px;
  /* The explicit width triple kills the min-width:auto content floor: a
   * flex item's default min-width is its min-content size, so a populated
   * version list (nowrap titles, pre-fix) silently widened this column past
   * its 260px basis while empty families sat at exactly 260px — the
   * family-tab width jump. The column must be incapable of deriving width
   * from content; the editor (flex: 1 1) takes all remaining space. */
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.morning-editor {
  flex: 1 1 460px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.version-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Reserve roughly four version rows (4 x ~35px + 3 x 6px gap) so switching
 * the master-prompt family between a populated list and an empty family
 * does not collapse the left column — the empty-state line sits inside the
 * same reserved space. Scoped to the prompt list: the intro-config list
 * never switches families, and reserving height there would only add dead
 * space above its New draft button. */
#mp-versions {
  min-height: 160px;
}

.version-row {
  display: flex;
  /* Top-align so the version number + status chip ride the title's first
   * line when the title wraps onto several lines. */
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--c-ui-200);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  /* Children may not force the row (and thus the column) wide. */
  min-width: 0;
}

.version-row:hover {
  background: var(--c-ui-100);
}

.version-row.selected {
  border-color: var(--c-brand-purple);
  background: var(--c-ui-150);
}

.version-num {
  font-weight: 600;
  color: var(--c-text-secondary);
}

/* Titles wrap fully visible — no ellipsis truncation (owner requirement).
 * anywhere-breaking bounds even unbroken tokens (long prompt ids), so the
 * title can never contribute more than ~1ch of min-content width. */
.version-title {
  color: var(--c-text-primary);
  min-width: 0;
  overflow-wrap: anywhere;
}

.editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.editor-tag {
  font-weight: 600;
  color: var(--c-text-primary);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-secondary);
}

.field-label input[type="text"],
.field-label textarea {
  font-weight: 400;
  width: 100%;
}

#mp-body,
#mic-config {
  resize: vertical;
  line-height: 1.5;
}

#mic-config {
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 13px;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.editor-msg {
  margin: 0;
  font-size: 14px;
  border-radius: 12px;
  padding: 8px 14px;
}

.editor-msg.ok {
  background: var(--c-ui-150);
  color: var(--c-text-primary);
  border: 1px solid var(--c-ui-300);
}

.editor-msg.error {
  background: #FBEAE3;
  color: #8C3418;
  border: 1px solid var(--c-brand-orange);
}

.editor-validation {
  font-size: 14px;
}

.editor-validation .v-errors li {
  color: #8C3418;
}

/* Morning lifecycle chips (draft | active | archived). */
.chip-m-draft {
  border: 1px solid var(--c-ui-300);
  color: var(--c-text-secondary);
}

.chip-m-active {
  background: var(--c-brand-purple);
  color: var(--c-ui-0);
}

.chip-m-archived {
  border: 1px solid var(--c-ui-200);
  color: var(--c-text-tertiary);
}

/* Describe-to-generate: the PRIMARY intro-config authoring path (P1.5). A
 * lightly tinted card sets it above the JSON fine-tune panel below it. */
.generate-intro-box {
  background: var(--c-ui-100);
  border: 1px solid var(--c-brand-purple);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.generate-intro-box textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.5;
}

.morning-preview {
  margin-top: 26px;
  border-top: 1px solid var(--c-ui-200);
  padding-top: 18px;
}

.morning-preview .muted {
  margin-top: 0;
}

/* ---- morning simulator (P2): generate + tap-through + ledger ---- */

.sim-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.sim-controls textarea {
  width: 100%;
  resize: vertical;
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 13px;
  line-height: 1.5;
}

.sim-ledger-hint {
  margin: 0;
  font-size: 13px;
}

#sim-armed {
  font-size: 13px;
}

/* Loading state: the real latency made visible (spinner + elapsed clock). */
.sim-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--c-ui-150);
  border: 1px solid var(--c-ui-300);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--c-text-secondary);
}

.sim-loading-elapsed {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--c-text-primary);
}

.spinner {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-ui-300);
  border-top-color: var(--c-brand-purple);
  border-radius: 50%;
  animation: sim-spin 0.8s linear infinite;
}

@keyframes sim-spin {
  to {
    transform: rotate(360deg);
  }
}

.sim-result {
  margin-top: 22px;
  border-top: 1px solid var(--c-ui-200);
  padding-top: 18px;
}

.sim-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-start;
}

.sim-preview-col {
  flex: 0 0 auto;
}

.sim-side {
  flex: 1 1 360px;
  min-width: 300px;
}

/* Ledger readout: a compact key/value table + the raw one-liner. */
.sim-ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sim-ledger-table td {
  border-bottom: 1px solid var(--c-ui-200);
  padding: 6px 8px;
  vertical-align: top;
}

.sim-l-key {
  font-weight: 600;
  color: var(--c-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  white-space: nowrap;
  width: 84px;
}

.sim-l-val {
  color: var(--c-text-primary);
  word-break: break-word;
}

.sim-l-raw-label {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-tertiary);
}

.sim-l-raw,
.sim-raw pre {
  background: var(--c-ui-100);
  border: 1px solid var(--c-ui-200);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  margin: 6px 0 0;
}

.sim-warnings {
  font-size: 13px;
}

.sim-raw {
  margin-top: 16px;
}

.sim-raw summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-secondary);
}

.sim-raw pre {
  max-height: 360px;
  overflow: auto;
}

/* ---- request framing (reminder + presentation appendix) ---- */

.framing-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--c-ui-200);
}

.framing-block:first-of-type {
  margin-top: 8px;
  padding-top: 0;
  border-top: none;
}

.framing-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.framing-head h3 {
  margin: 0;
}

.framing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.framing-chip {
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.framing-chip.is-default {
  border: 1px solid var(--c-ui-300);
  color: var(--c-text-secondary);
}

.framing-chip.is-stored {
  background: var(--c-brand-purple);
  color: var(--c-ui-0);
}

.framing-when {
  color: var(--c-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.framing-status {
  margin: 6px 0 0;
  font-size: 13px;
}

.framing-status.is-warn {
  color: #8C3418;
}

.framing-status.is-live {
  color: var(--c-brand-purple);
}

.framing-preview {
  margin: 12px 0;
  background: var(--c-ui-100);
  border: 1px solid var(--c-ui-200);
  border-radius: 12px;
  padding: 10px 14px;
}

.framing-preview summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-secondary);
}

.framing-preview-note {
  margin: 10px 0 6px;
  font-size: 12px;
}

.framing-dyn {
  color: var(--c-brand-orange);
  font-weight: 600;
}

.framing-pre {
  background: var(--c-ui-0);
  border: 1px solid var(--c-ui-200);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--c-text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow: auto;
  margin: 0;
}

#fr-reminder-text,
#fr-appendix-text {
  width: 100%;
  resize: vertical;
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* ---- model + cost (multi-provider LLM selector + pricing) ---- */

/* Production vs test, side by side. The whole point is that an operator can
 * never mistake what they are testing for what real users get. */
.llm-scope {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 18px;
}

.llm-scope-box {
  border: 1px solid var(--c-ui-300);
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--c-ui-50);
}

.llm-scope-box.is-prod {
  border-left: 4px solid var(--c-brand-purple);
}

.llm-scope-box.is-test {
  border-left: 4px solid var(--c-brand-orange);
}

.llm-scope-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-tertiary);
}

.llm-scope-value {
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-primary);
  margin-top: 2px;
  word-break: break-word;
}

.llm-scope-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--c-text-tertiary);
  margin-top: 4px;
}

.llm-scope-note.is-override {
  color: var(--c-brand-orange);
  font-weight: 600;
}

.llm-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.llm-selector select {
  font-family: inherit;
  font-size: 15px;
  color: var(--c-text-primary);
  background: var(--c-ui-50);
  border: 1px solid var(--c-ui-300);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}

.llm-selector select:disabled {
  opacity: 0.5;
  cursor: default;
}

.llm-caps {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--c-text-tertiary);
}

.llm-cap-warn {
  color: #8C3418;
  font-weight: 600;
}

.llm-save-note {
  margin: 6px 0 0;
  font-size: 12px;
}

.llm-cost-block {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--c-ui-200);
}

.llm-warm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--c-text-secondary);
}

.llm-cost-card {
  border: 1px solid var(--c-ui-200);
  border-radius: 12px;
  background: var(--c-ui-50);
  padding: 12px 14px;
  margin-top: 10px;
}

.llm-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-primary);
  margin-bottom: 8px;
}

.llm-basis {
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-weight: 400;
  font-size: 12px;
  color: var(--c-text-tertiary);
}

.llm-chip {
  border-radius: 999px;
  border: 1px solid var(--c-ui-300);
  padding: 1px 8px;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-secondary);
}

.llm-chip.is-override {
  background: var(--c-brand-orange);
  border-color: var(--c-brand-orange);
  color: var(--c-ui-0);
}

.framing-chip.is-unverified {
  background: var(--c-brand-orange);
  color: var(--c-ui-0);
}

.llm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.llm-table td {
  padding: 4px 0;
  border-bottom: 1px solid var(--c-ui-150);
  vertical-align: top;
}

.llm-table tr:last-child td {
  border-bottom: none;
}

.llm-table .llm-k {
  color: var(--c-text-secondary);
  width: 42%;
}

.llm-table .llm-v {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  width: 24%;
}

.llm-table .llm-c {
  color: var(--c-text-tertiary);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* The "of which" rows: reasoning is INSIDE output and cached input is a
 * split of the input line — indented so neither reads as an extra charge. */
.llm-table tr.llm-sub .llm-k {
  padding-left: 18px;
  color: var(--c-text-tertiary);
  font-style: italic;
}

.llm-table tr.llm-sub .llm-v {
  font-weight: 400;
  color: var(--c-text-secondary);
}

.llm-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--c-ui-300);
  font-size: 14px;
  font-weight: 700;
}

.llm-total-value {
  font-variant-numeric: tabular-nums;
  color: var(--c-brand-purple);
}

.llm-total.is-unpriced .llm-total-value {
  color: #8C3418;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.llm-est-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--c-text-tertiary);
}

.llm-unverified {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #8C3418;
}

.llm-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 10px;
}

.llm-history-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-tertiary);
  border-bottom: 1px solid var(--c-ui-300);
  padding: 4px 8px 4px 0;
}

.llm-history-table td {
  padding: 5px 8px 5px 0;
  border-bottom: 1px solid var(--c-ui-150);
}

.llm-history-table .llm-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.llm-h-model {
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 12px;
}

.llm-unpriced-cell {
  color: #8C3418;
  font-weight: 600;
}

.llm-prices {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--c-ui-200);
}

.llm-prices summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.llm-prices-note {
  margin: 10px 0;
  font-size: 12px;
}

.llm-prices-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.llm-prices-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-tertiary);
  border-bottom: 1px solid var(--c-ui-300);
  padding: 4px 8px 4px 0;
}

.llm-prices-table td {
  padding: 4px 8px 4px 0;
  border-bottom: 1px solid var(--c-ui-150);
}

.llm-price-key {
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 12px;
  white-space: nowrap;
}

.llm-price-flag {
  margin-left: 8px;
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8C3418;
}

.llm-price-input {
  font-family: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo,
      monospace;
  font-size: 13px;
  color: var(--c-text-primary);
  background: var(--c-ui-50);
  border: 1px solid var(--c-ui-300);
  border-radius: 8px;
  padding: 5px 8px;
  width: 100%;
  min-width: 80px;
  outline: none;
}

.llm-price-input:focus {
  border-color: var(--c-brand-purple);
}

.llm-prices-when {
  margin: 10px 0 0;
  font-size: 12px;
}
