/* Live application components, based on the supplied light briefing reference. */
@layer theme {
  :root {
    color-scheme: light;
    --canvas: var(--rf-canvas);
    --rail: var(--rf-paper);
    --paper: var(--rf-paper);
    --soft: #f4f4f4;
    --line: var(--rf-line);
    --control-line: var(--rf-control-border);
    --ink: var(--rf-ink);
    --muted: var(--rf-ink-3);
    --accent: var(--rf-accent);
    --blue: var(--rf-focus);
    --warning: var(--rf-warning);
    --danger: var(--rf-danger);
    --success: var(--rf-positive);
    --success-surface: #edf6f0;
    --warning-surface: var(--rf-warning-soft);
    --info-surface: var(--rf-accent-soft);
    --danger-surface: var(--rf-danger-soft);
    --sidebar: var(--rf-rail);
  }

  html, body { background: var(--canvas); color: var(--ink); }
  html { font-family: var(--rf-font); font-size: 14px; -webkit-font-smoothing: antialiased; }
  body { min-height: 100dvh; line-height: 1.5; }
  ::selection { background: #cde6e1; color: var(--ink); }
  :focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
  input, textarea { caret-color: var(--accent); }
  .sidebar, .nav, .checks, dialog { scrollbar-color: #b9b9b9 transparent; scrollbar-width: thin; }
  h1, h2, h3 { font-weight: 600; letter-spacing: -.025em; overflow-wrap: anywhere; }
  h1 { font-size: var(--rf-text-title); line-height: var(--rf-leading-title); }
  h2 { font-size: var(--rf-text-section); line-height: var(--rf-leading-section); }
  h3 { font-size: 16px; line-height: 24px; letter-spacing: -.015em; }
  strong, b { font-weight: 600; }
  a { color: var(--accent); }
  a:hover { color: var(--rf-accent-hover); }
  button { color: inherit; }
  small, .small { font-size: 13px; line-height: 1.45; }
  .eyebrow { color: var(--muted); font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; }
  .wordmark { font-size: 15px; font-weight: 600; letter-spacing: -.025em; }
  .dot { width: 6px; height: 6px; background: var(--accent); }
  .skip { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
  .boot, .loading { background: var(--canvas); color: var(--muted); }
  .icon { width: 18px; height: 18px; }

  .sidebar { background: var(--rail); padding: 24px 14px 18px; border-color: var(--line); overflow-y: auto; }
  .brand { padding: 0 10px 20px; }
  .brand .small { font-size: 12px; letter-spacing: 0; margin-top: 4px; }
  .project-switch { background: var(--soft); color: var(--ink); border: 1px solid transparent; border-radius: var(--rf-radius-control); margin-bottom: 22px; padding: 9px; gap: 10px; }
  .project-switch:hover { background: #ededed; border-color: var(--line); }
  .project-switch .initial { width: 32px; height: 32px; background: var(--ink); color: white; border-radius: 6px; font-size: 13px; font-weight: 500; }
  .project-switch .truncate { display: block; }
  .project-switch .text { line-height: 1.4; }
  .project-switch .small { font-size: 12px; }
  .project-switch > .icon { color: var(--muted); width: 15px; height: 15px; }
  .nav-label { padding-left: 10px; margin-bottom: 8px; font-size: 11px; letter-spacing: .045em; text-transform: uppercase; }
  .nav { gap: 3px; }
  .nav button { color: var(--rf-ink-2); gap: 10px; padding: 9px 10px; border-radius: 6px; font-size: 14px; font-weight: 400; min-height: 40px; }
  .nav button:hover { color: var(--ink); background: #f8f8f8; }
  .nav button.active { color: var(--ink); background: var(--soft); font-weight: 500; }
  .nav button .icon { color: var(--muted); }
  .nav button.active .icon { color: var(--ink); }
  .nav .count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
  .sidebar-footer { border-color: var(--line); padding: 14px 5px 0; }
  .sidebar-footer .btn { padding-inline: 5px; font-size: 13px; margin-bottom: 12px; }
  .local-state { padding-inline: 5px; font-size: 12px; }
  .topbar { background: var(--paper); border-color: var(--line); min-height: var(--rf-toolbar); padding: 10px 32px; }
  .breadcrumb { min-width: 0; flex-wrap: wrap; gap: 10px; font-size: 14px; }
  .breadcrumb strong { color: var(--ink); font-weight: 500; }
  .topbar-actions { flex-shrink: 0; gap: 12px; }
  .save-note { font-size: 12px; }
  .save-note .icon { width: 15px; height: 15px; }
  main.workspace { max-width: 1510px; padding: 32px 32px 64px; }
  .page-heading { align-items: center; margin-bottom: 24px; gap: 20px; }
  .page-heading .eyebrow { display: none; }
  .page-heading p { max-width: 70ch; margin-top: 6px; font-size: 14px; }
  .heading-actions { gap: 8px; flex-shrink: 0; }
  .two-col { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 20px; }
  .section { margin-top: 24px; }
  .section-title { margin-bottom: 14px; }
  .section-title h2 { font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -.025em; }
  .stack { gap: 16px; }
  .two-col > *, .page-heading > *, .section-title > *, .row > * { min-width: 0; }
  .toolbar { gap: 12px; margin-bottom: 20px; }

  .btn {
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--rf-radius-control);
    padding: 8px 12px;
    min-height: 36px;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    box-shadow: none;
    transition: background-color .12s ease-out, border-color .12s ease-out;
  }
  .btn:hover { background: #f7f7f7; border-color: var(--rf-line-strong); }
  .btn.primary, .btn.dark { color: white; background: var(--ink); border-color: var(--ink); }
  .btn.primary:hover, .btn.dark:hover { color: white; background: #363636; border-color: #363636; }
  .btn.ghost { background: transparent; border-color: transparent; }
  .btn.ghost:hover { background: var(--soft); border-color: transparent; }
  .btn.compact { min-height: 32px; padding: 5px 10px; font-size: 13px; line-height: 20px; }
  .btn.icon-only { padding: 8px; flex-shrink: 0; }
  .btn[data-action^='ai-'], .btn[data-action='toggle-ai-interview'] { color: var(--accent); background: var(--info-surface); border-color: #a9cec6; }
  .btn[data-action^='ai-']:hover, .btn[data-action='toggle-ai-interview']:hover { background: #dfeeea; border-color: #81b4a9; }
  .text-btn { color: var(--rf-ink-2); font-size: 13px; font-weight: 400; min-height: 32px; }
  .text-btn:hover { color: var(--ink); }
  button:disabled, .btn[aria-disabled='true'],
  .btn.primary:disabled, .btn.dark:disabled,
  .btn[data-action^='ai-']:disabled, .btn[data-action='toggle-ai-interview']:disabled {
    opacity: 1;
    color: #767676;
    background: #f0f0f0;
    border-color: #e2e2e2;
    cursor: not-allowed;
  }

  .badge { color: var(--rf-ink-2); background: var(--soft); font-size: 12px; font-weight: 400; letter-spacing: 0; border-radius: 4px; padding: 3px 6px; max-width: 100%; }
  .badge.green { color: var(--success); background: var(--success-surface); }
  .badge.amber { color: var(--warning); background: var(--warning-surface); }
  .badge.blue { color: var(--accent); background: var(--info-surface); }
  .badge.red { color: var(--danger); background: var(--danger-surface); }
  .panel, .record, .next-action { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 22px; box-shadow: none; }
  .next-action { gap: 20px; }
  .next-action h2 { font-size: 20px; line-height: 26px; font-weight: 600; margin: 8px 0; max-width: 65ch; }
  .next-action p { color: var(--rf-ink-2); max-width: 70ch; }
  .next-action .actions { margin-top: 16px; gap: 14px; }
  .next-mark { display: none; }
  .metrics { margin: 20px 0; padding: 22px; gap: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
  .metric, .metric:first-child { display: flex; flex-direction: column; padding: 0; border: 0; min-width: 0; }
  .metric .value { font-size: var(--rf-text-metric); line-height: var(--rf-leading-metric); letter-spacing: -.03em; font-weight: 600; }
  .metric p { order: -1; margin: 0 0 6px; color: var(--muted); font-size: 13px; }
  .metric-source { color: var(--muted); font-size: 12px; margin-top: 6px; }
  .overview-main .next-action { display: block; }
  .decision-marker { width: 6px; height: 6px; margin-top: 8px; border-radius: 50%; background: var(--warning); flex-shrink: 0; }
  .decision-queue .line-item { gap: 10px; }
  .decision-queue .text-btn { display: inline-block; margin-top: 6px; }
  .decision-queue .queue-note { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; font-size: 13px; }
  .record h3 { font-size: 18px; font-weight: 500; line-height: 25px; margin-bottom: 10px; }
  .record .record-meta { gap: 6px; margin-bottom: 12px; }
  .record blockquote { border-left: 1px solid var(--rf-line-strong); color: var(--rf-ink-2); font-size: 15px; line-height: 1.6; max-width: 75ch; padding-left: 16px; }
  .record-footer { border-color: var(--line); margin-top: 18px; padding-top: 14px; }
  .record details > .stack { padding-top: 12px; }
  .panel > p { color: var(--rf-ink-2); }
  .panel > .panel, .record .panel, .dialog-content .panel { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
  .line-item { gap: 12px; padding: 16px 0; border-color: var(--line); }
  .line-item h3 { font-size: 15px; font-weight: 500; letter-spacing: -.01em; line-height: 22px; }
  .line-item p { color: var(--rf-ink-2); }
  .item-index { color: var(--accent); font-size: 12px; }
  .empty { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 28px 22px; }
  .empty .icon { color: var(--muted); width: 22px; height: 22px; }
  .empty h3 { font-weight: 500; }
  .blank-art { display: none; }

  summary { color: var(--rf-ink-2); }
  summary:hover, details[open] > summary { color: var(--ink); }
  summary::marker { color: var(--muted); }
  .notice { color: var(--rf-ink-2); background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
  .notice.amber { color: var(--warning); background: var(--warning-surface); border-color: #eddda9; }
  .notice.blue { color: var(--accent); background: var(--info-surface); border-color: #cce3dc; }
  .notice summary { color: inherit; }
  .error { color: var(--danger); background: var(--danger-surface); border: 1px solid #efcad1; border-radius: 6px; }
  .approval-list { color: var(--warning); }
  code { color: var(--ink); background: #efefef; border-radius: 4px; }
  .notice code { color: inherit; background: #ffffff80; }

  input, textarea, select, .toolbar input, .interview-main textarea {
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--control-line);
    border-radius: 6px;
    padding: 9px 11px;
    font-size: 14px;
    line-height: 20px;
    box-shadow: none;
  }
  input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
  input:hover, textarea:hover, select:hover { border-color: #626262; }
  input:focus-visible, textarea:focus-visible, select:focus-visible { outline-offset: 2px; border-color: var(--blue); }
  input[aria-invalid='true'], textarea[aria-invalid='true'], select[aria-invalid='true'] { border-color: var(--danger); }
  input:disabled, textarea:disabled, select:disabled { color: #767676; background: #f0f0f0; border-color: #c5c5c5; cursor: not-allowed; }
  input[readonly], textarea[readonly] { color: var(--rf-ink-2); background: var(--soft); }
  input[type='checkbox'], input[type='radio'] { padding: 0; accent-color: var(--accent); }
  input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus { -webkit-text-fill-color: var(--ink); -webkit-box-shadow: 0 0 0 1000px var(--paper) inset; caret-color: var(--ink); }
  .field { gap: 6px; margin-bottom: 18px; }
  .field label, fieldset legend { font-weight: 500; color: var(--ink); font-size: 14px; }
  .field .help { font-size: 13px; line-height: 20px; }
  .checks { background: var(--paper); border-color: var(--control-line); }
  .check { line-height: 1.6; }
  .form-actions { flex-wrap: wrap; border-color: var(--line); margin-top: 20px; padding-top: 18px; }

  dialog { color: var(--ink); background: var(--paper); border-color: var(--line); border-radius: 12px; box-shadow: none; }
  dialog::backdrop { background: #20202050; backdrop-filter: none; }
  .dialog-head { padding: 24px 24px 20px; }
  .dialog-head h2 { font-weight: 600; font-size: 22px; line-height: 28px; }
  .dialog-head > div { min-width: 0; }
  .dialog-content { padding: 0 24px 24px; }
  .dialog-content .panel h2.section { margin-top: 8px; }
  #toast { background: var(--ink); color: white; border: 0; border-radius: 6px; box-shadow: none; }
  .step-rail { gap: 6px; margin-bottom: 20px; }
  .step-rail span { height: 2px; background: var(--line); }
  .step-rail span.done { background: var(--accent); }
  .choice-grid label { color: var(--rf-ink-2); background: var(--paper); border-color: var(--control-line); border-radius: 6px; padding: 14px 12px; }
  .choice-grid label:hover { background: #f8f8f8; border-color: #626262; }
  .choice-grid label:has(input:checked) { color: var(--accent); background: var(--info-surface); border-color: var(--accent); }
  .choice-grid label:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 3px; }
  .journey { border-color: var(--line); padding-left: 20px; margin-left: 7px; }
  .journey div { margin-bottom: 20px; }
  .journey div::before { width: 5px; height: 5px; left: -26px; top: 5px; background: #929292; border-width: 3px; }
  .journey strong { font-weight: 500; }
  .journey p { font-size: 13px; line-height: 20px; }

  .interview-shell { background: var(--canvas); max-width: 1100px; padding: 0 32px 64px; }
  .interview-top { min-height: 64px; margin-inline: -32px; padding: 12px 32px; background: var(--paper); border-color: var(--line); }
  .interview-layout { grid-template-columns: minmax(0, 680px) 240px; gap: 40px; margin: 32px 0; }
  .interview-main { min-width: 0; }
  .interview-main h1 { font-size: 28px; font-weight: 600; letter-spacing: -.025em; line-height: 36px; margin: 12px 0 16px; }
  .interview-main .guidance { max-width: 70ch; font-size: 15px; line-height: 24px; margin-bottom: 20px; }
  .interview-main form > .eyebrow { display: block; margin-bottom: 8px; color: var(--ink); font-size: 14px; }
  .interview-main textarea { min-height: 180px; padding: 14px; font-size: 16px; line-height: 24px; }
  .interview-aside { border-color: var(--line); }
  .interview-aside h3 { font-size: 14px; font-weight: 500; letter-spacing: 0; }
  .interview-aside p { font-size: 13px; line-height: 21px; }
  .scenario { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
  .scenario p { color: var(--rf-ink-2); font-size: 15px; line-height: 24px; }
  .answer-choices button { color: var(--ink); background: var(--paper); border: 1px solid var(--rf-line-strong); border-radius: 6px; gap: 12px; padding: 12px; }
  .answer-choices button:hover, .answer-choices button:focus { background: var(--info-surface); border-color: var(--accent); }
  .answer-choices button span { color: var(--rf-ink-2); background: var(--soft); border-color: var(--line); border-radius: 4px; width: 24px; height: 24px; }
  .answer-choices button:disabled { color: #767676; background: #f0f0f0; border-color: var(--line); }
  .question-sources { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .audit-row { border-color: var(--line); font-size: 13px; }
  .audit-row > * { overflow-wrap: anywhere; }

  @media (max-width: 1100px) {
    :root { --sidebar: 224px; }
    .sidebar { padding-inline: 12px; }
    .brand { padding-inline: 8px; }
    .wordmark { font-size: 14px; }
    .topbar { padding-inline: 24px; }
    main.workspace { padding: 28px 24px 56px; }
    .two-col { grid-template-columns: 1fr; }
    .page-heading { align-items: flex-start; flex-wrap: wrap; }
    .interview-layout { grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; }
  }
  @media (max-width: 760px) {
    .sidebar { padding: 18px 18px 12px; overflow: visible; }
    .brand { padding: 0 0 14px; }
    .project-switch { margin: 0 0 10px; padding: 8px; }
    .project-switch .text { display: flex; align-items: baseline; gap: 4px; }
    .project-switch .truncate { max-width: min(60vw, 420px); }
    .nav { padding: 4px 2px 8px; margin-inline: -2px; }
    .nav button { min-height: 44px; padding: 9px 12px; }
    .sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; padding: 8px 0 0; }
    .sidebar-footer .btn { margin: 0; padding: 8px; }
    .sidebar-footer .local-state { padding: 0; }
    .topbar { min-height: 60px; gap: 12px; padding: 10px 20px; }
    main.workspace { padding: 24px 20px 48px; }
    .page-heading { gap: 14px; margin-bottom: 20px; }
    .page-heading .heading-actions { width: 100%; }
    .next-action { padding: 20px; }
    .next-action h2 { font-size: 20px; }
    .metrics { padding: 20px; gap: 20px; }
    .metric .value { font-size: 28px; line-height: 34px; }
    .record-meta .badge { white-space: normal; overflow-wrap: anywhere; }
    .form-actions .btn { max-width: 100%; }
    .interview-shell { padding: 0 20px 48px; }
    .interview-top { margin-inline: -20px; padding-inline: 20px; flex-wrap: wrap; align-items: center; gap: 8px; }
    .interview-top .row { gap: 8px; }
    .interview-top .btn { padding-inline: 8px; }
    .interview-layout { grid-template-columns: 1fr; margin-top: 24px; gap: 24px; }
    .interview-main h1 { font-size: 26px; line-height: 34px; }
    .btn, .btn.compact, .text-btn { min-height: 44px; }
    input:not([type='checkbox']):not([type='radio']), select { min-height: 44px; font-size: 16px; }
    .check { min-height: 44px; }
  }
  @media (max-width: 420px) {
    .sidebar { padding-inline: 14px; }
    .sidebar-footer { flex-wrap: wrap; gap: 0 12px; }
    .local-state { font-size: 11px; }
    .topbar { padding-inline: 16px; flex-wrap: wrap; }
    .topbar-actions { margin-left: auto; }
    main.workspace { padding-inline: 16px; }
    .next-action, .panel, .record { padding: 18px; }
    .metrics { padding: 18px; gap: 18px; }
    .metric p { font-size: 12px; }
    .section-title { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
    .line-item { gap: 10px; flex-wrap: wrap; }
    .line-item .body { flex-basis: calc(100% - 35px); }
    .line-item > .btn, .line-item > .text-btn { margin-left: 32px; }
    .dialog-head { padding: 20px 18px 18px; gap: 10px; }
    .dialog-content { padding: 0 18px 20px; }
    .dialog-head h2 { font-size: 20px; line-height: 26px; }
    .choice-grid { grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
    .choice-grid label { display: flex; align-items: center; gap: 12px; padding: 12px; font-size: 14px; }
    .choice-grid .icon { margin: 0; }
    .form-actions { justify-content: flex-start; gap: 10px; }
    .form-actions > .btn { flex: 1 1 auto; }
    .interview-shell { padding-inline: 16px; }
    .interview-top { margin-inline: -16px; padding-inline: 16px; }
    .interview-main h1 { font-size: 24px; line-height: 32px; }
    .answer-choices button { align-items: flex-start; gap: 10px; padding: 12px; }
    .audit-row { flex-direction: column; gap: 4px; }
  }
  @media (pointer: coarse) {
    .btn, .btn.compact, .text-btn, .nav button { min-height: 44px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .btn { transition: none; }
  }
}
