:root {
  color-scheme: light;
  --page: #f3f5f3;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --surface-warm: #fbf7ed;
  --ink: #181b20;
  --muted: #59616b;
  --line: #d9dedb;
  --line-strong: #b7c0bd;
  --aubergine: #4a154b;
  --aubergine-soft: #f2e8f3;
  --teal: #087a78;
  --teal-soft: #e5f4f2;
  --blue: #215f9a;
  --blue-soft: #e8f1fa;
  --amber: #9a6508;
  --amber-soft: #fff3d3;
  --red: #a83232;
  --red-soft: #fbe9e9;
  --green: #17613b;
  --green-soft: #e7f3ec;
  --gray-soft: #edf0ee;
  --shadow: 0 10px 28px rgba(24, 27, 32, 0.07);
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
}

button,
textarea {
  font: inherit;
}

button,
a,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: var(--blue);
  text-underline-offset: 3px;
}

a:hover {
  color: #163f68;
}

h1,
h2,
h3,
p,
li,
td,
th,
dd,
dt,
span,
strong,
button,
textarea {
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 1.42rem;
  line-height: 1.18;
}

h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

h3 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.app-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1500px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  gap: 28px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid #c8b3ca;
  border-radius: 5px;
  background: var(--aubergine-soft);
  color: var(--aubergine);
}

.brand-mark svg,
.button-icon {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark svg {
  width: 21px;
  height: 21px;
  stroke-width: 2;
}

.eyebrow,
.section-kicker {
  margin: 0 0 3px;
  color: var(--teal);
  font-size: 0.71rem;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.source-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 1 640px;
  color: var(--muted);
  font-size: 0.73rem;
  text-align: right;
}

.source-block strong {
  color: var(--ink);
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 2px;
}

.scanner-band {
  border-bottom: 1px solid var(--line);
  background: var(--page);
}

.scanner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(430px, 0.92fr);
  width: min(1500px, calc(100% - 32px));
  min-height: min(650px, calc(100vh - 126px));
  margin: 0 auto;
  padding: 14px 0;
  gap: 14px;
}

.tool-pane {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.evidence-pane,
.summary-pane {
  display: flex;
  flex-direction: column;
}

.pane-heading,
.results-header,
.subsection-heading,
.surface-heading,
.copy-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.local-chip,
.status-chip,
.result-summary-chip,
#source-date-chip,
.flow-state,
.priority-chip,
.readiness-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--gray-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.2;
  white-space: normal;
}

.local-chip {
  border-color: #bdd6d4;
  background: var(--teal-soft);
  color: #075e5b;
}

.positioning {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcfb;
  color: var(--ink);
  resize: vertical;
}

#evidence-input {
  flex: 1 1 auto;
  min-height: 280px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.45;
}

#evidence-input:focus,
.artifact-output:focus {
  outline: 2px solid rgba(8, 122, 120, 0.28);
  outline-offset: 2px;
  border-color: var(--teal);
}

.input-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.73rem;
}

.input-message,
.result-status,
.copy-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.button:hover,
.tab-button:hover,
.artifact-button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.tab-button:focus-visible,
.artifact-button:focus-visible {
  outline: 2px solid rgba(8, 122, 120, 0.34);
  outline-offset: 2px;
}

.button-icon {
  width: 17px;
  height: 17px;
  margin-right: 7px;
  stroke-width: 2;
}

.primary-action {
  border-color: var(--aubergine);
  background: var(--aubergine);
  color: white;
}

.secondary-action {
  border-color: #b4d0ce;
  background: var(--teal-soft);
  color: #075e5b;
}

.ghost-action {
  background: var(--surface-soft);
}

.accepted-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.accepted-inputs span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.summary-band {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.summary-band.state-critical {
  border-left-color: var(--red);
  background: var(--red-soft);
}

.summary-band.state-high {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.summary-band.state-medium {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.summary-band.state-low {
  border-left-color: var(--green);
  background: var(--green-soft);
}

.summary-band.state-empty {
  border-left-color: var(--line-strong);
}

.metric-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.exposure-block strong,
.top-risk-block strong {
  display: block;
  font-size: 1.12rem;
  line-height: 1.25;
}

.confidence-line {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

.metric-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.metric-grid dt {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-grid dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 850;
}

.next-action {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-warm);
}

.next-action span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.next-action strong {
  display: block;
  margin-top: 3px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.surface-summary {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.surface-heading {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.compact-list,
.timeline-list,
.checklist,
.plan-list,
.missing-list {
  margin: 9px 0 0;
  padding-left: 18px;
}

.compact-list li,
.timeline-list li,
.checklist li,
.plan-list li,
.missing-list li {
  margin: 6px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.privacy-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 14px;
  gap: 8px;
}

.privacy-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.results-band {
  background: var(--surface);
}

.results-inner {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 22px;
}

.result-summary-chip {
  border-color: #c8b3ca;
  background: var(--aubergine-soft);
  color: var(--aubergine);
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  min-width: 104px;
  min-height: 38px;
  margin-bottom: -1px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
}

.tab-button.active {
  border-color: var(--line);
  border-bottom-color: var(--surface);
  background: var(--surface);
  color: var(--aubergine);
}

.tab-panel {
  padding-top: 16px;
}

.hidden {
  display: none;
}

.portfolio-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.portfolio-summary strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.portfolio-summary span {
  color: var(--muted);
  font-size: 0.82rem;
}

.table-wrap {
  width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  background: var(--surface);
}

.data-table th,
.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.8rem;
}

.data-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.empty-row td {
  color: var(--muted);
  font-style: italic;
}

.lifecycle-section,
.result-section,
.missing-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.split-panels {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
}

.checklist {
  padding-left: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.checklist li:last-child {
  border-bottom: 0;
}

.flow-state {
  min-width: 78px;
  border-radius: var(--radius);
}

.flow-state.complete,
.readiness-chip.ready,
.priority-chip.low {
  border-color: #b7d6c2;
  background: var(--green-soft);
  color: var(--green);
}

.flow-state.partial,
.readiness-chip.partial,
.priority-chip.medium {
  border-color: #c1d2e7;
  background: var(--blue-soft);
  color: var(--blue);
}

.flow-state.missing,
.readiness-chip.missing,
.priority-chip.high {
  border-color: #edd48f;
  background: var(--amber-soft);
  color: var(--amber);
}

.priority-chip.critical {
  border-color: #e5b2b2;
  background: var(--red-soft);
  color: var(--red);
}

.plan-list {
  padding-left: 0;
  list-style: none;
}

.plan-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.plan-list li:last-child {
  border-bottom: 0;
}

.plan-list strong,
.checklist strong {
  display: block;
  color: var(--ink);
  font-size: 0.86rem;
}

.plan-list span,
.checklist span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.owner-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.owner-cell {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.owner-cell span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.owner-cell strong {
  display: block;
  margin-top: 3px;
  font-size: 0.86rem;
}

.copy-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 16px;
}

.artifact-menu {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.artifact-button {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.artifact-button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: #075e5b;
}

.copy-output-section {
  min-width: 0;
}

.copy-action {
  min-width: 92px;
}

.artifact-output {
  min-height: 330px;
  margin-top: 12px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.claim-band {
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.claim-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0;
  gap: 18px;
}

.claim-inner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.status-critical {
  border-color: #e5b2b2;
  background: var(--red-soft);
  color: var(--red);
}

.status-high {
  border-color: #edd48f;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-medium {
  border-color: #c1d2e7;
  background: var(--blue-soft);
  color: var(--blue);
}

.status-low {
  border-color: #b7d6c2;
  background: var(--green-soft);
  color: var(--green);
}

.status-unknown {
  border-color: var(--line);
  background: var(--gray-soft);
  color: var(--muted);
}

@media (max-width: 1100px) {
  .scanner-grid,
  .split-panels,
  .claim-inner {
    grid-template-columns: 1fr;
  }

  .scanner-grid {
    min-height: 0;
  }

  #evidence-input {
    min-height: 260px;
  }
}

@media (max-width: 760px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
    padding: 13px 0;
    gap: 10px;
  }

  .source-block {
    align-items: flex-start;
    flex: 0 0 auto;
    width: 100%;
    text-align: left;
  }

  .source-links {
    justify-content: flex-start;
  }

  .scanner-grid,
  .results-inner,
  .privacy-strip,
  .claim-inner,
  .header-inner {
    width: min(100% - 20px, 1500px);
  }

  .tool-pane {
    padding: 13px;
  }

  .pane-heading,
  .results-header,
  .subsection-heading,
  .copy-header {
    flex-direction: column;
    gap: 8px;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

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

  .copy-layout,
  .owner-grid {
    grid-template-columns: 1fr;
  }

  .data-table {
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    display: block;
    border-bottom: 1px solid var(--line);
  }

  .data-table tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    display: grid;
    grid-template-columns: minmax(112px, 38%) minmax(0, 1fr);
    min-height: 38px;
    border-bottom: 1px solid #edf0ee;
  }

  .data-table td:last-child {
    border-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 850;
    text-transform: uppercase;
  }

  .empty-row td {
    display: block;
  }

  .empty-row td::before {
    content: "";
    display: none;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.18rem;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .tab-button {
    min-width: calc(50% - 4px);
    flex: 1 1 calc(50% - 4px);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }
}
