/* Bonsai — minimal editorial theme.
 * Ported from the design kit: Instrument Serif display, Inter UI, JetBrains Mono eyebrows.
 * Near-monochrome with green / red / amber tints for status. */

:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-alt: #F2F2ED;
  --ink: #0E0E0C;
  --ink-soft: #525248;
  --ink-mute: #8B8B7E;
  --line: rgba(14, 14, 12, 0.08);
  --line-strong: rgba(14, 14, 12, 0.16);
  --green: #177245;
  --green-tint: #E4EFE7;
  --red: #8B1E2E;
  --red-tint: #F0E1E3;
  --amber: #8B5E14;
  --amber-tint: #F0E9D7;

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
pre { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; }
code { font-family: var(--font-mono); font-size: 0.92em; }

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
em { font-style: italic; font-family: var(--font-display); font-size: 1.05em; letter-spacing: -0.005em; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}
.eyebrow-mt { margin-top: 22px; }
.eyebrow-red { color: var(--red); font-weight: 600; letter-spacing: 0.06em; }

/* ─── Layout ───────────────────────────────────────────────── */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 12px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}
.brand-mark img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.018em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
}
.wordmark .wm-lead { font-style: normal; }
.wordmark .wm-tail {
  font-style: normal;
  color: var(--amber);
  letter-spacing: -0.002em;
  margin-left: 0.5px;
  position: relative;
  font-weight: 400;
}
/* Tasteful hairline rule under the italic "ai" — the AI tell, editorial. */
.wordmark .wm-tail::after {
  content: "";
  position: absolute;
  left: 1px;
  right: -1px;
  bottom: 2px;
  height: 1px;
  background: var(--amber);
  opacity: 0.45;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.nav-item.active {
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 600;
}
.nav-item:disabled {
  color: var(--ink-mute);
  cursor: default;
}
.nav-item:hover:not(.active) { background: var(--surface-alt); }
.nav-ic {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: currentColor;
}
.nav-item .nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line-strong);
}
.nav-item.active .nav-dot { background: var(--green); }
.nav-count.soft {
  background: var(--surface-alt);
  color: var(--ink-soft);
}
/* Red badge for "needs your attention" / "something new" states. Shows up
 * next to Bills (rows in attention) and Comparison (new lower-price
 * offers found). */
.nav-count.alert {
  background: #b53a3a;
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  height: 18px;
}
.nav-item > span:nth-child(2) { flex: 1; }
.nav-count {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
}
.nav-count[hidden] { display: none; }

.sidebar-foot {
  margin-top: auto;
  padding: 18px 8px 4px;
  border-top: 1px solid var(--line);
}
.sidebar-foot .foot-line { margin-top: 4px; font-size: 11.5px; color: var(--ink-mute); line-height: 1.5; }
.tagline {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.22;
  color: var(--ink);
  letter-spacing: -0.012em;
}
.tagline .tagline-lead { font-style: normal; color: var(--ink); }
.tagline .tagline-accent {
  font-style: normal;
  color: var(--amber);
  position: relative;
  margin: 0 1px;
}
.tagline .tagline-accent::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  height: 1px;
  background: var(--amber);
  opacity: 0.45;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─── Page header ──────────────────────────────────────────── */

.page-header {
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  gap: 24px;
}
.page-header[hidden] { display: none; }
.page-header-lead { flex: 1; min-width: 0; }
.page-title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 6px 0 0;
  color: var(--ink);
}
.page-header-stats {
  display: flex;
  gap: 28px;
  flex-shrink: 0;
}
.page-header-stats > div { min-width: 80px; }
.page-header-stats .stat-val {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.015em;
  margin-top: 2px;
  color: var(--ink);
}
.page-header-stats .stat-val.stat-green { color: var(--green); }

/* ─── Content area ────────────────────────────────────────── */

.content {
  padding: 28px 32px 40px;
  overflow: auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}

/* ─── Intake ──────────────────────────────────────────────── */

.intake-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.dropzone {
  background: var(--surface);
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  padding: 40px 32px 30px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone.drag {
  border-color: var(--ink);
  background: var(--surface-alt);
}
.dz-icon {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.dz-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.08;
}
.dz-sub {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 8px auto 22px;
  max-width: 56ch;
  line-height: 1.55;
}
.dz-form {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: left;
  max-width: 560px;
  margin: 6px auto 0;
}
.file-field-full {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Hide the native input entirely — the adjacent <span class="file-field-btn">
 * is the clickable control; clicks on the <label> forward to the hidden
 * input and open the OS file picker. Removes the ugly border + filename text. */
.file-field-full input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-field-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-ui);
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
}
.file-field-full:hover .file-field-btn { opacity: 0.85; }
.dz-note {
  font-size: 11.5px;
  color: var(--ink-mute);
  margin-top: 16px;
  font-family: var(--font-mono);
  letter-spacing: -0.005em;
}
.dz-sample-row {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.dz-sample-link {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.dz-sample-link:hover { color: var(--ink); }
.dz-sample-link-select { display: none; }
.aside-hint {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border-radius: 8px;
  font-style: italic;
  font-family: var(--font-display);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.file-field, .fx-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}
.file-field input[type="file"],
.file-field select,
.fx-label input,
.fx-label select {
  padding: 9px 11px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
}
.file-field input[type="file"] {
  padding: 7px 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink-soft);
}
.file-field select:focus,
.fx-label select:focus,
.fx-label input:focus { border-color: var(--ink); }

.intake-aside {
  display: flex;
  flex-direction: column;
}
.fixture-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fx-note {
  font-size: 11.5px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.how-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.how-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.how-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  padding-top: 2px;
  width: 22px;
  flex-shrink: 0;
}
.how-t {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.015em;
}
.how-s {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 1px;
}

/* ─── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  height: 34px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.btn-primary:hover:not(:disabled) { background: #1a1a17; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); }
.btn-green {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-lg { height: 40px; font-size: 13.5px; padding: 10px 18px; }
.btn-sm { height: 30px; font-size: 12px; padding: 6px 12px; }

/* ─── FlowStepper ─────────────────────────────────────────── */

.flow-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.fs-step {
  display: flex;
  align-items: center;
  gap: 7px;
}
.fs-bubble {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-mute);
  background: transparent;
}
.fs-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
}
.fs-step.active .fs-bubble {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.fs-step.active .fs-label {
  color: var(--ink);
  font-weight: 600;
}
.fs-step.done .fs-bubble {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.fs-step.done .fs-label {
  color: var(--green);
}
.fs-connector {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.fs-connector.done { background: var(--green); }

/* ─── Run card + timeline ─────────────────────────────────── */

.run-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}
.run-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.run-head-icon {
  width: 36px; height: 36px;
  border-radius: 7px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.run-head-title {
  font-size: 14px;
  font-weight: 600;
}
.run-head-sub {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.25); }
}

.timeline {
  position: relative;
  padding-left: 26px;
  min-height: 160px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 11px; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--line);
}
.tl-item {
  position: relative;
  margin-bottom: 14px;
  animation: fade-in .4s ease;
}
.tl-item:last-child { margin-bottom: 0; }
.tl-dot {
  position: absolute;
  left: -19px; top: 5px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--surface);
  box-sizing: content-box;
}
.tl-item.active .tl-dot {
  background: var(--green);
  animation: pulse 1.2s ease-in-out infinite;
}
.tl-item.done .tl-dot { background: var(--green); }
.tl-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.tl-chip {
  width: 24px; height: 24px;
  border-radius: 5px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tl-title {
  font-size: 13px;
  font-weight: 600;
}
.tl-sub {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 2px;
}
.tl-item.active .tl-title {
  color: var(--ink-soft);
  font-style: italic;
  font-weight: 500;
}
.dots span { display: inline-block; animation: dot 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ─── Review (findings + plan + Q&A + approve) ───────────── */

.review-head {
  margin-bottom: 18px;
}
.review-title {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 4px 0 2px;
}
.review-sub {
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 680px;
}
.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-areas:
    "findings plan"
    "qa qa";
  gap: 14px;
  margin-bottom: 16px;
}
.review-findings { grid-area: findings; }
.review-plan { grid-area: plan; }
.review-qa { grid-area: qa; }

.review-findings.card,
.review-plan.card,
.review-qa.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}

.review-findings #review-findings-list {
  margin-top: 10px;
}

/* ─── New review layout: receipt + opportunities ──────────────────── */
.review-split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 900px) {
  .review-split { grid-template-columns: 1fr; }
}

/* Receipt */
.receipt.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.receipt-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.receipt-provider {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 4px 0 2px;
}
.receipt-meta {
  font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.receipt-items {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.receipt-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.receipt-item:last-child { border-bottom: none; }
.receipt-item-label {
  color: var(--ink);
  line-height: 1.4;
}
.receipt-item-detail {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 1px;
}
.receipt-item-amt {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}
.receipt-empty {
  padding: 14px 2px;
  font-size: 13px;
  color: var(--ink-mute);
  font-style: italic;
  line-height: 1.5;
}
.receipt-totals {
  border-top: 2px solid var(--line-strong);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.receipt-total-line {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}
.receipt-total-line .minus { color: var(--green); }
.receipt-total-due {
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* Opportunities */
.opps.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}
.opps-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.opps-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-top: 6px;
}
.opps-total {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: -0.02em;
  color: var(--green);
  line-height: 1;
}
.opps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.opp-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.opp-item:last-child { border-bottom: none; }
.opp-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
  border-radius: 6px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.opp-body { min-width: 0; }
.opp-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.opp-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.opp-amount {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  white-space: nowrap;
  padding-top: 2px;
}
.opp-empty {
  padding: 16px 0;
  font-size: 13px;
  color: var(--ink-mute);
  font-style: italic;
  line-height: 1.5;
}
.opp-skel-bar {
  background: linear-gradient(90deg, var(--surface-alt) 0%, var(--surface) 50%, var(--surface-alt) 100%);
  background-size: 200% 100%;
  animation: oppShimmer 1.2s linear infinite;
  border-radius: 4px;
  height: 14px;
  color: transparent;
}
.opp-skel .opp-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.opp-skel .opp-title { height: 14px; }
.opp-skel .opp-desc { height: 12px; }
.opp-skel .opp-amount { height: 14px; }
@keyframes oppShimmer {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

/* Unified review chat */
.review-chat.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.review-chat-head { margin-bottom: 12px; }
.review-chat-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.5;
}
.review-chat .qa-log:empty { display: none; }
.review-chat .qa-log { margin-bottom: 10px; }

.plan-title {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 6px 0 4px;
}
.plan-reason {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 12px;
}
.plan-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plan-steps li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 13px;
  color: var(--ink);
}
.plan-steps li .plan-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  background: var(--surface-alt);
  border-radius: 5px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.plan-steps li em {
  color: var(--ink-soft);
  font-style: normal;
}
.plan-edit {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.plan-edit textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}
.plan-edit textarea:focus {
  outline: none;
  border-color: var(--ink-soft);
  background: var(--surface);
}

.qa-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0 12px;
  max-height: 280px;
  overflow-y: auto;
}
.qa-log:empty { margin: 0; }
.qa-log .qa-msg {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: start;
}
.qa-log .qa-role {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-top: 2px;
}
.qa-log .qa-body {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}
.qa-log .qa-msg.q .qa-body { color: var(--ink); font-weight: 500; }
.qa-log .qa-msg.a .qa-body { color: var(--ink-soft); }
.qa-form {
  display: flex;
  gap: 8px;
}
.qa-form input {
  flex: 1;
  padding: 10px 12px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.qa-form input:focus {
  outline: none;
  border-color: var(--ink-soft);
  background: var(--surface);
}
.qa-form button[disabled] { opacity: 0.5; cursor: wait; }

.review-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 6px;
}

@media (max-width: 960px) {
  .review-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "findings" "plan" "qa";
  }
}

/* ─── Results hero ────────────────────────────────────────── */

.hero-saved {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 30px 24px;
  margin-bottom: 22px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1;
  margin: 6px 0 4px;
  color: var(--ink);
}
.hero-amount { color: var(--green); }
.hero-sub {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 6px 0 20px;
  max-width: 68ch;
  line-height: 1.5;
}
.hero-title.hero-title-muted .hero-amount { color: var(--amber); }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  padding: 16px 18px;
  background: var(--surface-alt);
  border-radius: 8px;
}
.stat-strip .stat-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.015em;
  margin-top: 3px;
  color: var(--ink);
}
.stat-strip .stat-val.strike {
  color: var(--ink-soft);
  text-decoration: line-through;
}
.stat-strip .stat-val.stat-green { color: var(--green); }
.stat-strip .stat-val.stat-small {
  font-size: 16px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-top: 5px;
}

/* ─── Tabs ────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.tab {
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--ink-mute);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 1.5px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink-soft); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Findings ────────────────────────────────────────────── */

.findings-head {
  margin-bottom: 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.findings-sub {
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 60ch;
}
.findings-group-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 18px 0 10px;
  font-weight: 600;
}
.findings-group-title:first-child { margin-top: 4px; }

.finding {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 10px;
}
.finding.worth {
  border-left-color: var(--amber);
}
.finding-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.finding-amount {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--green);
  letter-spacing: -0.015em;
  font-weight: 400;
}
.finding.worth .finding-amount { color: var(--amber); }
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.005em;
  font-family: var(--font-ui);
}
.tag-green  { background: var(--green-tint); color: var(--green); }
.tag-red    { background: var(--red-tint); color: var(--red); }
.tag-amber  { background: var(--amber-tint); color: var(--amber); }
.tag-ink    { background: var(--ink); color: #fff; }
.tag-mono   { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.03em; text-transform: uppercase; }

.finding-page {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.finding-quote {
  background: var(--surface-alt);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin: 6px 0 8px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.finding-evidence {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ─── Appeal letter ───────────────────────────────────────── */

.letter-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.metadata-panel {
  padding: 16px;
}
.m-row {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.m-row:last-child { border-bottom: none; }
.m-row .k {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.m-row .v {
  color: var(--ink);
  word-break: break-word;
}
.m-row .v.missing { color: var(--ink-mute); font-style: italic; }

.letter-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 26px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.65;
  max-height: 700px;
  overflow: auto;
}

/* ─── Conversation ────────────────────────────────────────── */

.strategy-note {
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.strategy-note .tag { flex-shrink: 0; }

.conv-msg {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--surface);
}
.conv-msg.us {
  border-left: 3px solid var(--ink);
}
.conv-msg.them {
  border-left: 3px solid var(--amber);
  background: var(--surface-alt);
}
.conv-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.conv-meta .who-us { color: var(--ink); font-weight: 600; }
.conv-meta .who-them { color: var(--amber); font-weight: 600; }
.conv-body {
  font-size: 13px;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.55;
}

.conv-section-head {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.conv-section-head:first-child { margin-top: 0; }

/* ── Offer hunt results panel (inside each offer card) ──────────── */
.offer-hunt-slot:empty { display: none; }
.hunt-panel {
  margin: 10px 0 6px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink);
}
.hunt-panel.error { color: var(--red); background: #fff; }
.hunt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.hunt-headline { font-weight: 500; }
.hunt-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hunt-rows { display: flex; flex-direction: column; gap: 8px; }
.hunt-row {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.hunt-row-head { margin-bottom: 4px; }
.hunt-row-note { font-size: 11.5px; color: var(--ink-mute); margin-bottom: 4px; }
.hunt-reply { font-size: 11.5px; color: var(--ink-mute); }
.hunt-reply summary { cursor: pointer; user-select: none; }
.hunt-reply-body {
  padding: 6px 8px;
  margin-top: 4px;
  background: var(--bg);
  border-left: 2px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--ink);
}

/* ── Persistent-agent summary panel ─────────────────────────────── */
.persistent-panel {
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.persistent-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.persistent-headline {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
}
.persistent-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  margin-bottom: 12px;
}
.persistent-meta strong { color: var(--ink); font-weight: 600; }
.persistent-rows { display: flex; flex-direction: column; gap: 6px; }
.persistent-row {
  display: grid;
  grid-template-columns: 70px 110px 90px 140px 70px auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12.5px;
}
.persistent-row.best {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green) inset;
}
.persistent-outcome {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}
.persistent-amt { font-weight: 600; }
.persistent-turns { font-size: 11px; color: var(--ink-mute); }

.call-turn {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.call-turn .who {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding-top: 2px;
}
.call-turn .txt {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
  white-space: pre-wrap;
}
.call-turn.agent .who { color: var(--ink); font-weight: 600; }
.call-turn.rep .who { color: var(--amber); font-weight: 600; }
.call-turn.tool {
  background: var(--surface-alt);
  border-radius: 6px;
  border-bottom-color: transparent;
  margin: 4px 0;
}
.call-turn.tool .who { color: var(--green); font-weight: 600; }
.call-turn.tool .txt { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }

/* ─── Raw + error ─────────────────────────────────────────── */

.raw {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  font-size: 11.5px;
  color: var(--ink-soft);
  max-height: 620px;
  overflow: auto;
}
.error-card {
  border-color: var(--red);
}
.error-card pre {
  background: var(--red-tint);
  color: var(--red);
  padding: 14px 16px;
  border-radius: 8px;
  margin: 10px 0 14px;
  white-space: pre-wrap;
}

.results-foot {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
}

/* ─── Live indicator pill (used on Bills + Offers) ────────── */

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.live-indicator[hidden] { display: none; }


/* ─── Agent reasoning timeline ─────────────────────────────── */

.agent-timeline {
  margin: 4px 0 16px;
  padding: 14px 16px;
  background: var(--surface-alt, #fafaf7);
  border: 1px solid var(--ink-faint, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
}
.agent-steps {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.agent-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  position: relative;
  padding: 6px 0 14px;
}
.agent-step:last-child { padding-bottom: 0; }
.agent-step-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
  z-index: 1;
}
.agent-step-bar {
  position: absolute;
  left: 12px;
  top: 30px;
  bottom: 0;
  width: 1.5px;
  background: var(--ink-faint, rgba(0, 0, 0, 0.15));
}
.agent-step-body { padding-top: 1px; }
.agent-step-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.agent-step-detail {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
  line-height: 1.45;
}
.agent-step.kind-good .agent-step-dot { background: var(--green); border-color: var(--green); color: #fff; }
.agent-step.kind-warn .agent-step-dot { background: #fef0c7; border-color: #cc7a00; color: #6b3f00; }
.agent-step.kind-danger .agent-step-dot { background: #fde2e1; border-color: #c0392b; color: #7a1d12; }
.agent-step.kind-resolved .agent-step-dot { background: var(--green); border-color: var(--green); color: #fff; }
.agent-step.kind-escalated .agent-step-dot { background: #fde2e1; border-color: #c0392b; color: #7a1d12; }

/* ─── Overview receipts ledger ─────────────────────────────── */

.receipts-block {
  margin-bottom: 28px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.receipts-block[hidden] { display: none; }
.receipts-hero {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--ink-faint, rgba(0, 0, 0, 0.08));
  background: var(--surface-alt, #fafaf7);
}
.receipts-hero-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.receipts-hero-amount {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.0;
  color: var(--green);
  margin: 4px 0 6px;
}
.receipts-hero-sub {
  font-size: 13px;
  color: var(--ink-soft);
}
.receipts-rows {
  display: flex;
  flex-direction: column;
}
.receipt-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 14px 28px;
  border-top: 1px solid var(--ink-faint, rgba(0, 0, 0, 0.06));
  font-size: 14px;
}
.receipt-row:first-child { border-top: none; }
.receipt-provider {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.receipt-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.receipt-saved {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--green);
  letter-spacing: -0.015em;
  text-align: right;
}
.receipt-channel {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 3px 8px;
  border: 1px solid var(--ink-faint, rgba(0,0,0,0.12));
  border-radius: 4px;
}
.receipt-quote {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--surface-alt, #fafaf7);
  border-left: 2px solid var(--green);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ─── Overview approvals ──────────────────────────────────── */

.approvals-block { margin-bottom: 28px; }
.approvals-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.approvals-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-top: 4px;
  color: var(--ink);
}
.approvals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.approval-card {
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.approval-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.approval-card-icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.approval-card-meta {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.approval-card-save {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--green);
  letter-spacing: -0.015em;
}
.approval-card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.approval-card-body {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.approval-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}
.approval-card-actions .btn { flex: 1; }

/* ─── Bills ───────────────────────────────────────────────── */

.bills-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 18px;
  overflow: hidden;
}
.bills-stats > div {
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}
.bills-stats > div:last-child { border-right: none; }
.bills-stats .stat-val {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: 5px;
}
.bills-stats .stat-val.stat-green { color: var(--green); }
.bills-stats .stat-val.stat-red { color: #b53a3a; }

.bills-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.bills-filters .filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.bills-filters .filter-field .eyebrow {
  font-size: 10px;
}
.bills-filters .filter-field:first-child { flex: 1 1 200px; min-width: 180px; }
.bills-filters input[type="search"],
.bills-filters select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink);
  min-width: 140px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.bills-filters input[type="search"] { cursor: text; }
.bills-filters input[type="search"]:focus,
.bills-filters select:focus {
  outline: none;
  border-color: var(--ink-soft);
  background: var(--surface);
}
.bills-filters select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%2374706d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='1 1 5 5 9 1'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.bills-filters .filter-reset {
  margin-left: auto;
  align-self: flex-end;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.bills-filters .filter-reset:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
}
.bills-empty-filtered {
  padding: 28px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
}

.bills-table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.bills-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 120px 140px 28px;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.bills-row:last-child { border-bottom: none; }
.bills-row.bills-header {
  padding: 12px 20px;
  background: var(--surface-alt);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.bills-header .with-help {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
  cursor: help;
  outline: none;
}
.help-tip:hover, .help-tip:focus-visible { color: var(--ink); }
.help-tip-bubble {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  width: max-content;
  max-width: 260px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
  white-space: normal;
}
.help-tip-bubble::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--ink);
}
.help-tip:hover .help-tip-bubble,
.help-tip:focus-visible .help-tip-bubble {
  opacity: 1;
}
.bills-row.bill-item {
  cursor: pointer;
  transition: background .12s;
}
.bills-row.bill-item:hover { background: var(--surface-alt); }
.bill-item-active {
  background: linear-gradient(90deg, rgba(245,177,0,0.06) 0%, transparent 40%);
  border-left: 2px solid #f5b100;
  padding-left: 18px; /* compensate for the border */
}
.bill-inline-active {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #b88100;
  background: rgba(245, 177, 0, 0.08);
  border: 1px solid rgba(245, 177, 0, 0.28);
  border-radius: 4px;
  vertical-align: middle;
}
.bill-inline-active .status-dot {
  width: 6px;
  height: 6px;
  background: #f5b100;
  border-radius: 50%;
  animation: statusPulse 1.6s ease-out infinite;
}

/* Attention chip — same shape as bill-inline-active, but tone varies by
 * reason. Escalated and error read as urgent (red); awaiting reads as
 * "ball is in your court" (amber); paused is intentional, so neutral gray. */
.bill-inline-attention {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  vertical-align: middle;
  white-space: nowrap;
}
.bill-inline-escalated,
.bill-inline-error {
  color: #b53a3a;
  background: rgba(181, 58, 58, 0.06);
  border: 1px solid rgba(181, 58, 58, 0.28);
}
.bill-inline-awaiting {
  color: #b88100;
  background: rgba(245, 177, 0, 0.08);
  border: 1px solid rgba(245, 177, 0, 0.28);
}
.bill-inline-paused,
.bill-inline-watching {
  color: var(--ink-mute);
  background: var(--surface-alt);
  border: 1px solid var(--line);
}
.bill-inline-resolved {
  color: var(--green);
  background: rgba(43, 122, 80, 0.06);
  border: 1px solid rgba(43, 122, 80, 0.32);
}

.bill-main {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.bill-ic {
  width: 34px; height: 34px;
  border-radius: 7px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.bill-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bill-account {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bill-price {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.015em;
  line-height: 1;
}
.bill-price-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  margin-top: 3px;
}
.bill-category {
  font-size: 12.5px;
  color: var(--ink-soft);
}
.bill-score {
  min-width: 0;
}
.bill-score-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.bill-score-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}
.bill-score-bar {
  height: 3px;
  background: var(--surface-alt);
  border-radius: 2px;
  overflow: hidden;
}
.bill-score-fill { height: 100%; }
.bill-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.bill-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.bill-status-active        { color: #b88100; }
.bill-status-active .status-dot {
  background: #f5b100;
  box-shadow: 0 0 0 0 rgba(245, 177, 0, 0.5);
  animation: statusPulse 1.6s ease-out infinite;
}
.bill-status-resolved      { color: #1f7a3d; }
.bill-status-resolved .status-dot { background: #22a355; }
.bill-status-attention     { color: #b53a3a; }
.bill-status-attention .status-dot { background: #d6484a; }
@keyframes statusPulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 177, 0, 0.55); }
  80%  { box-shadow: 0 0 0 8px rgba(245, 177, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 177, 0, 0); }
}

.toggle {
  width: 40px; height: 22px;
  border-radius: 12px;
  border: none;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  padding: 0;
  transition: background .15s;
}
.toggle.on { background: var(--green); }
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.toggle.on::after { left: 21px; }

.bill-arrow {
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ─── Offers ──────────────────────────────────────────────── */

.offers-banner {
  padding: 24px 28px;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 24px;
}
/* `display: flex` above wins over the default [hidden] display:none, so
   spell out the hidden rule explicitly for the banner. Same for the
   filter chips so they don't render alone when there are no offers. */
.offers-banner[hidden] { display: none; }
.banner-lead { flex: 1; min-width: 0; }
.eyebrow-inverted {
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.banner-amount {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1;
}
.banner-amount .per {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.6);
  margin-left: 8px;
  letter-spacing: 0.01em;
}
.banner-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 8px;
}
.btn-on-dark {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.btn-on-dark:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.offers-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.filter-chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.offers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.offer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.offer-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.offer-ic {
  width: 38px; height: 38px;
  border-radius: 7px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.offer-head-main { flex: 1; min-width: 0; }
.offer-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.offer-source {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.015em;
}
.offer-price-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.offer-price-row .col-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.offer-current {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink-soft);
  letter-spacing: -0.01em;
  margin-top: 2px;
}
/* Strike only the dollar amount — the unit ("/mo") sits in its own span
 * with no decoration, so the line ends at the last digit. */
.offer-amt-strike { text-decoration: line-through; }
.offer-unit {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--ink-mute);
  margin-left: 4px;
  letter-spacing: 0;
}
.offer-new {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.015em;
  margin-top: 2px;
}
.offer-saves {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--green);
  letter-spacing: -0.015em;
  margin-top: 2px;
}
.offer-arrow { color: var(--ink-mute); }
.offer-pad { flex: 1; }
.offer-right { text-align: right; }
.offer-sub {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.offer-sub-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.offer-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.offer-actions .btn { flex: 1; }
.offer-eta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: right;
}

/* ─── Settings ────────────────────────────────────────────── */

.settings-wrap {
  max-width: 780px;
}
.settings-group { margin-bottom: 28px; }
.settings-group-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.settings-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.settings-input {
  width: 100%;
  margin-top: 8px;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
}
.settings-input:focus { border-color: var(--ink); }

/* Settings → Connected accounts: one row per integration with pill + Connect
 * / Edit / Disconnect actions. Editing opens the credential modal instead
 * of exposing input fields inline. */
.intg-req {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.intg-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.intg-actions .btn { padding: 7px 14px; font-size: 12.5px; }
.intg-disconnect { color: #b53a3a; }
.intg-disconnect:hover { background: rgba(181, 58, 58, 0.08); border-color: rgba(181, 58, 58, 0.45); }

/* Credential modal — wider than the generic confirm modal so inputs breathe.
 * The doubled selector (.confirm-modal.intg-modal) outranks the generic
 * .confirm-modal `width: min(420px,…)` rule defined later in this file. */
.confirm-modal.intg-modal { width: min(480px, calc(100vw - 40px)); }

/* Compare modal — side-by-side current vs recommended with full breakdown.
 * Wide layout: cap at 1080px on desktop, fluid below. The two provider
 * columns get plenty of horizontal room before the layout collapses.
 * Doubled selector beats the generic `.confirm-modal { width: 420px }`. */
.confirm-modal.cmp-modal { width: min(1080px, calc(100vw - 48px)); }
.cmp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 32px 16px;
  border-bottom: 1px solid var(--line);
}
.cmp-head .confirm-title { margin: 4px 0 0; }
.cmp-body { padding: 24px 32px; max-height: 70vh; overflow-y: auto; }
.cmp-cols {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 22px;
}
.cmp-col {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cmp-col-offer {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 6%, var(--surface));
}
.cmp-col-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.cmp-col-eyebrow-green { color: var(--green); }
.cmp-provider {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.cmp-price {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 2px;
}
.cmp-price-green { color: var(--green); }
.cmp-unit {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink-mute);
  margin-left: 4px;
  letter-spacing: 0;
}
.cmp-specifics {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.cmp-saves {
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.5;
}
.cmp-saves strong { color: var(--green); font-weight: 600; }
.cmp-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
}
.cmp-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}
.cmp-section:first-of-type { margin-top: 0; }
.cmp-section-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.cmp-section-body {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}
.cmp-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}
.cmp-meta-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.cmp-meta-val {
  font-size: 13px;
  color: var(--ink);
  margin-top: 2px;
}
.offer-card-dismissed {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}
@media (max-width: 720px) {
  .confirm-modal.cmp-modal { width: calc(100vw - 24px); }
  .cmp-head, .cmp-body { padding-left: 20px; padding-right: 20px; }
  .cmp-cols { grid-template-columns: 1fr; gap: 14px; }
  .cmp-arrow { transform: rotate(90deg); }
}
.intg-modal-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.intg-field { display: flex; flex-direction: column; gap: 4px; }
.intg-field-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.intg-input { margin-top: 0; }
.intg-modal-status {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  min-height: 14px;
}
.intg-modal-status.err { color: #b53a3a; }
.acc-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.acc-toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.acc-toggle-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}
.tg-help-steps {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.tg-help-steps code {
  font-family: var(--font-mono);
  background: var(--surface-alt);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11.5px;
}
.tg-help-steps a { color: var(--ink); text-decoration: underline; }
.tg-save-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  opacity: 1;
  transition: opacity 0.6s ease;
}
.tg-save-status.fading { opacity: 0; }
.tg-save-status.ok { color: var(--green); }
.tg-save-status.err { color: var(--red, #b53a3a); }

/* Profile: two inputs side by side in one row (first / last name). */
.settings-row-split {
  display: flex;
  gap: 16px;
  align-items: stretch;
}
.settings-row-split > .settings-row-main { flex: 1; min-width: 0; }

/* Profile: blanket authorization checkbox. */
.settings-row-checkbox { padding: 16px 18px; }
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.consent-row input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
  cursor: pointer;
}
.consent-row .settings-row-label { display: block; }
.consent-row .settings-row-help { display: block; margin-top: 4px; }

/* Profile: HIPAA disclosure panel — reveals when the main auth box is checked. */
.hipaa-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
  opacity: 0;
  border-top: 1px solid var(--line);
  padding: 0 18px;
}
.hipaa-panel.open {
  max-height: 600px;
  opacity: 1;
  padding: 16px 18px 18px;
}
.hipaa-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.hipaa-body {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border-radius: 6px;
  border: 1px solid var(--line);
}
.hipaa-body p { margin: 0 0 8px; }
.hipaa-body p:last-child { margin-bottom: 0; }
.hipaa-body strong { color: var(--ink); font-weight: 600; }
.hipaa-ack { padding-top: 4px; }

/* Confirm modal — used by Delete account. */
.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modal-fade-in 0.15s ease;
}
@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  width: min(440px, 92vw);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.modal-title {
  font-family: var(--font-serif, var(--font-sans));
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px;
}
.modal-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}
.modal-body strong { color: var(--ink); font-weight: 600; }
.modal .settings-input { margin-top: 14px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Settings: footer Save row pinned at bottom of the page. The 18px right
 * padding lines the Save button up with the Delete button column inside
 * the Data card's `.settings-row` (which uses `padding: 14px 18px`). */
.settings-save-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 16px 18px 0;
  border-top: 1px solid var(--line);
}

/* Tune: tone picker (polite / firm / aggressive). */
.tone-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.tone-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tone-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.tone-opt-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.tone-opt-help {
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.tone-opt:hover { border-color: var(--ink-mute); }
.tone-opt-sel {
  border-color: var(--ink);
  background: var(--surface-alt);
}

/* Tune: channel toggles. */
.channel-toggles {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}
.channel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.channel-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
  cursor: pointer;
}

.settings-row {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-main { flex: 1; min-width: 0; }
.settings-row-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.settings-row-help {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.5;
}
.settings-row-value {
  font-size: 13px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  text-align: right;
}
.settings-row-value.tone-green { color: var(--green); }
.settings-row-value.tone-amber { color: var(--amber); }
.settings-row-value.tone-red { color: var(--red); }
.settings-row-value code {
  background: var(--surface-alt);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11.5px;
}

.range-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.range-row-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.range-row input[type=range] {
  width: 100%;
  accent-color: var(--ink);
}
.range-row-value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
}

/* ─── Small screens ───────────────────────────────────────── */

@media (max-width: 980px) {
  .app { flex-direction: column; }
  .sidebar {
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    gap: 18px;
  }
  .brand { padding: 0; }
  .nav { flex-direction: row; gap: 6px; flex: 1; overflow: auto; }
  .sidebar-foot { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; padding: 20px 20px 16px; }
  .page-header-stats { gap: 18px; flex-wrap: wrap; }
  .content { padding: 22px 20px 32px; }
  .intake-grid { grid-template-columns: 1fr; }
  .dz-form { grid-template-columns: 1fr; }
  .dz-form button[type="submit"] { width: 100%; }
  .sidebar { position: static; height: auto; }
  .letter-layout { grid-template-columns: 1fr; }
  .hero-title { font-size: 42px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .page-title { font-size: 30px; }
}

/* ─── Bill detail drawer (CRM-style audit log) ───────────────── */

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(14, 14, 12, 0.32);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(640px, 94vw);
  background: var(--bg);
  border-left: 1px solid var(--line-strong);
  box-shadow: -24px 0 60px -20px rgba(14, 14, 12, 0.18);
  display: flex;
  flex-direction: column;
  z-index: 41;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.drawer.open { transform: translateX(0); }
/* Awaiting-approval rows are a *review* surface — give the drawer enough
 * width to feel like a screen rather than a side rail. */
.drawer.drawer-wide { width: min(960px, 96vw); }

.drawer-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 22px 26px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-head-lead { flex: 1; min-width: 0; }
.drawer-title {
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--ink);
}
.drawer-sub {
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.drawer-close {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s;
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--surface-alt); color: var(--ink); }

.drawer-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 14px 26px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer-stats .drawer-stat .eyebrow { margin-bottom: 4px; }
.drawer-stats .drawer-stat-val {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.drawer-stats .drawer-stat-val.green { color: var(--green); }
.drawer-stats .drawer-stat-val.mute  { color: var(--ink-mute); }
.drawer-stats .drawer-stat-val.strike { text-decoration: line-through; color: var(--ink-mute); }
.drawer-stat-status { margin-top: 4px; }
.drawer-stat-sub { font-size: 11px; color: var(--ink-mute); margin-top: 4px; letter-spacing: 0.02em; }

.drawer-controls {
  padding: 12px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.drawer-control {
  display: flex;
  align-items: center;
  gap: 12px;
}
.drawer-stop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #b53a3a;
  color: #fff;
  border: 1px solid #9e2e2e;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .12s;
}
.drawer-stop-btn:hover { background: #a02f2f; }
.drawer-stop-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.drawer-resume-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .12s;
}
.drawer-resume-btn:hover { opacity: 0.85; }
.drawer-resume-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Drawer title row — bill name + red trash icon sit side-by-side in the
 * drawer header. The trash only renders when the drawer is open (i.e. when
 * the user has clicked into a bill). */
.drawer-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-delete-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #b53a3a;
  border: 1px solid rgba(181, 58, 58, 0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
  padding: 0;
  flex-shrink: 0;
}
.drawer-delete-icon:hover {
  color: #fff;
  background: #b53a3a;
  border-color: #9e2e2e;
}

/* ─── Confirm modal ─────────────────────────────────────────── */
.confirm-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}
.confirm-scrim[hidden] { display: none; }
.confirm-scrim.open { opacity: 1; pointer-events: auto; }
.confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 8px));
  z-index: 101;
  width: min(420px, calc(100vw - 40px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease;
  overflow: hidden;
}
.confirm-modal[hidden] { display: none; }
.confirm-modal.open {
  opacity: 1;
  transform: translate(-50%, -50%);
}
.confirm-body {
  padding: 22px 24px 18px;
}
.confirm-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  color: var(--ink);
  font-weight: 400;
}
.confirm-sub {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
}
.btn-danger {
  background: #b53a3a;
  color: #fff;
  border: 1px solid #9e2e2e;
}
.btn-danger:hover { background: #a02f2f; }

/* Needs-attention drawer tab — explains the state and offers one CTA. */
.dattn {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 10px;
}
.dattn-urgent { border-left-color: #b53a3a; }
.dattn-awaiting { border-left-color: #d09800; }
.dattn-neutral { border-left-color: var(--ink-mute); }
.dattn-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.dattn-urgent .dattn-eyebrow { color: #b53a3a; }
.dattn-awaiting .dattn-eyebrow { color: #b88100; }
.dattn-title {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.015em;
  color: var(--ink);
  font-weight: 400;
  margin: -4px 0 0;
}
.dattn-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.dattn-steps {
  margin: 0;
  padding-left: 22px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.6;
}
.dattn-steps li { margin-bottom: 4px; }
.dattn-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* Counter snapshot inside the Needs-attention tab. Side-by-side numbers
 * so the user can decide approve-vs-keep-negotiating without leaving the
 * tab. */
.dattn-counter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dattn-counter-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr 1fr;
  gap: 14px;
  align-items: end;
}
.dattn-counter-cell { display: flex; flex-direction: column; gap: 4px; }
.dattn-counter-saves { border-left: 1px solid var(--line); padding-left: 14px; }
.dattn-counter-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.dattn-counter-amt {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.dattn-counter-amt-green { color: var(--green); }
.dattn-counter-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0;
}
.dattn-counter-arrow {
  font-size: 18px;
  color: var(--ink-mute);
  align-self: center;
  padding-bottom: 6px;
}
.dattn-counter-notes {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  font-style: italic;
}

/* Inline chat at the bottom of the Needs-attention panel. Same form ids
 * as the Feedback tab so handlers are shared. */
.dattn-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 4px;
}
.dattn-chat-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.dattn-chat-sub {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: -2px;
  margin-bottom: 6px;
}
.dattn-chat-log:empty { display: none; }
.dattn-chat-log {
  max-height: 220px;
  overflow-y: auto;
}
@media (max-width: 600px) {
  .dattn-counter-grid { grid-template-columns: 1fr; }
  .dattn-counter-arrow { display: none; }
  .dattn-counter-saves { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 10px; }
}

.dfb-tab { display: flex; flex-direction: column; gap: 12px; }
.dfb-head { display: flex; flex-direction: column; gap: 4px; }
.dfb-sub {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.dfb-tab .qa-log:empty { display: none; }
.dfb-tab .qa-log {
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
}
.drawer-control .eyebrow { margin: 0; }
.drawer-select {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.drawer-select:focus { outline: none; border-color: var(--ink); }

.drawer-tabs {
  display: flex;
  gap: 2px;
  padding: 10px 20px 0;
  border-bottom: 1px solid var(--line);
}
.drawer-tab {
  background: transparent;
  border: 0;
  padding: 8px 12px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.drawer-tab:hover { color: var(--ink-soft); }
.drawer-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 26px 40px;
}

/* Activity timeline */
.dact-timeline {
  position: relative;
  padding-left: 24px;
}
.dact-timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 7px;
  width: 2px;
  background: var(--line);
}
.dact-event {
  position: relative;
  padding: 0 0 20px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
}
.dact-event:last-child { padding-bottom: 0; }
.dact-event::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--ink-mute);
  z-index: 1;
}
.dact-event.tone-green::before { border-color: var(--green); background: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.dact-event.tone-red::before   { border-color: var(--red);   background: var(--red);   box-shadow: 0 0 0 3px var(--red-tint); }
.dact-event.tone-amber::before { border-color: var(--amber); background: var(--amber); box-shadow: 0 0 0 3px var(--amber-tint); }
.dact-event.tone-ink::before   { border-color: var(--ink);   background: var(--ink); }

.dact-headline {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.45;
  font-weight: 500;
}
.dact-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding-top: 2px;
}
.dact-channel {
  grid-column: 1;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 2px;
}
.dact-detail {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  white-space: pre-wrap;
}
.dact-detail.quote {
  font-style: italic;
  font-family: var(--font-display);
  font-size: 14.5px;
  color: var(--ink);
}
.dact-actor {
  grid-column: 1;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.dact-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-mute);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
}

/* Findings in drawer */
.dfind-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.dfind-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 4px;
}
.dfind-row-head .mono { font-size: 11px; color: var(--ink-mute); }
.dfind-title { font-size: 13.5px; color: var(--ink); }
.dfind-quote {
  margin-top: 8px;
  padding: 8px 11px;
  border-left: 2px solid var(--line-strong);
  color: var(--ink-soft);
  font-style: italic;
  font-size: 12.5px;
  line-height: 1.45;
  font-family: var(--font-display);
}

/* Messages */
.dmsg-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.dmsg-section-head:first-child { margin-top: 0; }
.dmsg-section-head .eyebrow { margin: 0; }
.dmsg-msg {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--surface);
}
.dmsg-msg.out { background: var(--surface-alt); }
.dmsg-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.dmsg-subject { font-weight: 600; color: var(--ink); font-size: 12.5px; margin-bottom: 4px; }
.dmsg-body {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  white-space: pre-wrap;
}

.drawer-pre {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink-soft);
  max-height: none;
}

/* Make bill rows look clickable */
.bill-item { cursor: pointer; }
.bill-item:hover { background: var(--surface-alt); }

@media (max-width: 820px) {
  .drawer { width: 100vw; }
  .drawer-stats { grid-template-columns: 1fr 1fr; }
}

/* ─── Multi-file staging ───────────────────────────────────── */
.dz-staging {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  text-align: left;
}
.dz-staging-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.dz-staging-hint {
  font-size: 11.5px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  letter-spacing: -0.005em;
}
.dz-staging-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.dz-tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.dz-tile-thumb {
  aspect-ratio: 4 / 3;
  background: var(--surface-alt);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
  position: relative;
}
.dz-tile-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dz-tile-thumb-doc {
  background: var(--surface);
}
.dz-tile-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-alt);
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}
.dz-tile-thumb-loading {
  background: repeating-linear-gradient(
    -45deg,
    var(--surface-alt),
    var(--surface-alt) 6px,
    var(--surface) 6px,
    var(--surface) 12px
  );
  background-size: 200% 200%;
  animation: dzShimmer 1.2s linear infinite;
}
@keyframes dzShimmer {
  from { background-position: 0 0; }
  to   { background-position: 100% 0; }
}
.dz-tile-name {
  font-size: 11.5px;
  color: var(--ink-soft);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dz-tile-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: 0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 2px;
}
.dz-tile-remove:hover { background: rgba(0, 0, 0, 0.85); }
.dz-staging-actions {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dz-add-more {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  padding: 8px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  transition: border-color 120ms ease;
}
.dz-add-more:hover { border-color: var(--ink-soft); color: var(--ink); }
.dz-flash {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-mute);
  padding: 6px 8px;
  border-left: 2px solid var(--ink-mute);
  background: var(--surface);
}

/* ─── Plan edit + view-bill button ─────────────────────────── */
.plan-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.btn-tight {
  padding: 6px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.plan-edit {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.plan-edit label {
  display: block;
  margin-bottom: 6px;
}
.plan-edit textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}
.plan-edit textarea:focus {
  outline: none;
  border-color: var(--ink-soft);
  background: var(--surface);
}

/* ─── Chat-style plan editor ──────────────────────────────── */
.plan-chat {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.plan-chat-hint {
  margin-top: 4px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--ink-mute);
  font-style: italic;
  line-height: 1.4;
}
.plan-chat-log {
  margin-bottom: 10px;
}
.plan-chat-log:empty {
  display: none;
}

/* ─── Chat-style Q&A composer ──────────────────────────────── */
.qa-form-chat {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 4px 4px 16px;
  gap: 6px;
  transition: border-color 150ms ease, background 150ms ease;
}
.qa-form-chat:focus-within {
  border-color: var(--ink-soft);
  background: var(--surface);
}
.qa-form-chat input {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 10px 0;
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--ink);
}
.qa-form-chat input:focus { outline: none; background: transparent; border: 0; }
.qa-send {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms ease, transform 120ms ease;
}
.qa-send:hover:not(:disabled) { background: #1a1a17; }
.qa-send:disabled { opacity: 0.4; cursor: wait; }

/* ─── Bill viewer modal ────────────────────────────────────── */
.bill-viewer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}
.bill-viewer-scrim.open { opacity: 1; pointer-events: auto; }
.bill-viewer-scrim[hidden] { display: none; }
.bill-viewer[hidden] { display: none; }
.bill-viewer {
  position: fixed;
  inset: 40px;
  max-width: 1100px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  z-index: 51;
  display: flex;
  flex-direction: column;
  transform: translateY(10px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
  overflow: hidden;
}
.bill-viewer.open { transform: translateY(0); opacity: 1; }
.bill-viewer-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.bill-viewer-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  margin: 4px 0 2px;
  line-height: 1.2;
  word-break: break-all;
}
.bill-viewer-sub {
  font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.bill-viewer-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.bill-viewer-tabs:empty { display: none; }
.bv-tab {
  background: transparent;
  border: 0;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.bv-tab:hover { color: var(--ink-soft); }
.bv-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.bill-viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--surface-alt);
  overflow: auto;
  position: relative;
}
.bv-open-new {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 2;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 5px 10px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.bv-open-new:hover { border-color: var(--ink); }
.bv-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.bv-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  padding: 20px;
  align-self: center;
}
.bv-loading, .bv-empty {
  padding: 40px;
  color: var(--ink-mute);
  font-size: 13.5px;
  align-self: center;
  text-align: center;
  max-width: 460px;
}
.bv-empty code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.bv-download {
  display: inline-block;
  margin-top: 12px;
  color: var(--ink);
  text-decoration: underline;
}

@media (max-width: 640px) {
  .bill-viewer { inset: 12px; }
  .bill-viewer-head { padding: 14px 16px; }
}

/* ── Drawer Contact tab ──────────────────────────────────────── */
.drawer-contact {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px 20px;
}
.contact-help-ok,
.contact-help-warn {
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.contact-help-ok {
  color: var(--green, #2a8447);
  background: rgba(42, 132, 71, 0.06);
  border-color: rgba(42, 132, 71, 0.25);
}
.contact-help-warn {
  color: #8a5400;
  background: rgba(184, 129, 0, 0.06);
  border-color: rgba(184, 129, 0, 0.25);
}
.contact-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.contact-field .eyebrow { margin: 0 0 2px; }
.contact-field .muted { color: var(--ink-mute, #888); font-weight: 400; letter-spacing: 0; text-transform: none; }
.drawer-input {
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.drawer-input:focus { outline: none; border-color: var(--ink); }
.drawer-input:disabled {
  background: var(--surface-soft, #f7f6f3);
  color: var(--ink-mute, #888);
  cursor: not-allowed;
}
.contact-field-hint {
  font-size: 11px;
  color: var(--ink-mute, #888);
  line-height: 1.4;
}
/* Drawer Contact-tab actions row (drawer-only — main intro). The plan-review
   `.contact-card .contact-actions` rule below resets margin/align via its
   own selectors, so this default doesn't bleed into the audit page. */
.contact-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.contact-save-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  cursor: pointer;
}
.contact-save-btn:hover { opacity: 0.9; }
.contact-save-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.contact-status {
  font-size: 12px;
  color: var(--ink-mute, #888);
}
.contact-status.ok { color: var(--green, #2a8447); }
.contact-status.warn { color: #b53a3a; }

/* Locked agent button — visible cue that the gate is in effect. */
.drawer-agent-btn-locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.drawer-agent-btn-locked:hover { opacity: 0.55; }

/* ─── Auth screen ───────────────────────────────────────────────── */
body.auth-screen {
  background: var(--bg);
  display: grid;
  place-items: center;
  min-height: 100vh;
  margin: 0;
}
.auth-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 40px 16px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.04);
}
.auth-brand.brand {
  /* Match the sidebar brand mark + wordmark exactly so the auth screen
     reads as the same product, not a separate sign-in surface. */
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
}
.auth-brand .brand-mark {
  display: inline-flex;
  width: 32px;
  height: 32px;
}
.auth-brand .brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}
.auth-brand .wordmark {
  font-family: var(--font-display, var(--font-serif, Georgia, serif));
  font-size: 28px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.auth-tag {
  margin-top: 4px;
  color: var(--ink-mute);
  font-size: 13.5px;
}
.auth-tabs {
  display: flex;
  gap: 0;
  margin-top: 24px;
  border-bottom: 1px solid var(--line);
}
.auth-tab {
  background: none;
  border: none;
  padding: 10px 4px;
  margin-right: 22px;
  font-size: 14px;
  color: var(--ink-mute);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.auth-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.auth-form {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.auth-field span {
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.auth-field input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--ink);
}
.auth-submit {
  margin-top: 8px;
  padding: 11px 14px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.auth-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}
.auth-error {
  margin-top: 4px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 13px;
  border-radius: 6px;
}
.auth-info {
  margin-top: 4px;
  padding: 10px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
  font-size: 13px;
  border-radius: 6px;
}
/* Auth foot lays out the forgot-password link and the signup terms
   checkbox in the same grid cell so toggling between login and signup
   modes doesn't change card height. Only one is visible at a time —
   `hidden` swaps which one shows. */
.auth-foot {
  display: grid;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--ink-mute);
  text-align: center;
  min-height: 22px;
}
.auth-foot > * {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  justify-self: center;
}
/* `.auth-terms { display: flex }` below would otherwise win over the
   user-agent `[hidden] { display: none }` because of specificity, so the
   checkbox would stay visible in login mode. Force it down with a more
   specific selector. */
.auth-foot > [hidden] { display: none; }
.auth-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
}

/* Password show/hide toggle. The wrapper is positioned so the eye button
   floats inside the right edge of the input, with enough right-padding on
   the input itself that the masked dots never overlap the icon. */
.pw-wrap {
  position: relative;
  display: block;
}
.pw-input {
  /* Override the default auth-field input padding to make room for the eye. */
  padding-right: 40px !important;
  width: 100%;
}
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 0;
  transition: color .12s, background .12s;
}
.pw-toggle:hover { color: var(--ink); background: var(--surface-alt); }
.pw-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* Terms acceptance row on signup — sits in the same auth-foot slot as
   "Forgot password?", visible only in signup mode. */
.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  text-align: left;
  max-width: 100%;
}
.auth-terms input[type="checkbox"] {
  margin: 2px 0 0;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  accent-color: var(--ink);
  cursor: pointer;
}
.auth-terms a {
  color: var(--ink);
  text-decoration: underline;
}
.auth-terms a:hover { color: var(--green); }

/* Drawer-level "did this match?" banner. Sits between the stats grid
   and the drawer controls; only renders for resolved bills. Subtle
   surface — we don't want to compete with the activity timeline. */
#drawer-outcome-banner { padding: 0 22px; }
.outcome-verify {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin: 12px 0 0;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.outcome-verify-text { flex: 1; color: var(--ink-soft); }
.outcome-verify-text strong { color: var(--ink); font-weight: 600; display: block; margin-bottom: 2px; }
.outcome-verify-actions { display: flex; gap: 8px; }
.outcome-verify-done {
  background: var(--green-tint);
  border-color: rgba(23, 114, 69, 0.2);
}
.outcome-verify-done .outcome-verify-text strong { color: var(--green); }
.outcome-verify-notes { font-style: italic; color: var(--ink-mute); }

/* ─── Static legal pages (terms, privacy) ─────────────────────── */
body.legal-page { background: var(--bg); }
.legal-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 60px 28px 80px;
  color: var(--ink);
}
.legal-brand.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 36px;
}
.legal-brand .brand-mark { width: 28px; height: 28px; }
.legal-brand .brand-mark img { width: 100%; height: 100%; display: block; }
.legal-brand .wordmark {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.01em;
}
.legal-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.legal-title {
  font-family: var(--font-display);
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
  font-weight: 400;
}
.legal-lede {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 28px;
}
.legal-wrap h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 32px 0 10px;
}
.legal-wrap p, .legal-wrap li {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.legal-wrap ul { padding-left: 20px; margin: 8px 0 16px; }
.legal-wrap li { margin-bottom: 6px; }
.legal-wrap strong { color: var(--ink); font-weight: 600; }
.legal-foot {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.legal-foot a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.legal-foot a:hover { color: var(--green); }


/* ─── Provider-contact card (plan-review tab) ────────────────────
 * Distinct from the drawer Contact tab above (`.drawer-contact`).
 * Selectors are scoped under `.contact-card` so they don't bleed into
 * the drawer rules. */
.contact-card {
  margin: 28px 0;
  padding: 18px 20px;
}
.contact-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.contact-title {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 18px;
  color: var(--ink);
}

.contact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.contact-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.contact-row input {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
  text-transform: none;
  letter-spacing: normal;
}
.contact-row input:focus {
  outline: none;
  border-color: var(--ink);
}
.contact-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 16px;
  flex-wrap: wrap;
}
.contact-notes {
  font-size: 12.5px;
  color: var(--ink-mute);
  flex: 1;
  min-width: 200px;
}
/* Plan-review actions row — scoped under `.contact-card` so it doesn't
   override the drawer's `.contact-actions` rule above. */
.contact-card .contact-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 0;
}
.contact-retry,
.contact-save {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
.contact-save {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.contact-retry:disabled,
.contact-save:disabled { opacity: 0.6; cursor: progress; }
.contact-sources {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}
.contact-sources a {
  color: var(--ink-mute);
  text-decoration: underline;
}
.contact-sources a:hover { color: var(--ink); }

@media (max-width: 640px) {
  .contact-row { grid-template-columns: 1fr; }
}

/* ─── Empty hero (Bills / Comparison pre-first-bill) ────────────
 * Brand-aligned: solid 1.5px border at ~32% ink, Instrument Serif
 * headline, soft ink body, dark pill CTA. No logo here — the sidebar
 * already carries the brand mark. */
.empty-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 40px 20px;
}
.empty-hero-card {
  width: 100%;
  max-width: 560px;
  text-align: center;
  padding: 56px 40px 48px;
  background: var(--surface);
  /* Solid border (not dashed) — dashed reads as a drop zone, and Bills /
     Comparison don't accept drops. The CTA is the only way in.
     ~32% ink + 1.5px so the card edge actually contrasts against the
     off-white page; --line / --line-strong tokens disappeared at this
     card size and dropped the empty state into the bg. */
  border: 1.5px solid rgba(14, 14, 12, 0.32);
  border-radius: 12px;
}
.empty-hero-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 12px;
}
.empty-hero-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 auto 22px;
  max-width: 56ch;
}
.empty-hero-cta {
  /* Inherits .btn.btn-primary.btn-lg sizing; nothing custom needed.
     Kept as a hook for future per-page tweaks. */
}

/* Approve-flow blocker (Resend / contact not configured). Sits above the
   approve button so the user keeps the plan/findings context — better
   than punting them to the full-page error view. */
.approve-blocker {
  margin: 16px 0;
  padding: 16px 18px;
  background: #fef9e7;
  border: 1px solid #f3d99a;
  border-radius: 8px;
}
.approve-blocker-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 4px;
}
.approve-blocker-body {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 10px;
  line-height: 1.5;
}

/* Sidebar nav badge for routes that aren't live yet. Quieter than the
   alert pill but visible enough to set expectations before the click. */
.nav-tbd {
  margin-left: auto;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  text-transform: uppercase;
}
