:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #65717e;
  --line: #dce2e7;
  --line-strong: #c7d0d8;
  --surface: #ffffff;
  --canvas: #f3f5f6;
  --accent: #087c68;
  --accent-dark: #075f51;
  --accent-soft: #e7f4f0;
  --warning: #a75e04;
  --warning-soft: #fff3dc;
  --danger: #a63838;
  --danger-soft: #fdeaea;
  --success: #176c4e;
  --success-soft: #e6f4ed;
  --shadow: 0 8px 28px rgba(29, 46, 61, 0.07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 320px; background: var(--canvas); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.app-header {
  background: #123e39;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.header-inner,
main,
footer {
  width: min(1420px, calc(100% - 48px));
  margin: 0 auto;
}

.header-inner {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.56);
  font-weight: 750;
  font-size: 20px;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-size: 16px; line-height: 1.2; }
.brand small { color: rgba(255, 255, 255, 0.68); font-size: 11px; margin-top: 2px; }

.header-meta { display: flex; align-items: center; gap: 22px; font-size: 12px; }
.environment { display: flex; align-items: center; gap: 8px; }
.environment > span { width: 7px; height: 7px; border-radius: 50%; background: #6de2b8; box-shadow: 0 0 0 4px rgba(109, 226, 184, 0.14); }
.policy-version { color: rgba(255, 255, 255, 0.65); }

main { padding: 34px 0 50px; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 750;
  font-size: 11px;
  letter-spacing: 0.08em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: 30px; line-height: 1.18; font-weight: 720; }
.page-heading > div > p:last-child { margin: 0; color: var(--muted); max-width: 760px; }

.privacy-note {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.privacy-note .shield {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid #b9d6cf;
  background: var(--accent-soft);
}

.privacy-note strong, .privacy-note small { display: block; }
.privacy-note strong { color: var(--ink); font-size: 12px; }
.privacy-note small { font-size: 11px; }

.tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 20px;
}

.tab {
  appearance: none;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 1px 12px;
  font-weight: 650;
}

.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.sample-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.sample-strip > span { color: var(--muted); font-size: 12px; font-weight: 650; }
.segmented { display: flex; border: 1px solid var(--line-strong); background: var(--surface); }
.segmented button { border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); padding: 7px 13px; font-size: 12px; }
.segmented button:last-child { border-right: 0; }
.segmented button:hover { background: #f6f8f9; color: var(--ink); }
.segmented button.selected { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(390px, 0.88fr) minmax(540px, 1.12fr);
  gap: 16px;
  align-items: start;
}

.input-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 0;
}

.input-panel { padding: 22px; }
.result-panel { min-height: 715px; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.result-heading { padding: 22px 24px 19px; margin: 0; border-bottom: 1px solid var(--line); }
.panel-heading > div { display: flex; align-items: center; gap: 10px; }
.panel-heading h2 { margin: 0; font-size: 16px; line-height: 1.3; }

.step-number {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.upload-button,
.output-actions button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 650;
}

.upload-button:hover,
.output-actions button:hover { background: #f5f7f8; }

.field-label,
.form-grid label > span {
  display: block;
  color: #35414c;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fbfcfc;
  color: var(--ink);
  outline: none;
}

textarea:focus,
input:focus,
select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 124, 104, 0.09); }

textarea { min-height: 205px; resize: vertical; padding: 13px; line-height: 1.55; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
input, select { height: 39px; padding: 0 10px; }
select { appearance: auto; }
.field-help { color: var(--muted); font-size: 11px; margin: 7px 0 0; }

.section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.controls-grid { row-gap: 12px; }

.primary-action {
  width: 100%;
  min-height: 46px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  border: 0;
  background: var(--accent);
  color: white;
  font-weight: 750;
}

.primary-action:hover { background: var(--accent-dark); }
.primary-action:disabled { cursor: wait; opacity: 0.75; }
.button-arrow { font-size: 19px; }
.input-error { color: var(--danger); margin: 9px 0 0; font-size: 12px; }
.run-time { font-size: 11px; color: var(--muted); }

.empty-state {
  min-height: 600px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.empty-icon { font-size: 42px; color: #90a099; margin-bottom: 10px; }
.empty-state h3 { color: var(--ink); font-size: 16px; margin-bottom: 7px; }
.empty-state p { max-width: 330px; margin-bottom: 0; font-size: 13px; }

.processing-state { padding: 44px 32px; }
.progress-line { height: 3px; background: #e8edef; overflow: hidden; margin-bottom: 26px; }
.progress-line span { display: block; width: 42%; height: 100%; background: var(--accent); animation: progress 1.2s ease-in-out infinite; }
@keyframes progress { from { transform: translateX(-110%); } to { transform: translateX(250%); } }
.processing-state ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.processing-state li { display: flex; align-items: center; gap: 10px; color: #96a0aa; }
.processing-state li span { width: 8px; height: 8px; border-radius: 50%; background: #d3dadd; }
.processing-state li.current { color: var(--ink); font-weight: 650; }
.processing-state li.current span { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.processing-state li.complete { color: var(--success); }
.processing-state li.complete span { background: var(--success); }

#result-content { padding: 20px 24px 22px; }
.decision-banner {
  min-height: 82px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 15px 17px;
  border-left: 4px solid var(--warning);
  background: var(--warning-soft);
}

.decision-banner.success { border-color: var(--success); background: var(--success-soft); }
.decision-banner.danger { border-color: var(--danger); background: var(--danger-soft); }
.decision-banner span, .decision-banner strong { display: block; }
#decision-kicker { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
#decision-label { font-size: 20px; line-height: 1.2; }
.decision-code { border: 1px solid currentColor; padding: 5px 8px; font-size: 10px; font-weight: 800; white-space: nowrap; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-top: 0; }
.metrics div { padding: 15px 16px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span, .metrics strong { display: block; }
.metrics span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.metrics strong { font-size: 16px; }

.result-section { margin-top: 22px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 9px; }
.section-title-row h3 { margin: 0; font-size: 13px; }
.section-title-row > span { color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { text-align: left; color: var(--muted); background: #f6f8f9; font-weight: 700; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td:nth-child(1) { width: 24%; font-weight: 650; }
td:nth-child(2) { width: 15%; }
.check-badge { display: inline-block; min-width: 55px; padding: 2px 5px; text-align: center; font-size: 9px; font-weight: 800; }
.check-badge.pass { color: var(--success); background: var(--success-soft); }
.check-badge.fail { color: var(--danger); background: var(--danger-soft); }
.check-badge.unknown { color: var(--warning); background: var(--warning-soft); }
.review-note { margin: 0; padding: 11px 13px; background: #f6f8f9; border-left: 3px solid var(--line-strong); font-size: 12px; }
.output-actions { display: flex; gap: 6px; }
pre { margin: 0; max-height: 310px; overflow: auto; padding: 14px; background: #17232b; color: #dcebe6; font: 11px/1.55 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.audit-footer { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding-top: 16px; margin-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.audit-footer strong { color: var(--ink); }

.workflow-panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.workflow-heading { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 30px; border-bottom: 1px solid var(--line); }
.workflow-heading h2 { margin: 0; font-size: 24px; }
.workflow-heading > p { margin: 0; color: var(--muted); align-self: end; }
.flow-band { display: grid; grid-template-columns: repeat(4, 1fr auto) 1fr; align-items: stretch; background: #eef3f2; border-bottom: 1px solid var(--line); }
.flow-band div { padding: 22px 16px; min-width: 0; }
.flow-band span, .flow-band strong, .flow-band small { display: block; }
.flow-band span { color: var(--accent); font-size: 10px; font-weight: 800; margin-bottom: 9px; }
.flow-band strong { font-size: 14px; }
.flow-band small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.flow-band i { align-self: center; color: #8da09a; font-style: normal; }
.workflow-columns { display: grid; grid-template-columns: 1fr 1fr; }
.workflow-columns > section { padding: 30px; }
.workflow-columns > section:first-child { border-right: 1px solid var(--line); }
.workflow-columns h3 { font-size: 15px; margin-bottom: 18px; }
.policy-list { list-style: none; counter-reset: rules; margin: 0; padding: 0; display: grid; gap: 13px; }
.policy-list li { counter-increment: rules; position: relative; padding-left: 38px; }
.policy-list li::before { content: counter(rules); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; display: grid; place-items: center; background: var(--canvas); border: 1px solid var(--line); font-size: 10px; font-weight: 800; }
.policy-list strong, .policy-list span { display: block; }
.policy-list strong { font-size: 12px; }
.policy-list span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.safeguard-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.safeguard-list li { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.safeguard-list span { width: 20px; height: 20px; display: grid; place-items: center; color: var(--success); background: var(--success-soft); font-size: 10px; }
.success-band { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); background: #fbfcfc; }
.success-band div { padding: 20px 30px; border-right: 1px solid var(--line); }
.success-band div:last-child { border-right: 0; }
.success-band span, .success-band strong, .success-band small { display: block; }
.success-band span { color: var(--muted); font-size: 10px; text-transform: uppercase; font-weight: 750; letter-spacing: 0.05em; }
.success-band strong { font-size: 20px; margin: 4px 0 1px; }
.success-band small { color: var(--muted); font-size: 10px; }

footer { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; padding: 0 0 24px; }

@media (max-width: 980px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .result-panel { min-height: 0; }
  .empty-state { min-height: 400px; }
  .flow-band { grid-template-columns: 1fr; }
  .flow-band i { display: none; }
  .flow-band div { border-bottom: 1px solid var(--line); }
}

@media (max-width: 680px) {
  .header-inner, main, footer { width: min(100% - 28px, 1420px); }
  .header-meta .policy-version { display: none; }
  main { padding-top: 24px; }
  .page-heading { display: block; }
  .privacy-note { margin-top: 16px; }
  h1 { font-size: 25px; }
  .sample-strip { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: 1 0 auto; }
  .input-panel, #result-content { padding: 17px; }
  .result-heading { padding: 17px; }
  .form-grid, .metrics, .workflow-heading, .workflow-columns, .success-band { grid-template-columns: 1fr; }
  .metrics div { border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics div:last-child { border-bottom: 0; }
  .workflow-heading { gap: 16px; padding: 22px; }
  .workflow-columns > section { padding: 22px; }
  .workflow-columns > section:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .success-band div { border-right: 0; border-bottom: 1px solid var(--line); }
  .success-band div:last-child { border-bottom: 0; }
  footer { gap: 12px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; }
}
