/* Nova — design tokens + app shell. Chakra UI design system ported to CSS.
   Palette: docs/BRANDING/brand-colors.md → Chakra UI Adaptation.
   No component framework, no React — tokens + a small CSS layer only. */

:root,
[data-theme="light"] {
  /* Surfaces */
  --bg-shell: #fcfcfc;
  --bg: #ffffff;
  --bg-subtle: #f7f7f7;
  --bg-elevated: #ffffff;

  /* Text + borders */
  --text: #18202e;
  --text-muted: #6a7290;
  --text-faint: #808aa2;
  --border: #e5e5e5;
  --border-muted: #f0f0f0;

  /* Actions */
  --primary: #2b55cc;
  --primary-hover: #2244a8;
  --primary-subtle: #e9eefb;
  --primary-focus: #b9c7f5;
  --secondary: #6248c4;
  --secondary-subtle: #eeeafb;

  /* Logo tile — sampled from the Toza Nova artwork (sky blue 200°, lavender 270°) */
  --logo-bg: #eaf3fb;

  /* Content column — fills a 24-inch screen (1920 px) without ever forcing a
     horizontal scrollbar: 92vw with a 1600 px ceiling. */
  --content-max: min(92vw, 1600px);

  /* Tooltip reveal delay and type size — one value each for the whole app.
     Native `title` tooltips cannot be timed, so tooltips are `data-tooltip`
     bubbles; they must not inherit the control's type, or a 13 px button and a
     16 px icon button would render different-looking hints. */
  --tip-delay: 200ms;
  --tip-font-size: 13px;

  /* Alerts */
  --danger: #c02820;
  --danger-subtle: #fbeceb;
  --warning: #8e7000;
  --warning-subtle: #fbf5e0;
  --success: #157843;
  --success-subtle: #e8f5ee;
  --info: #2244a8;

  /* Chrome */
  --banner-bg: #1a202c;
  --banner-fg: #eceef8;
  --banner-icon: #f6e05e;

  /* Shape + elevation (Chakra radii / shadows) */
  --r-sm: 0.125rem;
  --r-md: 0.375rem;
  --r-lg: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg-shell: #303030;
  --bg: #3c3c3c;
  --bg-subtle: #363636;
  --bg-elevated: #454545;

  --text: #f0f2f8;
  --text-muted: #b0b6c8;
  --text-faint: #8a91a5;
  --border: #565656;
  --border-muted: #464646;

  --primary: #6888e8;
  --primary-hover: #8fa3ee;
  --primary-subtle: #2a3a66;
  --primary-focus: #3f5bb8;
  --secondary: #9878e0;
  --secondary-subtle: #3d2e7a;

  --logo-bg: #26314b;

  --danger: #e05050;
  --danger-subtle: #4a2424;
  --warning: #d4b000;
  --warning-subtle: #43391a;
  --success: #38c870;
  --success-subtle: #1e3a2a;
  --info: #8fa3ee;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

/* Components set `display`, which would otherwise beat the browser's own
   `[hidden]` rule — keep the attribute authoritative. */
[hidden] {
  display: none !important;
}

html {
  /* Reserve the scrollbar gutter on every page: a short page (Ask Nova before
     an answer exists) then keeps the same centred column as a long one
     (Documents, Admin) instead of shifting by half a scrollbar width. */
  scrollbar-gutter: stable;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  font: 16px/1.5 var(--font-body);
  background: var(--bg-shell);
  color: var(--text);
}

a {
  color: var(--primary);
}

/* Placeholders are a hint, never content: one faint tone everywhere, and
   `opacity: 1` because Firefox dims placeholders on its own. The field label
   or heading above each control still carries the actual name. */
::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

:focus-visible {
  outline: 2px solid var(--primary-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* ---- Shell: top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 56px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: block;
  flex: none;
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: var(--r-md);
  background: var(--logo-bg);
}

.areas {
  display: flex;
  align-items: center;
  gap: 2px;
}

.area {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.area:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.area[aria-current="page"] {
  background: var(--primary-subtle);
  color: var(--primary);
}

.soon {
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-muted);
  /* Form controls default to the UA font (Arial); inherit the app font so
     tooltips and any label inside match the buttons beside them. */
  font: inherit;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--secondary-subtle);
  color: var(--secondary);
  font-size: 10.5px;
  font-weight: 700;
}

/* ---- Shell: page head + tabs ---- */
.page-head {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.page-head-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 18px 24px 0;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.crumbs svg {
  width: 12px;
  height: 12px;
}

.page-head h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 14px;
}

.tab {
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-current="page"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---- Shell: content + footer ---- */
.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 24px 40px;
}

.footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11.5px;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
}

/* ---- Shared primitives ---- */
.card {
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.eyebrow {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.btn {
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 9px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Press feedback — the control acknowledges the click before the request lands (B6). */
.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

[data-theme="dark"] .btn-primary {
  color: #101010;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- Tooltips ---- */
/* One shared tooltip: `data-tooltip` carries the text, `--tip-delay` the reveal
   delay. The bubble is a real element (see tooltip.js) so the hint never joins
   the control's accessible name. */
[data-tooltip] {
  position: relative;
}

.tip-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 260px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  /* Same type as the button labels it sits beside: 13 px / 600 / 1.5. A bubble
     never inherits its host's casing or tracking, or a tooltip on an uppercase
     heading would shout back (user direction 2026-11-18). */
  font-size: var(--tip-font-size);
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  opacity: 0;
  transform: translate(-50%, 2px);
  pointer-events: none;
  transition:
    opacity 120ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 120ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tail — decorative only, so it stays a pseudo-element. */
.tip-bubble::before {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  transform: translateX(-50%) rotate(45deg);
}

.tip-bubble svg {
  flex: none;
  width: 1em;
  height: 1em;
  color: var(--text-muted);
}

/* Elements pinned to the top of the viewport open downward. */
[data-tooltip-pos="bottom"] .tip-bubble {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translate(-50%, -2px);
}

[data-tooltip-pos="bottom"] .tip-bubble::before {
  top: -5px;
  bottom: auto;
  border-right: 0;
  border-bottom: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

[data-tooltip]:hover .tip-bubble,
[data-tooltip]:focus-visible .tip-bubble {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: var(--tip-delay);
}

/* Right-edge controls: anchor the bubble to the control's right edge, so a long
   hint grows inward instead of running off the viewport. */
[data-tooltip-align="end"] .tip-bubble {
  left: auto;
  right: 0;
  transform: translateY(2px);
}

[data-tooltip-align="end"][data-tooltip-pos="bottom"] .tip-bubble {
  transform: translateY(-2px);
}

[data-tooltip-align="end"] .tip-bubble::before {
  left: auto;
  right: 10px;
  transform: rotate(45deg);
}

[data-tooltip-align="end"]:hover .tip-bubble,
[data-tooltip-align="end"]:focus-visible .tip-bubble {
  transform: translateY(0);
}

/* Left-edge controls: anchor the bubble to the control's left edge so it grows
   rightward, the mirror of the `end` case. Without this a centred bubble on a
   control near the rail's left edge is clipped by the step's own box (user
   direction 2026-11-18). */
[data-tooltip-align="start"] .tip-bubble {
  left: 0;
  right: auto;
  transform: translateY(2px);
}

[data-tooltip-align="start"][data-tooltip-pos="bottom"] .tip-bubble {
  transform: translateY(-2px);
}

[data-tooltip-align="start"] .tip-bubble::before {
  left: 10px;
  right: auto;
  transform: rotate(45deg);
}

[data-tooltip-align="start"]:hover .tip-bubble,
[data-tooltip-align="start"]:focus-visible .tip-bubble {
  transform: translateY(0);
}

/* ---- Ask Nova page ---- */
.ask-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}

.ask-help-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ask-help-row .field-help {
  flex: 1 1 auto;
}

.effort-group {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.effort-label {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* Quick / Deep answer effort (decision #77). The unselected label sits on the
   card surface at --text-muted (4.75:1), never on --bg-subtle, so the control
   clears AA at 12px. The selected segment reuses the active nav tint
   (--primary-subtle) but keeps --text as its label colour: --primary on
   --primary-subtle measures 3.3:1 in dark mode, which is not readable at 12px. */
.effort-switch {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.effort-option {
  padding: 4px 12px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
    color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.effort-option:hover {
  color: var(--text);
}

.effort-option[aria-pressed="true"] {
  background: var(--primary-subtle);
  color: var(--text);
}

.effort-option:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.question-input {
  display: block;
  width: 100%;
  margin: 8px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  resize: vertical;
}

.question-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.field-help {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.btn-ghost {
  border-color: var(--border);
  background: var(--bg);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
}

.ask-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.answer-region {
  margin-top: 16px;
}

.answer-loading {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.answer-loading.htmx-request {
  display: flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Answer in flight (decision #79) ----
   htmx 4 beta re-enables `hx-disable` elements at the first stream message, so
   the page holds its own busy state (ask.js) and this makes it visible. */
.ask-form[data-busy="true"] .btn-primary {
  opacity: 0.55;
  pointer-events: none;
}

/* Live activity panel — real steps only, one line each. */
.activity {
  padding: 14px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.activity__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.activity__list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 13px;
}

.activity__row {
  margin: 5px 0;
}

.activity__row::marker {
  color: var(--text-muted);
}

/* What Nova did — collapsed record above the finished card (decision #80). */
.activity-summary {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.activity-summary__toggle {
  cursor: pointer;
}

.activity-summary__toggle:hover,
.activity-summary[open] .activity-summary__toggle {
  color: var(--text);
}

.activity-summary__list {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 12.5px;
}

/* ---- Answer card (fragment) ---- */
.answer-card {
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.answer-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.answer-card__eyebrow {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.answer-card__badge {
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Measured answer time — quiet, right-aligned on the eyebrow row (decision #61). */
.answer-card__duration {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11.5px;
  font-style: italic;
}

.answer-card__section {
  padding: 12px 0;
  border-top: 1px solid var(--border-muted);
}

.answer-card__heading {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Route block — the label is the block's only heading (decision #81). */
.answer-route__label {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.answer-route__bullets {
  margin: 0;
  padding-left: 20px;
}

.answer-route__bullets li {
  margin: 4px 0;
}

.answer-route p + .answer-route__bullets,
.answer-route p + .answer-card__steps,
.answer-route__bullets + .answer-card__steps {
  margin-top: 8px;
}

.answer-route__references {
  margin: 10px 0 0;
}

.answer-card__summary,
.answer-card__section p {
  margin: 0;
  font-size: 15px;
}

.answer-card__steps {
  margin: 0;
  padding-left: 20px;
}

.answer-card__steps li {
  margin: 4px 0;
}

.answer-card__references,
.answer-card__assumptions {
  margin: 0;
  padding: 0;
  list-style: none;
}

.answer-card__references li + li {
  margin-top: 6px;
}

.answer-card__reference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.answer-card__reference:hover {
  border-color: var(--primary);
}

.answer-card__lines {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 400;
}

.answer-card__assumptions li {
  margin: 4px 0;
  font-size: 15px;
}

.answer-card__empty {
  color: var(--text-muted);
  font-style: italic;
}

/* ---- View changes (diff, decision #29) ---- */
.answer-diff {
  margin-top: 10px;
  border-top: 1px solid var(--border-muted);
  padding-top: 10px;
}

.answer-diff__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.answer-diff__toggle::-webkit-details-marker {
  display: none;
}

.answer-diff[open] .answer-diff__toggle {
  border-color: var(--primary);
  background: var(--primary-subtle);
  color: var(--primary);
}

.answer-diff__body {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border-muted);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
}

.answer-diff__heading {
  margin: 10px 0 4px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.answer-diff__heading:first-child {
  margin-top: 0;
}

.answer-diff__text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.7;
}

.answer-diff__list {
  margin: 0;
  padding-left: 18px;
  font-size: 14.5px;
}

.answer-diff__steps {
  counter-reset: step;
  margin: 0;
  padding-left: 20px;
  list-style: none;
  font-size: 14.5px;
}

.answer-diff__steps li {
  position: relative;
  margin: 4px 0;
  counter-increment: step;
}

.answer-diff__steps li::before {
  position: absolute;
  left: -20px;
  width: 14px;
  text-align: right;
  content: counter(step) ".";
}

.answer-diff__steps li.d-del {
  counter-increment: none;
}

.d-add {
  background: var(--success-subtle);
  color: var(--success);
  border-radius: var(--r-sm);
  padding: 0 2px;
}

.d-del {
  background: var(--danger-subtle);
  color: var(--danger);
  border-radius: var(--r-sm);
  padding: 0 2px;
  text-decoration: line-through;
}

/* ---- Document drawer + viewer ---- */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(var(--drawer-width, 45%), 100%);
  /* Floor: below 560 px the line gutter and the source text stop being readable. */
  min-width: min(560px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

/* Resize grip on the left edge — drag to any width, double-click to snap wide. */
.drawer-grip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -3px;
  width: 8px;
  z-index: 1;
  cursor: col-resize;
  touch-action: none;
}

.drawer-grip:hover,
.drawer-grip:focus-visible {
  background: var(--primary-focus);
  outline: none;
}

/* `hidden` must win over the flex display above. */
.drawer[hidden] {
  display: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.drawer-head .icon-btn {
  margin-left: auto;
}

.drawer-content {
  flex: 1;
  overflow: auto;
  padding: 10px 0;
}

.drawer-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.drawer-meta__icon {
  flex: none;
  width: 13px;
  height: 13px;
}

.doc-line {
  display: flex;
  padding: 0 18px;
  font: 12.5px/1.65 var(--font-mono);
}

.doc-line__number {
  flex: none;
  width: 38px;
  padding-right: 12px;
  color: var(--text-muted);
  text-align: right;
  user-select: none;
}

.doc-line__text {
  white-space: pre-wrap;
}

.doc-line--hit {
  background: var(--primary-subtle);
  box-shadow: inset 2px 0 0 var(--primary);
}

/* ---- Document drawer views (decision #78) ---- */
.drawer-head__actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.drawer-head__actions .icon-btn {
  margin-left: 0;
}

.doc--rendered {
  padding: 6px 18px 24px;
  font-size: 13px;
  line-height: 1.6;
}

.doc--rendered > :first-child {
  margin-top: 0;
}

.doc--rendered p,
.doc--rendered ul,
.doc--rendered ol,
.doc--rendered pre,
.doc--rendered table,
.doc--rendered blockquote {
  margin: 0 0 10px;
}

.doc--rendered h1,
.doc--rendered h2,
.doc--rendered h3,
.doc--rendered h4,
.doc--rendered h5,
.doc--rendered h6 {
  margin: 16px 0 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.doc--rendered h1 {
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
}

.doc--rendered ul,
.doc--rendered ol {
  padding-left: 22px;
}

.doc--rendered li + li {
  margin-top: 4px;
}

.doc--rendered code {
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-subtle);
  font: 12px var(--font-mono);
}

.doc--rendered pre {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-subtle);
  overflow-x: auto;
}

.doc--rendered pre code {
  padding: 0;
  background: none;
}

.doc--rendered blockquote {
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}

.doc--rendered table {
  border-collapse: collapse;
  font-size: 12px;
}

.doc--rendered th,
.doc--rendered td {
  padding: 5px 10px;
  border: 1px solid var(--border);
  text-align: left;
}

.md-block {
  margin: 0 -8px;
  padding: 2px 8px;
  border-radius: 4px;
}

.md-block--hit {
  background: var(--primary-subtle);
  box-shadow: inset 2px 0 0 var(--primary);
}

.doc-frontmatter {
  margin: 4px 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-subtle);
}

.doc-frontmatter summary {
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.doc-frontmatter pre {
  margin: 0;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: none;
  color: var(--text-muted);
  font: 12px/1.55 var(--font-mono);
  white-space: pre-wrap;
}

/* Source view: Markdown token colouring, colour only, never diagnostics. */
.md-src-heading,
.md-src-marker {
  color: var(--primary);
  font-weight: 700;
}

.md-src-meta {
  color: var(--text-muted);
  font-style: italic;
}

.md-src-code {
  padding: 0 3px;
  border-radius: 3px;
  background: var(--bg-subtle);
}

.md-src-strong {
  font-weight: 700;
}

.md-src-link {
  color: var(--primary);
  text-decoration: underline;
}

.md-src-quote {
  color: var(--text-muted);
}

/* ---- Documents page ---- */
.doc-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
}

.doc-search__field {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
}

.doc-search__field svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.doc-search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.doc-search input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

/* htmx indicator: the element exists in the markup and only shows while its
   request runs, so a debounced search reports work without a layout jump. */
.htmx-indicator {
  display: none;
}

.htmx-indicator.htmx-request {
  display: inline-flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinner-rotate 0.7s linear infinite;
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

.doc-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 1100px) {
  .doc-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .doc-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

.doc-item {
  display: block;
  width: 100%;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.doc-item:hover {
  border-color: var(--primary);
}

.doc-item__name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}

.doc-item__icon {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.doc-item__context {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.doc-item__snippet {
  display: -webkit-box;
  margin-top: 6px;
  padding-left: 10px;
  border-left: 2px solid var(--primary-subtle);
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.doc-item__meta {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Claim Nova: visit search (row 15) ---- */
.claim-search {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.claim-search__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.claim-search__field--date {
  min-width: 170px;
}

.claim-search__input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}

.claim-search__input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.claim-search .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
}

.claim-search .btn svg {
  width: 16px;
  height: 16px;
}

.claim-search__status {
  display: flex;
  align-items: center;
  height: 40px;
}

.claim-results {
  padding: 16px 18px;
}

.visit-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.visit-item {
  margin: 0;
}

.visit-row {
  display: grid;
  width: 100%;
  /* The rows live in the 380 px rail, so each visit reads on two lines: the
     name with the visit number, then the times with the amount. */
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main visit"
    "duration amount"
    "filed amount";
  align-items: center;
  gap: 2px 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.visit-row:hover {
  border-color: var(--primary);
}

.visit-row:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

/* Each cell names its own area, so no row can push its neighbours sideways. */
.visit-row__main {
  grid-area: main;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.visit-row__name {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visit-row__nric {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.visit-row__visit {
  grid-area: visit;
  justify-self: end;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.visit-row__visit--none {
  border-style: dashed;
}

.visit-row__duration {
  grid-area: duration;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.visit-row__filed {
  grid-area: filed;
  justify-self: start;
  padding: 1px 7px;
  border-radius: var(--r-sm);
  background: var(--success-subtle);
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.visit-row__amount {
  grid-area: amount;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.visit-row__total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.visit-row__split {
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---- Opened visit card and the accordion rail (rows 16 and 17) ---- */
.claim-stage {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.claim-rail {
  display: grid;
  gap: 8px;
}

.claim-rail__steps {
  display: grid;
  gap: 8px;
}

.claim-step {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.claim-step__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* The bar holds the step head, any control of its own and the collapse arrow, in
   this order (user direction 2026-11-18): the change-visit icon sits immediately
   left of the arrow, and both stretch to the header's full height so the row
   reads as one control rather than a chip floating beside it. */
.claim-step__bar {
  display: flex;
  align-items: stretch;
}

.claim-step__swapbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.claim-step__swapbtn:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

.claim-step__swapbtn:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary);
}

/* The arrow is a sibling of the head in this bar, not a child of it, so it
   centres itself and keeps the head's right padding. */
.claim-step__chev--bar {
  align-self: center;
  flex: 0 0 15px;
  margin: 0 14px 0 0;
  cursor: pointer;
}

.claim-step__head:hover {
  background: var(--bg-subtle);
}

.claim-step__head:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.claim-step__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 999px;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.claim-step__title {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.claim-step__summary {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.claim-step__chev {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

/* The Patient step's head asks for the search again instead of opening and
   closing, so it carries a swap mark rather than a chevron. */
.claim-step__swap {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: inherit;
}

.claim-step[data-open="true"] .claim-step__chev {
  transform: rotate(180deg);
}

.claim-step[data-open="true"] .claim-step__summary {
  display: none;
}

/* The divider under an open step spans the whole header, not just the head
   button, so the change-visit icon sits on the same line as the title. */
.claim-step[data-open="true"] .claim-step__bar,
.claim-step[data-open="true"] .claim-step__head {
  border-bottom: 1px solid var(--border-muted);
}

.claim-step__body {
  display: none;
  padding: 12px 14px 14px;
}

.claim-step[data-open="true"] .claim-step__body {
  display: block;
}

.claim-panel {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  min-height: 120px;
}

.plan-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.plan-tile {
  display: grid;
  gap: 2px;
  position: relative;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.plan-tile:hover {
  border-color: var(--primary);
}

.plan-tile:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.plan-tile[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.plan-tile__name {
  font-weight: 700;
  font-size: 13.5px;
}

.plan-tile__meta {
  color: var(--text-muted);
  font-size: 12px;
}

.plan-tile__warn {
  color: var(--warning, #b45309);
  font-size: 11.5px;
  font-weight: 600;
}

.plan-tile__check,
.insurer-choice__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.insurer-list {
  display: grid;
  gap: 6px;
}

.insurer-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.insurer-choice:hover {
  border-color: var(--primary);
}

.insurer-choice:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.insurer-choice[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-subtle);
  font-weight: 600;
}

.insurer-choice__check {
  position: static;
  margin-left: auto;
}

.visit-card {
  display: grid;
  gap: 14px;
}

/* The identity block follows placement 6 of the mockup: name on top, then one
   labelled row per identifier. Label, value and copy are three columns of one
   grid, so every value starts at the same x and every copy icon sits in its own
   column rather than trailing each value (user direction 2026-11-18). */
.visit-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.visit-card__who {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) 24px;
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  min-width: 0;
}

.visit-card__name {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Each row borrows the block's three columns, so a value of any width leaves the
   copy column where the row above put it. */
.visit-card__row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  align-items: center;
  margin: 0;
  min-height: 24px;
}

.visit-card__label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.visit-card__value {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  min-width: 0;
}

/* The copy control is the icon alone, in its own column; the tooltip and
   accessible label say which value it copies (user direction 2026-11-18). */
.visit-card__copy {
  width: 24px;
  height: 24px;
  justify-self: end;
}

.visit-card__copy svg {
  width: 13px;
  height: 13px;
}

.visit-card__copy[data-copy-state="copied"] {
  color: var(--success);
}

.visit-card__copy[data-copy-state="failed"] {
  color: var(--danger);
}

.visit-card__company {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--primary-focus);
  border-radius: 999px;
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.visit-card__company svg {
  width: 12px;
  height: 12px;
  color: var(--primary);
}

/* A patient the clinic registered no company for reads `Nil` in the pill, muted
   so it never looks like a company actually called Nil (user direction 2026-11-18). */
.visit-card__company--empty {
  border-color: var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

.visit-card__company--empty svg {
  color: var(--text-muted);
}

.visit-card__flag {
  padding: 2px 8px;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: normal;
}

/* The band is filled on purpose: it is what tells the CA at a glance that this
   is the right patient and visit (user direction 2026-11-18). */
.visit-band {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border: 1px solid var(--primary-focus);
  border-radius: var(--r-md);
  background: var(--primary-subtle);
}

.visit-band__date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.visit-band__date svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.visit-band__times {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.visit-band__time {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-variant-numeric: tabular-nums;
}

.visit-band__time:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-focus);
  border-radius: var(--r-sm);
}

.visit-band__time--amount {
  text-align: right;
}

.visit-band__label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.visit-band__value {
  font-size: 13px;
  font-weight: 600;
}

.clinical {
  display: grid;
  gap: 14px;
}

.clinical__group {
  display: grid;
  gap: 6px;
}

/* The date-only caveat rides beside the group heading as one icon with a
   tooltip, so it explains the whole list without repeating on every row
   (user direction 2026-11-18). */
.clinical__heading {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.clinical__info {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  cursor: help;
  border-radius: 999px;
}

.clinical__info svg {
  width: 12px;
  height: 12px;
}

.clinical__info:hover,
.clinical__info:focus-visible {
  color: var(--primary);
}

.clinical__info:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-focus);
}

.clinical__list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.clinical__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
}

.clinical__text {
  font-weight: 600;
  font-size: 12.5px;
}

.clinical__note {
  color: var(--text-muted);
  font-size: 11.5px;
}

/* ---- Suggestions panel (row 18) ---- */
.claim-get {
  display: grid;
  gap: 10px;
}

.claim-get form {
  display: grid;
  gap: 10px;
}

/* The run's controls sit on one row: the trigger, the Thinking effort switch and
   the busy indicator. */
.claim-get__controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* The run trigger is a control, not a banner (fixed 2026-11-18): the icon and the
   label sit on one baseline, the icon at the shared 16px control size, and the
   button at the 40px height the page's other controls use. Without this the
   Lucide icon renders at its 24px default inside a block button, so the label
   sits low and the whole control stands 48px tall. */
.claim-get .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  line-height: 1;
}

.claim-get .btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.suggest-head {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-muted);
}

.suggest-head__top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.suggest-head__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.suggest-head__age {
  color: var(--text-muted);
  font-size: 12px;
}

.suggest-head__warn {
  margin: 0;
  color: var(--warning, #b45309);
  font-size: 12px;
  font-weight: 600;
}

.suggest-head__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.suggest-group {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.suggest-group__title {
  margin: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.suggest-lines {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* One item is the suggestion's box plus, underneath it and outside the border,
   its count of other candidates (user direction 2026-11-18). */
.suggest-item {
  display: grid;
  gap: 4px;
}

.suggest-line {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
}

/* The suggested value, its band word and the copy icon share one line: the value
   first, the copy at the right edge (user direction 2026-11-18). */
.suggest-line__row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.suggest-line__value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.suggest-line__code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.suggest-line__name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest-line__copy {
  margin-left: auto;
  flex: 0 0 auto;
}

.suggest-line__more {
  margin-top: 2px;
}

/* The count of other candidates sits under the suggestion's box, outside its
   border, with the same caret affordance as the row's own Details. Opening it
   shows each alternative as its own bordered card, because they are separate
   candidates rather than detail of the one above (user direction 2026-11-18). */
.suggest-line__others {
  margin-top: 0;
}

/* One step lighter than the row's own `Details` (user direction 2026-11-18): the
   count is a secondary affordance on the row, not part of what the row says. It
   darkens on hover and when open so the label never reads as disabled. */
.suggest-line__others summary {
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.suggest-line__others summary:hover {
  color: var(--text-muted);
}

.suggest-line__others summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 5px;
  transition: transform 0.15s ease;
}

.suggest-line__others[open] summary::before {
  transform: rotate(90deg);
}

.suggest-line__others[open] summary {
  color: var(--text-muted);
}

.suggest-line__more summary {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.suggest-line__more summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 5px;
  transition: transform 0.15s ease;
}

.suggest-line__more[open] summary::before {
  transform: rotate(90deg);
}

.suggest-detail {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 3px 10px;
  margin: 6px 0 0;
  font-size: 12.5px;
}

.suggest-detail dt {
  color: var(--text-muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.suggest-detail dd {
  margin: 0;
}

/* A reference reads like Ask Nova's: one bordered control, what it is on the
   left and the cited value on the right. */
.suggest-ref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.suggest-ref:hover {
  border-color: var(--primary);
}

.suggest-ref__meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.suggest-ref--alt {
  margin-top: 6px;
}

.suggest-alts {
  display: grid;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

/* Each alternative is its own object, so it carries its own border rather than
   sharing the suggestion's (user direction 2026-11-18). The subtle surface keeps
   it visually secondary to the suggestion above it. */
.suggest-alt {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border-muted);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
}

.suggest-alt__row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.suggest-alt__why {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.suggest-line__primary {
  padding: 1px 7px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.suggest-line__flag {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.band {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.band--exact {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-subtle);
}

.band--high {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-subtle);
}

.band--low {
  border-color: var(--warning, #b45309);
  color: var(--warning, #b45309);
}

.band--no_match {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-subtle);
}

.reference {
  display: grid;
  gap: 10px;
}

.reference__lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
}

.reference__rows {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reference__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--border-muted);
  border-radius: var(--r-sm);
  background: var(--bg);
}

.reference__row--chosen {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.reference__key {
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  color: var(--text-muted);
}

.reference__text {
  font-size: 13px;
}

.reference__flag {
  margin-left: auto;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .claim-stage {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .visit-band {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "date"
      "times"
      "amount";
  }

  .visit-band__amount {
    align-items: flex-start;
  }
}

.claim-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: var(--r-md);
  background: var(--danger-subtle);
  flex-wrap: wrap;
}

.claim-notice p {
  margin: 0;
  color: var(--danger);
}

@media (max-width: 720px) {
  .claim-search__field,
  .claim-search__field--date {
    min-width: 100%;
  }

  .visit-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .visit-row > * {
    grid-column: 1;
    justify-self: start;
  }

  .visit-row__amount {
    align-items: flex-start;
  }
}

/* ---- Documents → Manage (row 71) ---- */
.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

[data-theme="dark"] .btn-danger {
  color: #101010;
}

.btn-danger:hover:not([disabled]) {
  filter: brightness(0.94);
}

[data-theme="dark"] .btn-danger:hover:not([disabled]) {
  filter: brightness(1.08);
}

.manage-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.manage-toolbar .field-help {
  margin-right: auto;
}

.manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  overflow: hidden;
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--border-muted);
}

.manage-row:first-child {
  border-top: 0;
}

.manage-row:hover {
  background: var(--bg-subtle);
}

.manage-row__check {
  flex: none;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.manage-row__check:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.manage-row__open {
  flex: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.manage-row__open:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.manage-row__open:hover .manage-row__name {
  color: var(--primary);
}

.manage-row__name {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.manage-row__icon {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.manage-row__meta {
  color: var(--text-muted);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

/* Motion is decoration here — drop it for users who ask for less. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
