:root {
  --ink: #17251e;
  --ink-soft: #4b5a52;
  --ink-muted: #6f7d75;
  --forest-950: #12231b;
  --forest-900: #182d23;
  --forest-800: #234033;
  --forest-700: #315747;
  --forest-600: #42725d;
  --mint-100: #dfeee7;
  --mint-50: #f0f7f3;
  --paper: #fbfaf7;
  --paper-deep: #f3f1ea;
  --white: #ffffff;
  --line: #dce2dd;
  --line-strong: #c8d1ca;
  --verified: #21764c;
  --verified-bg: #e3f4ea;
  --likely: #31708d;
  --likely-bg: #e4f1f7;
  --review: #a8660c;
  --review-bg: #fff1d7;
  --unknown: #65716b;
  --unknown-bg: #edf0ee;
  --rejected: #a13d3d;
  --rejected-bg: #fae8e6;
  --danger: #9f3434;
  --danger-dark: #792828;
  --shadow-sm: 0 1px 2px rgba(18, 35, 27, 0.07), 0 2px 8px rgba(18, 35, 27, 0.035);
  --shadow-md: 0 14px 38px rgba(18, 35, 27, 0.12), 0 2px 8px rgba(18, 35, 27, 0.06);
  --radius-sm: 8px;
  --radius: 13px;
  --radius-lg: 20px;
  --sidebar-width: 252px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper-deep);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

input[readonly],
textarea[readonly] {
  background: #f2f1ea;
  color: var(--ink-muted);
}

a {
  color: var(--forest-700);
}

svg {
  display: block;
  fill: currentColor;
}

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

h1 {
  margin-bottom: 8px;
  letter-spacing: -0.035em;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.12;
}

h2 {
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  font-size: 19px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 5px;
  font-size: 16px;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--forest-950);
  transition: transform 140ms ease;
}

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

:focus-visible {
  outline: 3px solid rgba(67, 134, 105, 0.42);
  outline-offset: 2px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  padding: 30px 18px;
  background:
    radial-gradient(circle at 12% 18%, rgba(93, 151, 126, 0.19), transparent 29%),
    radial-gradient(circle at 88% 86%, rgba(198, 155, 70, 0.14), transparent 28%),
    linear-gradient(145deg, #12251c, #1e3b2e 58%, #2c4c3e);
}

.auth-card {
  width: min(100%, 470px);
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 24px;
  background: rgba(251, 250, 247, 0.985);
  box-shadow: 0 30px 80px rgba(7, 18, 12, 0.32);
}

.auth-card h1 {
  max-width: 390px;
  font-size: 31px;
}

.auth-card .lede {
  margin-bottom: 27px;
  color: var(--ink-soft);
}

.auth-note,
.auth-footer {
  margin: 23px 0 0;
  color: var(--ink-muted);
  text-align: center;
  font-size: 12px;
}

.auth-footer {
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.02em;
}

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

.brand--auth {
  margin-bottom: 39px;
  color: var(--forest-900);
}

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 3px;
  flex: 0 0 auto;
  padding: 6px;
  border-radius: 9px;
  color: var(--forest-950);
  background: #d9af57;
}

.brand-mark span {
  display: block;
  border-radius: 2px 2px 1px 1px;
  background: currentColor;
}

.brand-mark span:nth-child(1) { height: 42%; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 69%; }

.brand-word {
  display: block;
  letter-spacing: -0.03em;
  font-size: 18px;
  font-weight: 760;
}

.brand-context {
  display: block;
  margin-top: -2px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--forest-600);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 750;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 25px 17px 17px;
  color: #fff;
  background: var(--forest-950);
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.05);
}

.sidebar > .brand {
  padding: 0 8px;
}

.nav-list {
  display: grid;
  gap: 4px;
  margin-top: 35px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.68);
  text-align: left;
  background: transparent;
  transition: color 120ms ease, background 120ms ease;
}

.nav-item svg {
  width: 19px;
  height: 19px;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.065);
}

.nav-item.is-active {
  color: #fff;
  background: rgba(220, 239, 230, 0.13);
  box-shadow: inset 3px 0 #d9af57;
}

.nav-count {
  min-width: 22px;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  color: #302515;
  text-align: center;
  background: #e4bd6b;
  font-size: 11px;
  font-weight: 800;
}

.sidebar-footer {
  position: relative;
  margin-top: auto;
}

.sidebar-status {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 8px 15px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.74);
  font-size: 11px;
}

.sidebar-status > span:last-child span {
  display: block;
}

#sidebar-status-label {
  color: rgba(255, 255, 255, 0.91);
  font-weight: 650;
}

#sidebar-status-detail {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.47);
}

.status-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  flex: 0 0 auto;
  margin-top: 4px;
  border-radius: 999px;
  background: #87928d;
  box-shadow: 0 0 0 3px rgba(135, 146, 141, 0.15);
}

.status-dot--available { background: #6fd19e; box-shadow: 0 0 0 3px rgba(111, 209, 158, 0.16); }
.status-dot--warning { background: #e5af4a; box-shadow: 0 0 0 3px rgba(229, 175, 74, 0.16); }
.status-dot--danger { background: #e47676; box-shadow: 0 0 0 3px rgba(228, 118, 118, 0.16); }
.status-dot--unknown { background: #87928d; box-shadow: 0 0 0 3px rgba(135, 146, 141, 0.14); }

.account-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  text-align: left;
  background: transparent;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.06);
}

.account-button > svg {
  width: 18px;
  height: 18px;
  margin-left: auto;
  color: rgba(255, 255, 255, 0.52);
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--forest-950);
  background: #dfeee7;
  font-size: 11px;
  font-weight: 800;
}

.account-copy {
  min-width: 0;
}

.account-copy strong,
.account-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong { max-width: 135px; font-size: 12px; }
.account-copy span { color: rgba(255, 255, 255, 0.51); font-size: 10px; }

.account-menu {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: 55px;
  left: 0;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: var(--forest-800);
  box-shadow: var(--shadow-md);
}

.account-menu button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.83);
  text-align: left;
  background: transparent;
  font-size: 12px;
}

.account-menu button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.mobile-header,
.nav-scrim {
  display: none;
}

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 43px clamp(25px, 4vw, 58px) 70px;
}

.view {
  width: min(100%, 1440px);
  margin: 0 auto;
}

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

.page-header--compact {
  margin-bottom: 23px;
}

.page-description {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--ink-soft);
}

.button {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  transition: background 120ms ease, border 120ms ease, color 120ms ease, transform 120ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button svg { width: 17px; height: 17px; }
.button--primary { color: #fff; background: var(--forest-700); box-shadow: 0 2px 7px rgba(35, 78, 60, 0.17); }
.button--primary:hover:not(:disabled) { background: var(--forest-800); }
.button--secondary { border-color: var(--line-strong); color: var(--ink); background: var(--white); }
.button--secondary:hover:not(:disabled) { border-color: #aab7ae; background: #f8faf8; }
.button--danger { border-color: #e0bbbb; color: var(--danger); background: #fff8f8; }
.button--danger:hover:not(:disabled) { border-color: #d69999; background: var(--rejected-bg); }
.button--small { min-height: 33px; padding: 6px 10px; font-size: 12px; }
.button--wide { width: 100%; }
.button.is-loading > span:first-child { opacity: 0.65; }
.button-spinner { display: none; width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: currentColor; border-radius: 999px; animation: spin 700ms linear infinite; }
.button.is-loading .button-spinner { display: inline-block; }

.text-button,
.metric-link,
.back-button {
  padding: 0;
  border: 0;
  color: var(--forest-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: transparent;
  font-weight: 650;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.panel-heading {
  min-height: 73px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 19px;
  border-bottom: 1px solid var(--line);
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--ink-muted);
  font-size: 12px;
}

.panel-heading--wrap {
  flex-wrap: wrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 17px;
}

.metric-card {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.metric-card--review {
  border-color: #ecd5aa;
  background: linear-gradient(145deg, #fffdfa, #fff7e8);
}

.metric-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.metric-card > strong {
  margin: 5px 0 3px;
  letter-spacing: -0.04em;
  font-size: 29px;
  line-height: 1.1;
}

.metric-note,
.metric-link {
  color: var(--ink-muted);
  font-size: 10px;
}

.metric-link {
  width: max-content;
  color: #855208;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 13px 18px;
  border-bottom: 1px solid #e8ece9;
  vertical-align: middle;
}

th {
  color: var(--ink-muted);
  background: #fafbf9;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfdfc; }

.cell-title {
  display: block;
  max-width: 470px;
  margin-bottom: 2px;
  color: var(--ink);
  font-weight: 690;
}

.cell-subtitle {
  display: block;
  color: var(--ink-muted);
  font-size: 11px;
}

.cell-actions {
  text-align: right;
  white-space: nowrap;
}

.row-button {
  padding: 5px 8px;
  border: 0;
  color: var(--forest-700);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.row-button:hover { text-decoration: underline; text-underline-offset: 3px; }

.badge {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 820;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--VERIFIED,
.badge--AVAILABLE,
.badge--COMPLETED,
.badge--CONFIRMED,
.badge--ADMIN,
.badge--ACTIVE { color: var(--verified); background: var(--verified-bg); }
.badge--LIKELY,
.badge--COLLECTING,
.badge--MATCHING,
.badge--QUEUED { color: var(--likely); background: var(--likely-bg); }
.badge--REVIEW,
.badge--PARTIAL,
.badge--DEGRADED,
.badge--HOLD { color: var(--review); background: var(--review-bg); }
.badge--UNKNOWN,
.badge--MISSING,
.badge--CANCELLED,
.badge--VA,
.badge--INACTIVE { color: var(--unknown); background: var(--unknown-bg); }
.badge--REJECTED,
.badge--FAILED { color: var(--rejected); background: var(--rejected-bg); }

.progress-mini {
  width: 112px;
}

.progress-mini > span:first-child {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 10px;
}

.progress-mini-track,
.progress-track {
  width: 100%;
  height: 6px;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #e6ebe7;
  appearance: none;
  -webkit-appearance: none;
}

.progress-mini-track::-webkit-progress-bar,
.progress-track::-webkit-progress-bar { border-radius: inherit; background: #e6ebe7; }
.progress-mini-track::-webkit-progress-value,
.progress-track::-webkit-progress-value { border-radius: inherit; background: var(--forest-600); }
.progress-mini-track::-moz-progress-bar,
.progress-track::-moz-progress-bar {
  border-radius: inherit;
  background: var(--forest-600);
}

.empty-state,
.loading-state {
  padding: 44px 20px;
  color: var(--ink-muted);
  text-align: center;
}

.empty-state h3 { color: var(--ink); }
.empty-state p { max-width: 500px; margin: 0 auto 18px; font-size: 13px; }
.empty-icon { width: 39px; height: 39px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 12px; color: var(--forest-700); background: var(--mint-100); font-size: 18px; font-weight: 800; }
.empty-icon--check { color: var(--verified); background: var(--verified-bg); }

.spinner {
  width: 18px;
  height: 18px;
  display: inline-block;
  margin-right: 6px;
  border: 2px solid #d2d9d4;
  border-top-color: var(--forest-600);
  border-radius: 999px;
  vertical-align: -4px;
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.form-layout {
  display: grid;
  gap: 15px;
}

.form-panel {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 26px 34px;
  padding: 25px;
}

.form-panel .field,
.form-panel .field-grid,
.form-panel .check-field,
.form-panel > .notice {
  grid-column: 2;
}

.step-heading {
  display: flex;
  align-items: flex-start;
  align-self: start;
  gap: 13px;
}

.step-heading h2 { margin-top: 2px; }
.step-heading p { margin: 0; color: var(--ink-muted); font-size: 12px; }
.step-number { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: var(--forest-800); background: var(--mint-100); font-size: 12px; font-weight: 800; }

.form-stack {
  display: grid;
  gap: 17px;
}

.form-inline {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span:first-child,
.decision-fieldset legend {
  color: var(--ink);
  font-size: 12px;
  font-weight: 690;
}

.field input,
.field textarea,
.field select,
.select-field select,
.search-field input,
.input-prefix,
.input-affix {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--white);
  box-shadow: inset 0 1px 1px rgba(18, 35, 27, 0.025);
  transition: border 120ms ease, box-shadow 120ms ease;
}

.field input,
.field textarea,
.field select,
.select-field select,
.search-field input {
  min-height: 41px;
  padding: 9px 11px;
}

.field textarea { resize: vertical; }
.field input:focus,
.field textarea:focus,
.field select:focus,
.select-field select:focus,
.search-field input:focus { border-color: var(--forest-600); outline: 0; box-shadow: 0 0 0 3px rgba(66, 114, 93, 0.12); }
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: var(--danger); }
.field small,
.field-help { color: var(--ink-muted); font-size: 10px; }
.field--short { max-width: 220px; }

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

.input-prefix,
.input-affix {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.input-prefix:focus-within,
.input-affix:focus-within { border-color: var(--forest-600); box-shadow: 0 0 0 3px rgba(66, 114, 93, 0.12); }
.input-prefix > span,
.input-affix > span { padding: 0 11px; color: var(--ink-muted); font-size: 12px; }
.input-prefix input,
.input-affix input { min-width: 0; border: 0; box-shadow: none; }
.input-prefix input { padding-left: 0; }
.input-affix input { padding-right: 0; }

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 650px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafbf9;
}

.check-field input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--forest-600); }
.check-field strong,
.check-field small { display: block; }
.check-field strong { margin-bottom: 3px; font-size: 12px; }
.check-field small { color: var(--ink-muted); font-size: 10px; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 10px 0;
}

.form-actions .form-error { margin-right: auto; }
.form-error { margin: 0; color: var(--danger); font-size: 12px; font-weight: 620; }

.notice {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 9px;
  background: #fafbf9;
  font-size: 12px;
}

.notice strong { display: block; margin-bottom: 2px; }
.notice p { margin: 0; }
.notice--neutral { border-left-color: var(--forest-600); background: var(--mint-50); }
.notice--warning { border-color: #ecd5aa; border-left-color: var(--review); color: #764c11; background: #fff9ec; }
.notice--danger { border-color: #e8c4c4; border-left-color: var(--danger); color: #7f3030; background: #fff8f8; }
#dashboard-alert { margin-bottom: 17px; }

.connection-banner {
  position: fixed;
  z-index: 200;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 41px;
  padding: 7px 18px;
  border-bottom: 1px solid #e0c07d;
  color: #63400e;
  background: #fff3d7;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
}

.connection-banner .status-dot { margin-top: 0; }
.connection-banner .text-button { margin-left: 8px; color: #63400e; }

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 14px;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 12px;
}

.back-button:hover { color: var(--forest-700); }
.back-button svg { width: 17px; height: 17px; }

.title-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.title-line h1 { margin-bottom: 5px; }
.subtle-link { color: var(--forest-700); font-size: 12px; overflow-wrap: anywhere; }
.scan-detail-header { margin-bottom: 20px; }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.progress-panel {
  margin-bottom: 15px;
  padding: 17px 19px;
  border: 1px solid #cdded5;
  border-radius: var(--radius);
  background: var(--mint-50);
}

.progress-copy { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 8px; color: var(--forest-800); font-size: 12px; }
.progress-track { height: 7px; }
.progress-panel p { margin: 7px 0 0; color: var(--ink-muted); font-size: 10px; }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.summary-strip > div { padding: 13px 16px; border-right: 1px solid var(--line); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip span,
.summary-strip strong { display: block; }
.summary-strip span { margin-bottom: 2px; color: var(--ink-muted); font-size: 10px; }
.summary-strip strong { font-size: 19px; }

.result-tools { display: flex; gap: 7px; }
.search-field { position: relative; }
.search-field svg { position: absolute; z-index: 1; top: 50%; left: 10px; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-muted); }
.search-field input { width: 235px; min-height: 37px; padding: 7px 10px 7px 32px; font-size: 12px; }
.select-field select { min-height: 37px; padding: 7px 32px 7px 10px; font-size: 12px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 17px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
  background: #fcfdfc;
  font-size: 9px;
}

.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; display: block; border-radius: 999px; }
.legend-dot--verified { background: var(--verified); }
.legend-dot--likely { background: var(--likely); }
.legend-dot--review { background: var(--review); }
.legend-dot--unknown { background: var(--unknown); }

.table-wrap--results { max-height: min(66vh, 760px); }
.results-table thead { position: sticky; z-index: 2; top: 0; }
.results-table th,
.results-table td { padding: 14px 15px; }
.results-table td { vertical-align: top; }
.results-table td:nth-child(1) { width: 30%; min-width: 260px; }
.results-table td:nth-child(2) { width: 27%; min-width: 230px; }
.results-table td:nth-child(3) { min-width: 135px; }
.results-table td:nth-child(4) { min-width: 145px; }
.results-table td:nth-child(5) { min-width: 115px; }

.product-cell,
.retailer-cell,
.match-cell,
.economics-cell {
  display: grid;
  gap: 4px;
}

.product-cell-title,
.retailer-cell-title { color: var(--ink); font-size: 12px; font-weight: 680; line-height: 1.35; }
.product-identifiers,
.retailer-meta,
.match-reason,
.economics-meta { color: var(--ink-muted); font-size: 9px; }
.retailer-cell a { width: max-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.price-pair { display: flex; align-items: baseline; gap: 7px; }
.price-pair strong { font-size: 14px; }
.price-pair del { color: var(--ink-muted); font-size: 10px; }
.confidence { display: flex; align-items: center; gap: 7px; }
.confidence strong { font-size: 17px; }
.confidence span { color: var(--ink-muted); font-size: 9px; }
.economics-value { font-size: 16px; font-weight: 780; }
.economics-value.is-positive { color: var(--verified); }
.economics-value.is-negative { color: var(--rejected); }
.economics-hold { display: inline-flex; align-items: center; gap: 5px; color: var(--review); font-size: 10px; font-weight: 700; }
.result-review-actions { display: grid; justify-items: start; gap: 5px; }
.human-decision { color: var(--ink-muted); font-size: 9px; }

.review-guidance { margin-bottom: 15px; }
.review-list { display: grid; }
.review-card { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; align-items: center; gap: 22px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.review-card:last-child { border-bottom: 0; }
.review-card h3 { margin: 0 0 4px; font-size: 13px; }
.review-card p { margin: 0; color: var(--ink-muted); font-size: 10px; }
.review-card-compare { display: grid; grid-template-columns: 1fr 24px 1fr; align-items: center; gap: 7px; }
.review-card-compare > span { display: grid; }
.review-card-compare strong { font-size: 13px; }
.review-card-compare small { color: var(--ink-muted); font-size: 9px; }
.review-arrow { text-align: center; color: var(--ink-muted); }
.review-card-actions { display: flex; gap: 6px; }

.system-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 15px;
}

.system-card { display: flex; align-items: flex-start; gap: 12px; min-height: 91px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow-sm); }
.system-card-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: var(--forest-700); background: var(--mint-100); }
.system-card-icon svg { width: 18px; height: 18px; }
.system-card strong,
.system-card span { display: block; }
.system-card strong { margin-bottom: 2px; font-size: 12px; }
.system-card span { color: var(--ink-muted); font-size: 10px; }
.system-card .badge { margin-top: 5px; }

.provider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; padding: 18px; }
.provider-card { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fcfdfc; }
.provider-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.provider-card h3 { margin: 0; }
.provider-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; font-size: 9px; }
.provider-card dt { color: var(--ink-muted); }
.provider-card dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.provider-card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }

.info-panel { margin-top: 15px; padding: 20px; }
.definition-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; margin: 14px 0 0; }
.definition-list div { padding-left: 11px; border-left: 2px solid var(--line-strong); }
.definition-list dt { margin-bottom: 3px; font-size: 11px; font-weight: 750; }
.definition-list dd { margin: 0; color: var(--ink-muted); font-size: 9px; }

.dialog {
  width: min(calc(100% - 28px), 580px);
  max-height: min(90vh, 860px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 30px 100px rgba(11, 24, 16, 0.31);
}

.dialog--wide { width: min(calc(100% - 28px), 850px); }
.dialog::backdrop { background: rgba(12, 25, 17, 0.6); backdrop-filter: blur(2px); }
.dialog-frame { max-height: inherit; display: flex; flex-direction: column; margin: 0; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 21px; }
.dialog-header .eyebrow { margin-bottom: 3px; }
.dialog-body { padding: 20px 22px; overflow-y: auto; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fafbf9; }
.dialog-footer--spread { justify-content: space-between; }
.dialog-footer p { max-width: 540px; margin: 0; color: var(--ink-muted); font-size: 9px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-soft); background: var(--white); }
.icon-button svg { width: 20px; height: 20px; }
.dialog-close { width: 31px; height: 31px; flex: 0 0 auto; border: 0; background: #f3f5f3; font-size: 22px; line-height: 1; }

.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.evidence-card { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fcfdfc; }
.evidence-card h3 { margin-bottom: 9px; }
.evidence-card dl { display: grid; grid-template-columns: 95px minmax(0, 1fr); gap: 6px 9px; margin: 0; font-size: 10px; }
.evidence-card dt { color: var(--ink-muted); }
.evidence-card dd { margin: 0; overflow-wrap: anywhere; }
.evidence-section { margin-top: 16px; }
.evidence-section h3 { margin-bottom: 8px; }
.evidence-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.evidence-list li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 7px; background: var(--mint-50); font-size: 10px; }
.evidence-list li::before { content: "✓"; color: var(--verified); font-weight: 800; }
.evidence-list--warning li { background: #fff8e9; }
.evidence-list--warning li::before { content: "!"; color: var(--review); }
.evidence-list--danger li { background: #fff1f0; }
.evidence-list--danger li::before { content: "×"; color: var(--rejected); }

.decision-fieldset { display: grid; gap: 8px; margin: 17px 0; padding: 0; border: 0; }
.decision-fieldset legend { margin-bottom: 7px; }
.decision-option { display: flex; align-items: flex-start; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fcfdfc; }
.decision-option:has(input:checked) { border-color: var(--forest-600); box-shadow: 0 0 0 2px rgba(66, 114, 93, 0.1); }
.decision-option input { margin: 3px 0 0; accent-color: var(--forest-600); }
.decision-option strong,
.decision-option small { display: block; }
.decision-option strong { font-size: 11px; }
.decision-option small { color: var(--ink-muted); font-size: 9px; }
.review-offer-summary { padding: 12px; border-radius: 9px; background: var(--paper-deep); font-size: 11px; }
.review-offer-summary strong,
.review-offer-summary span { display: block; }
.review-offer-summary span { color: var(--ink-muted); }

.copy-field { display: flex; gap: 8px; margin: 15px 0; }
.copy-field code { min-width: 0; flex: 1; padding: 10px 12px; overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper-deep); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }

.toast-region { position: fixed; z-index: 500; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(calc(100% - 36px), 390px); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--white); box-shadow: var(--shadow-md); animation: toast-in 180ms ease both; pointer-events: auto; }
.toast::before { content: "✓"; width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 999px; color: var(--verified); background: var(--verified-bg); font-size: 10px; font-weight: 800; }
.toast--error::before { content: "!"; color: var(--rejected); background: var(--rejected-bg); }
.toast-copy strong,
.toast-copy span { display: block; }
.toast-copy strong { font-size: 11px; }
.toast-copy span { color: var(--ink-muted); font-size: 9px; }
@keyframes toast-in { from { transform: translateY(7px); opacity: 0; } }

@media (max-width: 1150px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .definition-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .review-card { grid-template-columns: 1fr auto; }
  .review-card-compare { grid-column: 1; }
  .review-card-actions { grid-row: 1 / span 2; grid-column: 2; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 180ms ease; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar.is-open + .mobile-header + .nav-scrim { display: block; }
  .mobile-header { position: sticky; z-index: 40; top: 0; height: 59px; display: flex; align-items: center; justify-content: space-between; padding: 9px 15px; border-bottom: 1px solid var(--line); background: rgba(251, 250, 247, 0.96); backdrop-filter: blur(8px); }
  .brand--mobile { color: var(--forest-950); }
  .brand--mobile .brand-mark { width: 28px; height: 28px; }
  .mobile-header .avatar { color: #fff; background: var(--forest-700); }
  .nav-scrim { position: fixed; z-index: 45; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(9, 22, 14, 0.48); }
  .main-content { margin-left: 0; padding: 27px 20px 60px; }
  .form-panel { grid-template-columns: 1fr; }
  .step-heading { grid-row: auto; }
  .form-panel .field,
  .form-panel .field-grid,
  .form-panel .check-field,
  .form-panel > .notice { grid-column: 1; }
  .summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-strip > div:nth-child(3) { border-right: 0; }
  .summary-strip > div:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .system-summary { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .auth-card { padding: 28px 22px; }
  .auth-card h1 { font-size: 27px; }
  .page-header { display: grid; gap: 16px; }
  .page-header > .button { width: max-content; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 115px; padding: 15px; }
  .metric-card > strong { font-size: 25px; }
  .field-grid { grid-template-columns: 1fr; }
  .form-panel { padding: 19px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .form-error { width: 100%; margin: 0 0 6px; }
  .scan-detail-header .header-actions { width: 100%; }
  .header-actions .button { flex: 1 1 auto; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-strip > div,
  .summary-strip > div:nth-child(3) { border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
  .summary-strip > div:nth-child(1),
  .summary-strip > div:nth-child(2) { border-top: 0; }
  .summary-strip > div:nth-child(even) { border-right: 0; }
  .panel-heading--wrap { align-items: flex-start; }
  .result-tools { width: 100%; display: grid; grid-template-columns: 1fr; }
  .search-field input,
  .select-field select { width: 100%; }
  .legend { display: grid; grid-template-columns: 1fr; }
  .review-card { grid-template-columns: 1fr; gap: 12px; }
  .review-card-actions { grid-row: auto; grid-column: auto; }
  .provider-grid { grid-template-columns: 1fr; }
  .definition-list { grid-template-columns: 1fr 1fr; }
  .evidence-grid { grid-template-columns: 1fr; }
  .dialog-footer--spread { align-items: flex-end; }
  .connection-banner { justify-content: flex-start; }
}

@media (max-width: 430px) {
  .main-content { padding-right: 14px; padding-left: 14px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 105px; }
  .summary-strip { grid-template-columns: 1fr; }
  .summary-strip > div { border-top: 1px solid var(--line) !important; border-right: 0 !important; }
  .summary-strip > div:first-child { border-top: 0 !important; }
  .definition-list { grid-template-columns: 1fr; }
  .dialog-body,
  .dialog-header,
  .dialog-footer { padding-right: 16px; padding-left: 16px; }
}

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

@media print {
  .sidebar,
  .mobile-header,
  .page-header .button,
  .result-tools,
  .legend,
  .result-review-actions,
  .connection-banner { display: none !important; }
  .main-content { margin: 0; padding: 0; }
  .panel,
  .summary-strip { box-shadow: none; }
}
