:root {
  --bg: #0B1220;
  --surface: #101A2E;
  --surface-raised: #16223A;
  --grid-line: #1E2A42;
  --border: #24324E;
  --amber: #E8A33D;
  --amber-dim: #7A5A24;
  --cyan: #4FD1C5;
  --red: #E5484D;
  --text: #E4E9F2;
  --text-muted: #7C8AA5;
  --text-faint: #4C5A78;
  --font-display: 'IBM Plex Sans Condensed', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.frame { max-width: 1040px; margin: 0 auto; padding: 0 24px 64px; }

/* --- Top bar ------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.brand-mark { color: var(--amber); font-size: 22px; line-height: 1; }
.brand-text { display: flex; flex-direction: column; }
.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 15px;
}
.brand-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 0.03em; }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.topbar-nav a:hover { color: var(--text); background: var(--surface-raised); }
.topbar-nav a.active { color: var(--bg); background: var(--amber); font-weight: 600; }

/* --- Status chips ---------------------------------------------------- */
.status-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; }
.status-chip {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 7px 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}
.status-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.status-chip.ok { color: var(--cyan); border-color: rgba(79,209,197,0.3); }
.status-chip.ok .dot { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.status-chip.warn { color: var(--amber); border-color: rgba(232,163,61,0.3); }
.status-chip.warn .dot { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status-chip.muted .dot { background: var(--text-faint); }

/* --- Pipeline schematic ----------------------------------------------- */
.pipeline-schematic {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 28px 20px;
  margin-bottom: 32px;
}
.pipe-stage { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.pipe-icon {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  width: 34px; height: 34px;
  border: 1px solid var(--amber-dim);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.pipe-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.06em;
}
.pipe-desc { font-size: 11px; color: var(--text-muted); max-width: 130px; }
.pipe-connector { flex: 0 0 48px; display: flex; align-items: center; margin-top: 17px; position: relative; }
.pipe-connector::before {
  content: "";
  width: 100%; height: 0;
  border-top: 1px dashed var(--border);
}
.pipe-flow {
  position: absolute; left: 0; top: -2px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: flow 2.4s linear infinite;
}
@keyframes flow { from { left: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } to { left: calc(100% - 4px); opacity: 0; } }

/* --- Run panel ---------------------------------------------------------- */
.run-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.run-panel-head h2 {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.03em;
  margin: 0;
  color: var(--text);
}
.hint { color: var(--text-muted); font-size: 13px; margin: -8px 0 20px; }

.btn-primary {
  background: var(--amber);
  color: #1A1002;
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.btn-primary:hover { background: #f0ae4d; }
.btn-primary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.run-list { display: flex; flex-direction: column; gap: 10px; }
.run-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-faint);
  border-radius: 4px;
  padding: 14px 16px;
}
.run-card.success { border-left-color: var(--cyan); }
.run-card.noop { border-left-color: var(--text-faint); }
.run-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.run-form-id { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.run-badge { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 3px; }
.run-badge.success { color: var(--cyan); background: rgba(79,209,197,0.1); }
.run-badge.noop { color: var(--text-muted); background: rgba(124,138,165,0.1); }

.step-trace { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; gap: 10px; font-size: 12px; align-items: baseline; }
.step-name { font-family: var(--font-mono); width: 130px; flex-shrink: 0; color: var(--text-faint); }
.step-detail { color: var(--text-muted); }
.step-ok .step-name { color: var(--cyan); }
.step-skipped .step-name { color: var(--amber); }
.step-failed .step-name { color: var(--red); }

/* --- Mapping table ------------------------------------------------------- */
.mapping-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.mapping-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.mapping-table td { padding: 6px; border-bottom: 1px solid var(--grid-line); }
.mapping-table input {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 3px;
}
.mapping-table input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }

@media (max-width: 640px) {
  .pipeline-schematic { flex-direction: column; }
  .pipe-connector { width: 1px; height: 24px; margin: 0 auto; }
  .pipe-connector::before { border-top: none; border-left: 1px dashed var(--border); height: 100%; width: 0; margin: 0 auto; }
}

/* ==========================================================================
   Landing page
   ========================================================================== */

.landing-body { min-height: 100vh; background: var(--bg) !important; }

.l-topbar { border-bottom: 1px solid var(--border); }
.l-topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 22px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.l-topbar-inner .topbar-nav a { color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 500; padding: 8px 14px; }
.l-topbar-inner .topbar-nav a:hover { color: var(--text); }
.l-nav-cta {
  border: 1px solid var(--amber-dim);
  border-radius: 4px;
  color: var(--amber) !important;
}
.l-nav-cta:hover { background: rgba(232,163,61,0.08); }

.l-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--cyan);
  margin: 0 0 18px;
}

/* --- Hero ------------------------------------------------------------- */
.l-hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 72px 24px 96px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px;
}
.l-hero-inner { max-width: 640px; }
.l-headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
  color: var(--text);
}
.l-subhead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 0 32px;
}
.l-cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.btn-lg { padding: 13px 24px; font-size: 14px; }
.btn-ghost {
  display: inline-flex; align-items: center;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 13px 24px;
  border-radius: 4px;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.btn-ghost:hover { border-color: var(--text-faint); background: var(--surface-raised); }
a.btn-primary { text-decoration: none; display: inline-flex; align-items: center; }
.l-hero-note { font-size: 12.5px; color: var(--text-faint); font-family: var(--font-mono); }
.l-hero-note strong { color: var(--cyan); font-weight: 500; }

.l-hero-visual {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px 28px;
}
.l-pipe { display: flex; align-items: stretch; }
.l-pipe-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.l-pipe-stage.in { opacity: 1; transform: translateY(0); }
.l-pipe-stage .pipe-icon { width: 40px; height: 40px; font-size: 12px; }
.l-pipe-stage .pipe-label { font-size: 13px; }
.l-pipe-stage .pipe-desc { max-width: 150px; }
.l-pipe-connector { flex: 0 0 40px; display: flex; align-items: center; margin-top: 20px; position: relative; }
.l-pipe-connector::before { content: ""; width: 100%; height: 0; border-top: 1px dashed var(--border); }

/* --- Stat strip --------------------------------------------------------- */
.l-stats { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.l-stats-inner {
  max-width: 1120px; margin: 0 auto; padding: 40px 24px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px;
}
.l-stat { display: flex; flex-direction: column; gap: 6px; }
.l-stat-num { font-family: var(--font-display); font-weight: 700; font-size: 34px; color: var(--amber); line-height: 1; }
.l-stat-label { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); letter-spacing: 0.02em; line-height: 1.5; }

/* --- Example rule ------------------------------------------------------- */
.l-example { max-width: 1120px; margin: 0 auto; padding: 96px 24px; }
.l-example-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.l-h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.25;
  color: var(--text);
  margin: 0 0 16px;
}
.l-body { font-size: 15px; line-height: 1.65; color: var(--text-muted); max-width: 460px; }
.l-example-code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.l-code-head {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--text-faint);
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-raised);
}
.l-code {
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: var(--cyan);
  margin: 0; padding: 20px; overflow-x: auto;
}

/* --- CTA band ------------------------------------------------------------ */
.l-ctaband {
  max-width: 720px; margin: 0 auto; padding: 40px 24px 120px;
  text-align: center;
}
.l-ctaband .l-h2 { font-size: 30px; }
.l-ctaband .l-body { margin: 0 auto 28px; }

/* --- Footer ---------------------------------------------------------- */
.l-footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  display: flex; align-items: center; gap: 10px; justify-content: center;
  font-size: 12px; color: var(--text-faint);
}
.l-footer .brand-mark { color: var(--amber); font-size: 14px; }

@media (min-width: 900px) {
  .l-hero { grid-template-columns: 1fr 1fr; align-items: center; }
}
@media (max-width: 700px) {
  .l-example-inner { grid-template-columns: 1fr; }
  .l-stats-inner { grid-template-columns: 1fr; gap: 24px; }
  .l-pipe { flex-direction: column; }
  .l-pipe-connector { width: 1px; height: 24px; margin: 0 auto; }
  .l-pipe-connector::before { border-top: none; border-left: 1px dashed var(--border); height: 100%; width: 0; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .l-pipe-stage { transition: none; opacity: 1; transform: none; }
  .pipe-flow { animation: none; }
}

/* ==========================================================================
   Landing page — white / dark-blue / light-blue palette
   (scoped to .landing-body only; console + mapping keep the dark theme)
   ========================================================================== */

.landing-body {
  --bg: #FFFFFF;
  --surface: #F3F8FC;
  --surface-raised: #E7F1FA;
  --grid-line: #EAF2FA;
  --border: #D6E5F2;
  --amber: #0B4C8C;        /* dark blue — primary accent / CTA */
  --amber-dim: #B7D6EE;    /* light blue-grey — borders/dividers */
  --cyan: #2E9BE0;         /* light blue — secondary accent */
  --red: #C4453D;
  --text: #0B2545;
  --text-muted: #4B647C;
  --text-faint: #8098AE;
}

.landing-body .btn-primary { color: #FFFFFF; }
.landing-body .btn-primary:hover { background: #0E5CA6; }
.landing-body .l-nav-cta { border-color: var(--amber-dim); }
.landing-body .l-nav-cta:hover { background: rgba(11,76,140,0.06); }
.landing-body .btn-ghost { color: var(--text); border-color: var(--border); }
.landing-body .btn-ghost:hover { background: var(--surface-raised); border-color: var(--amber-dim); }

/* Replace the circular "checkbox" numeral badge with a plain underlined number */
.l-pipe-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  color: var(--cyan);
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 2px solid var(--amber);
  display: inline-block;
}

.landing-body .l-example-code { border-color: var(--border); }
.landing-body .l-code { color: var(--amber); }
.landing-body .l-code-head { color: var(--text-faint); }
.landing-body .l-footer { color: var(--text-faint); border-color: var(--border); }
.landing-body .l-hero-visual { box-shadow: 0 1px 3px rgba(11,37,69,0.06); }
.landing-body .l-stats { box-shadow: inset 0 1px 0 var(--border), inset 0 -1px 0 var(--border); }

/* --- Full footer (landing) ------------------------------------------- */
.l-footer-full {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.l-footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 56px 24px 40px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
}
.l-footer-tagline {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 320px;
  margin: 16px 0 0;
}
.l-footer-col { display: flex; flex-direction: column; gap: 10px; }
.l-footer-heading {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.l-footer-col a {
  font-size: 13.5px;
  color: var(--text);
  text-decoration: none;
}
.l-footer-col a:hover { color: var(--amber); text-decoration: underline; }
.l-footer-static {
  font-size: 12.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.l-footer-bottom {
  max-width: 1120px; margin: 0 auto; padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-faint);
}

@media (max-width: 800px) {
  .l-footer-inner { grid-template-columns: 1fr 1fr; }
  .l-footer-bottom { flex-direction: column; gap: 6px; align-items: flex-start; }
}
@media (max-width: 520px) {
  .l-footer-inner { grid-template-columns: 1fr; }
}

/* --- Setup workflow timeline (landing) --------------------------------- */
.l-setup { max-width: 760px; margin: 0 auto; padding: 96px 24px; }
.l-setup .l-body { max-width: 560px; margin-bottom: 48px; }
.l-setup .l-body code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-raised); padding: 1px 6px; border-radius: 3px; }
.l-setup .l-body strong { color: var(--text); }

.l-timeline { list-style: none; margin: 0 0 40px; padding: 0; position: relative; }
.l-timeline::before {
  content: "";
  position: absolute;
  left: 20px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--border);
}
.l-tl-step {
  position: relative;
  display: flex;
  gap: 22px;
  padding-bottom: 36px;
  opacity: 0;
  transform: translateX(-14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.l-tl-step.in { opacity: 1; transform: translateX(0); }
.l-tl-step:last-child { padding-bottom: 0; }
.l-tl-num {
  position: relative;
  z-index: 1;
  flex: 0 0 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--amber-dim);
  color: var(--amber);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.l-tl-step.in .l-tl-num { background: var(--amber); color: #fff; border-color: var(--amber); transition: background 0.3s ease, color 0.3s ease; }
.l-tl-body h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 6px 0 6px;
}
.l-tl-body p { font-size: 14px; line-height: 1.6; color: var(--text-muted); margin: 0; max-width: 460px; }
.l-tl-body a { color: var(--amber); }
.l-tl-body code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-raised); padding: 1px 6px; border-radius: 3px; }

@media (prefers-reduced-motion: reduce) {
  .l-tl-step { transition: none; opacity: 1; transform: none; }
}

/* --- Login page (light theme) ------------------------------------------ */
.l-login { max-width: 560px; margin: 0 auto; padding: 72px 24px 96px; }
.l-login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px;
}
.l-login-h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--text);
  margin: 0 0 14px;
}
.l-login-input { width: 100%; margin-bottom: 4px; }
.l-login-callback { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.l-login-status { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* Setup-page form classes, reused here + on /select-project; colors pick
   up whichever palette the enclosing page (.landing-body vs dark console)
   has set via CSS variables. */
.setup-error {
  background: rgba(196,69,61,0.08);
  border: 1px solid rgba(196,69,61,0.3);
  color: var(--red);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 20px;
}
.setup-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 16px 0 6px;
  display: block;
}
.setup-input {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 4px;
}
.setup-input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.setup-note { font-size: 11.5px; color: var(--text-faint); margin: 6px 0 0; }
.setup-copy-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.setup-copy-row code {
  flex: 1;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 4px;
  overflow-x: auto;
  white-space: nowrap;
}
.setup-disconnect {
  background: none;
  border: 1px solid var(--border);
  color: var(--red);
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
}
.setup-disconnect:hover { background: rgba(196,69,61,0.06); border-color: rgba(196,69,61,0.4); }

/* --- Select-project page ------------------------------------------------- */
.l-selectproj { max-width: 760px; margin: 0 auto; padding: 72px 24px 96px; }
.l-hub-group { margin-bottom: 32px; }
.l-hub-heading {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.l-project-list { display: flex; flex-direction: column; gap: 10px; }
.l-project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  margin: 0;
}
.l-project-card.current { border-color: var(--amber); background: rgba(11,76,140,0.04); }
.l-project-info { display: flex; flex-direction: column; gap: 4px; }
.l-project-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--text); }
.l-project-id { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }

@media (max-width: 640px) {
  .l-login-card { padding: 24px; }
  .l-project-card { flex-direction: column; align-items: flex-start; }
}

/* --- Light-theme fixups for chips/badges whose tint was hardcoded to the
   old dark-theme teal/orange -- keeps console + mapping visually
   consistent with the landing/login palette now that they share it. */
.landing-body .status-chip.ok { border-color: rgba(46,155,224,0.35); }
.landing-body .status-chip.warn { border-color: rgba(11,76,140,0.3); }
.landing-body .run-badge.success { background: rgba(46,155,224,0.12); }
.landing-body .run-card.success { border-left-color: var(--cyan); }
