:root {
  --ink: #0d1b2a;
  --ink-soft: #43536a;
  --paper: #f4f7f8;
  --paper-deep: #e7edf0;
  --line: #c7d2d9;
  --line-strong: #8ea2af;
  --blue: #0067c5;
  --blue-deep: #003b73;
  --blue-pale: #dceeff;
  --cyan: #00a4d6;
  --orange: #d85a13;
  --orange-pale: #fff0e4;
  --red: #b42318;
  --red-pale: #fff0ee;
  --green: #167a55;
  --green-pale: #e2f6ed;
  --white: #ffffff;
  --shadow: 0 18px 45px rgb(12 35 57 / 0.12);
  --display: "Avenir Next Condensed", "DIN Alternate", "Franklin Gothic Condensed", sans-serif;
  --body: "Avenir Next", "Gill Sans", "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(0 103 197 / 0.035) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(rgb(0 103 197 / 0.035) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--paper);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  min-width: 320px;
}

button,
textarea,
input {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible + span {
  outline: 3px solid rgb(0 164 214 / 0.42);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 62px;
  padding: 8px clamp(16px, 3vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--white);
  background:
    linear-gradient(90deg, rgb(255 255 255 / 0.045) 1px, transparent 1px) 0 0 / 32px 32px,
    #081a2d;
  border-bottom: 3px solid var(--cyan);
  box-shadow: 0 8px 30px rgb(4 22 40 / 0.2);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 7px;
  border: 1px solid rgb(255 255 255 / 0.35);
  background: rgb(255 255 255 / 0.06);
  transform: rotate(-4deg);
}

.brand-mark i {
  display: block;
  background: var(--cyan);
}

.brand-mark i:nth-child(2) {
  transform: translateY(4px);
  background: var(--white);
}

.brand-mark i:nth-child(3) {
  transform: translateY(8px);
  background: #ff8f3d;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-copy strong {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.02em;
}

.brand-copy small {
  margin-top: 4px;
  color: #a9c5dc;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.status-key {
  color: #93b9d6;
}

.status-value {
  padding: 6px 9px;
  color: #dff8f1;
  background: rgb(22 122 85 / 0.28);
  border: 1px solid rgb(99 220 173 / 0.35);
}

main {
  width: min(1880px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 2.5vw, 40px);
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.55fr);
  border: 1px solid var(--line-strong);
  background: var(--white);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tool-workspace {
  position: relative;
  padding: clamp(20px, 2.8vw, 40px);
  isolation: isolate;
}

.tool-workspace::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(135deg, rgb(0 103 197 / 0.06), transparent 32%),
    repeating-linear-gradient(90deg, transparent 0 95px, rgb(13 27 42 / 0.035) 95px 96px);
  pointer-events: none;
}

.tool-heading,
.results-heading,
.panel-intro,
.handoff-heading,
.rail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.section-kicker {
  margin: 0 0 7px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  font-family: var(--display);
}

h1 {
  max-width: 840px;
  margin-bottom: 18px;
  font-size: clamp(28px, 3.2vw, 52px);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1;
  letter-spacing: -0.025em;
}

.source-stamp {
  margin: 2px 0 0;
  padding: 6px 8px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 0.72);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.mode-switch {
  margin: 0 0 13px;
  padding: 0;
  display: flex;
  gap: 6px;
  border: 0;
}

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

.mode-switch label {
  position: relative;
  cursor: pointer;
}

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

.mode-switch span {
  min-height: 34px;
  padding: 8px 13px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.mode-switch label:hover span {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.mode-switch input:checked + span {
  color: var(--white);
  background: var(--blue-deep);
  border-color: var(--blue-deep);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.input-label {
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#evidenceInput {
  width: 100%;
  min-height: 238px;
  max-height: 360px;
  resize: vertical;
  padding: 15px 16px;
  color: #dcecff;
  caret-color: var(--cyan);
  background:
    linear-gradient(90deg, rgb(0 164 214 / 0.08) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(rgb(0 164 214 / 0.06) 1px, transparent 1px) 0 0 / 32px 32px,
    #0b2034;
  border: 1px solid #0b2034;
  border-left: 5px solid var(--cyan);
  border-radius: 0;
  box-shadow: inset 0 0 35px rgb(0 0 0 / 0.18);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  tab-size: 2;
}

#evidenceInput::placeholder {
  color: #829bb0;
}

.input-guard {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  color: #713208;
  background: var(--orange-pale);
  border: 1px solid #efba8d;
  border-top: 0;
  font-size: 12px;
}

.guard-symbol {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--orange);
  font-family: var(--mono);
  font-weight: 800;
}

.tool-actions {
  margin-top: 14px;
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}

.button {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.025em;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(0);
}

.button--primary {
  min-width: min(100%, 320px);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--white);
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 5px 5px 0 var(--blue-deep);
}

.button--primary:hover {
  background: #005aa9;
  box-shadow: 7px 7px 0 var(--blue-deep);
}

.button--secondary {
  color: var(--blue-deep);
  background: var(--blue-pale);
  border-color: #95c8f3;
}

.button--quiet {
  color: var(--ink);
  background: var(--white);
  border-color: var(--line-strong);
}

.button--small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 10px;
}

.privacy-line {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
}

.privacy-line span::before {
  content: "✓";
  margin-right: 6px;
  color: var(--green);
  font-weight: 800;
}

.deadline-rail {
  padding: clamp(20px, 2.6vw, 36px);
  color: #dcecff;
  background:
    linear-gradient(180deg, rgb(0 164 214 / 0.12), transparent 34%),
    #10283e;
  border-left: 1px solid #2d516e;
}

.rail-head {
  align-items: center;
  padding-bottom: 13px;
  border-bottom: 1px solid #34516a;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rail-head strong {
  padding: 4px 7px;
  color: var(--cyan);
  border: 1px solid #386a88;
}

.deadline-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.deadline {
  position: relative;
  min-height: 72px;
  padding: 15px 0 15px 27px;
  display: grid;
  gap: 4px;
  border-bottom: 1px solid #2a465e;
}

.deadline::before {
  content: "";
  position: absolute;
  top: 21px;
  left: 2px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--cyan);
  background: #10283e;
  transform: rotate(45deg);
}

.deadline::after {
  content: "";
  position: absolute;
  top: 34px;
  bottom: -22px;
  left: 7px;
  width: 1px;
  background: #386a88;
}

.deadline:last-child::after {
  display: none;
}

.deadline time {
  color: var(--white);
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
}

.deadline span {
  color: #a9c5dc;
  font-size: 12px;
}

.deadline--passed::before {
  border-color: #8ea2af;
  background: #8ea2af;
}

.deadline--urgent time,
.deadline--final time {
  color: #ffb37e;
}

.deadline--urgent::before,
.deadline--final::before {
  border-color: #ff8f3d;
}

.replacement-key {
  margin-top: 20px;
  padding: 13px;
  background: rgb(255 255 255 / 0.045);
  border: 1px solid #34516a;
}

.replacement-key p {
  margin: 0;
  display: grid;
  gap: 2px;
}

.replacement-key p + p {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #34516a;
}

.replacement-key strong {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.replacement-key span {
  color: var(--white);
  font-size: 13px;
}

.source-link {
  margin-top: 16px;
  display: inline-block;
  color: #b9dcf4;
  font-size: 11px;
  text-underline-offset: 3px;
}

.results {
  margin-top: clamp(28px, 4vw, 58px);
  scroll-margin-top: 78px;
}

.results-heading {
  align-items: flex-end;
  margin-bottom: 18px;
}

#resultStatus {
  max-width: 440px;
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
}

.warning-band {
  margin-bottom: 14px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 14px;
  color: #6d2c05;
  background:
    repeating-linear-gradient(-45deg, rgb(216 90 19 / 0.06) 0 8px, transparent 8px 16px),
    var(--orange-pale);
  border: 1px solid #e9a873;
  border-left: 5px solid var(--orange);
  font-size: 12px;
}

.warning-title {
  font-family: var(--mono);
  text-transform: uppercase;
}

.warning-critical {
  grid-column: 2;
  color: var(--red);
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--line-strong);
  background: var(--white);
}

.metric {
  min-height: 88px;
  padding: 14px 16px;
  display: grid;
  align-content: center;
  gap: 4px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric strong {
  color: var(--blue-deep);
  font-family: var(--display);
  font-size: 34px;
  line-height: 1;
}

.metric span {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.phase-strip {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, max-content) minmax(240px, 1fr);
  gap: 1px;
  color: #c5ddef;
  background: var(--blue-deep);
  border: 1px solid var(--blue-deep);
  font-family: var(--mono);
  font-size: 10px;
}

.phase-strip span {
  padding: 8px 10px;
  background: #102e4b;
}

.phase-strip strong {
  color: #ffb37e;
}

.phase-strip .phase-boundary {
  text-align: right;
  color: #a8c4d8;
}

.tabs {
  margin-top: 14px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tabs button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 10px 14px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.tabs button[aria-selected="true"] {
  color: var(--blue-deep);
  background: var(--white);
  border-color: var(--line-strong);
  border-bottom-color: var(--blue);
}

.tab-panel {
  margin-top: 8px;
  padding: clamp(16px, 2vw, 26px);
  background: var(--white);
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 30px rgb(12 35 57 / 0.08);
}

.panel-intro {
  align-items: center;
  margin-bottom: 16px;
}

.panel-intro p {
  max-width: 880px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.panel-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  scrollbar-color: var(--line-strong) var(--paper-deep);
}

.data-table {
  width: 100%;
  min-width: 1420px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 11px;
}

.matrix-table th:nth-child(1) { width: 170px; }
.matrix-table th:nth-child(2) { width: 130px; }
.matrix-table th:nth-child(3) { width: 185px; }
.matrix-table th:nth-child(4) { width: 170px; }
.matrix-table th:nth-child(5) { width: 180px; }
.matrix-table th:nth-child(6) { width: 165px; }
.matrix-table th:nth-child(7) { width: 125px; }
.matrix-table th:nth-child(8) { width: 215px; }
.matrix-table th:nth-child(9) { width: 250px; }
.matrix-table th:nth-child(10) { width: 180px; }

.owner-table {
  min-width: 1360px;
}

.owner-table th:nth-child(1) { width: 90px; }
.owner-table th:nth-child(2) { width: 170px; }
.owner-table th:nth-child(3) { width: 135px; }
.owner-table th:nth-child(4) { width: 180px; }
.owner-table th:nth-child(5) { width: 145px; }
.owner-table th:nth-child(6) { width: 135px; }
.owner-table th:nth-child(7) { width: 135px; }
.owner-table th:nth-child(8) { width: 175px; }
.owner-table th:nth-child(9) { width: 230px; }
.owner-table th:nth-child(10) { width: 170px; }

.data-table th {
  padding: 10px 11px;
  color: #d9edfc;
  background: #123452;
  border-right: 1px solid #31536c;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.055em;
  line-height: 1.25;
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
}

.data-table td {
  padding: 12px 11px;
  color: #24354a;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.data-table tbody tr:nth-child(even) td {
  background: #f7fafb;
}

.data-table tbody tr:hover td {
  background: #eef7ff;
}

.scope-cell,
.artifact-cell {
  display: grid;
  gap: 7px;
}

.scope-name,
.artifact-name {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
}

.scope-map {
  color: var(--ink-soft);
  font-size: 10px;
}

.state-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  padding: 3px 5px;
  color: var(--blue-deep);
  background: var(--blue-pale);
  border: 1px solid #acd5f6;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.2;
}

.badge--warn {
  color: #753305;
  background: var(--orange-pale);
  border-color: #efc19d;
}

.badge--danger {
  color: var(--red);
  background: var(--red-pale);
  border-color: #efb5ae;
}

.badge--target {
  color: var(--green);
  background: var(--green-pale);
  border-color: #9dd8bd;
}

.phase-cell {
  color: #713208 !important;
  font-weight: 700;
}

.gap-cell {
  color: #8b3706 !important;
  background: #fff8f1 !important;
}

.action-cell {
  color: var(--blue-deep) !important;
  font-weight: 650;
}

.boundary-cell {
  color: var(--ink-soft) !important;
  font-style: italic;
}

.blocker-cell {
  color: var(--red) !important;
}

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

.artifact-stat {
  min-height: 126px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  background: var(--white);
}

.artifact-stat--2 {
  background: #edf7ff;
}

.artifact-stat--3 {
  background: #fff7ef;
}

.artifact-stat--4 {
  color: var(--white);
  background: var(--blue-deep);
}

.artifact-stat__label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.artifact-stat__value {
  font-family: var(--display);
  font-size: 42px;
  line-height: 1;
}

.evidence-boundary {
  margin: 18px 0 0;
  padding-top: 12px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
}

.migration-checklist {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  list-style: none;
}

.checklist-item {
  min-height: 190px;
  padding: 18px;
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 8px 10px;
  background: var(--white);
}

.checklist-item:nth-child(3n + 2) {
  background: #f5faff;
}

.checklist-index {
  grid-row: 1 / 3;
  color: var(--cyan);
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
}

.checklist-title {
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.05;
}

.checklist-detail {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.checklist-boundary {
  grid-column: 2;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}

.handoff-list {
  display: grid;
  gap: 12px;
}

.handoff {
  border: 1px solid var(--line-strong);
  background: #f8fafb;
}

.handoff-heading {
  align-items: center;
  padding: 11px 13px;
  color: var(--white);
  background: #123452;
}

.handoff-heading h3 {
  flex: 1;
  margin: 0;
  font-size: 17px;
}

.handoff-number {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
}

.handoff-body {
  max-height: 320px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #273a50;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.55;
}

.empty-state {
  min-height: 250px;
  padding: clamp(28px, 5vw, 70px);
  color: var(--ink-soft);
  background:
    repeating-linear-gradient(-45deg, rgb(0 103 197 / 0.04) 0 10px, transparent 10px 20px),
    var(--white);
  border: 1px dashed var(--line-strong);
  text-align: center;
}

.empty-state > span {
  display: inline-block;
  padding: 5px 8px;
  color: var(--blue);
  border: 1px solid var(--blue);
  font-family: var(--mono);
  font-size: 10px;
}

.empty-state h3 {
  margin: 16px 0 8px;
  color: var(--ink);
  font-size: clamp(25px, 3vw, 38px);
}

.empty-state p {
  max-width: 720px;
  margin: 0 auto;
}

.boundary-note {
  margin-top: clamp(30px, 5vw, 70px);
  padding: clamp(24px, 4vw, 48px);
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(300px, 1.2fr);
  gap: clamp(30px, 7vw, 100px);
  align-items: end;
  color: var(--white);
  background:
    linear-gradient(115deg, rgb(0 164 214 / 0.22), transparent 38%),
    #0b2034;
  border-left: 8px solid var(--orange);
}

.boundary-index {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
}

.boundary-note h2 {
  margin-top: 14px;
  font-size: clamp(28px, 4vw, 52px);
}

.boundary-note p {
  margin: 0;
  color: #b7cde0;
  font-size: 14px;
}

footer {
  margin: 0;
  padding: 24px clamp(18px, 4vw, 60px);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  color: #8ba8be;
  background: #071522;
  border-top: 1px solid #27435b;
  font-family: var(--mono);
  font-size: 9px;
}

footer p {
  max-width: 720px;
  margin: 0;
}

.clipboard-helper {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
}

@media (max-width: 1040px) {
  .tool-shell {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .tool-heading {
    display: block;
  }

  .source-stamp {
    display: inline-block;
    margin: -4px 0 14px;
  }

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

  .metric:nth-child(3) {
    border-right: 0;
  }

  .metric:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .phase-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .phase-strip .phase-boundary {
    grid-column: 1 / -1;
    text-align: left;
  }

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

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

@media (max-width: 760px) {
  .app-bar {
    min-height: 54px;
    padding: 7px 14px;
  }

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

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy small,
  .app-status {
    display: none;
  }

  main {
    padding: 13px;
  }

  .tool-shell {
    display: flex;
    flex-direction: column;
  }

  .tool-workspace {
    padding: 16px;
  }

  h1 {
    margin-bottom: 12px;
    font-size: 28px;
    line-height: 1;
  }

  .section-kicker {
    margin-bottom: 5px;
    font-size: 9px;
  }

  .source-stamp {
    display: none;
  }

  .mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 8px;
  }

  .mode-switch span {
    min-height: 31px;
    padding: 6px 7px;
    font-size: 9px;
  }

  .input-label {
    margin-bottom: 4px;
    font-size: 9px;
  }

  #evidenceInput {
    min-height: 178px;
    max-height: 240px;
    padding: 11px;
    font-size: 10px;
    line-height: 1.4;
  }

  .input-guard {
    min-height: 33px;
    padding: 6px 8px;
    font-size: 9px;
    line-height: 1.3;
  }

  .guard-symbol {
    width: 18px;
    height: 18px;
  }

  .tool-actions {
    margin-top: 9px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .button {
    min-height: 38px;
    padding: 8px 9px;
    font-size: 9px;
  }

  .button--primary {
    min-width: 0;
    grid-column: 1 / -1;
    min-height: 44px;
    box-shadow: 3px 3px 0 var(--blue-deep);
  }

  .privacy-line {
    margin-top: 9px;
    gap: 3px 10px;
    font-size: 8px;
  }

  .deadline-rail {
    padding: 17px;
    border-top: 1px solid #2d516e;
    border-left: 0;
  }

  .deadline-list,
  .replacement-key,
  .source-link {
    display: none;
  }

  .rail-head {
    padding: 0;
    border: 0;
  }

  .results {
    margin-top: 30px;
  }

  .results-heading {
    display: block;
  }

  .results-heading h2 {
    font-size: 31px;
  }

  #resultStatus {
    margin-top: 8px;
    text-align: left;
  }

  .warning-band {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .warning-critical {
    grid-column: 1;
  }

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

  .metric {
    min-height: 72px;
    padding: 10px;
  }

  .metric strong {
    font-size: 27px;
  }

  .metric span {
    font-size: 8px;
  }

  .phase-strip {
    display: none;
  }

  .tabs {
    margin-top: 10px;
  }

  .tabs button {
    min-height: 39px;
    padding: 8px 10px;
    font-size: 9px;
  }

  .tab-panel {
    padding: 11px;
  }

  .panel-intro {
    display: grid;
    gap: 10px;
  }

  .panel-actions {
    width: 100%;
  }

  .panel-actions .button {
    flex: 1;
  }

  .table-scroll {
    overflow: visible;
    border: 0;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .data-table tbody {
    display: grid;
    gap: 10px;
  }

  .data-table tr {
    border: 1px solid var(--line-strong);
    box-shadow: 3px 3px 0 var(--paper-deep);
  }

  .data-table td,
  .data-table tbody tr:nth-child(even) td,
  .data-table tbody tr:hover td {
    min-height: 36px;
    padding: 8px 9px;
    display: grid;
    grid-template-columns: minmax(92px, 0.36fr) minmax(0, 1fr);
    gap: 10px;
    color: #24354a;
    background: var(--white);
    border: 0;
    border-bottom: 1px solid var(--line);
    font-size: 10px;
  }

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

  .data-table td::before {
    content: attr(data-label);
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .scope-cell,
  .artifact-cell {
    display: grid !important;
    grid-template-columns: minmax(92px, 0.36fr) minmax(0, 1fr) !important;
  }

  .scope-cell::after,
  .artifact-cell::after {
    content: "";
    display: none;
  }

  .scope-cell > *,
  .artifact-cell > * {
    grid-column: 2;
  }

  .scope-cell::before,
  .artifact-cell::before {
    grid-column: 1;
    grid-row: 1 / 4;
  }

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

  .artifact-stat {
    min-height: 105px;
    padding: 13px;
  }

  .artifact-stat__value {
    font-size: 34px;
  }

  .migration-checklist {
    grid-template-columns: 1fr;
  }

  .checklist-item {
    min-height: 150px;
  }

  .handoff-heading {
    display: grid;
    grid-template-columns: 28px 1fr;
  }

  .handoff-heading .button {
    grid-column: 2;
    justify-self: start;
  }

  .boundary-note {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  footer {
    display: grid;
    gap: 8px;
  }
}

@media (max-width: 380px) {
  .tool-workspace {
    padding: 13px;
  }

  h1 {
    font-size: 25px;
  }

  #evidenceInput {
    min-height: 160px;
  }

  .privacy-line span:nth-child(3) {
    display: none;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
