:root {
  --ivory: #f3f0e7;
  --paper: #fffdf8;
  --paper-muted: #ebe7dc;
  --teal: #285f5d;
  --teal-deep: #123b39;
  --teal-dark: #092b2a;
  --ink: #172725;
  --ink-soft: #64716e;
  --line: rgba(23, 62, 59, 0.14);
  --line-strong: rgba(23, 62, 59, 0.28);
  --green: #18875f;
  --red: #b4403d;
  --amber: #a86b1e;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--ivory);
  font-family: var(--font);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select { font: inherit; }

button,
select { color: inherit; }

button { cursor: pointer; }

svg { display: block; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

::selection { color: white; background: var(--teal); }

:focus-visible { outline: 3px solid rgba(40, 95, 93, 0.34); outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: var(--teal-deep);
  background: white;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.review-header {
  height: 68px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  color: white;
  background: var(--teal-deep);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.review-brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 9px;
  color: inherit;
  text-decoration: none;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.review-brand svg { width: 27px; height: 27px; }
.review-brand strong { font-weight: 800; }

.review-brand small {
  margin-left: 6px;
  padding-left: 12px;
  color: rgba(255, 255, 255, 0.58);
  border-left: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.review-run {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

.run-status { display: inline-flex; align-items: center; gap: 7px; color: white; font-weight: 650; }
.run-status i,
.capture-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.run-status.passed i,
.capture-status.passed i { background: #44cc91; box-shadow: 0 0 0 4px rgba(68, 204, 145, 0.13); }
.run-status.failed i,
.capture-status.failed i { background: #ff7470; box-shadow: 0 0 0 4px rgba(255, 116, 112, 0.12); }

.header-action {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px 0 13px;
  color: white;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

.header-action:hover { background: rgba(255, 255, 255, 0.08); }
.header-action svg { width: 17px; height: 17px; }
.header-action span { min-width: 24px; padding: 3px 6px; color: var(--teal-deep); background: white; border-radius: 4px; font-size: 11px; }

.review-summary {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.review-summary > div {
  min-width: 112px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding-right: 22px;
  margin-right: 22px;
  border-right: 1px solid var(--line);
}

.review-summary strong { color: var(--teal-deep); font-size: 22px; letter-spacing: -0.04em; }
.review-summary span { color: var(--ink-soft); font-size: 12px; }
.review-summary p { margin: 0 0 0 auto; color: var(--ink-soft); font-size: 12px; text-align: right; }

.review-workspace {
  height: calc(100vh - 130px);
  min-height: 620px;
  display: grid;
  grid-template-columns: 278px minmax(440px, 1fr) 294px;
  overflow: hidden;
}

.review-index,
.review-inspector { background: var(--paper); }

.review-index { display: flex; min-height: 0; flex-direction: column; border-right: 1px solid var(--line); }

.index-tools { padding: 16px 15px 12px; border-bottom: 1px solid var(--line); }

.review-search {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--ivory);
  border: 1px solid transparent;
  border-radius: 5px;
}

.review-search:focus-within { background: white; border-color: var(--teal); }
.review-search svg { width: 16px; height: 16px; color: var(--ink-soft); }
.review-search input { min-width: 0; flex: 1; padding: 0; background: transparent; border: 0; outline: 0; font-size: 13px; }
.review-search kbd { padding: 2px 5px; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); border-radius: 3px; font-size: 10px; }

.index-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.index-filters select,
.endpoint-tools select { width: 100%; height: 34px; padding: 0 26px 0 9px; background: transparent; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; }
.flow-count { padding: 9px 16px 7px; color: var(--ink-soft); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.flow-list { min-height: 0; overflow: auto; padding-bottom: 24px; scrollbar-width: thin; }

.flow-item {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr 8px;
  align-items: start;
  gap: 9px;
  padding: 10px 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  text-align: left;
  opacity: 0;
  transform: translateY(5px);
  animation: row-in 280ms ease forwards;
}

.flow-item:hover { background: rgba(40, 95, 93, 0.055); }
.flow-item.active { background: rgba(40, 95, 93, 0.09); border-left-color: var(--teal); }
.flow-number { padding-top: 2px; color: var(--ink-soft); font-size: 10px; font-variant-numeric: tabular-nums; }
.flow-copy { min-width: 0; }
.flow-copy strong { display: block; overflow: hidden; font-size: 12px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.flow-copy small { display: block; margin-top: 2px; overflow: hidden; color: var(--ink-soft); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.flow-dot { width: 6px; height: 6px; margin-top: 5px; border-radius: 50%; background: var(--green); }
.flow-item.failed .flow-dot { background: var(--red); }
.flow-separator { padding: 15px 16px 6px; color: var(--teal); border-top: 1px solid var(--line); font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.flow-separator:first-child { border-top: 0; }

@keyframes row-in { to { opacity: 1; transform: translateY(0); } }

.review-stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #d8d5cc; }

.stage-header {
  min-height: 102px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 17px 22px 15px;
  background: var(--ivory);
  border-bottom: 1px solid var(--line);
}

.stage-kicker { margin: 0 0 4px; color: var(--teal); font-size: 9px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.stage-header h1 { margin: 0; font-size: clamp(19px, 2vw, 27px); font-weight: 730; letter-spacing: -0.035em; }
.stage-header p:not(.stage-kicker) { max-width: 620px; margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; }

.viewport-switch { flex: 0 0 auto; display: inline-flex; padding: 3px; background: var(--paper-muted); border-radius: 6px; }
.viewport-switch button { min-height: 31px; padding: 0 10px; color: var(--ink-soft); background: transparent; border: 0; border-radius: 4px; font-size: 10px; font-weight: 700; }
.viewport-switch button:hover { color: var(--ink); }
.viewport-switch button.active { color: white; background: var(--teal-deep); }

.stage-meta {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  color: var(--ink-soft);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.stage-meta code { min-width: 0; flex: 1; overflow: hidden; color: var(--teal-deep); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }

.capture-canvas {
  min-height: 0;
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px;
  background-color: #183d3b;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 24px 24px;
  scrollbar-color: rgba(255,255,255,.3) transparent;
}

.capture-placeholder { align-self: center; display: grid; justify-items: center; gap: 12px; color: rgba(255,255,255,.58); text-align: center; }
.capture-placeholder svg { width: 44px; height: 44px; }
.capture-placeholder p { margin: 0; font-size: 12px; }

.capture-frame {
  width: min(100%, 1120px);
  margin: 0;
  overflow: hidden;
  background: white;
  border-radius: 4px;
  box-shadow: 0 28px 72px rgba(3, 20, 19, 0.36);
  animation: capture-in 260ms cubic-bezier(.2,.72,.2,1) both;
}

.capture-frame[data-device="mobile"] { width: min(100%, 390px); }
.capture-frame[data-device="tablet"] { width: min(100%, 820px); }
.capture-frame img { width: 100%; height: auto; display: block; cursor: zoom-in; }
.capture-frame.missing { min-height: 320px; display: grid; place-items: center; padding: 30px; color: var(--ink-soft); box-shadow: none; }

@keyframes capture-in { from { opacity: .25; transform: translateY(10px) scale(.992); } to { opacity: 1; transform: none; } }

.compare-grid { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); align-items: start; gap: 18px; }
.compare-column { min-width: 0; }
.compare-column > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: white; font-size: 10px; }
.compare-column .capture-frame { width: 100%; max-height: none; }

.stage-footer { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: var(--paper); border-top: 1px solid var(--line); }
.stage-footer button { padding: 7px 8px; color: var(--teal); background: transparent; border: 0; font-size: 11px; font-weight: 700; }
.stage-footer button:disabled { opacity: .35; cursor: not-allowed; }
.stage-footer p { margin: 0; color: var(--ink-soft); font-size: 10px; }

.review-inspector { min-height: 0; overflow: auto; padding: 19px 18px 30px; border-left: 1px solid var(--line); }
.review-inspector > header h2 { margin: 0; font-size: 19px; letter-spacing: -.03em; }

.capture-status { display: flex; align-items: center; gap: 9px; margin: 17px 0 13px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 750; }
.capture-status.passed { color: var(--green); }
.capture-status.failed { color: var(--red); }

.inspection-list { margin: 0; }
.inspection-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.inspection-list dt { color: var(--ink-soft); }
.inspection-list dd { margin: 0; text-align: right; font-weight: 680; }

.issue-section,
.resolution-map { margin-top: 24px; }
.issue-section > header { display: flex; align-items: center; justify-content: space-between; }
.issue-section h3,
.resolution-map h3 { margin: 0 0 9px; font-size: 11px; }
.issue-section > header span { min-width: 22px; padding: 3px 6px; color: var(--ink-soft); background: var(--paper-muted); border-radius: 10px; font-size: 9px; text-align: center; }
.issue-list p { margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.issue { margin: 0 0 7px; padding-left: 10px; color: var(--red); border-left: 2px solid currentColor; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.issue.warning { color: var(--amber); }

.resolution-map > div { display: grid; gap: 6px; }
.resolution-row { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 9px; }
.resolution-track { height: 4px; overflow: hidden; background: var(--paper-muted); border-radius: 4px; }
.resolution-track i { width: 100%; height: 100%; display: block; background: var(--green); }
.resolution-row.failed .resolution-track i { background: var(--red); }
.resolution-row.missing .resolution-track i { width: 0; }

.endpoint-dialog,
.lightbox { padding: 0; border: 0; }
.endpoint-dialog { width: min(1080px, calc(100vw - 32px)); height: min(760px, calc(100vh - 32px)); color: var(--ink); background: var(--paper); border-radius: 8px; box-shadow: 0 32px 120px rgba(6, 30, 29, .36); }
.endpoint-dialog::backdrop,
.lightbox::backdrop { background: rgba(6, 31, 30, .72); backdrop-filter: blur(5px); }
.dialog-shell { height: 100%; display: flex; flex-direction: column; }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 24px; padding: 24px 26px 18px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.dialog-header p:not(.stage-kicker) { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 50%; font-size: 24px; line-height: 1; }
.icon-button:hover { background: var(--paper-muted); }
.endpoint-tools { display: grid; grid-template-columns: 1fr 180px; gap: 10px; padding: 13px 26px; border-bottom: 1px solid var(--line); }
.endpoint-table-wrap { min-height: 0; flex: 1; overflow: auto; }
.endpoint-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.endpoint-table th { position: sticky; z-index: 1; top: 0; padding: 10px 14px; color: var(--ink-soft); background: var(--paper-muted); font-size: 9px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.endpoint-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.endpoint-table code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; overflow-wrap: anywhere; }
.method { display: inline-block; min-width: 39px; padding: 3px 5px; color: var(--teal-deep); background: rgba(40,95,93,.09); border-radius: 3px; font-size: 9px; font-weight: 800; text-align: center; }
.result-mark { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.result-mark::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.result-mark.failed { color: var(--red); }
.result-mark.failed::before { background: var(--red); }

.lightbox { width: calc(100vw - 32px); height: calc(100vh - 32px); max-width: none; max-height: none; overflow: auto; background: #102e2c; }
.lightbox img { display: block; width: auto; min-width: min(100%, 1000px); max-width: none; margin: 0 auto; }
.lightbox-close { position: fixed; z-index: 2; top: 28px; right: 28px; color: white; background: rgba(7,30,29,.72); border-color: rgba(255,255,255,.3); }

.empty-data { position: fixed; z-index: 200; inset: 0; display: grid; place-content: center; padding: 30px; color: white; background: var(--teal-deep); text-align: center; }
.empty-data[hidden] { display: none; }
.empty-data h1 { margin: 0; font-size: clamp(28px, 5vw, 60px); }
.empty-data p { color: rgba(255,255,255,.7); }
.empty-data code { color: white; }

@media (max-width: 1180px) {
  .review-workspace { grid-template-columns: 248px minmax(420px, 1fr) 250px; }
  .review-summary > div { min-width: 96px; margin-right: 14px; padding-right: 14px; }
  .capture-canvas { padding: 22px; }
}

@media (max-width: 940px) {
  .review-header { grid-template-columns: 1fr auto; }
  .review-run { display: none; }
  .review-summary p { display: none; }
  .review-workspace { grid-template-columns: 230px minmax(0, 1fr); overflow: auto; }
  .review-index { grid-row: 1 / span 2; }
  .review-inspector { grid-column: 2; border-top: 1px solid var(--line); border-left: 0; overflow: visible; }
  .index-filters { grid-template-columns: 1fr; }
  .stage-header { align-items: start; flex-direction: column; gap: 12px; }
  .compare-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .review-header { height: 58px; padding: 0 14px; }
  .review-brand small { display: none; }
  .header-action { min-height: 34px; }
  .review-summary { min-height: 0; flex-wrap: wrap; gap: 5px 0; padding: 8px 14px; }
  .review-summary > div { width: 50%; min-width: 0; margin: 0; padding: 2px 10px 2px 0; border-right: 0; }
  .review-summary strong { font-size: 18px; }
  .review-workspace { height: auto; min-height: 0; display: block; overflow: visible; }
  .review-index { max-height: 300px; border-right: 0; border-bottom: 1px solid var(--line); }
  .review-inspector { padding: 18px 16px 28px; border-top: 1px solid var(--line); }
  .flow-list { max-height: 178px; }
  .review-stage { min-height: calc(100vh - 110px); }
  .stage-header { min-height: 0; padding: 15px; }
  .stage-header h1 { font-size: 21px; }
  .viewport-switch { width: 100%; overflow-x: auto; }
  .viewport-switch button { flex: 1; }
  .stage-meta { padding: 0 15px; }
  .stage-meta span:last-child { display: none; }
  .capture-canvas { min-height: 520px; padding: 16px; }
  .stage-footer p { display: none; }
  .endpoint-dialog { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; }
  .endpoint-tools { grid-template-columns: 1fr; }
  .endpoint-table th:nth-child(5),
  .endpoint-table td:nth-child(5) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
