:root {
  color-scheme: light;
  --paper: #f7f6f1;
  --surface: #ffffff;
  --ink: #18211f;
  --muted: #62706c;
  --rule: #d9dfda;
  --accent: #007c70;
  --accent-strong: #005c53;
  --accent-soft: #dff3e9;
  --highlight: #f4c768;
  --navy: #132c35;
  --on-accent: #ffffff;
  --warning: #7a4d00;
  --warning-soft: #fff5dc;
  --danger: #a33a2b;
  --danger-soft: #fff0ed;
  --info-soft: #edf5f4;
  --focus: rgba(0, 124, 112, .28);
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow-sm: 0 1px 2px rgba(19, 44, 53, .05);
  --shadow-md: 0 12px 30px rgba(19, 44, 53, .07);
  --radius: 4px;
  --radius-lg: 8px;
  --content-max: 1180px;
  --gutter: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--font-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

button, summary, input[type="file"], input[type="checkbox"] { cursor: pointer; }

button:disabled, input:disabled, select:disabled {
  cursor: not-allowed;
  opacity: .58;
}

::selection { background: var(--accent-soft); color: var(--navy); }

.shell {
  width: min(var(--content-max), calc(100% - (var(--gutter) * 2)));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 12px;
  translate: 0 -160%;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--navy);
  padding: 10px 14px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

.skip-link:focus { translate: 0; }

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  background: var(--navy);
  color: var(--on-accent);
}

.app-header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .52);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
}

.brand > span:last-child { display: grid; line-height: 1.1; }
.brand strong { font-size: 14px; letter-spacing: -.01em; }
.brand small { margin-top: 4px; color: rgba(255, 255, 255, .64); font-size: 10px; }

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, .72);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.language-control select {
  width: auto;
  min-width: 92px;
  min-height: 36px;
  border-color: rgba(255, 255, 255, .24);
  background-color: var(--surface);
  background-position: calc(100% - 13px) 15px, calc(100% - 8px) 15px;
  padding: 6px 27px 6px 9px;
  color: var(--navy);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: rgba(255, 255, 255, .86);
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #68d7b3;
  box-shadow: 0 0 0 3px rgba(104, 215, 179, .16);
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(280px, 4fr);
  align-items: end;
  gap: 56px;
  padding: 72px 0 48px;
}

.eyebrow, .section-kicker {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1, h2, h3, h4, p { margin-top: 0; }

h1 {
  max-width: 820px;
  margin-bottom: 20px;
  font-family: var(--font-display);
  font-size: clamp(44px, 5.15vw, 64px);
  font-weight: 400;
  letter-spacing: -.055em;
  line-height: 1.02;
  text-wrap: balance;
}

h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 400;
  letter-spacing: -.035em;
  line-height: 1.1;
}

h3 {
  margin-bottom: 16px;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -.015em;
}

h4 { margin-bottom: 6px; font-size: 14px; line-height: 1.35; }

.lede {
  max-width: 670px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 18px 20px;
}

.privacy-note svg {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--accent-strong);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.privacy-note div { display: grid; gap: 4px; }
.privacy-note strong { color: var(--navy); font-size: 13px; }
.privacy-note span { color: var(--muted); font-size: 12px; line-height: 1.45; }

.workflow {
  margin-bottom: 24px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .58);
  box-shadow: var(--shadow-sm);
}

.workflow ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 24px;
}

.workflow li + li { border-left: 1px solid var(--rule); }

.workflow li > span {
  display: grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workflow li > div { display: grid; gap: 1px; }
.workflow strong { font-size: 13px; }
.workflow small { color: var(--muted); font-size: 11px; }

.workflow li.active { background: var(--surface); }
.workflow li.active:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.workflow li.active:last-child { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.workflow li.active::after {
  content: "";
  position: absolute;
  right: 20px;
  bottom: -1px;
  left: 20px;
  height: 3px;
  background: var(--accent);
}

.workflow li.active > span {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.workflow li.complete > span {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.workflow li.complete > span::before { content: "✓"; }
.workflow li.complete > span { font-size: 0; }
.workflow li.complete > span::before { font-size: 13px; }

.panel {
  margin-bottom: 24px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.import-panel {
  position: relative;
  margin-bottom: 40px;
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.import-panel::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 32px;
  left: 32px;
  height: 3px;
  background: var(--accent);
}

.section-heading, .review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading.compact { align-items: flex-start; margin-bottom: 16px; }
.section-heading.compact h3 { margin-bottom: 0; }
.section-heading.compact .section-kicker { margin-bottom: 4px; }

.heading-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.step {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 800;
}

.button, button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 18px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.button svg, button svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.button:hover:not(:disabled), button:hover:not(:disabled) { background: var(--accent-strong); }
.button:active:not(:disabled), button:active:not(:disabled) { transform: translateY(1px); }

.button-secondary {
  border-color: var(--navy);
  background: var(--navy);
}
.button-secondary:hover:not(:disabled) { border-color: #081b22; background: #081b22; }

.button-outline {
  border-color: #bbc6c1;
  background: var(--surface);
  color: var(--navy);
}
.button-outline:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

.button-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}
.button-ghost:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-strong); }

.app-header .button-ghost { min-height: 36px; padding: 6px 10px; color: rgba(255, 255, 255, .78); }
.app-header .button-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .1); color: var(--on-accent); }
.button.danger, button.danger { color: var(--danger); }
.button.danger:hover:not(:disabled), button.danger:hover:not(:disabled) { border-color: #e5bbb5; background: var(--danger-soft); color: #7f2117; }

.guide {
  margin: 0 0 24px;
  border: 1px solid #b9d8cf;
  border-radius: var(--radius-lg);
  background: var(--info-soft);
  padding: 24px;
}

.guide-intro { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.guide-intro h3 { margin-bottom: 2px; }
.guide-intro p { margin-bottom: 0; }
.guide-icon, .card-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.guide-icon svg, .card-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.guide-steps { display: grid; gap: 0; margin: 0 0 20px; padding: 0; list-style: none; }
.guide-steps li { display: grid; grid-template-columns: 42px 1fr; gap: 12px; border-top: 1px solid #cfe1dc; padding: 12px 0; }
.guide-steps li:last-child { border-bottom: 1px solid #cfe1dc; }
.guide-steps span { color: var(--accent-strong); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.guide-steps p { margin: 0; }

.callout-note {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  margin-bottom: 20px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--rule);
}
.guide-grid > div { background: var(--surface); padding: 16px; }
.guide-grid p { margin-bottom: 0; color: var(--muted); font-size: 13px; }

.import-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
  gap: 20px;
}

.dropzone {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px dashed #8aa89f;
  border-radius: var(--radius-lg);
  background: #f8fbf9;
  padding: 28px;
  text-align: center;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.dropzone:hover { border-color: var(--accent); background: #f1f9f5; }
.dropzone:has(input:focus-visible) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }

.dropzone-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.dropzone-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.dropzone-copy { min-width: 0; display: grid; gap: 4px; }
.dropzone-copy strong { color: var(--navy); font-size: 14px; }
.dropzone-copy small { color: var(--muted); font-size: 12px; font-weight: 400; }

.dropzone input[type="file"] { max-width: 100%; color: var(--muted); font-size: 12px; }
.dropzone input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 10px;
  border: 1px solid #bbc6c1;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--navy);
  padding: 7px 12px;
  font: inherit;
  font-weight: 700;
}
.dropzone input[type="file"]::file-selector-button:hover { border-color: var(--accent); background: var(--accent-soft); }

.identity-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 22px;
}

.card-heading { display: flex; align-items: center; gap: 12px; }
.card-heading h3 { margin-bottom: 1px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.identity-card > .note { margin: 16px 0; }

.import-identity-grid, .upload-grid, .field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.advanced-options {
  margin-top: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.advanced-options > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}
.advanced-options > summary::-webkit-details-marker { display: none; }
.advanced-options > summary span { display: inline-flex; align-items: center; gap: 9px; }
.advanced-options > summary svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.advanced-options .chevron { transition: transform .16s ease; }
.advanced-options[open] .chevron { transform: rotate(180deg); }
.advanced-options[open] > summary { border-bottom: 1px solid var(--rule); }
.details-content { padding: 16px; }
.details-content > .note { margin-bottom: 14px; }
.compact-dropzone { min-height: 130px; align-items: flex-start; padding: 18px; text-align: left; }

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.hidden { display: none !important; }
.hosted-only { display: none !important; }
html[data-runtime-mode="pending"] .local-only,
html[data-runtime-mode="unknown"] .local-only { display: none !important; }
html[data-runtime-mode="hosted"] .local-only { display: none !important; }
html[data-runtime-mode="hosted"] .hosted-only { display: block !important; }
html[data-runtime-mode="hosted"] .privacy-note.hosted-only { display: flex !important; }

#review-panel { scroll-margin-top: 72px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.dropzone.has-file { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }

.review-toolbar {
  margin-bottom: 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: rgba(247, 246, 241, .94);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.review-toolbar h2 { display: inline; font-size: 27px; }
.review-toolbar .section-kicker { margin-bottom: 2px; }

.sticky-heading { position: sticky; z-index: 10; top: 72px; }

.provider-context, .status-badge, .source, .warning-count {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}

.provider-context { margin-left: 8px; background: var(--accent-soft); color: var(--accent-strong); padding: 4px 9px; vertical-align: 4px; }
.status-badge { border: 1px solid #b9d8cf; background: var(--accent-soft); color: var(--accent-strong); padding: 6px 10px; }

.totals-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.total-card {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
}

.total-card small { display: block; color: var(--muted); font-size: 11px; }
.total-card b { color: var(--navy); font-size: 21px; line-height: 1.2; font-variant-numeric: tabular-nums lining-nums; }
.total-card.primary { grid-column: span 2; border-color: var(--navy); background: var(--navy); }
.total-card.primary b { color: var(--on-accent); font-family: var(--font-display); font-size: 31px; font-weight: 400; }
.total-card.primary small { color: rgba(255, 255, 255, .66); }
.total-card.warning-total { border-color: #e7cd90; background: var(--warning-soft); }
.total-card.warning-total b { color: var(--warning); }

.field-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

label.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #47534f;
  font-size: 12px;
  font-weight: 700;
}

input:not([type="file"]):not([type="checkbox"]), select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #b9c4bf;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 11px;
  box-shadow: inset 0 1px 2px rgba(19, 44, 53, .03);
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

input::placeholder { color: #88928e; }
input:not([type="file"]):not([type="checkbox"]):hover, select:hover { border-color: #899791; }
input:not([type="file"]):not([type="checkbox"]):focus-visible, select:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 19px, calc(100% - 11px) 19px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 32px;
}

code {
  border-radius: 3px;
  background: #eef1ee;
  color: #33413d;
  padding: 2px 5px;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  scrollbar-color: #aebbb5 transparent;
}

.table-scroll:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.table-scroll-hint {
  display: none;
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.table-scroll-hint span { margin-right: 4px; color: var(--accent-strong); }

table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums lining-nums;
}

th {
  border-bottom: 1px solid #afbbb6;
  background: #f0f3f0;
  color: #40504b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .015em;
  text-align: left;
  white-space: nowrap;
}

th, td { padding: 10px 12px; vertical-align: top; }
td { border-bottom: 1px solid #e4e8e5; }
tbody th {
  border-bottom: 1px solid #e4e8e5;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover td { background: #fafbf9; }
tbody tr:hover th { background: #fafbf9; }
td.numeric, th.numeric { text-align: right; }
td input { min-width: 86px; padding: 6px; }

.security-card { margin: 14px 0; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-lg); }
.security-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--rule); background: #f3f5f3; padding: 14px 16px; }
.security-head h4 { margin: 0; }
.security-body { padding: 16px; }
.security-fields { grid-template-columns: repeat(6, 1fr); }

.subheading {
  margin: 24px 0 9px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.subheading:first-child { margin-top: 8px; }
.original { margin-top: 10px; color: var(--muted); font-size: 12px; }
.original code { white-space: pre-wrap; overflow-wrap: anywhere; }

.note { color: var(--muted); font-size: 13px; }

.message {
  margin: 10px 0;
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 13px;
}
.message.error { border-color: #e4b5af; background: var(--danger-soft); color: #7f2117; }
.message.warning { border-color: #e7cd90; background: var(--warning-soft); color: #654000; }
.message.success { border-color: #aed5ca; background: var(--accent-soft); color: var(--accent-strong); }

.warning-panel { border-top: 3px solid var(--highlight); }
.warning-count { background: var(--warning-soft); color: var(--warning); padding: 6px 10px; }

.finding {
  position: relative;
  margin: 8px 0;
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px 14px;
}
.finding.warning { border-left-color: #bd7b00; background: #fffaf0; }
.finding.error { border-left-color: var(--danger); background: #fff6f4; }
.finding.notice { border-left-color: var(--accent); }
.finding-head { display: flex; justify-content: space-between; gap: 12px; }
.finding-head b { color: var(--navy); font-size: 12px; }
.finding-head span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .035em; }
.finding p { margin: 5px 0; font-size: 13px; }
.finding small { color: var(--muted); font-size: 11px; }

.finding-buckets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.finding-bucket {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .42);
  padding: 12px;
}

.finding-bucket.attention { border-top: 3px solid var(--highlight); }
.finding-bucket.information { border-top: 3px solid #a8d7cd; }

.finding-bucket-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 7px;
}

.finding-bucket-heading h4 { margin: 0; color: var(--navy); }
.finding-bucket-heading span {
  display: grid;
  min-width: 26px;
  min-height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #edf1ee;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.finding-effect {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  border-top: 1px solid rgba(98, 112, 108, .16);
  padding-top: 9px;
  font-size: 11px;
}

.finding-effect span { color: var(--muted); }
.finding-effect strong { color: var(--navy); text-align: right; }

.finding-corrections {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  border-radius: var(--radius);
  background: var(--info-soft);
  padding: 11px;
}

.finding-corrections > strong { color: var(--accent-strong); font-size: 11px; }
.correction-subject {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(10rem, .75fr);
  gap: 8px;
  margin: 0;
}
.correction-subject > div {
  min-width: 0;
  border: 1px solid rgba(98, 112, 108, .16);
  border-radius: 6px;
  background: rgba(255, 255, 255, .58);
  padding: 8px 9px;
}
.correction-subject dt {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.correction-subject dd {
  margin: 3px 0 0;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.correction-subject code { font-size: 11px; }
.inline-correction { min-width: 0; display: grid; gap: 6px; }
.inline-correction + .inline-correction { border-top: 1px solid rgba(98, 112, 108, .16); padding-top: 10px; }
.inline-correction-label { color: #47534f; font-size: 12px; font-weight: 700; }
.inline-correction-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.inline-correction-control .button { min-height: 44px; }
.correction-requirement,
.correction-input-help,
.correction-verification {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}
.correction-requirement { color: var(--ink); }
.correction-input-help { color: var(--muted); }
.correction-verification {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  color: var(--muted);
}
.correction-verification strong { color: var(--accent-strong); }
.inline-correction-status { margin: 0; }
.inline-correction-status:empty { display: none; }
.finding-advanced, .table-advanced { margin-top: 10px; color: var(--muted); }
.finding-advanced summary, .table-advanced summary { width: fit-content; font-size: 11px; font-weight: 700; }
.finding-advanced p { overflow-wrap: anywhere; }
.table-advanced small { display: block; margin-top: 5px; overflow-wrap: anywhere; }

.excluded { margin: 8px 0; border-left: 3px solid #bd7b00; background: var(--warning-soft); padding: 12px; }
.excluded > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.excluded-count { flex: none; color: #654000; font-size: 12px; font-weight: 700; }
.excluded-list { margin-top: 10px; }
.excluded-row + .excluded-row { margin-top: 10px; border-top: 1px solid #ead7ad; padding-top: 10px; }
.excluded code { display: block; margin-top: 5px; white-space: pre-wrap; overflow-wrap: anywhere; }

.source-legend { display: flex; flex-wrap: wrap; gap: 7px; }
.source { padding: 3px 8px; letter-spacing: .04em; text-transform: uppercase; }
.source.ictax, .source.estv { background: var(--accent-soft); color: var(--accent-strong); }
.source.ibkr { background: #e8f0f2; color: var(--navy); }
.source.manual { background: var(--warning-soft); color: var(--warning); }

.override-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}
#override-status { margin-top: 10px; }
#overrides { margin-top: 16px; }

.reference-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}
.reference-panel > div:first-child { min-width: 0; }
.reference-panel .card-heading { margin-bottom: 10px; }
.reference-panel h3 { margin-bottom: 1px; }
.reference-panel > div > .note { margin-bottom: 0; }
.reference-actions { min-width: 245px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.reference-actions .button { width: 100%; }

.final-review-panel { border-top: 3px solid var(--accent); }
.final-review-summary { display: grid; gap: 18px; }
.final-review-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.final-review-facts > div {
  min-width: 0;
  border-left: 2px solid var(--rule);
  padding-left: 12px;
}
.final-review-facts dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.final-review-facts dd { margin: 4px 0 0; color: var(--navy); font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.final-review-facts .readiness.ready { color: var(--accent-strong); }
.final-review-facts .readiness.blocked { color: var(--danger); }
.disposition-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius); }
.disposition-summary > div { display: grid; gap: 2px; padding: 12px; }
.disposition-summary > div + div { border-left: 1px solid var(--rule); }
.disposition-summary strong { color: var(--navy); font-family: var(--font-display); font-size: 22px; font-weight: 400; }
.disposition-summary span { color: var(--muted); font-size: 10px; font-weight: 700; }

.generate-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  overflow: hidden;
  border-color: var(--navy);
  background: var(--navy);
  color: var(--on-accent);
  box-shadow: var(--shadow-md);
}
.generate-panel .step { background: var(--accent-soft); color: var(--accent-strong); }
.generate-panel .section-kicker { color: #7ed6c1; }
.generate-panel p { max-width: 700px; margin: 12px 0; color: rgba(255, 255, 255, .66); }
.generate-panel h2 { color: var(--on-accent); }

.ack {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 18px;
  color: var(--on-accent);
}
.ack input {
  width: 19px;
  height: 19px;
  flex: none;
  margin: 2px 0 0;
  accent-color: #6bd0b6;
}
.ack span { display: grid; gap: 2px; }
.ack strong { font-size: 13px; }
.ack small { color: rgba(255, 255, 255, .63); font-size: 11px; font-weight: 400; }
.generate-actions { min-width: 230px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.filing-language-field { margin-bottom: 4px; color: rgba(255, 255, 255, .8); }
.filing-language-field select { color: var(--ink); font-weight: 500; }
.generate-actions .button { width: 100%; background: var(--surface); color: var(--navy); }
.generate-actions .button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-strong); }
.generate-actions .status { color: rgba(255, 255, 255, .72); text-align: right; }
.generate-panel .checkout-price { margin: 0 0 2px; color: #9ee0d0; font-size: 11px; font-weight: 800; text-align: right; }

.disposition-audit_only > :first-child,
.disposition-omitted > :first-child,
.disposition-zeroed > :first-child { color: var(--warning); font-weight: 800; }

footer {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 14px 0 44px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
footer span + span::before { content: "·"; margin: 0 10px; color: #a0aaa6; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 960px) {
  .intro { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 56px 0 40px; }
  .privacy-note { max-width: 620px; }
  .import-grid { grid-template-columns: minmax(0, 1fr); }
  .dropzone { min-height: 230px; }
  .identity-card { padding: 20px; }
  .totals-grid { grid-template-columns: repeat(2, 1fr); }
  .field-grid, .security-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .final-review-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .generate-panel { grid-template-columns: minmax(0, 1fr); }
  .generate-actions { width: 100%; min-width: 0; align-items: flex-start; }
  .generate-actions .button { width: fit-content; }
  .generate-actions .status { text-align: left; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .app-header { position: static; }
  .app-header-inner { min-height: 64px; }
  .brand small { display: none; }
  .privacy-badge { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .language-control > span { display: none; }
  .language-control select { min-width: 76px; }
  .app-header .button-ghost { width: 38px; padding: 0; font-size: 0; }
  .app-header .button-ghost svg { width: 18px; height: 18px; }
  .workflow li { min-height: 68px; gap: 8px; padding: 12px; }
  .workflow li.active::after { right: 10px; left: 10px; }
  .workflow small { display: none; }
  .panel, .import-panel { padding: 22px; }
  .import-panel::before { right: 22px; left: 22px; }
  .section-heading, .review-toolbar { align-items: flex-start; }
  .section-heading:not(.compact), .review-toolbar { flex-direction: column; }
  .section-heading:not(.compact) .button, .review-toolbar .button { width: 100%; }
  .sticky-heading { top: 72px; }
  .review-toolbar.sticky-heading { position: static; }
  #review-panel { scroll-margin-top: 12px; }
  .table-scroll-hint { display: block; }
  .guide-grid { grid-template-columns: minmax(0, 1fr); }
  .upload-grid, .import-identity-grid { grid-template-columns: minmax(0, 1fr); }
  .override-grid { grid-template-columns: minmax(0, 1fr); }
  .reference-panel { align-items: flex-start; flex-direction: column; }
  .reference-actions { width: 100%; min-width: 0; }
  .finding-buckets { grid-template-columns: minmax(0, 1fr); }
  .disposition-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .disposition-summary > div + div { border-left: 0; }
  .disposition-summary > div:nth-child(even) { border-left: 1px solid var(--rule); }
  .disposition-summary > div:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}

@media (max-width: 520px) {
  :root { --gutter: 12px; }
  .app-header-inner { gap: 10px; }
  .brand { gap: 8px; }
  .brand-mark { width: 30px; height: 30px; }
  .masthead-actions { gap: 4px; }
  .privacy-badge { display: none; }
  .language-control select { min-width: 70px; min-height: 32px; padding-top: 4px; padding-bottom: 4px; }
  .status-dot { width: 6px; height: 6px; }
  .intro { gap: 24px; padding: 42px 4px 32px; }
  h1 { margin-bottom: 16px; font-size: 42px; }
  .lede { font-size: 16px; }
  .privacy-note { padding: 16px; }
  .workflow { margin-bottom: 14px; }
  .workflow li { min-width: 0; justify-content: center; padding: 10px 6px; }
  .workflow li > div { min-width: 0; }
  .workflow li > span { width: 27px; height: 27px; }
  .workflow strong { font-size: 11px; }
  .panel, .import-panel { border-radius: var(--radius); padding: 18px; }
  .import-panel { margin-bottom: 28px; }
  .section-heading, .review-toolbar { gap: 16px; margin-bottom: 20px; }
  .heading-group { align-items: flex-start; gap: 10px; }
  .step { width: 29px; height: 29px; }
  h2 { font-size: 27px; }
  .dropzone { min-height: 0; padding: 22px 14px; }
  .dropzone input[type="file"] { width: 100%; }
  .identity-card { padding: 17px; }
  .details-content { padding: 14px; }
  .advanced-options > summary { align-items: flex-start; }
  .actions { align-items: stretch; flex-direction: column; }
  .actions .button { width: 100%; }
  .review-toolbar { padding: 14px; }
  .review-toolbar h2 { display: block; font-size: 24px; }
  .provider-context { margin: 5px 0 0; vertical-align: 0; }
  .totals-grid { grid-template-columns: minmax(0, 1fr); }
  .total-card, .total-card.primary { grid-column: auto; min-height: 96px; }
  .field-grid, .security-fields { grid-template-columns: minmax(0, 1fr); }
  .section-heading.compact { align-items: flex-start; flex-direction: column; gap: 10px; }
  .finding-head { flex-direction: column; gap: 3px; }
  .correction-subject { grid-template-columns: minmax(0, 1fr); }
  .inline-correction-control { grid-template-columns: minmax(0, 1fr); }
  .correction-verification { grid-template-columns: minmax(0, 1fr); }
  .final-review-facts { grid-template-columns: minmax(0, 1fr); }
  .generate-panel { gap: 20px; }
  .generate-actions .button { width: 100%; }
  footer { align-items: center; flex-direction: column; gap: 3px; padding-bottom: 28px; }
  footer span + span::before { content: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  .app-header, .workflow, #ibkr-import-panel, footer, .review-toolbar .button, .reference-actions { display: none !important; }
  body { background: var(--surface); }
  .shell { width: 100%; }
  .panel { break-inside: avoid; box-shadow: none; }
  .sticky-heading { position: static; }
  .table-scroll { overflow: visible; }
  table { min-width: 0; }
}
