:root {
  color-scheme: light;
  --navy-950: #07192b;
  --navy-900: #0b2239;
  --navy-800: #123451;
  --teal-700: #0f6b78;
  --teal-600: #148293;
  --teal-100: #d8f1f2;
  --amber-700: #9a6508;
  --amber-500: #d9a441;
  --amber-100: #fff3d6;
  --red-700: #a4261d;
  --red-100: #fde7e5;
  --green-700: #176b45;
  --green-100: #ddf4e8;
  --ink: #162536;
  --muted: #607184;
  --soft: #edf2f6;
  --panel: #ffffff;
  --canvas: #f4f7f9;
  --line: #d7e0e7;
  --line-strong: #bcc9d3;
  --focus: #0a7fa2;
  --shadow: 0 18px 50px rgba(7, 25, 43, 0.09);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --rail-width: 286px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ecf4f8;
  --muted: #9fb1c1;
  --soft: #162c3e;
  --panel: #10283a;
  --canvas: #081c2d;
  --line: #294458;
  --line-strong: #3a596f;
  --teal-100: #123d46;
  --amber-100: #3b321c;
  --red-100: #422422;
  --green-100: #173a2e;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 74% -8%, rgba(20, 130, 147, 0.08), transparent 30rem),
    var(--canvas);
  color: var(--ink);
  font-family: "Noto Sans Thai", "Sarabun", "Leelawadee UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

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

button:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateY(-160%);
}

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

.app-shell {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  min-height: 100vh;
}

.side-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--rail-width);
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  padding: 28px 22px 22px;
  background:
    linear-gradient(160deg, rgba(20, 130, 147, 0.13), transparent 34%),
    var(--navy-950);
  color: #edf7fa;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-lockup img {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: contain;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: #ffffff;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal-600);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.13em;
  line-height: 1.35;
  text-transform: uppercase;
}

.side-rail .eyebrow {
  color: #80cfd8;
}

.brand-name {
  margin: 0;
  color: #ffffff;
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.rail-menu {
  display: grid;
  gap: 8px;
}

.rail-menu-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(128, 207, 216, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  color: #a9bdca;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.rail-menu-item::before {
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #80cfd8;
  content: "";
  opacity: 0;
  transition: opacity 180ms ease;
}

.rail-menu-item:hover {
  border-color: rgba(128, 207, 216, 0.42);
  background: rgba(128, 207, 216, 0.08);
  color: #f3fcfd;
  transform: translateX(2px);
}

.rail-menu-item:focus-visible {
  outline: 3px solid rgba(128, 207, 216, 0.34);
  outline-offset: 2px;
}

.rail-menu-item.is-active {
  border-color: rgba(128, 207, 216, 0.52);
  background: rgba(128, 207, 216, 0.12);
  color: #ffffff;
}

.rail-menu-item.is-active::before {
  opacity: 1;
}

.rail-menu-item > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(128, 207, 216, 0.16);
  border-radius: 11px;
  background: rgba(128, 207, 216, 0.1);
  color: #80cfd8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.rail-menu-item.is-active > span {
  border-color: #80cfd8;
  background: #80cfd8;
  color: var(--navy-950);
}

.rail-menu-item svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.rail-menu-item strong,
.rail-menu-item small {
  display: block;
}

.rail-menu-item strong {
  font-size: 13px;
  line-height: 1.35;
}

.rail-menu-item small {
  margin-top: 2px;
  color: #7893a6;
  font-size: 10px;
  line-height: 1.35;
}

.rail-menu-item.is-active small {
  color: #a7c5d2;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(129, 207, 216, 0.2);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
}

.mode-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  background: rgba(128, 207, 216, 0.12);
  color: #80cfd8;
}

.mode-icon svg,
.read-only-pill svg,
.primary-button svg,
.copy-button svg,
.icon-button svg,
.evidence-icon svg,
.status-banner-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.mode-card strong,
.mode-card span,
.rail-footer strong,
.rail-footer small {
  display: block;
}

.mode-card strong {
  font-size: 13px;
}

.mode-card span,
.rail-footer small {
  color: #9cb4c4;
  font-size: 11px;
}

.journey ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.journey-step {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  min-height: 68px;
  padding: 11px 10px;
  border-radius: 12px;
  color: #8fa8ba;
  transition: background 180ms ease, color 180ms ease;
}

.journey-step::after {
  position: absolute;
  top: 48px;
  bottom: -12px;
  left: 26px;
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
  content: "";
}

.journey-step:last-child::after {
  display: none;
}

.journey-step > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.journey-step strong,
.journey-step small {
  display: block;
}

.journey-step strong {
  color: currentColor;
  font-size: 13px;
}

.journey-step small {
  margin-top: 2px;
  color: #7893a6;
  font-size: 11px;
}

.journey-step.is-active,
.journey-step.is-complete {
  background: rgba(128, 207, 216, 0.09);
  color: #f3fcfd;
}

.journey-step.is-active > span {
  border-color: #80cfd8;
  background: #80cfd8;
  color: var(--navy-950);
}

.journey-step.is-complete > span {
  border-color: #67bba4;
  color: #89dac1;
}

.rail-tool-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 12px 10px;
  border: 1px solid rgba(128, 207, 216, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #a9bdca;
  text-align: left;
  text-decoration: none;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.rail-tool-link:hover,
.rail-tool-link.is-active {
  border-color: rgba(128, 207, 216, 0.48);
  background: rgba(128, 207, 216, 0.1);
  color: #f3fcfd;
}

.rail-tool-link > span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: rgba(128, 207, 216, 0.1);
  color: #80cfd8;
}

.rail-tool-link svg,
.back-button svg,
.route-node svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.rail-tool-link strong,
.rail-tool-link small {
  display: block;
}

.rail-tool-link strong {
  font-size: 12px;
}

.rail-tool-link small {
  margin-top: 2px;
  color: #7893a6;
  font-size: 10px;
}

.rail-footer {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 13px 10px 4px;
}

.connection-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: var(--amber-500);
  box-shadow: 0 0 0 5px rgba(217, 164, 65, 0.12);
}

.connection-dot.is-online {
  background: #56bd98;
  box-shadow: 0 0 0 5px rgba(86, 189, 152, 0.12);
}

.connection-dot.is-error {
  background: #df6b62;
  box-shadow: 0 0 0 5px rgba(223, 107, 98, 0.12);
}

.workspace {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 17px clamp(20px, 4vw, 54px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  background: color-mix(in srgb, var(--canvas) 91%, transparent);
  backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lineage-guide-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--teal-600) 65%, var(--line));
  border-radius: 11px;
  color: var(--teal-600);
  background: color-mix(in srgb, var(--teal-600) 8%, transparent);
  font-size: .78rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.lineage-guide-link:hover {
  border-color: var(--teal-600);
  background: color-mix(in srgb, var(--teal-600) 14%, transparent);
}

.module-switcher {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  width: min(1220px, calc(100% - 40px));
  margin: 22px auto 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--panel) 88%, var(--canvas));
  box-shadow: 0 12px 32px rgba(7, 25, 43, 0.06);
}

.module-switch-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.module-switch-card:hover {
  border-color: color-mix(in srgb, var(--teal-600) 62%, var(--line));
  box-shadow: 0 8px 22px rgba(7, 25, 43, 0.08);
  transform: translateY(-2px);
}

.module-switch-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

.module-switch-card.is-active {
  border-color: var(--teal-600);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal-100) 64%, var(--panel)), var(--panel));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--teal-600) 36%, transparent);
}

.module-switch-number {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 13px;
  background: var(--navy-900);
  color: #ffffff;
  font: 800 17px/1 ui-monospace, "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0.02em;
}

.module-switch-card.is-active .module-switch-number {
  background: var(--teal-600);
}

.module-switch-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.module-switch-copy small {
  color: var(--teal-600);
  font: 800 10px/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0.14em;
}

.module-switch-copy strong {
  font-size: 16px;
  line-height: 1.35;
}

.module-switch-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-switch-state {
  justify-self: end;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.module-switch-card.is-active .module-switch-state {
  border-color: color-mix(in srgb, var(--teal-600) 46%, var(--line));
  background: color-mix(in srgb, var(--teal-600) 11%, transparent);
  color: var(--teal-600);
}

.module-switch-flow {
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
}

.module-switch-flow b {
  color: var(--teal-600);
  font-size: 21px;
  line-height: 1;
}

.module-switch-flow small {
  margin-top: 5px;
  font-size: 9px;
  white-space: nowrap;
}

.icon-button,
.copy-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.icon-button:hover,
.copy-button:hover:not(:disabled) {
  border-color: var(--teal-600);
  color: var(--teal-600);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 11px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
}

.user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: var(--navy-900);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.user-chip strong,
.user-chip small {
  display: block;
  line-height: 1.2;
}

.user-chip strong {
  font-size: 12px;
}

.user-chip small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.text-button {
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.text-button:hover {
  color: var(--red-700);
}

main {
  display: grid;
  min-width: 0;
  gap: 22px;
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 68px;
}

.page-view {
  display: grid;
  min-width: 0;
  gap: 22px;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 17px;
  border: 1px solid #e5c885;
  border-radius: var(--radius-md);
  background: var(--amber-100);
  color: var(--amber-700);
}

.status-banner.is-ready {
  border-color: #9acfb9;
  background: var(--green-100);
  color: var(--green-700);
}

.status-banner.is-error {
  border-color: #e7aaa5;
  background: var(--red-100);
  color: var(--red-700);
}

.status-banner-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, currentColor 11%, transparent);
}

.status-banner strong,
.status-banner span {
  display: block;
}

.status-banner strong {
  font-size: 13px;
}

.status-banner span {
  margin-top: 1px;
  font-size: 11px;
}

.control-grid,
.readiness-section,
.target-section,
.results-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 24px;
}

.full-width {
  grid-column: 1 / -1;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-number {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  background: var(--soft);
  color: var(--teal-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.read-only-pill,
.summary-badge {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--teal-100);
  color: var(--teal-700);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.read-only-pill svg {
  width: 15px;
  height: 15px;
}

.summary-badge.is-error {
  background: var(--red-100);
  color: var(--red-700);
}

.field-card {
  display: flex;
  min-width: 0;
  min-height: 106px;
  flex-direction: column;
  justify-content: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--soft) 38%, var(--panel));
}

.field-card > span {
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
}

.field-card select {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 650;
}

.field-card small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.readiness-section,
.target-section,
.results-section {
  padding: 24px;
}

.source-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.source-metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--soft) 42%, var(--panel));
}

.source-metric span,
.source-metric strong,
.source-metric small {
  display: block;
}

.source-metric span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.source-metric strong {
  margin: 4px 0 1px;
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.source-metric small {
  color: var(--muted);
  font-size: 9px;
}

.preflight-note {
  margin: 13px 0 0;
  padding: 9px 12px;
  border-left: 3px solid var(--teal-600);
  background: color-mix(in srgb, var(--teal-100) 46%, transparent);
  color: var(--muted);
  font-size: 10px;
}

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

.check-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.check-row.is-failed {
  grid-column: 1 / -1;
  align-items: start;
  border-color: #e7aaa5;
  border-left-width: 4px;
  background: color-mix(in srgb, var(--red-100) 48%, var(--panel));
}

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

.check-mark,
.target-state-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 12px;
  font-weight: 900;
}

.check-row.is-failed .check-mark {
  background: var(--red-100);
  color: var(--red-700);
}

.check-row strong,
.check-row small {
  display: block;
}

.check-row strong {
  font-size: 11px;
}

.check-row small,
.check-row > span:last-child {
  color: var(--muted);
  font-size: 9px;
}

.check-row > span:last-child {
  font-weight: 700;
  white-space: nowrap;
}

.check-guidance {
  margin-top: 8px;
  color: var(--red-700);
  font-size: 10px;
}

.issue-preview {
  display: grid;
  gap: 5px;
  margin-top: 9px;
}

.issue-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.45fr);
  gap: 10px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--red-700) 14%, var(--line));
  border-radius: 8px;
  background: var(--panel);
}

.issue-preview-row code {
  overflow: hidden;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-preview-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-preview-loading,
.issue-preview-error {
  color: var(--muted);
  font-size: 9px;
}

.issue-preview-error {
  color: var(--red-700);
}

.issue-detail-button {
  margin-top: 9px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--red-700) 32%, var(--line));
  border-radius: 8px;
  background: var(--panel);
  color: var(--red-700);
  font-size: 9px;
  font-weight: 800;
}

.issue-detail-button:hover {
  border-color: var(--red-700);
}

.scope-issue {
  display: grid;
  gap: 2px;
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--red-700);
}

.scope-issue strong,
.scope-issue span {
  font-size: 9px;
}

.section-note {
  margin: 12px 0 0 48px;
  color: var(--muted);
  font-size: 11px;
}

.secondary-button,
.primary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 10px;
  font-weight: 720;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--teal-600);
  color: var(--teal-700);
}

.primary-button {
  border: 1px solid var(--teal-700);
  background: var(--teal-700);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 107, 120, 0.18);
}

.primary-button:hover:not(:disabled) {
  border-color: var(--navy-800);
  background: var(--navy-800);
  box-shadow: 0 10px 24px rgba(11, 34, 57, 0.22);
}

.primary-button:disabled,
.secondary-button:disabled,
.copy-button:disabled {
  opacity: 0.48;
}

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

.target-card {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 238px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.target-card:hover:not(.is-disabled) {
  border-color: var(--teal-600);
}

.target-card.is-selected {
  border-color: var(--teal-600);
  background: color-mix(in srgb, var(--teal-100) 38%, var(--panel));
  box-shadow: inset 3px 0 0 var(--teal-600);
}

.target-card.is-review:not(.is-selected) {
  border-color: color-mix(in srgb, var(--amber-500) 68%, var(--line));
  background: color-mix(in srgb, var(--amber-100) 30%, var(--panel));
}

.target-card.is-disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

.target-card input {
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  accent-color: var(--teal-700);
}

.target-card code,
.target-card strong,
.target-card small,
.target-card em {
  display: block;
}

.target-source-panel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
}

.target-source-heading {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.target-source-panel ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.target-source-panel li {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1.2fr);
  gap: 10px;
  align-items: center;
}

.target-source-copy {
  min-width: 0;
}

.target-card .target-source-table {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 9px;
}

.target-source-copy > span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-source-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.target-source-status > span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.target-source-status > .is-pass {
  border-color: color-mix(in srgb, var(--green-700) 26%, var(--line));
  background: var(--green-100);
  color: var(--green-700);
}

.target-source-status > .is-fail {
  border-color: color-mix(in srgb, var(--red-700) 28%, var(--line));
  background: var(--red-100);
  color: var(--red-700);
}

.target-source-status b {
  font-size: 9px;
  line-height: 1;
}

.target-card code {
  margin-bottom: 5px;
  color: var(--teal-700);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.target-card strong {
  font-size: 14px;
}

.target-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.target-card em {
  margin-top: 10px;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.target-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.target-state span {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.target-card.is-disabled .target-state span {
  background: var(--red-100);
  color: var(--red-700);
}

.target-card.is-review .target-state span {
  background: var(--amber-100);
  color: var(--amber-700);
}

.target-state b {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.run-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 22px 24px;
  border: 1px solid #31576c;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 90% 0, rgba(128, 207, 216, 0.13), transparent 18rem),
    var(--navy-900);
  color: #f2f8fb;
  box-shadow: var(--shadow);
}

.run-console .eyebrow {
  color: #80cfd8;
}

.run-console h2 {
  margin: 0;
  font-size: 20px;
}

.run-console p {
  max-width: 720px;
  margin: 7px 0 0;
  color: #aac0ce;
  font-size: 11px;
}

.confirm-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  color: #d9e8ef;
  font-size: 11px;
  font-weight: 650;
}

.confirm-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #80cfd8;
}

.run-actions {
  display: grid;
  justify-items: end;
  gap: 9px;
}

.run-actions > span {
  color: #aac0ce;
  font-size: 10px;
}

.run-actions .primary-button {
  min-width: 202px;
  border-color: #80cfd8;
  background: #80cfd8;
  color: var(--navy-950);
}

.run-actions .primary-button:hover:not(:disabled) {
  border-color: #ffffff;
  background: #ffffff;
}

.results-section {
  min-width: 0;
  box-shadow: 0 20px 60px rgba(15, 107, 120, 0.12);
}

.run-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 0;
}

.run-stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--soft) 42%, var(--panel));
}

.run-stat span,
.run-stat strong {
  display: block;
}

.run-stat span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.run-stat strong {
  margin-top: 5px;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin-top: 18px;
  padding: 0 0 3px;
  scrollbar-width: thin;
}

.result-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px 10px 4px 4px;
  background: var(--panel);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 750;
}

.result-tab[aria-selected="true"] {
  border-color: var(--teal-600);
  background: var(--teal-100);
  color: var(--teal-700);
}

.table-panel {
  min-width: 0;
  max-width: 100%;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--soft) 48%, var(--panel));
}

.table-toolbar strong,
.table-toolbar span {
  display: block;
}

.table-toolbar strong {
  font-size: 12px;
}

.table-toolbar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.table-toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.table-toolbar-actions .primary-button,
.table-toolbar-actions .secondary-button {
  min-height: 38px;
  padding-block: 7px;
  font-size: 10px;
}

.table-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  background: var(--panel);
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--soft) 65%, var(--panel));
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--teal-100) 22%, transparent);
}

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

.cell-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 650;
}

.match-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 9px;
  font-weight: 800;
}

.match-chip.is-mismatch {
  background: var(--red-100);
  color: var(--red-700);
}

.result-notification {
  display: grid;
  gap: 3px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--amber-500) 62%, var(--line));
  border-radius: 12px;
  color: var(--amber-700);
  background: color-mix(in srgb, var(--amber-100) 72%, var(--panel));
}

.result-notification strong,
.result-notification span {
  display: block;
}

.result-notification strong {
  font-size: 12px;
}

.result-notification span {
  font-size: 10px;
  line-height: 1.5;
}

.result-notification.is-error {
  border-color: color-mix(in srgb, var(--red-700) 62%, var(--line));
  color: var(--red-700);
  background: color-mix(in srgb, var(--red-100) 72%, var(--panel));
}

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

.source-mode-panel,
.manual-csv-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.source-mode-panel {
  display: grid;
  gap: 15px;
  padding: clamp(22px, 3vw, 30px);
}

.source-mode-panel h2,
.manual-csv-panel h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: -0.035em;
}

.source-mode-intro {
  max-width: 780px;
  margin: -5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.source-mode-live {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--teal-100);
  color: var(--teal-700);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.source-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.source-mode-option {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: color-mix(in srgb, var(--soft) 35%, var(--panel));
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.source-mode-option:hover {
  border-color: color-mix(in srgb, var(--teal-600) 55%, var(--line));
  transform: translateY(-1px);
}

.source-mode-option:has(input:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--teal-600) 28%, transparent);
  outline-offset: 2px;
}

.source-mode-option:has(input:checked) {
  border-color: var(--teal-600);
  background: color-mix(in srgb, var(--teal-100) 48%, var(--panel));
  box-shadow: inset 4px 0 0 var(--teal-600);
}

.source-mode-option > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.source-option-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 13px;
  background: var(--teal-100);
  color: var(--teal-700);
}

.source-option-icon.is-csv {
  background: var(--amber-100);
  color: var(--amber-700);
}

.source-option-icon svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.source-option-copy small,
.source-option-copy strong,
.source-option-copy em {
  display: block;
}

.source-option-copy small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.source-option-copy strong {
  margin-top: 3px;
  font-size: 13px;
}

.source-option-copy em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.source-option-state {
  min-width: 62px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 8px;
  font-weight: 850;
  text-align: center;
}

.source-mode-option:has(input:checked) .source-option-state {
  background: var(--green-100);
  color: var(--green-700);
}

.manual-csv-panel {
  display: grid;
  gap: 20px;
  padding: clamp(22px, 3vw, 30px);
}

.manual-csv-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.manual-csv-heading p:last-child {
  max-width: 700px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.manual-upload-summary {
  display: grid;
  min-width: 118px;
  justify-items: end;
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--soft);
}

.manual-upload-summary strong {
  color: var(--ink);
  font-size: 15px;
}

.manual-upload-summary span {
  color: var(--muted);
  font-size: 8px;
}

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

.manual-file-card {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--soft) 42%, var(--panel));
}

.manual-file-card.is-ready {
  border-color: color-mix(in srgb, var(--green-700) 35%, var(--line));
  background: color-mix(in srgb, var(--green-100) 30%, var(--panel));
}

.manual-file-card.is-error {
  border-color: color-mix(in srgb, var(--red-700) 35%, var(--line));
  background: color-mix(in srgb, var(--red-100) 24%, var(--panel));
}

.manual-file-title {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.manual-file-title > span {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 8px;
  background: var(--panel);
  color: var(--teal-700);
  font-size: 8px;
  font-weight: 850;
}

.manual-file-title code,
.manual-file-title strong {
  display: block;
}

.manual-file-title code {
  overflow: hidden;
  color: var(--teal-700);
  font-size: 10px;
  font-weight: 850;
  text-overflow: ellipsis;
}

.manual-file-title strong {
  margin-top: 2px;
  font-size: 11px;
}

.manual-file-card > p {
  min-height: 30px;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.manual-file-evidence {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 8px 9px;
  border-radius: 10px;
  background: var(--panel);
}

.manual-file-mark {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.manual-file-card.is-ready .manual-file-mark {
  background: var(--green-100);
  color: var(--green-700);
}

.manual-file-card.is-error .manual-file-mark {
  background: var(--red-100);
  color: var(--red-700);
}

.manual-file-evidence strong,
.manual-file-evidence small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-file-evidence strong {
  font-size: 9px;
}

.manual-file-evidence small {
  margin-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
}

.manual-file-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.manual-file-actions label.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.manual-file-remove {
  color: var(--red-700);
}

.manual-privacy-note {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--teal-600) 30%, var(--line));
  border-radius: 13px;
  background: color-mix(in srgb, var(--teal-100) 34%, var(--panel));
}

.manual-privacy-note > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: var(--panel);
  color: var(--teal-700);
  font-weight: 900;
}

.manual-privacy-note strong {
  display: block;
  font-size: 10px;
}

.manual-privacy-note p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 8px;
}

.database-managed-note {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--soft);
}

.database-managed-note strong,
.database-managed-note span {
  display: block;
}

.database-managed-note strong {
  font-size: 11px;
}

.database-managed-note span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.connection-page {
  --connection-ink: #0c2c44;
}

html[data-theme="dark"] .connection-page {
  --connection-ink: #e9f6f8;
}

.connection-hero,
.connection-form,
.active-connection-card,
.schema-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.connection-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(520px, 1.35fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  overflow: hidden;
  padding: clamp(26px, 4vw, 44px);
  background:
    linear-gradient(112deg, color-mix(in srgb, var(--teal-100) 72%, var(--panel)), var(--panel) 55%);
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 22px -6px;
  padding: 5px 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.back-button:hover {
  color: var(--teal-700);
}

.connection-hero h2 {
  max-width: 490px;
  margin: 4px 0 10px;
  color: var(--connection-ink);
  font-size: clamp(26px, 3.3vw, 43px);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1.16;
}

.connection-hero-copy > p:last-child {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.connection-route {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(66px, 0.55fr) minmax(120px, 1fr) minmax(48px, 0.4fr) minmax(120px, 1fr);
  align-items: center;
}

.route-node {
  position: relative;
  display: grid;
  min-height: 126px;
  align-content: center;
  justify-items: center;
  padding: 17px 12px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 76%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  text-align: center;
}

.route-node > span {
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 11px;
  place-items: center;
  border-radius: 12px;
  background: var(--soft);
  color: var(--teal-700);
}

.route-node.is-database > span {
  background: var(--teal-100);
}

.route-node small,
.route-node strong {
  display: block;
  max-width: 100%;
}

.route-node small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.route-node strong {
  overflow: hidden;
  margin-top: 4px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-link {
  display: grid;
  grid-template-columns: minmax(8px, 1fr) auto minmax(8px, 1fr);
  align-items: center;
  color: var(--teal-700);
}

.route-link i {
  height: 1px;
  background: color-mix(in srgb, var(--teal-600) 42%, var(--line));
}

.route-link b {
  padding: 0 5px;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.connection-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.connection-form {
  display: grid;
  gap: 20px;
  padding: clamp(22px, 3vw, 32px);
}

.connection-form h3,
.schema-card h3 {
  margin: 2px 0 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.connection-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(120px, 0.7fr);
  gap: 16px;
}

.connection-field {
  display: block;
  min-width: 0;
}

.connection-field.is-wide {
  grid-column: 1 / -1;
}

.connection-field > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 720;
}

.connection-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.connection-field input:focus {
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal-600) 14%, transparent);
}

.connection-field small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 62px;
}

.password-control button {
  position: absolute;
  top: 6px;
  right: 6px;
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: var(--soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.connection-test-result {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--soft) 62%, transparent);
}

.connection-test-result.is-passed {
  border-style: solid;
  border-color: #9acfb9;
  background: var(--green-100);
  color: var(--green-700);
}

.connection-test-result.is-warning {
  border-style: solid;
  border-color: color-mix(in srgb, var(--amber-500, #d49b2b) 72%, var(--line));
  background: color-mix(in srgb, #d49b2b 15%, var(--panel));
  color: var(--amber-700, #b57600);
}

.connection-test-result.is-failed {
  border-style: solid;
  border-color: #e7aaa5;
  background: var(--red-100);
  color: var(--red-700);
}

.test-result-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  font-size: 13px;
  font-weight: 850;
}

.connection-test-result strong,
.connection-test-result span {
  display: block;
}

.connection-test-result strong {
  font-size: 11px;
}

.connection-test-result span {
  margin-top: 2px;
  color: color-mix(in srgb, currentColor 78%, var(--muted));
  font-size: 9px;
}

.connection-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.connection-save-note {
  margin: -9px 0 0;
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.connection-side {
  display: grid;
  gap: 14px;
}

.active-connection-card,
.schema-card {
  padding: 20px;
  box-shadow: none;
}

.active-connection-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 17px;
}

.active-connection-heading .connection-dot {
  border-color: var(--line-strong);
}

.active-connection-heading small,
.active-connection-heading strong {
  display: block;
}

.active-connection-heading small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.active-connection-heading strong {
  margin-top: 2px;
  font-size: 13px;
}

.active-connection-card dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.active-connection-card dl > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.active-connection-card dt,
.active-connection-card dd {
  margin: 0;
  font-size: 10px;
}

.active-connection-card dt {
  color: var(--muted);
}

.active-connection-card dd {
  overflow: hidden;
  font-weight: 700;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-token {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 8px;
  font-weight: 850;
}

.schema-card ul {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.schema-card li {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  border-radius: 9px;
  background: var(--soft);
}

.schema-card li > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.schema-card li.is-ready > span {
  background: var(--green-100);
  color: var(--green-700);
}

.schema-card li.is-missing > span {
  background: var(--red-100);
  color: var(--red-700);
}

.schema-card li strong,
.schema-card li small {
  display: block;
}

.schema-card li strong {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.schema-card li small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 8px;
}

.connection-warning,
.connection-pending {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 9px;
}

.connection-warning {
  border: 1px solid #e5c885;
  background: var(--amber-100);
  color: var(--amber-700);
}

.connection-pending {
  border: 1px solid #9acfb9;
  background: var(--green-100);
  color: var(--green-700);
}

.connection-warning strong,
.connection-pending strong {
  font-size: 10px;
}

.preflight-dialog {
  width: min(1180px, calc(100% - 32px));
  max-height: min(850px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.3);
}

.preflight-dialog::backdrop {
  background: rgba(7, 25, 43, 0.76);
  backdrop-filter: blur(5px);
}

.preflight-dialog-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(220px, 1fr) auto;
  max-height: min(850px, calc(100vh - 32px));
}

.preflight-dialog-shell > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}

.preflight-dialog-shell h2 {
  margin: 2px 0 4px;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.preflight-dialog-shell header p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.preflight-dialog-shell header .icon-button {
  flex: 0 0 auto;
  font-size: 21px;
  line-height: 1;
}

.issue-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 14px 26px 0;
}

.issue-scope span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.issue-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 26px;
}

.issue-table-toolbar strong,
.issue-table-toolbar span {
  display: block;
}

.issue-table-toolbar strong {
  font-size: 13px;
}

.issue-table-toolbar span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.issue-table-scroll {
  min-height: 220px;
  overflow: auto;
  border-block: 1px solid var(--line);
}

.issue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9px;
}

.issue-table th,
.issue-table td {
  min-width: 150px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.issue-table th:first-child,
.issue-table td:first-child {
  min-width: 330px;
}

.issue-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--navy-900);
  color: #edf7fa;
  font-size: 8px;
  letter-spacing: 0.04em;
}

.issue-table td code {
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
}

.issue-person {
  display: grid;
  gap: 0.35rem;
  min-width: 18rem;
}

.issue-person strong {
  color: var(--text-strong);
  font-weight: 800;
}

.issue-person span {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.issue-loading-cell,
.issue-error-cell {
  padding: 36px !important;
  color: var(--muted);
  text-align: center !important;
}

.issue-error-cell {
  color: var(--red-700);
}

.preflight-dialog-shell > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 26px;
}

.preflight-dialog-shell > footer > span {
  color: var(--muted);
  font-size: 9px;
}

.preflight-dialog-shell > footer > div {
  display: flex;
  gap: 8px;
}

.login-dialog {
  width: min(450px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.28);
}

.login-dialog::backdrop {
  background: rgba(7, 25, 43, 0.74);
  backdrop-filter: blur(6px);
}

.login-dialog form {
  display: grid;
  gap: 14px;
  padding: 26px;
}

.dialog-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.dialog-brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.dialog-brand h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.login-dialog form > p:not(.form-error) {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
}

.login-dialog label span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
}

.login-dialog input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
}

.full-button {
  width: 100%;
  margin-top: 2px;
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--red-100);
  color: var(--red-700);
  font-size: 10px;
  font-weight: 650;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 650;
  animation: toast-in 180ms ease both;
}

.toast.is-error {
  border-color: #e7aaa5;
  background: var(--red-100);
  color: var(--red-700);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

[hidden] {
  display: none !important;
}

@media (max-width: 1100px) {
  :root { --rail-width: 240px; }
  .side-rail { padding-inline: 16px; }
  .brand-name { font-size: 16px; }
  .source-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connection-hero { grid-template-columns: 1fr; }
  .connection-layout { grid-template-columns: minmax(0, 1fr) 280px; }
}

@media (max-width: 860px) {
  .app-shell { display: block; }
  .side-rail {
    position: static;
    width: 100%;
    min-height: auto;
    overflow: visible;
    padding: 15px 18px;
  }
  .rail-footer { display: none; }
  .rail-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-left: auto;
  }
  .rail-menu-item { width: auto; min-height: 52px; padding: 7px 9px; }
  .rail-menu-item > span { width: 34px; height: 34px; }
  .rail-menu-item small { display: none; }
  .workspace { width: 100%; }
  .topbar { position: static; min-height: 76px; padding: 14px 18px; }
  .module-switcher { width: min(100% - 28px, 760px); margin-top: 14px; }
  .module-switch-card { grid-template-columns: 46px minmax(0, 1fr); min-height: 82px; padding: 12px; }
  .module-switch-number { width: 46px; height: 46px; }
  .module-switch-state { grid-column: 2; justify-self: start; padding: 3px 7px; }
  main { width: min(100% - 28px, 760px); padding-top: 18px; }
  .control-grid { grid-template-columns: 1fr 1fr; }
  .target-grid { grid-template-columns: 1fr; }
  .run-console { grid-template-columns: 1fr; }
  .run-actions { justify-items: stretch; }
  .run-actions > span { text-align: left; }
  .run-actions .primary-button { width: 100%; }
  .source-mode-switch { grid-template-columns: 1fr; }
  .manual-file-grid { grid-template-columns: 1fr; }
  .connection-layout { grid-template-columns: 1fr; }
  .connection-side { grid-template-columns: 1fr 1fr; }
  .connection-warning,
  .connection-pending { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .side-rail { gap: 12px; padding-inline: 14px; }
  .brand-lockup img { width: 44px; height: 44px; }
  .brand-name { font-size: 15px; }
  .rail-menu { width: 100%; margin-left: 0; gap: 5px; }
  .rail-menu-item { min-height: 46px; justify-content: center; padding: 5px; }
  .rail-menu-item > span { width: 32px; height: 32px; }
  .rail-menu-item > div { display: none; }
  .topbar { align-items: flex-start; }
  .topbar .eyebrow { display: none; }
  .topbar h1 { font-size: 18px; }
  .module-switcher { grid-template-columns: 1fr; gap: 7px; padding: 8px; }
  .module-switch-flow { min-height: 20px; grid-auto-flow: column; gap: 7px; }
  .module-switch-flow b { transform: rotate(90deg); }
  .module-switch-flow small { margin-top: 0; }
  .module-switch-detail { white-space: normal; }
  .user-chip { display: none !important; }
  .text-button { display: none !important; }
  .control-grid { grid-template-columns: 1fr; padding: 18px; }
  .section-heading { align-items: flex-start; }
  .section-heading .secondary-button { min-height: 36px; padding: 7px 9px; }
  .read-only-pill { display: none; }
  .readiness-section,
  .target-section,
  .results-section { padding: 18px; }
  .source-metrics,
  .check-list,
  .run-overview { grid-template-columns: 1fr; }
  .section-note { margin-left: 0; }
  .target-card { grid-template-columns: 25px minmax(0, 1fr); }
  .target-state { grid-column: 2; align-items: flex-start; }
  .target-source-panel li { grid-template-columns: 1fr; gap: 5px; }
  .target-source-status { justify-content: flex-start; }
  .run-console { padding: 19px; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .table-toolbar-actions { width: 100%; }
  .table-toolbar-actions .primary-button,
  .table-toolbar-actions .secondary-button { flex: 1; }
  .source-mode-panel,
  .manual-csv-panel { padding: 18px; }
  .source-mode-option { grid-template-columns: 42px minmax(0, 1fr); }
  .source-option-state { grid-column: 2; justify-self: start; }
  .manual-csv-heading { flex-direction: column; }
  .manual-upload-summary { width: 100%; justify-items: start; }
  .manual-file-remove:not([hidden]) { display: inline-flex !important; }
  .manual-privacy-note { grid-template-columns: 32px minmax(0, 1fr); }
  .manual-privacy-note .primary-button { grid-column: 1 / -1; width: 100%; }
  .connection-hero { padding: 22px 18px; }
  .connection-route { grid-template-columns: 1fr; gap: 8px; }
  .route-node { min-height: 96px; }
  .route-link { grid-template-columns: 1fr; justify-items: center; min-height: 20px; }
  .route-link i { width: 1px; height: 8px; }
  .route-link b { padding: 3px 0; }
  .connection-fields { grid-template-columns: 1fr; }
  .connection-field.is-wide { grid-column: auto; }
  .connection-actions { flex-direction: column; }
  .connection-actions button { width: 100%; }
  .connection-save-note { text-align: left; }
  .connection-side { grid-template-columns: 1fr; }
  .issue-preview-row { grid-template-columns: 1fr; }
  .issue-preview-row span { text-align: left; }
  .preflight-dialog { width: calc(100% - 16px); max-height: calc(100vh - 16px); }
  .preflight-dialog-shell { max-height: calc(100vh - 16px); }
  .preflight-dialog-shell > header,
  .issue-table-toolbar,
  .preflight-dialog-shell > footer { padding-inline: 16px; }
  .issue-scope { padding-inline: 16px; }
  .issue-table-toolbar { align-items: stretch; flex-direction: column; }
  .issue-table-toolbar .secondary-button { width: 100%; }
}

@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;
  }
}

/* 2026-09 · NNET-only workspace renovation */
:root {
  --source-blue: #2f7ed8;
  --adapter-cyan: #24a6b6;
  --rule-amber: #d9a441;
  --module-one-teal: #1b9aaa;
  --module-two-violet: #8a78d6;
}

.pipeline-map {
  width: min(1220px, calc(100% - 40px));
  margin: 18px auto 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 10px 32px rgba(7, 25, 43, 0.06);
  overflow: hidden;
}

.pipeline-map ol {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline-step {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-height: 78px;
  padding: 15px 16px;
  align-items: center;
  border-right: 1px solid var(--line);
}

.pipeline-step:last-child { border-right: 0; }

.pipeline-step::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--line-strong);
}

.pipeline-step[data-state="ready"]::after { background: var(--green-700); }
.pipeline-step[data-state="attention"]::after { background: var(--rule-amber); }
.pipeline-step[data-state="current"]::after { background: var(--module-one-teal); }
.statistics-shell .pipeline-step[data-state="current"]::after { background: var(--module-two-violet); }

.pipeline-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  background: var(--soft);
  font: 700 12px/1 "IBM Plex Mono", ui-monospace, monospace;
}

.pipeline-step[data-state="ready"] .pipeline-index {
  color: var(--green-700);
  border-color: color-mix(in srgb, var(--green-700) 50%, var(--line));
  background: var(--green-100);
}

.pipeline-step[data-state="attention"] .pipeline-index {
  color: var(--amber-700);
  border-color: color-mix(in srgb, var(--amber-500) 60%, var(--line));
  background: var(--amber-100);
}

.pipeline-step[data-state="current"] .pipeline-index {
  color: white;
  border-color: var(--module-one-teal);
  background: var(--module-one-teal);
}

.statistics-shell .pipeline-step[data-state="current"] .pipeline-index {
  border-color: var(--module-two-violet);
  background: var(--module-two-violet);
}

.pipeline-step > span:last-child { min-width: 0; }
.pipeline-step strong,
.pipeline-step small { display: block; }
.pipeline-step strong { font-size: 13px; line-height: 1.35; }
.pipeline-step small { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }

.first-run-hero {
  position: relative;
  display: grid;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--teal-600) 46%, var(--line));
  border-radius: 24px;
  background-color: var(--panel);
  background-image:
    linear-gradient(color-mix(in srgb, var(--teal-600) 6%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--teal-600) 6%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
  box-shadow: var(--shadow);
}

.first-run-hero {
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
  gap: clamp(28px, 5vw, 64px);
  padding: clamp(26px, 4vw, 48px);
  align-items: center;
}

.first-run-copy { position: relative; z-index: 1; }
.first-run-copy h2 {
  max-width: 760px;
  margin: 5px 0 12px;
  font-size: clamp(25px, 3vw, 40px);
  line-height: 1.24;
  letter-spacing: -.02em;
}

.first-run-copy > p:not(.eyebrow) {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.first-run-copy code {
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--teal-600);
  background: var(--teal-100);
  font-weight: 800;
}

.hero-action {
  width: fit-content;
  margin-top: 22px;
  text-decoration: none;
}

.first-run-checklist {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.first-run-checklist li {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 67px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--soft) 88%, transparent);
}

.first-run-checklist li > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--teal-600);
  background: var(--teal-100);
  font-weight: 850;
}

.first-run-checklist strong,
.first-run-checklist small { display: block; }
.first-run-checklist strong { font-size: 14px; }
.first-run-checklist small { margin-top: 2px; color: var(--muted); font-size: 12px; }

.legacy-source-controls[hidden] { display: none !important; }

.connection-layout { align-items: start; }
.connection-side { align-content: start; }
.schema-card { min-width: 0; }
.schema-card h3 { margin-top: 3px; }
.schema-card ul { max-height: 430px; overflow: auto; scrollbar-gutter: stable; }
.schema-card li { align-items: start; }
.schema-card li small { line-height: 1.45; overflow-wrap: anywhere; }

.nnet-preflight-card { border-top: 3px solid var(--rule-amber); }
.nnet-adapter-card { border-top: 3px solid var(--adapter-cyan); }
.nnet-adapter-card ul { max-height: none; }

.nnet-preflight-card li.is-missing {
  background: color-mix(in srgb, var(--amber-100) 45%, transparent);
}

.nnet-preflight-card li.is-missing > span {
  color: var(--amber-700);
  background: var(--amber-100);
}

@media (max-width: 1100px) {
  .pipeline-map { overflow-x: auto; }
  .pipeline-map ol { min-width: 880px; }
  .first-run-hero { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .pipeline-map { width: min(100% - 28px, 760px); margin-top: 14px; }
  .first-run-hero { gap: 24px; padding: 26px; }
}

@media (max-width: 600px) {
  .pipeline-map ol {
    min-width: 760px;
    grid-template-columns: repeat(5, 152px);
  }
  .pipeline-step { min-height: 70px; padding: 12px; }
  .first-run-hero { border-radius: 18px; padding: 20px 18px; }
  .first-run-copy h2 { font-size: 24px; }
  .first-run-copy > p:not(.eyebrow) { font-size: 14px; }
  .hero-action { width: 100%; }
  .first-run-checklist li { padding: 10px; }
  .schema-card ul { max-height: 360px; }
}
