/* ================================================================
   GaliClaim application styles
   Brand: ink #141719 / ivory #F5F2EA / panel #ECE7DA / teal #1D9E75
   Font: Schibsted Grotesk 400 / 700
   ================================================================ */

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --ink:        #141719;
  --ink-80:     rgba(20,23,25,0.80);
  --ink-40:     rgba(20,23,25,0.40);
  --ink-12:     rgba(20,23,25,0.12);
  --ivory:      #F5F2EA;
  --panel:      #ECE7DA;
  --panel-dk:   #DDD8CB;
  --teal:       #1D9E75;
  --teal-dk:    #168A64;
  --teal-15:    rgba(29,158,117,0.15);
  --teal-8:     rgba(29,158,117,0.08);

  --text-h:     #141719;
  --text-b:     #3A3F3A;
  --text-muted: #767C72;

  --mono: 'Courier New', Courier, monospace;
  --sans: 'Schibsted Grotesk', sans-serif;

  --radius-sm: 3px;
  --radius:    6px;
  --radius-lg: 10px;

  --header-h: 56px;
  --drawer-w: 440px;
}

/* ── Base ────────────────────────────────────────────────────── */
body {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-b);
  background: var(--ivory);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }

/* ── Narrow-screen notice ────────────────────────────────────── */
.narrow-notice {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--ivory);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 40px 32px;
  text-align: center;
}
.narrow-wordmark { height: 28px; width: auto; }
.narrow-text {
  font-size: 0.9375rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
}

@media (max-width: 1023px) {
  .narrow-notice { display: flex; }
  .app-shell { display: none !important; }
}

/* ── App shell ───────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--ink);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
}

.header-logo { display: flex; align-items: center; flex-shrink: 0; }
.header-wordmark { height: 26px; width: auto; }

.header-mid {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-demo {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  border: 1px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 2px 7px 1px;
  white-space: nowrap;
}

.badge-corpus {
  font-size: 0.5625rem;
  letter-spacing: 0.05em;
  color: rgba(245,242,234,0.38);
  white-space: nowrap;
}

.header-end { display: flex; align-items: center; }

.fixture-pill {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--teal);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 3px 8px 2px;
}

/* ── Main area ───────────────────────────────────────────────── */
.main-area {
  flex: 1;
  padding: 0 0 64px;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--panel-dk);
  padding: 18px 28px;
}
.footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Loading ─────────────────────────────────────────────────── */
.loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--panel-dk);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* ── Page container ─────────────────────────────────────────── */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 28px 0;
}

/* ── Page heading ────────────────────────────────────────────── */
.page-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-b);
  letter-spacing: -0.01em;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  border-radius: var(--radius);
  padding: 10px 18px;
  transition: background 0.12s, opacity 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--teal-dk); }

.btn-outline {
  background: transparent;
  color: var(--text-b);
  border: 1.5px solid var(--panel-dk);
}
.btn-outline:hover:not(:disabled) { border-color: var(--ink-40); }

/* .btn-outline's default colors (dark text, light border) assume a light
   background - inside the dark .header they were reading as the same color
   as the header itself. Same class, light-on-dark treatment when nested
   there (e.g. #logout-btn), matching .badge-corpus's translucent ivory. */
.header .btn-outline {
  color: rgba(245, 242, 234, 0.75);
  border-color: rgba(245, 242, 234, 0.3);
}
.header .btn-outline:hover:not(:disabled) {
  color: #fff;
  border-color: var(--teal);
  background: rgba(245, 242, 234, 0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}
.btn-ghost:hover:not(:disabled) { color: var(--text-h); background: var(--panel); }

.btn-ink {
  background: var(--ink);
  color: var(--ivory);
}
.btn-ink:hover:not(:disabled) { background: #2a2f32; }

.btn-sm {
  font-size: 0.75rem;
  padding: 6px 12px;
}

/* ── Chips ───────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px 2px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  line-height: 1.4;
}

/* Kind chips */
.chip-kind {
  background: var(--panel);
  color: var(--text-muted);
}

/* Status chips */
.chip-status-draft     { background: var(--panel); color: var(--text-muted); }
.chip-status-determined { background: var(--teal-15); color: var(--teal-dk); }
.chip-status-signed     { background: var(--ink); color: var(--ivory); }

/* Regime chips */
.chip-regime {
  background: var(--ink-12);
  color: var(--text-h);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  padding: 3px 8px 2px;
}

/* Result chips */
.chip-pass       { background: var(--teal-15); color: var(--teal-dk); }
.chip-fail       { background: var(--ink); color: var(--ivory); }
.chip-contested  { background: transparent; color: var(--text-h); border: 1.5px solid var(--ink-40); }
.chip-na         { background: var(--panel); color: var(--text-muted); }

/* Sentinel chips */
.chip-sentinel-nr  { background: var(--panel); color: var(--text-muted); font-style: italic; }
.chip-sentinel-na  { background: var(--panel); color: var(--text-muted); font-style: italic; }
.chip-sentinel-sup {
  background: var(--ink-12);
  color: var(--text-muted);
  font-style: italic;
}

/* Material chip */
.chip-material   { background: var(--teal-15); color: var(--teal-dk); }
.chip-immaterial { background: var(--panel); color: var(--text-muted); }

/* ── Stat strip ─────────────────────────────────────────────── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--panel-dk);
  border: 1px solid var(--panel-dk);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 40px;
}

.stat-tile {
  background: var(--ivory);
  padding: 24px 24px 20px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-h);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.stat-accent { color: var(--teal); }

/* ── Filter / sort row ───────────────────────────────────────── */
.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--panel-dk);
  margin-bottom: 4px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 2px;
  white-space: nowrap;
}

.filter-chip {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 11px 3px;
  border-radius: 100px;
  border: 1.5px solid var(--panel-dk);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  white-space: nowrap;
  line-height: 1.4;
}
.filter-chip:hover {
  border-color: var(--ink-40);
  color: var(--text-h);
}
.filter-chip.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.filter-chip:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ── Case list ───────────────────────────────────────────────── */
.case-list-hd {
  display: grid;
  grid-template-columns: 1fr 140px 120px 130px 120px;
  gap: 16px;
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--panel-dk);
  margin-bottom: 4px;
}
.case-list-hd span {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.case-row {
  display: grid;
  grid-template-columns: 1fr 140px 120px 130px 120px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--panel);
}
.case-row:hover { background: var(--panel); }
.case-row:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.case-row:last-child { border-bottom: none; }

.case-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-h);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-date {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ── Due-date column ─────────────────────────────────────────── */
.case-due {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-b);
  white-space: nowrap;
}
.case-due-none { color: var(--text-muted); }

.due-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.due-dot--on_track  { background: var(--teal); }
.due-dot--due_soon  { background: #D97706; }          /* amber */
.due-dot--overdue   {
  background: transparent;
  border: 2px solid var(--ink);
}

/* ── Eligibility deadline banner ─────────────────────────────── */
.eligibility-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  margin-bottom: 20px;
  font-size: 0.875rem;
  flex-wrap: wrap;
}
.eligibility-banner--on_track {
  background: var(--teal-8);
  border-color: var(--teal-15);
}
.eligibility-banner--due_soon {
  background: rgba(217,119,6,0.08);
  border-color: rgba(217,119,6,0.20);
}
.eligibility-banner--overdue {
  background: var(--ink-12);
  border-color: var(--ink-40);
}

.eligibility-banner-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.eligibility-banner-date {
  font-weight: 700;
  color: var(--text-h);
  white-space: nowrap;
}
.eligibility-banner--on_track .eligibility-banner-date  { color: var(--teal-dk); }
.eligibility-banner--due_soon .eligibility-banner-date  { color: #B45309; }
.eligibility-banner--overdue  .eligibility-banner-date  { color: var(--text-h); }

.eligibility-banner-left {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.eligibility-banner--on_track .eligibility-banner-left  { color: var(--teal-dk); }
.eligibility-banner--due_soon .eligibility-banner-left  { color: #B45309; }
.eligibility-banner--overdue  .eligibility-banner-left  { color: var(--text-h); font-weight: 700; }

.empty-state {
  padding: 64px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ── Case view ───────────────────────────────────────────────── */
.case-page { padding: 40px 28px 64px; max-width: 1280px; margin: 0 auto; }

.case-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.case-title-lg {
  font-size: 1.4375rem;
  font-weight: 700;
  color: var(--text-h);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.case-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Service strip */
.service-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--ink);
  border-radius: var(--radius);
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.service-code {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ivory);
  letter-spacing: 0.04em;
}

.service-detail {
  font-size: 0.8125rem;
  color: rgba(245,242,234,0.6);
}

.service-sep { color: rgba(245,242,234,0.25); }

/* Party layout */
.party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.party-panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.party-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.party-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-h);
  margin-bottom: 4px;
}

.party-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.facts-list { display: flex; flex-direction: column; gap: 8px; }

.fact-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
}

.fact-key {
  font-weight: 700;
  color: var(--text-muted);
  min-width: 180px;
  font-size: 0.8125rem;
  padding-top: 1px;
  line-height: 1.4;
}

.fact-val { color: var(--text-b); line-height: 1.4; }
.fact-source {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Evidence */
.evidence-section { margin-top: 20px; }
.evidence-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.evidence-item {
  border: 1px solid var(--panel-dk);
  border-radius: var(--radius);
  margin-bottom: 6px;
  background: var(--ivory);
}

.evidence-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.evidence-toggle:hover { background: var(--panel); border-radius: var(--radius); }
.evidence-toggle-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-h);
}
.evidence-kind-chip {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 2px 6px;
  background: var(--panel);
  border-radius: var(--radius-sm);
}
.evidence-caret {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.evidence-caret.open { transform: rotate(90deg); }

.evidence-body {
  padding: 0 14px 12px;
  font-size: 0.8125rem;
  color: var(--text-b);
  line-height: 1.55;
  display: none;
}
.evidence-body.expanded { display: block; }

.case-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

/* ── Run workspace ───────────────────────────────────────────── */
.run-page { max-width: 1280px; margin: 0 auto; }

/* Conclusion banner */
.conclusion-banner {
  padding: 36px 28px 32px;
  border-bottom: 1px solid var(--panel-dk);
}

.conclusion-banner.payable   { background: var(--teal); }
.conclusion-banner.contested { background: var(--panel); }
.conclusion-banner.ineligible { background: var(--ink); }

.conclusion-eyebrow {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.conclusion-banner.payable    .conclusion-eyebrow { color: rgba(255,255,255,0.7); }
.conclusion-banner.contested  .conclusion-eyebrow { color: var(--text-muted); }
.conclusion-banner.ineligible .conclusion-eyebrow { color: rgba(245,242,234,0.55); }

.conclusion-heading {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.conclusion-banner.payable    .conclusion-heading { color: #fff; }
.conclusion-banner.contested  .conclusion-heading { color: var(--text-h); }
.conclusion-banner.ineligible .conclusion-heading { color: var(--ivory); }

.conclusion-sub {
  margin-top: 12px;
  font-size: 0.875rem;
}

.conclusion-banner.payable    .conclusion-sub { color: rgba(255,255,255,0.75); }
.conclusion-banner.contested  .conclusion-sub { color: var(--text-muted); }
.conclusion-banner.ineligible .conclusion-sub { color: rgba(245,242,234,0.5); }

.conclusion-amount {
  font-size: 3.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.035em;
  margin-top: 4px;
  line-height: 1;
}

.conclusion-meta {
  margin-top: 14px;
  font-size: 0.75rem;
  font-family: var(--mono);
}
.conclusion-banner.payable    .conclusion-meta { color: rgba(255,255,255,0.55); }
.conclusion-banner.contested  .conclusion-meta { color: var(--text-muted); }
.conclusion-banner.ineligible .conclusion-meta { color: rgba(245,242,234,0.38); }

/* Run strip (below banner) */
.run-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--panel-dk);
  background: var(--ivory);
}

.run-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.run-id-mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.run-strip-actions { display: flex; gap: 10px; }

/* Chain + side rail layout */
.chain-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  min-height: 400px;
  padding: 0 28px;
}

.chain-col { padding: 32px 24px 32px 0; }
.rail-col {
  padding: 32px 0 32px 24px;
  border-left: 1px solid var(--panel-dk);
  position: sticky;
  top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 80px);
  overflow-y: auto;
}

/* Chain spine */
.chain { position: relative; }
.chain::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 24px;
  bottom: 24px;
  width: 1px;
  background: var(--panel-dk);
  z-index: 0;
}

/* Step card */
.step-card {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 0 14px;
  align-items: flex-start;
  padding: 16px 0;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.1s;
}
.step-card:hover { background: var(--teal-8); }
.step-card:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.step-card.step-focused { background: var(--teal-8); }
.step-card.step-focused .step-num { border-color: var(--teal); }

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  transition: border-color 0.12s;
}

.step-num-pass     { background: var(--teal); color: #fff; }
.step-num-fail     { background: var(--ink); color: var(--ivory); }
.step-num-contested { background: var(--ivory); color: var(--text-h); border: 2px solid var(--ink-40); }
.step-num-na       { background: var(--panel); color: var(--text-muted); border: 1.5px solid var(--panel-dk); }

.step-body { min-width: 0; }
.step-statement {
  font-size: 0.9375rem;
  color: var(--text-b);
  line-height: 1.5;
}
.step-cite {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.step-result { padding-top: 4px; }

/* Contested block (different from step card) */
.contested-block {
  border: 1.5px solid var(--ink-40);
  border-radius: var(--radius-lg);
  margin: 8px 0;
  background: var(--ivory);
  overflow: hidden;
}

.contested-hd {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 0 14px;
  align-items: center;
  padding: 16px 16px 12px;
  background: var(--panel);
}

.contested-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.contested-statement {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-h);
}

.contested-cite {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.contested-body { padding: 20px; }

.branch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.branch-panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.branch-side-label {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.branch-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-h);
  margin-bottom: 6px;
}

.branch-effect {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.resolve-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.resolve-text {
  font-size: 0.875rem;
  color: var(--text-b);
  line-height: 1.45;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--panel);
  border-radius: var(--radius);
  border-left: 3px solid var(--panel-dk);
}

.cf-toggles {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.cf-toggle-btn {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--panel-dk);
  background: transparent;
  color: var(--text-b);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.cf-toggle-btn:hover { border-color: var(--ink-40); }
.cf-toggle-btn.active {
  background: var(--ink);
  color: var(--ivory);
  border-color: var(--ink);
}

.cf-preview {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  animation: fadeIn 0.15s ease;
}
.cf-preview.payable   { background: var(--teal-15); color: var(--teal-dk); }
.cf-preview.contested { background: var(--panel); color: var(--text-muted); }
.cf-preview.hidden    { display: none; }

.cf-preview-label {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.7;
}
.cf-preview-amount {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Side rail */
.rail-empty {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding: 4px 0;
}

.rail-title {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.rail-fact {
  padding: 10px 12px;
  background: var(--panel);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.rail-fact-key {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.rail-fact-val { font-size: 0.875rem; color: var(--text-h); }
.rail-fact-party {
  font-size: 0.5625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Reproduction panel */
.repro-section {
  padding: 32px 28px;
  border-top: 1px solid var(--panel-dk);
  background: var(--panel);
}

.repro-title {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.repro-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 20px;
}

.repro-key {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.repro-hash {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-h);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--ivory);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-dk);
}

.copy-btn {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-dk);
  background: var(--ivory);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.copy-btn:hover { color: var(--text-h); border-color: var(--ink-40); }
.copy-btn.copied { color: var(--teal); border-color: var(--teal); }

.repro-recipe {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.rerun-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.rerun-result {
  font-size: 0.875rem;
  color: var(--teal-dk);
  font-weight: 700;
  animation: fadeIn 0.2s ease;
  display: none;
}
.rerun-result.show { display: flex; align-items: center; gap: 6px; }

/* Run actions bottom */
.run-actions {
  padding: 20px 28px 40px;
  border-top: 1px solid var(--panel-dk);
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ── Sign-off drawer ─────────────────────────────────────────── */
.signoff-drawer {
  position: fixed;
  top: var(--header-h);
  right: 0;
  width: var(--drawer-w);
  height: calc(100vh - var(--header-h));
  background: var(--ivory);
  border-left: 1px solid var(--panel-dk);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: -4px 0 24px rgba(20,23,25,0.08);
}
.signoff-drawer.open { transform: translateX(0); }

.signoff-inner { padding: 24px 24px 40px; }

.signoff-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.signoff-hd-title {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-h);
}

.drawer-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  background: none;
  border: none;
  font-family: inherit;
}
.drawer-close:hover { background: var(--panel); color: var(--text-h); }

.drawer-field { margin-bottom: 14px; }
.drawer-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.drawer-input {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--text-h);
  background: var(--panel);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  transition: border-color 0.12s;
  outline: none;
}
.drawer-input:focus { border-color: var(--teal); background: var(--ivory); }

.progress-wrap { margin: 20px 0 18px; }
.progress-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.progress-bar-track {
  height: 4px;
  background: var(--panel-dk);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 99px;
  transition: width 0.25s ease;
}

.bulk-confirm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.bulk-confirm-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--teal);
  background: transparent;
  border: 1px solid var(--teal);
  border-radius: 7px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.bulk-confirm-btn:hover {
  background: var(--teal);
  color: var(--ivory);
}
.bulk-confirm-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.drawer-divider {
  border: none;
  border-top: 1px solid var(--panel-dk);
  margin: 18px 0;
}

.drawer-step {
  padding: 12px 0;
  border-bottom: 1px solid var(--panel);
}
.drawer-step:last-of-type { border-bottom: none; }

.drawer-step-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.drawer-step-n {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.drawer-step-stmt {
  font-size: 0.8125rem;
  color: var(--text-b);
  line-height: 1.45;
  flex: 1;
}

.drawer-step-auto {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.step-action-btns {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.step-action-btn {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--panel-dk);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s;
  font-family: inherit;
}
.step-action-btn:hover { border-color: var(--ink-40); color: var(--text-h); }
.step-action-btn.active-confirm { background: var(--teal-15); border-color: var(--teal); color: var(--teal-dk); }
.step-action-btn.active-modify  { background: var(--panel); border-color: var(--ink-40); color: var(--text-h); }
.step-action-btn.active-reject  { background: var(--ink-12); border-color: var(--ink-40); color: var(--text-h); }

.step-note-wrap { display: none; margin-top: 6px; }
.step-note-wrap.show { display: block; }
.step-note-textarea {
  width: 100%;
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-h);
  background: var(--panel);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 60px;
  outline: none;
  transition: border-color 0.12s;
}
.step-note-textarea:focus { border-color: var(--teal); background: var(--ivory); }
.step-note-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Contested resolution in drawer */
.drawer-contested-block {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 10px;
}
.drawer-contested-label {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.drawer-resolve-btns {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.drawer-resolve-btn {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--panel-dk);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s;
  font-family: inherit;
}
.drawer-resolve-btn:hover { border-color: var(--ink-40); color: var(--text-h); }
.drawer-resolve-btn.active-claimant { background: var(--teal-15); border-color: var(--teal); color: var(--teal-dk); }
.drawer-resolve-btn.active-respondent { background: var(--ink-12); border-color: var(--ink-40); color: var(--text-h); }
.drawer-resolve-note-required {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sign-section { margin-top: 24px; }
.sign-btn {
  width: 100%;
  padding: 14px;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--ivory);
  border: none;
  cursor: pointer;
  transition: opacity 0.12s, background 0.12s;
  font-family: inherit;
}
.sign-btn:hover:not(:disabled) { background: #2a2f32; }
.sign-btn:disabled { opacity: 0.28; cursor: not-allowed; }

/* Attestation block */
.attestation-block {
  background: var(--ink);
  color: var(--ivory);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  animation: fadeIn 0.25s ease;
}
.attestation-title {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245,242,234,0.5);
  margin-bottom: 12px;
}
.attestation-line {
  font-size: 0.875rem;
  color: var(--ivory);
  line-height: 1.55;
}
.attestation-line strong { font-weight: 700; }
.attestation-ref {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: rgba(245,242,234,0.45);
}

/* ── Template modal ──────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20,23,25,0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal {
  background: var(--ivory);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(20,23,25,0.22);
}

.modal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--panel-dk);
  position: sticky;
  top: 0;
  background: var(--ivory);
  z-index: 1;
}

.modal-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-h);
}

.modal-close-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
}
.modal-close-btn:hover { background: var(--panel); color: var(--text-h); }

.template-list { padding: 16px 0; }

.template-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
  cursor: pointer;
  transition: background 0.1s;
}
.template-item:hover { background: var(--panel); }

.template-item-body { flex: 1; min-width: 0; }
.template-item-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-h);
  margin-bottom: 3px;
}
.template-item-blurb {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.template-item-arrow {
  color: var(--text-muted);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Tooltip ─────────────────────────────────────────────────── */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--ivory);
  font-size: 0.6875rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 10;
}
.tooltip-wrap:hover .tooltip { opacity: 1; }

/* ── Utility ─────────────────────────────────────────────────── */
.hidden { display: none !important; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Focus ring override ─────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }


/* Sign-off blocker checklist */
.sign-blockers { margin-top: 10px; }
.sign-blockers-hd { font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.sign-blockers ul { margin: 0; padding-left: 18px; }
.sign-blockers li { font-size: 13px; color: #9A5B1E; line-height: 1.5; }

/* Make the contested resolution block impossible to miss */
.drawer-contested-block { margin-top: 10px; padding: 12px; border-radius: 8px;
  background: rgba(240, 176, 0, 0.10); border: 1px solid rgba(240, 176, 0, 0.45); }
.drawer-contested-label { font-size: 12px; font-weight: 700; color: #9A5B1E;
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.drawer-resolve-btns { display: flex; gap: 8px; margin-bottom: 8px; }
.drawer-resolve-note-required { font-size: 12px; color: var(--text-muted); margin: 4px 0; }
