:root {
  color-scheme: light;
  --page: #f2f4ef;
  --surface: #ffffff;
  --surface-soft: #f8faf6;
  --surface-tint: #edf6f2;
  --ink: #18201b;
  --muted: #607067;
  --line: #d9dfd8;
  --line-strong: #b8c3bc;
  --green: #16613f;
  --green-strong: #0f422c;
  --green-soft: #e3f2eb;
  --teal: #0d6670;
  --teal-soft: #e2f3f5;
  --amber: #9a6416;
  --amber-soft: #fff0d3;
  --red: #a33636;
  --red-soft: #f8e5e4;
  --violet: #584b89;
  --violet-soft: #ece9f7;
  --gray-soft: #eef1ed;
  --shadow: 0 18px 34px rgba(24, 32, 27, 0.08);
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  background:
    linear-gradient(90deg, rgba(22, 97, 63, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(13, 102, 112, 0.04) 1px, transparent 1px),
    var(--page);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: Aptos, "IBM Plex Sans", "Helvetica Neue", ui-sans-serif, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

a {
  color: var(--teal);
  font-weight: 720;
  text-underline-offset: 3px;
}

a:hover {
  color: #083f45;
}

code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--gray-soft);
  color: #28352f;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

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

h1 {
  margin: 0;
  max-width: 930px;
  font-size: clamp(1.2rem, 2vw, 1.74rem);
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.32;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.34;
  letter-spacing: 0;
}

.app-shell {
  width: min(1520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 34px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 78px;
  padding: 0 2px 14px;
  border-bottom: 1px solid var(--line);
}

.title-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
}

.positioning {
  margin: 6px 0 0;
  max-width: 940px;
  color: var(--muted);
  font-size: 0.84rem;
}

.source-note {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 0 1 510px;
  color: var(--muted);
  font-size: 0.74rem;
  text-align: right;
}

.source-date {
  color: var(--ink);
  font-weight: 760;
}

.scanner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(410px, 0.94fr);
  gap: 14px;
  min-height: min(680px, calc(100vh - 126px));
  padding: 14px 0;
}

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

.evidence-panel,
.summary-panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

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

.local-badge,
.status-chip,
.result-status,
.work-heading span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 720;
  line-height: 1.2;
  text-align: center;
}

.field-label {
  margin: 16px 0 7px;
  color: #35433c;
  font-size: 0.78rem;
  font-weight: 720;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 340px);
  margin: 14px 0 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.mode-switch legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.mode-switch label {
  min-width: 0;
}

.mode-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-switch span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.mode-switch input:checked + span {
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 16px rgba(22, 97, 63, 0.17);
}

textarea {
  width: 100%;
  min-height: 342px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fbfcfa;
  color: #17221c;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.48;
}

#evidence-input {
  flex: 1;
  padding: 13px;
}

textarea:focus {
  outline: 3px solid rgba(13, 102, 112, 0.18);
  border-color: var(--teal);
}

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

.input-message {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 11px;
}

.primary-action,
.secondary-action,
.ghost-action,
.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 790;
  line-height: 1.15;
  cursor: pointer;
}

.primary-action {
  background: var(--green);
  color: #fff;
}

.secondary-action {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
}

.ghost-action,
.copy-button {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.primary-action:hover,
.secondary-action:hover,
.ghost-action:hover,
.copy-button:hover {
  transform: translateY(-1px);
}

.button-glyph {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 900;
}

.secondary-action .button-glyph,
.ghost-action .button-glyph {
  background: var(--gray-soft);
}

.summary-panel {
  gap: 14px;
}

.score-band {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(230px, 1.1fr);
  gap: 16px;
  min-height: 128px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: var(--radius);
  background: var(--surface-tint);
}

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

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

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

.score-band.state-empty {
  border-left-color: var(--line-strong);
  background: var(--surface-soft);
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  text-transform: uppercase;
}

.score-value {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.6rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.score-facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.score-facts div {
  min-width: 0;
}

.score-facts dt,
.metric-grid dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  text-transform: uppercase;
}

.score-facts dd,
.metric-grid dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-weight: 800;
}

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

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

.metric-grid dd {
  font-size: 1.2rem;
  line-height: 1.2;
}

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

.deadline-strip div,
.next-action {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
  padding: 11px;
}

.deadline-strip span,
.next-action span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  text-transform: uppercase;
}

.deadline-strip strong,
.next-action strong {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  line-height: 1.32;
}

.risk-note {
  margin: auto 0 0;
  padding-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.status-critical,
.badge-critical {
  border-color: rgba(163, 54, 54, 0.35);
  background: var(--red-soft);
  color: var(--red);
}

.status-warning,
.badge-warning {
  border-color: rgba(154, 100, 22, 0.35);
  background: var(--amber-soft);
  color: var(--amber);
}

.status-good,
.badge-good {
  border-color: rgba(22, 97, 63, 0.3);
  background: var(--green-soft);
  color: var(--green);
}

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

.status-vendor,
.badge-vendor {
  border-color: rgba(88, 75, 137, 0.35);
  background: var(--violet-soft);
  color: var(--violet);
}

.privacy-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.privacy-strip span {
  min-height: 40px;
  padding: 10px 12px;
  background: var(--surface);
  color: #32443a;
  font-size: 0.76rem;
  font-weight: 720;
}

.results-section {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.tab-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 15px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.tab-button {
  flex: 0 0 auto;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.15;
  cursor: pointer;
}

.tab-button.is-active {
  background: var(--ink);
  color: #fff;
}

.tab-panel {
  margin-top: 14px;
}

.is-hidden {
  display: none;
}

.work-section,
.copy-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.matrix-layout,
.flag-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.flag-layout .work-section:last-child {
  grid-column: 1 / -1;
}

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

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.78rem;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: #34433b;
  font-size: 0.7rem;
  font-weight: 820;
  text-transform: uppercase;
}

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

.empty-row td,
.empty-copy {
  color: var(--muted);
  font-size: 0.8rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
}

.matrix-grid,
.upgrade-grid,
.band-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.matrix-item,
.upgrade-item,
.band-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px;
}

.matrix-item strong,
.upgrade-item strong,
.band-item strong {
  display: block;
  font-size: 0.86rem;
  line-height: 1.3;
}

.matrix-item span,
.upgrade-item span,
.band-item span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
}

.work-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.work-list li {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: #2c3b34;
  font-size: 0.79rem;
}

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

.copy-panel textarea {
  min-height: 210px;
  margin-top: 10px;
  padding: 11px;
}

.copy-footnote {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

@media (max-width: 1080px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-note {
    align-items: flex-start;
    flex: 0 1 auto;
    text-align: left;
  }

  .scanner-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .summary-panel {
    min-height: auto;
  }

  .score-band,
  .deadline-strip,
  .privacy-strip,
  .matrix-layout,
  .flag-layout,
  .copy-grid {
    grid-template-columns: 1fr;
  }

  .flag-layout .work-section:last-child {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1520px);
    padding-top: 10px;
  }

  .app-header {
    gap: 10px;
    min-height: 0;
    padding-bottom: 11px;
  }

  .evidence-panel,
  .summary-panel,
  .results-section {
    padding: 13px;
  }

  textarea {
    min-height: 260px;
    font-size: 0.78rem;
  }

  .panel-heading,
  .results-header,
  .work-heading,
  .copy-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .input-meta,
  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-action,
  .secondary-action,
  .ghost-action {
    width: 100%;
  }

  .score-band,
  .metric-grid,
  .matrix-grid,
  .upgrade-grid,
  .band-stack {
    grid-template-columns: 1fr;
  }

  .privacy-strip span {
    min-height: 34px;
  }

  .tab-bar {
    border-radius: var(--radius);
  }

  .tab-button {
    min-width: 118px;
  }
}
