@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #102033;
  --muted: #64748b;
  --navy: #0f2742;
  --navy-2: #163a5c;
  --accent: #0f766e;
  --accent-soft: #e6f5f3;
  --blue-soft: #eef5ff;
  --warning: #b7791f;
  --warning-bg: #fff7e6;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --danger-border: #ffccc7;
  --success: #027a48;
  --success-bg: #ecfdf3;
  --success-border: #b7ebc6;
  --warning-border: #ffd591;
  --shadow: 0 24px 70px rgba(15, 39, 66, .12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --focus: 0 0 0 4px rgba(15, 118, 110, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

a { color: inherit; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-logo {
  display: block;
  width: 168px;
  height: auto;
  object-fit: contain;
}
.brand strong { display: block; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); margin-top: 2px; }
.header-nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.status-chip, .version-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.status-chip.secure { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.version-chip { background: var(--navy); color: white; border-color: var(--navy); }

.wizard-wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0 80px;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 40px;
  align-items: center;
  margin-bottom: 40px;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 560px;
  margin-bottom: 16px;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.15;
  letter-spacing: -.015em;
  font-weight: 700;
  color: var(--navy);
}
.lead {
  max-width: 520px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 22px;
}
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 650;
}

.hero-methods {
  display: grid;
  gap: 10px;
}
.method-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(15, 39, 66, .05);
}
.method-tag {
  flex: 0 0 auto;
  min-width: 92px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}
.method-preview {
  margin: 0;
  font-size: 13.5px;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.method-preview b {
  font-weight: 700;
  background: var(--accent-soft);
  padding: 1px 4px;
  border-radius: 4px;
}
.method-preview .cover {
  display: inline-block;
  background: var(--navy);
  border-radius: 3px;
  vertical-align: middle;
}

.wizard-card {
  border-radius: 32px;
  border: 1px solid rgba(203, 213, 225, .9);
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, .92);
}
.step {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}
.step span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px;
}
.step.active {
  background: var(--navy);
  color: white;
  box-shadow: 0 14px 32px rgba(15, 39, 66, .16);
}
.step.active span { background: white; color: var(--navy); border-color: white; }
.step.done span { background: var(--success-bg); color: var(--success); border-color: #9ee2b0; }

.wizard-step {
  display: none;
  padding: clamp(24px, 4vw, 48px);
}
.wizard-step.active { display: block; animation: fadeUp .28s ease-out; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.step-heading { max-width: 700px; margin-bottom: 26px; }
.step-heading.compact { margin-bottom: 22px; }
.step-heading h2 {
  margin-bottom: 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.06;
  letter-spacing: -.04em;
  color: var(--navy);
}
.step-heading p { color: var(--muted); line-height: 1.65; font-size: 16px; margin-bottom: 0; }

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 290px;
  padding: 34px;
  text-align: center;
  border: 1.5px dashed #9fb7cf;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(248, 250, 252, .75), rgba(255, 255, 255, .95)),
    radial-gradient(circle at center, rgba(15, 118, 110, .08), transparent 55%);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--accent);
  box-shadow: 0 20px 42px rgba(15, 118, 110, .10);
  transform: translateY(-1px);
}
.upload-zone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-icon {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--navy);
  color: white;
  font-size: 32px;
  margin-bottom: 18px;
}
.upload-zone strong { display: block; font-size: 22px; color: var(--navy); margin-bottom: 8px; }
.upload-zone small { color: var(--muted); line-height: 1.5; }
.assurance-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 20px;
}
.assurance-row article {
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.assurance-row strong { display: block; color: var(--navy); margin-bottom: 6px; }
.assurance-row span { color: var(--muted); font-size: 14px; line-height: 1.45; }

.purpose-list {
  display: grid;
  gap: 10px;
}
.purpose-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px 16px 44px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  transition: border-color .15s ease, background .15s ease;
}
.purpose-row::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  background: var(--surface);
}
.purpose-row:hover { border-color: var(--line-strong); }
.purpose-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.purpose-row.active::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface);
}
.purpose-row-text { display: flex; flex-direction: column; gap: 4px; }
.purpose-row strong { font-size: 16px; letter-spacing: -.01em; color: var(--navy); }
.purpose-row p { margin: 0; color: var(--muted); line-height: 1.45; font-size: 13.5px; }
.purpose-row small {
  flex: 0 0 auto;
  color: var(--accent);
  font-weight: 700;
  font-size: 12.5px;
  white-space: nowrap;
}

.style-choice-panel { margin-top: 22px; }
.style-choice-title { display: block; margin-bottom: 12px; font-weight: 800; color: var(--navy); }
.style-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.style-card {
  text-align: left;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: .2s ease;
}
.style-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(15, 39, 66, .08); }
.style-card.active {
  border-color: rgba(15, 118, 110, .55);
  background: linear-gradient(180deg, #ffffff 0%, #f1fbf9 100%);
  box-shadow: 0 16px 34px rgba(15, 118, 110, .12);
}
.style-card strong { display: block; font-size: 16px; color: var(--navy); margin-bottom: 6px; }
.style-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.style-choice-note { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.preset-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 20px;
  background: var(--navy);
  color: white;
}
.preset-summary div { padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, .08); }
.preset-summary span { display: block; font-size: 12px; color: rgba(255,255,255,.66); margin-bottom: 5px; }
.preset-summary strong { display: block; font-size: 15px; }

.step-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}
.step-actions.split { justify-content: space-between; }
.primary, .secondary, .ghost {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 0 22px;
  font-weight: 800;
}
.primary {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: white;
  box-shadow: 0 16px 30px rgba(15, 39, 66, .22);
}
.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 18px 34px rgba(15, 39, 66, .26); }
.secondary { background: var(--accent-soft); color: var(--accent); }
.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line-strong); }
.ghost.small { min-height: 40px; padding: 0 14px; font-size: 14px; }

.inline-error {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 16px;
}

.redacted-sample {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-weight: 700;
  letter-spacing: .04em;
}

.processing-state {
  min-height: 420px;
  display: grid;
  place-items: center;
  text-align: center;
  align-content: center;
  gap: 14px;
}
.spinner {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-state h2 { margin-bottom: 0; color: var(--navy); }
.processing-state p { color: var(--muted); }

.result-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.result-head h2 { font-size: clamp(28px, 4vw, 42px); line-height: 1.06; letter-spacing: -.04em; color: var(--navy); margin-bottom: 8px; }
.result-head p { color: var(--muted); line-height: 1.55; margin: 0; }
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.stat span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat strong { display: block; color: var(--navy); font-size: 28px; letter-spacing: -.04em; }
.warning-box {
  padding: 16px 18px;
  border: 1px solid #ffd591;
  border-radius: 18px;
  background: var(--warning-bg);
  color: #704200;
  margin-bottom: 18px;
}
.warning-box strong { display: block; margin-bottom: 8px; }
.warning-box p { margin: 0; line-height: 1.5; }
.warning-box p + p { margin-top: 8px; }

.review-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.review-side {
  position: sticky;
  top: 104px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}
.review-side h3 { margin-bottom: 14px; color: var(--navy); }
.entity-list { display: grid; gap: 10px; }
.entity-row {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
}
.entity-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  margin-top: 6px;
  flex: 0 0 auto;
}
.entity-row strong { display: block; color: var(--navy); font-size: 14px; }
.entity-row span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.empty {
  color: var(--muted);
  padding: 14px;
  background: white;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.document-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #eef2f7;
  padding: clamp(14px, 2vw, 24px);
  min-width: 0;
}
.visual-preview { display: grid; gap: 22px; }
.page-review {
  border-radius: 20px;
  background: white;
  border: 1px solid var(--line);
  padding: 16px;
}
.page-review header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}
.page-review h3 { margin-bottom: 4px; color: var(--navy); }
.page-review header p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.page-review header span {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.page-canvas {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: white;
  box-shadow: 0 12px 30px rgba(15, 39, 66, .10);
}
.page-canvas img { display: block; width: 100%; height: auto; }
.empty-card {
  padding: 28px;
  border-radius: 16px;
  background: white;
  border: 1px solid var(--line);
  color: var(--muted);
}
.text-preview {
  padding: 20px;
  background: white;
  border-radius: 18px;
  border: 1px solid var(--line);
  line-height: 1.65;
}

.overlay-box {
  position: absolute;
  border: 2px solid color-mix(in srgb, var(--box-color, #0f766e) 75%, white);
  background: color-mix(in srgb, var(--box-color, #0f766e) 18%, transparent);
  border-radius: 5px;
}
.modal-dialog {
  width: min(1040px, calc(100vw - 28px));
  max-height: 86vh;
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 28px;
  box-shadow: 0 30px 90px rgba(15, 39, 66, .30);
}
.modal-dialog::backdrop { background: rgba(15, 39, 66, .68); }
.modal-dialog h2 { color: var(--navy); margin-bottom: 8px; }
.modal-dialog p { color: var(--muted); line-height: 1.55; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--navy);
  font-size: 24px;
}
.detection-only { max-height: 65vh; overflow: auto; padding-right: 4px; }

.decision-card {
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  margin-bottom: 18px;
}
.decision-card strong { display: block; color: var(--navy); font-size: 24px; letter-spacing: -.02em; margin-bottom: 6px; }
.decision-card span { color: var(--muted); line-height: 1.55; }
.decision-card.ok { background: var(--success-bg); border-color: var(--success-border); }
.decision-card.review { background: var(--warning-bg); border-color: var(--warning-border); }
.decision-card.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.decision-card.ok strong { color: var(--success); }
.decision-card.review strong { color: #915f00; }
.decision-card.danger strong { color: var(--danger); }
.human-review-note {
  padding: 20px;
  border-radius: 20px;
  background: var(--navy);
  color: white;
  margin-bottom: 18px;
}
.human-review-note strong { display: block; margin-bottom: 8px; }
.human-review-note p { margin: 0; color: rgba(255,255,255,.78); line-height: 1.55; }

.download-hero {
  text-align: center;
  padding: 20px 0 8px;
}
.success-mark {
  display: inline-grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border-radius: 24px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 38px;
  font-weight: 900;
  margin-bottom: 16px;
}
.download-hero h2 { font-size: clamp(32px, 4vw, 48px); color: var(--navy); letter-spacing: -.04em; margin-bottom: 8px; }
.download-hero p { color: var(--muted); font-size: 17px; }
.download-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}
.download-card {
  display: block;
  min-height: 160px;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: white;
  text-decoration: none;
  transition: .2s ease;
}
.download-card:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(15, 39, 66, .10); }
.download-card strong { display: block; color: var(--navy); font-size: 20px; letter-spacing: -.02em; margin-bottom: 10px; }
.download-card span { display: block; color: var(--muted); line-height: 1.5; }
.primary-download { background: linear-gradient(135deg, var(--navy), var(--accent)); border-color: transparent; }
.primary-download strong, .primary-download span { color: white; }
.primary-download span { opacity: .78; }
.final-actions { display: flex; justify-content: center; gap: 12px; margin-top: 24px; }

/* Multi-document upload: files picked in step 1, before anything is sent. */
.selected-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.selected-files.hidden { display: none; }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  font-size: 13.5px;
  color: var(--navy);
  max-width: min(100%, 320px);
}
/* min-width:0 is required for a flex child to ever shrink past its content's natural
   width - without it the ellipsis rule below never actually triggers and a long
   filename just overflows the pill instead of truncating. */
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-chip-remove {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.file-chip-remove:hover { background: var(--danger-bg); color: var(--danger); }
.upload-note {
  flex: 1 0 100%;
  margin: 4px 0 0;
  color: var(--warning);
  font-size: 13px;
}

/* Batch review: the document list that replaces the single-document spinner. */
.batch-panel {
  margin-bottom: 22px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}
.batch-panel.hidden, .batch-summary.hidden, .batch-downloads.hidden { display: none; }
.batch-panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.batch-panel-head h3 { margin: 0 0 4px; color: var(--navy); }
.batch-panel-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.batch-progress { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.batch-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.batch-item {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease;
  /* Grid/flex items default to min-width:auto, which refuses to shrink below the
     content's natural (unwrapped) width - without this, a long filename never actually
     hits the ellipsis rule below and instead overflows the card, overlapping whatever
     sits next to or after it. Needed at every nesting level the constraint passes through. */
  min-width: 0;
}
.batch-item:disabled { cursor: default; opacity: .72; }
.batch-item:not(:disabled):hover { border-color: var(--accent); }
.batch-item.active { border-color: var(--accent); box-shadow: var(--focus); }
.batch-item-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; min-width: 0; }
.batch-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
}
.batch-item-error { color: var(--danger); font-size: 12px; line-height: 1.4; }
.batch-chip {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}
.batch-chip.ok { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.batch-chip.review { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.batch-chip.danger, .batch-chip.error { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.batch-chip.processing { color: var(--accent); background: var(--accent-soft); border-color: #b7e2dd; }

/* Batch validation summary (step 4). */
.batch-summary {
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: white;
}
.batch-summary h3 { margin: 0 0 14px; color: var(--navy); }
.batch-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.batch-summary-grid article {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}
.batch-summary-grid span { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.batch-summary-grid strong { color: var(--navy); font-size: 22px; }
.batch-summary-note { margin: 12px 0 0; color: var(--warning); font-size: 13.5px; }

/* Batch downloads (step 5): one compact row per document, plus the whole-batch ZIP. */
.batch-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: center;
  margin-top: 28px;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}
.batch-download-actions.hidden { display: none; }
.batch-zip-hint { color: var(--muted); font-size: 13.5px; }
.batch-downloads { display: grid; gap: 10px; margin-top: 16px; }
.batch-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
}
.batch-download-row strong {
  color: var(--navy);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-download-links { display: flex; gap: 8px; flex-wrap: wrap; }
.batch-download-link {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: .18s ease;
}
.batch-download-link:hover { border-color: var(--accent); color: var(--accent); }
.batch-download-link.primary {
  background: var(--navy);
  border-color: transparent;
  color: white;
}
.batch-download-link.primary:hover { background: var(--accent); color: white; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .assurance-row, .preset-summary, .kpi-row, .validation-grid, .download-grid { grid-template-columns: 1fr; }
  .review-layout { grid-template-columns: 1fr; }
  .review-side { position: static; }
  .style-choice-grid { grid-template-columns: 1fr; }
  .batch-summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .batch-list, .batch-summary-grid { grid-template-columns: 1fr; }
  .batch-download-row { flex-direction: column; align-items: stretch; }
  .app-header { align-items: flex-start; flex-direction: column; }
  .wizard-wrap { width: min(100% - 20px, 1180px); padding-top: 28px; }
  h1 { font-size: 28px; }
  .stepper { grid-template-columns: 1fr; gap: 8px; }
  .step { justify-content: flex-start; padding-left: 12px; }
  .wizard-step { padding: 22px; }
  .purpose-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .step-actions, .step-actions.split, .final-actions { flex-direction: column-reverse; align-items: stretch; }
  .result-head { flex-direction: column; }
}

.ai-validation {
  margin: 16px 0 18px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 39, 66, .06);
}
.ai-validation.hidden { display: none; }
.ai-validation.ok { border-color: var(--success-border); background: linear-gradient(180deg, #ffffff, #f6fffa); }
.ai-validation.review { border-color: var(--warning-border); background: linear-gradient(180deg, #ffffff, #fffaf0); }
.ai-validation.offline { border-color: #d6dde8; background: linear-gradient(180deg, #ffffff, #f8fafc); }
.ai-validation.final { margin-bottom: 18px; }
.ai-topline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
}
.ai-badge.ok { color: var(--success); background: var(--success-bg); }
.ai-badge.review { color: #915f00; background: var(--warning-bg); }
.ai-badge.offline { color: var(--muted); background: var(--surface-soft); }
.ai-model { color: var(--muted); font-size: 13px; }
.ai-validation strong { display: block; color: var(--navy); font-size: 17px; margin-bottom: 6px; }
.ai-validation p { margin: 0; color: var(--muted); line-height: 1.55; }
.ai-list { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-list span { color: var(--navy); font-size: 13px; font-weight: 800; margin-right: 2px; }
.ai-list em {
  font-style: normal;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 9px;
  font-size: 12px;
}
.ai-list.issues em { background: var(--warning-bg); border-color: var(--warning-border); color: #7a4f00; }
.field-note{
  display:block;
  margin-top:.45rem;
  color:#667085;
  font-size:.78rem;
  line-height:1.35;
}

/* Keyboard focus: every interactive control gets a visible ring built from --focus.
   Native outline is suppressed only once a custom ring is guaranteed to render. */
a:focus-visible,
button:focus-visible,
.primary:focus-visible,
.secondary:focus-visible,
.ghost:focus-visible,
.step:focus-visible,
.purpose-row:focus-visible,
.style-card:focus-visible,
.download-card:focus-visible,
.modal-close:focus-visible,
.upload-zone:focus-within {
  outline: none;
  box-shadow: var(--focus);
}
.purpose-row:focus-visible,
.style-card:focus-visible {
  box-shadow: var(--focus), 0 16px 34px rgba(15, 39, 66, .09);
}
