/* ═══════════════════════════════════════════════════════════════
   FACADE CLIMATE INTELLIGENCE
   Fonts: DM Serif Display · JetBrains Mono · Plus Jakarta Sans
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces */
  --bg:        #07101e;
  --bg-mid:    #0c1829;
  --surface:   #101f34;
  --card:      #132038;
  --card-hi:   #192847;

  /* Borders */
  --br:        rgba(255, 255, 255, 0.065);
  --br-mid:    rgba(255, 255, 255, 0.11);
  --br-hi:     rgba(255, 255, 255, 0.18);

  /* Text */
  --tx:        #ddeaf9;
  --tx-mid:    #7a93b4;
  --tx-dim:    #3a5270;

  /* Accent: engineering orange */
  --a:         #f97316;
  --a-dim:     rgba(249, 115, 22, 0.13);
  --a-glow:    rgba(249, 115, 22, 0.28);
  --a-deep:    #c95e0e;

  /* Data blue */
  --db:        #38bdf8;
  --db-dim:    rgba(56, 189, 248, 0.1);

  /* Risk palette */
  --r1: #22c55e;
  --r2: #84cc16;
  --r3: #eab308;
  --r4: #f97316;
  --r5: #ef4444;

  /* Radius */
  --rx-xl: 18px;
  --rx-lg: 13px;
  --rx-md:  9px;
  --rx-sm:  5px;

  /* Shadow */
  --sh:    0 2px 16px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.4);
  --sh-lg: 0 8px 48px rgba(0, 0, 0, 0.7);

  /* Typography */
  --font-display: "DM Serif Display", Georgia, serif;
  --font-mono:    "JetBrains Mono", "Courier New", monospace;
  --font-ui:      "Plus Jakarta Sans", system-ui, sans-serif;

  /* Layout constraints */
  --rail-width: clamp(450px, 36vw, 590px);
  --content-gap: 18px;
  --chart-height: clamp(350px, 35vh, 450px);

  /* Legacy aliases (used by JS inline styles) */
  --canvas:      var(--bg);
  --paper:       var(--card);
  --ink:         var(--tx);
  --muted:       var(--tx-mid);
  --accent:      var(--a);
  --accent-deep: var(--a-deep);
  --line:        var(--br);
  --line-strong: var(--br-mid);
  --shadow-soft: var(--sh-lg);
  --shadow-crisp: var(--sh);
  --radius-lg:   var(--rx-lg);
  --radius-md:   var(--rx-md);
  --radius-sm:   var(--rx-sm);
  --radius-xl:   var(--rx-xl);
}

/* ── Light Theme ─────────────────────────────────────────────── */
body.light-theme {
  --bg:        #f0f4f8;
  --bg-mid:    #e2eaf3;
  --surface:   #f7fafc;
  --card:      #ffffff;
  --card-hi:   #eef3f9;

  --br:        rgba(0, 0, 0, 0.08);
  --br-mid:    rgba(0, 0, 0, 0.13);
  --br-hi:     rgba(0, 0, 0, 0.22);

  --tx:        #0f2236;
  --tx-mid:    #4a6580;
  --tx-dim:    #5d768e;

  --a-dim:     rgba(249, 115, 22, 0.1);
  --a-glow:    rgba(249, 115, 22, 0.2);

  --db-dim:    rgba(2, 132, 199, 0.08);
  --db:        #0284c7;

  --sh:    0 2px 12px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  --sh-lg: 0 8px 40px rgba(0, 0, 0, 0.14);

  --canvas:      var(--bg);
  --paper:       var(--card);
  --ink:         var(--tx);
  --muted:       var(--tx-mid);
  --line:        var(--br);
  --line-strong: var(--br-mid);
  --shadow-soft: var(--sh-lg);
  --shadow-crisp: var(--sh);
}

body.light-theme {
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(2, 132, 199, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(249, 115, 22, 0.04) 0%, transparent 55%),
    linear-gradient(180deg, #dce8f5 0%, var(--bg) 40%);
}

body.light-theme::before {
  background-image: radial-gradient(circle, rgba(2, 132, 199, 0.06) 1px, transparent 1px);
}

body.light-theme .topbar::before {
  background: linear-gradient(90deg, var(--a), var(--db), transparent);
}

body.light-theme .site-map .leaflet-tile-pane {
  filter: none;
}

body.light-theme select,
body.light-theme input[type="number"],
body.light-theme input[type="text"] {
  color-scheme: light;
}

/* Unit system segmented control */
.unit-segment {
  display: inline-flex;
  align-items: stretch;
  height: 32px;
  border-radius: var(--rx-md);
  border: 1px solid var(--br-mid);
  background: transparent;
  overflow: hidden;
  flex-shrink: 0;
}
.unit-seg {
  padding: 0 11px;
  border: none;
  background: transparent;
  color: var(--tx-mid);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.unit-seg:first-child { border-right: 1px solid var(--br-mid); }
.unit-seg[aria-pressed="true"] {
  background: var(--r1, #EC8C47);
  color: #fff;
}
.unit-seg:hover:not([aria-pressed="true"]) {
  background: var(--a-dim);
  color: var(--tx);
}

/* Theme toggle button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--rx-md);
  border: 1px solid var(--br-mid);
  background: transparent;
  color: var(--tx-mid);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  color: var(--tx);
  border-color: var(--br-hi);
  background: var(--a-dim);
}

.theme-toggle-btn .icon-sun { display: none; }
.theme-toggle-btn .icon-moon { display: block; }

body.light-theme .theme-toggle-btn .icon-sun  { display: block; }
body.light-theme .theme-toggle-btn .icon-moon { display: none; }

/* ── Reset ──────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ── Body & Background ─────────────────────────────────────── */
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--tx);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(56, 189, 248, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(249, 115, 22, 0.05) 0%, transparent 55%),
    linear-gradient(180deg, #0a1628 0%, var(--bg) 40%);
}

/* Subtle dot-grid overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(56, 189, 248, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 70%);
  z-index: 0;
}

/* ── Page Shell ─────────────────────────────────────────────── */
.page-shell {
  position: relative;
  z-index: 1;
  width: min(1540px, calc(100% - 32px));
  margin: 20px auto 40px;
}

/* ── Base Panel ─────────────────────────────────────────────── */
.panel,
.stamp-card {
  animation: settle-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel {
  background: var(--card);
  border: 1px solid var(--br);
  border-radius: var(--rx-lg);
  box-shadow: var(--sh);
}

.panel-accent {
  --card-accent: var(--db);
  position: relative;
  overflow: hidden;
}

.panel-accent::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--card-accent);
  border-radius: var(--rx-lg) var(--rx-lg) 0 0;
}

/* ── Top Bar (brand + nav steps in one strip) ───────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 12px;
  position: relative;
  overflow: hidden;
  background: var(--card);
  border-color: var(--br-mid);
}

.topbar::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--a), var(--db), transparent);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 16px;
  margin-right: 12px;
  border-right: 1px solid var(--br-mid);
  flex: 0 0 auto;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--tx);
  white-space: nowrap;
}

.topbar-steps {
  display: flex;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

/* ── Top Bar Contact CTA Buttons ────────────────────────────── */
.topbar-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
  flex: 0 0 auto;
}

.topbar-contact-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 116px;
}

.topbar-contact-copy span {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx-dim);
}

.topbar-contact-copy strong {
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--tx);
  white-space: nowrap;
}

.topbar-socials {
  display: flex;
  align-items: center;
  gap: 8px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 12px;
  border-radius: var(--rx-md);
  border: 1px solid var(--br-mid);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.github-btn {
  color: var(--tx-mid);
  background-color: transparent;
}

.github-btn:hover {
  color: #fff;
  border-color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}

.linkedin-btn {
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.06);
  border-color: rgba(56, 189, 248, 0.3);
}

.linkedin-btn:hover {
  color: #fff;
  background-color: #0077b5;
  border-color: #0077b5;
  box-shadow: 0 0 10px rgba(0, 119, 181, 0.4);
}

/* ── Typography System ─────────────────────────────────────── */
.eyebrow,
.section-kicker,
.note-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--a);
}

.lead-sheet h2,
.section-head h2,
.chart-head h3,
.notebook-card h3,
.verification-card h3,
.form-section summary {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--tx);
}

.section-head p,
.chart-head p,
.notebook-card p,
.recommendation-panel p,
.lead-summary {
  line-height: 1.65;
  color: var(--tx-mid);
}

.masthead-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 20px;
}

.masthead-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--db-dim);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--db);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  font-weight: 500;
}


/* ── Status Banner ──────────────────────────────────────────── */
.status-banner {
  margin: 14px 0 0;
  padding: 11px 16px;
  border-radius: var(--rx-md);
  font-size: 0.88rem;
  font-family: var(--font-mono);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-banner::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
  flex: 0 0 auto;
}

.status-loading {
  background: rgba(249,115,22,0.08);
  border-color: rgba(249,115,22,0.2);
  color: var(--a);
}

.status-success {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.2);
  color: #22c55e;
}

.status-error {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.25);
  color: #ef4444;
}

/* ── Workflow Steps (inside topbar) ─────────────────────────── */
.flow-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--rx-sm);
  background: transparent;
  color: var(--tx-mid);
  cursor: pointer;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.flow-step:hover {
  color: var(--tx);
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--br-mid);
}

.flow-step.flow-active {
  color: var(--tx);
  background: var(--card-hi);
  border-color: rgba(56, 189, 248, 0.22);
}

.flow-index {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--br-mid);
  color: var(--db);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
}

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

.flow-copy strong,
.flow-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-copy strong {
  color: inherit;
  font-size: 0.9rem;
  font-weight: 700;
}

.flow-copy small {
  color: var(--tx-dim);
  font-size: 0.74rem;
}

/* ── Workspace Grid ─────────────────────────────────────────── */
.workspace {
  display: grid;
  grid-template-columns: minmax(380px, var(--rail-width)) minmax(0, 1fr);
  gap: var(--content-gap);
  margin-top: 16px;
  align-items: start;
  min-width: 0;
}

/* ── Brief Rail (left sidebar) ──────────────────────────────── */
.brief-rail {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding-right: 2px;
  min-width: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ── Collapsible Rail State ─────────────────────────────────── */
.workspace.rail-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.workspace.rail-collapsed .brief-rail {
  display: none;
}

/* ── Sidebar Toggle Button ──────────────────────────────────── */
.stage-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.toggle-rail-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--card-hi);
  border: 1px solid var(--br-mid);
  color: var(--tx-mid);
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--rx-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  width: fit-content;
}

.toggle-rail-btn:hover {
  color: var(--a);
  border-color: var(--a);
  background-color: var(--a-dim);
  box-shadow: 0 0 10px var(--a-glow);
}

.toggle-arrow-icon {
  transition: transform 0.2s ease;
}

.workspace.rail-collapsed .toggle-arrow-icon {
  transform: rotate(180deg);
}

.input-sheet,
.lead-sheet,
.report-panel,
.chart-stage,
.table-panel,
.recommendation-panel,
.notebook-card,
.verification-card {
  padding: 22px;
}

.input-sheet {
  padding: 24px;
}

/* ── Map ────────────────────────────────────────────────────── */
.map-block {
  margin-bottom: 14px;
}

.site-map {
  margin-top: 10px;
  height: clamp(560px, 64vh, 740px);
  border-radius: var(--rx-md);
  overflow: hidden;
  border: 1px solid var(--br-mid);
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}

.map-hint {
  margin: 7px 0 0;
  font-size: 0.76rem;
  color: var(--tx-dim);
  font-family: var(--font-mono);
}

/* Make light map tiles less jarring in dark UI */
.site-map .leaflet-tile-pane {
  filter: brightness(0.78) saturate(0.7) hue-rotate(5deg);
}

/* ── Form / Field Grid ──────────────────────────────────────── */
.form-section {
  margin-top: 14px;
  border: 1px solid var(--br-mid);
  border-radius: var(--rx-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025);
}

.form-section summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 17px;
  font-size: 1rem;
}

.form-section summary::-webkit-details-marker { display: none; }

.form-section[open] summary {
  border-bottom: 1px solid var(--br);
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-span { grid-column: 1 / -1; }

.field span {
  color: var(--tx-mid);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field small {
  color: var(--tx-dim);
  font-size: 0.76rem;
  line-height: 1.35;
}

.field-toggle {
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 6px;
  padding: 12px 13px;
  border: 1px solid var(--br-mid);
  border-radius: var(--rx-sm);
  background: rgba(7, 16, 30, 0.35);
}

.field-toggle span { font-weight: 600; color: var(--tx); }

.field-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--a);
}

.field-toggle small { grid-column: 1 / -1; }

/* ── Inputs & Selects ───────────────────────────────────────── */
input, select, button { font: inherit; }

input:not([type="checkbox"]),
select {
  width: 100%;
  border: 1px solid var(--br-mid);
  background: rgba(7, 16, 30, 0.48);
  color: var(--tx);
  padding: 10px 12px;
  border-radius: var(--rx-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  line-height: 1.4;
  vertical-align: top;
  height: 42px;
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237a93b4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
  cursor: pointer;
}

input:not([type="checkbox"])::placeholder { color: var(--tx-dim); }

input:not([type="checkbox"]):focus,
select:focus {
  border-color: var(--a);
  box-shadow: 0 0 0 3px var(--a-dim);
}

.field:focus-within span {
  color: var(--a);
}

select option {
  background: var(--card);
  color: var(--tx);
}

body.light-theme input:not([type="checkbox"]),
body.light-theme select {
  background: #ffffff;
  border-color: var(--br-mid);
  color: var(--tx);
}

body.light-theme select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%233a5270' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.light-theme input:not([type="checkbox"])::placeholder {
  color: var(--tx-dim);
}

body.light-theme select option {
  background: #ffffff;
  color: var(--tx);
}

body.light-theme .field-toggle {
  background: var(--card-hi);
}

.wwr-card {
  padding: 14px;
  border: 1px solid var(--br-mid);
  border-top: 2px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--rx-sm);
  background: rgba(7, 16, 30, 0.38);
}

.wwr-card-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 12px;
}

.field .wwr-title {
  display: block;
  color: var(--tx);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
}

.wwr-controls {
  display: flex;
  gap: 8px;
  width: 100%;
}

.wwr-select {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 0.78rem;
}

.wwr-warning {
  margin-bottom: 12px;
  padding: 9px 10px;
  border: 1px solid rgba(198, 71, 58, 0.85);
  border-radius: var(--rx-sm);
  background: rgba(198, 71, 58, 0.12);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.35;
}

.wwr-gross-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--br);
  border-bottom: 1px solid var(--br);
  color: var(--tx-mid);
  font-size: 0.75rem;
}

.wwr-gross-row strong {
  color: var(--db);
  font-family: var(--font-mono);
}

#wwr-overall-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wwr-field {
  margin-bottom: 0;
}

.wwr-derived-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--br);
  border-radius: var(--rx-sm);
}

.wwr-derived-label {
  font-size: 0.74rem;
  color: var(--tx-dim);
}

.wwr-derived-value {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--tx-mid);
}

#wwr-orientation-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Per-orientation input grid ─────────────────────────────── */
.wwr-orient-header {
  display: grid;
  grid-template-columns: 84px 1fr 52px;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--tx-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding-bottom: 4px;
}

.wwr-orient-row {
  display: grid;
  grid-template-columns: 84px 1fr 52px;
  gap: 8px;
  align-items: center;
}

.wwr-orient-derived {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--tx-dim);
  text-align: right;
  white-space: nowrap;
  min-width: 52px;
}

.wwr-orient-label {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--tx-mid);
}

.wwr-orient-input {
  width: 100%;
  height: 36px;
  padding: 7px 8px;
  font-size: 0.8rem;
  background: rgba(7, 16, 30, 0.55);
  border: 1px solid var(--br-mid);
  border-radius: var(--rx-sm);
  color: var(--tx);
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wwr-orient-input:focus {
  border-color: var(--a);
  box-shadow: 0 0 0 2px var(--a-dim);
}

.wwr-orient-input::placeholder { color: var(--tx-dim); }

body.light-theme .wwr-card {
  background: var(--card-hi);
  border-top-color: rgba(2, 132, 199, 0.3);
}

body.light-theme .wwr-gross-row {
  border-color: var(--br);
}

body.light-theme .wwr-derived-row {
  background: rgba(0, 0, 0, 0.03);
  border-color: var(--br);
}

body.light-theme .wwr-orient-input {
  background: #ffffff;
  border-color: var(--br-mid);
  color: var(--tx);
}

@media (max-width: 720px) {
  .wwr-card-header,
  .wwr-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .wwr-select {
    width: 100%;
  }
}

/* ── Buttons ────────────────────────────────────────────────── */
.form-actions,
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-actions { margin-top: 16px; }

.button-primary,
.button-secondary {
  border: 0;
  border-radius: var(--rx-md);
  padding: 11px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.14s ease, opacity 0.14s ease, box-shadow 0.14s ease;
}

.button-primary {
  background: var(--a);
  color: #fff;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 20px var(--a-glow);
}

.button-primary:hover:not(:disabled) {
  background: #fb8a3c;
  box-shadow: 0 6px 28px var(--a-glow);
  transform: translateY(-1px);
}

.button-secondary {
  background: var(--surface);
  color: var(--tx);
  border: 1px solid var(--br-mid);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--a);
  color: var(--a);
  transform: translateY(-1px);
}

.button-ghost {
  background: transparent;
  color: var(--tx-mid);
  border: 1px solid var(--br);
  border-radius: var(--rx-md);
  padding: 11px 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.14s ease;
}

.button-ghost:hover:not(:disabled) {
  border-color: var(--br-mid);
  color: var(--tx);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  transform: none !important;
}

/* ── Wizard Progress ────────────────────────────────────────── */
.wizard-progress {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--br);
}

.wp-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex: 0 1 auto;
  min-width: 64px;
  transition: opacity 0.15s ease;
}

.wp-step:hover .wp-num { border-color: var(--br-hi); }

.wp-num {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--br-mid);
  color: var(--tx-mid);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.wp-step.wp-active .wp-num {
  background: var(--a);
  border-color: var(--a);
  color: #fff;
  box-shadow: 0 0 14px var(--a-glow), 0 0 0 3px var(--a-dim);
}

.wp-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--tx-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 1.15;
  max-width: 140px;
}

.wp-step.wp-active .wp-label {
  color: var(--a);
}

.wp-line {
  flex: 1;
  height: 1.5px;
  background: var(--br-mid);
  margin: 0 4px;
  margin-top: 20px;
}

/* ── Wizard Steps ───────────────────────────────────────────── */
.wizard-step {
  display: block;
  border: none;
  padding: 0;
  margin: 0;
}

.wizard-step-hidden { display: none; }

.step-legend {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--br);
}

.step-badge {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--a-dim);
  border: 1.5px solid rgba(249,115,22,0.3);
  color: var(--a);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  flex: 0 0 auto;
}

.step-legend h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--tx);
}

.step-legend p {
  margin: 5px 0 0;
  color: var(--tx-mid);
  font-size: 0.87rem;
}

/* ── Wizard Nav ─────────────────────────────────────────────── */
.wizard-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--br);
}

.wizard-btn-back { flex: 0 0 auto; }
.wizard-btn-next { flex: 0 0 auto; }

#reset-button {
  margin-left: auto;
}

.wizard-btn-run { display: none; }

/* ── Analysis Stage (right column) ─────────────────────────── */
.analysis-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

/* ── Lead Sheet ─────────────────────────────────────────────── */
.lead-sheet {
  --card-accent: var(--db);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(249,115,22,0.06) 0%, transparent 40%),
    var(--card);
  border-color: var(--br-mid);
}

.lead-sheet::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent);
  border-radius: var(--rx-lg) var(--rx-lg) 0 0;
}

.lead-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.lead-sheet h2 {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  margin-top: 8px;
  line-height: 1.1;
}

.lead-summary {
  margin: 14px 0 0;
  max-width: 72ch;
  font-size: 0.95rem;
  line-height: 1.7;
}

.lead-badge {
  min-width: 150px;
  padding: 14px 16px;
  border-radius: var(--rx-md);
  background: var(--surface);
  border: 1px solid var(--br-mid);
  text-align: center;
  flex: 0 0 auto;
}

.lead-badge strong {
  display: block;
  margin: 8px 0 4px;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--tx);
}

.lead-badge span { display: block; font-size: 0.84rem; color: var(--tx-mid); }

.lead-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* ── Lead Badge refinement ──────────────────────────────────── */
.lead-badge {
  transition: box-shadow 0.2s ease;
}

.lead-badge:hover {
  box-shadow: 0 0 0 1px var(--br-hi), var(--sh);
}

/* ── Lead Score Bars (horizontal) ───────────────────────────── */
.lead-spectrum {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--br);
}

.hbar-item {
  display: grid;
  grid-template-columns: 130px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.hbar-label {
  font-size: 0.78rem;
  color: var(--tx-mid);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hbar-track {
  height: 6px;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--br);
}

.hbar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.hbar-score {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: right;
}

/* ── Highlight Chips ────────────────────────────────────────── */
.highlight-chip,
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--db-dim);
  border: 1px solid rgba(56,189,248,0.18);
  color: var(--db);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

/* ── Result Tabs ────────────────────────────────────────────── */
.result-tabs {
  display: flex;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--br);
  border-radius: var(--rx-md);
  padding: 4px;
  margin: 0;
  min-width: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
}

/* Premium thin scrollbar for tab navigation */
.result-tabs::-webkit-scrollbar {
  height: 3px;
}
.result-tabs::-webkit-scrollbar-track {
  background: transparent;
}
.result-tabs::-webkit-scrollbar-thumb {
  background: var(--br-mid);
  border-radius: 99px;
}
.result-tabs::-webkit-scrollbar-thumb:hover {
  background: var(--a);
}

.rt-tab {
  flex: 1 0 auto;
  border: none;
  background: transparent;
  color: var(--tx-mid);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--rx-sm);
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  position: relative;
  min-width: max-content;
}

.rt-tab:hover { color: var(--tx); background: rgba(255,255,255,0.04); }

.rt-tab.rt-active {
  background: var(--card-hi);
  color: var(--tx);
  font-weight: 600;
  box-shadow: var(--sh);
}

.rt-tab.rt-active::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--a);
}

.tab-panel {
  display: block;
  animation: settle-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  min-width: 0;
}

.tab-panel-hidden { display: none; }

/* All direct children of .tab-panel except the first one get a standard margin-top */
.tab-panel > * + * {
  margin-top: 24px !important;
}

/* ── Stamp / Metric Cards ───────────────────────────────────── */
.stamp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: min-content;
  gap: 12px;
}

.stamp-card {
  --stamp: var(--a);
  padding: 18px 18px 16px;
  border-radius: var(--rx-lg);
  background: var(--card);
  border: 1px solid var(--br);
  box-shadow: var(--sh);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.stamp-card:hover {
  border-color: var(--stamp);
  transform: translateY(-2px);
  box-shadow: var(--sh), 0 0 0 1px var(--stamp);
}

.stamp-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--stamp);
  border-radius: var(--rx-lg) var(--rx-lg) 0 0;
}

.stamp-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, color-mix(in srgb, var(--stamp) 8%, transparent), transparent 60%);
  pointer-events: none;
}

.stamp-label {
  display: block;
  color: var(--tx-mid);
  font-size: 0.77rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.stamp-value {
  display: block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  color: var(--tx);
  letter-spacing: -0.02em;
}

.stamp-note,
.stamp-meta {
  display: block;
  margin-top: 8px;
  color: var(--tx-mid);
  font-size: 0.82rem;
}

/* ── Notebook Cards ─────────────────────────────────────────── */
.notebook-grid,
.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: min-content;
  gap: 14px;
  min-width: 0;
}

#monthly-summary {
  grid-column: 1 / -1;
}

.notebook-card {
  --card-accent: var(--db);
  background: var(--card);
  border: 1px solid var(--br);
  transition: border-color 0.15s ease;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.notebook-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--card-accent);
  border-radius: var(--rx-lg) var(--rx-lg) 0 0;
}

.notebook-card:hover { border-color: var(--br-mid); }

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-icon {
  color: var(--a);
  flex-shrink: 0;
  opacity: 0.85;
}

.notebook-card .card-icon {
  color: var(--card-accent);
}

/* Semantic notebook-card accents */
#project-summary { --card-accent: var(--db); }
#exposure-summary { --card-accent: #06b6d4; }
#physics-summary { --card-accent: var(--a); }
#code-summary { --card-accent: #3885bb; }
#monthly-summary { --card-accent: var(--r1); }

#seismic-card { --card-accent: #8b5cf6; }
#wind-pressure-card { --card-accent: var(--db); }
#thermal-card { --card-accent: var(--a); }
#driving-rain-card { --card-accent: #06b6d4; }
#corrosion-card { --card-accent: #f59e0b; }
#glazing-card { --card-accent: var(--db); }
#acoustic-card { --card-accent: #22c55e; }
#epc-card { --card-accent: #22c55e; }

.epc-band-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 12px;
}

.epc-band-badge {
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: bold;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.epc-summary {
  font-size: 0.85rem;
  color: var(--tx-mid);
  line-height: 1.5;
  margin: 8px 0 10px;
}

.epc-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.epc-action-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--surface);
  border-left: 3px solid var(--card-accent, var(--accent));
  border-radius: 0 4px 4px 0;
  font-size: 0.82rem;
}

.epc-action-item strong {
  color: var(--tx);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.epc-action-item span {
  color: var(--tx-mid);
  line-height: 1.45;
}

#lca-waterfall-card { --card-accent: #14b8a6; }
#bipv-details-card { --card-accent: #eab308; }
#smart-glass-card { --card-accent: #818cf8; }

#code-compliance-card { --card-accent: #3885bb; }
#bracket-design-card { --card-accent: var(--a); }
#diff-movement-card { --card-accent: #14b8a6; }
#certification-credits-card { --card-accent: #22c55e; }
#testing-protocol-card { --card-accent: #8b5cf6; }
#source-summary { --card-accent: var(--db); }
#provenance-scorecard-card { --card-accent: #06b6d4; }

.notebook-card h3,
.verification-card h3 {
  font-size: 1.25rem;
  margin-top: 8px;
  word-break: break-word;
  line-height: 1.3;
}

.notebook-card p {
  margin: 8px 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--tx-mid);
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ── Fact List ──────────────────────────────────────────────── */
.fact-list {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 7px 14px;
  margin: 14px 0 0;
  min-width: 0;
}

.fact-list dt {
  color: var(--tx-mid);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  word-break: break-word;
}

.fact-list dt::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tx-dim);
  margin-right: 6px;
  flex: 0 0 auto;
}

.fact-list dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--tx);
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* Row separator */
.fact-list dt:not(:first-child),
.fact-list dd:not(:nth-child(2)) {
  padding-top: 6px;
  border-top: 1px solid var(--br);
}

/* ── Section Heads ──────────────────────────────────────────── */
.lead-heading,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.block-head,
.section-head.tight {
  margin-bottom: 10px;
}

.section-head p,
.chart-head p {
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.section-head h2 {
  font-size: 1.55rem;
  margin-top: 6px;
}

/* ── Report / Risk Register ─────────────────────────────────── */
.report-panel,
.chart-stage,
.table-panel,
.recommendation-panel {
  overflow: hidden;
}

.register-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
  min-width: 0;
}

.verification-card {
  --card-accent: var(--a);
  background:
    radial-gradient(ellipse at top right, rgba(249,115,22,0.12), transparent 50%),
    linear-gradient(160deg, #1a1222, #0e0d1a);
  border: 1px solid rgba(249,115,22,0.15);
  border-radius: var(--rx-lg);
  color: var(--tx);
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.verification-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--card-accent);
  border-radius: var(--rx-lg) var(--rx-lg) 0 0;
}

.verification-card .section-kicker { color: var(--a); }
.verification-card h3 {
  color: var(--tx);
  font-size: 1rem;
  line-height: 1.25;
}
.verification-card .section-kicker + h3 { margin-top: 8px; }

.verification-list,
.recommendation-list {
  margin: 12px 0 0;
  padding-left: 16px;
  color: var(--tx-mid);
  line-height: 1.7;
}

.verification-list {
  list-style: none;
  padding-left: 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.verification-list li {
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.06);
  border-left: 2px solid rgba(249,115,22,0.55);
  border-radius: var(--rx-sm);
  background: rgba(255,255,255,0.025);
}

body.light-theme .verification-card {
  background:
    radial-gradient(ellipse at top right, rgba(249, 115, 22, 0.08), transparent 50%),
    linear-gradient(160deg, #eef3f9, #ffffff);
  border: 1px solid rgba(249, 115, 22, 0.25);
  color: var(--tx);
}

body.light-theme .verification-list {
  color: var(--tx-mid);
}

body.light-theme .verification-list li {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-left: 2px solid rgba(249, 115, 22, 0.55);
  background: rgba(0, 0, 0, 0.015);
  color: var(--tx);
}

.verification-list li + li,
.recommendation-list li + li {
  margin-top: 8px;
}

/* ── Charts ─────────────────────────────────────────────────── */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 450px), 1fr));
  gap: 14px;
  min-width: 0;
  align-items: stretch;
}

.chart-card {
  --card-accent: var(--db);
  padding: 18px;
  border-radius: var(--rx-lg);
  background: var(--card);
  border: 1px solid var(--br);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(var(--chart-height) + 120px);
}

.chart-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--card-accent);
  border-radius: var(--rx-lg) var(--rx-lg) 0 0;
}

.chart-head {
  margin-bottom: 12px;
  flex: 0 0 auto;
}

.chart-head h3 {
  font-size: 1.05rem;
  margin-top: 6px;
  letter-spacing: -0.01em;
}

.chart-canvas {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  height: var(--chart-height);
  min-height: 360px;
  min-width: 0;
  overflow: hidden;
  position: relative;
  border-radius: var(--rx-sm);
}

.chart-canvas .js-plotly-plot,
.chart-canvas .plot-container,
.chart-canvas .svg-container {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
}

.chart-canvas .modebar-container {
  top: 6px !important;
  right: 6px !important;
}

.chart-card.double-width {
  grid-column: span 2;
}

/* ── 3D Facade Viewer ───────────────────────────────────────── */
.canvas-3d-panel {
  padding: 24px 28px 20px;
  margin-bottom: 16px;
}

.facade-3d-canvas {
  width: 100%;
  height: 420px;
  border-radius: var(--rx-sm);
  overflow: hidden;
  background: #0a1520;
  position: relative;
}

.facade-3d-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.facade-3d-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
}

.facade-3d-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--ts);
}

.facade-3d-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .facade-3d-canvas {
    height: 300px;
  }
}

@media (max-width: 1600px) {
  .workspace:not(.rail-collapsed) .chart-card.double-width {
    grid-column: span 1;
  }
}

@media (max-width: 1100px) {
  .chart-card.double-width {
    grid-column: span 1;
  }
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap {
  overflow: auto;
  border-radius: var(--rx-md);
  max-width: 100%;
}

.orientation-table,
.register-table,
.ledger-table,
.source-table {
  width: 100%;
  border-collapse: collapse;
}

.orientation-table { min-width: 720px; }
.ledger-table { min-width: 500px; }
.register-table { min-width: 520px; }

.orientation-table th,
.orientation-table td,
.register-table th,
.register-table td,
.ledger-table th,
.ledger-table td,
.source-table th,
.source-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--br);
}

.orientation-table th,
.register-table th,
.ledger-table th,
.source-table th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--tx-dim);
  background: var(--surface);
  position: sticky;
  top: 0;
}

.orientation-table td,
.register-table td,
.ledger-table td,
.source-table td {
  color: var(--tx-mid);
  font-size: 0.9rem;
}

.source-table td:first-child,
.ledger-table td:first-child,
.register-table td:first-child,
.orientation-table td:first-child {
  color: var(--tx);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.orientation-table tr:hover td,
.register-table tr:hover td,
.ledger-table tr:hover td,
.source-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.light-theme .orientation-table tr:hover td,
.light-theme .register-table tr:hover td,
.light-theme .ledger-table tr:hover td,
.light-theme .source-table tr:hover td {
  background: rgba(15, 34, 54, 0.035);
}

/* ── Score Chips ────────────────────────────────────────────── */
.score-chip,
.register-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 5px 10px;
  border-radius: var(--rx-sm);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #fff;
}

.register-band {
  color: var(--tx-mid);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ── Engineering Data Grid ──────────────────────────────────── */
.eng-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: min-content;
  gap: 14px;
  margin-top: 16px;
  min-width: 0;
}

.eng-grid > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* ── Source Pills ────────────────────────────────────────────── */
.source-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.monthly-note {
  margin-top: 10px;
  color: var(--tx-dim);
  font-size: 0.86rem;
  font-family: var(--font-mono);
}

/* ── Rail Tags ──────────────────────────────────────────────── */
.rail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.rail-tags span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--a-dim);
  color: var(--a);
  font-size: 0.82rem;
  border: 1px solid rgba(249,115,22,0.2);
}

/* ── Leaflet overrides ──────────────────────────────────────── */
.leaflet-container {
  font-family: var(--font-ui);
  background: var(--surface);
}

.leaflet-popup-content-wrapper {
  background: var(--card);
  color: var(--tx);
  border: 1px solid var(--br-mid);
  box-shadow: var(--sh-lg);
}

.leaflet-popup-tip { background: var(--card); }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes settle-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────────────────── */
/* Responsive adjustments when the brief rail (sidebar) is open/expanded on standard desktop viewports (<= 1600px) */
@media (max-width: 1600px) {
  .workspace:not(.rail-collapsed) .notebook-grid,
  .workspace:not(.rail-collapsed) .eng-grid,
  .workspace:not(.rail-collapsed) .resource-grid,
  .workspace:not(.rail-collapsed) .chart-grid {
    grid-template-columns: 1fr;
  }

  .workspace:not(.rail-collapsed) .stamp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topbar-brand {
    border-right: none;
    padding-right: 0;
    margin-right: 0;
  }

  .topbar-steps {
    order: 3;
    width: 100%;
    flex: 1 0 100%;
    max-width: 100%;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--br);
    overflow-x: auto;
  }

  .flow-step {
    flex: 1 0 132px;
  }

  .topbar-contact {
    flex: 1 1 auto;
    justify-content: flex-end;
  }
}

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .brief-rail {
    position: static;
  }

  .register-layout,
  .chart-grid,
  .resource-grid {
    grid-template-columns: 1fr;
  }

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

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

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

/* Medium size / Tablet Viewports */
@media (max-width: 1100px) {
  .notebook-grid,
  .eng-grid {
    grid-template-columns: 1fr;
  }

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

/* ── Site Footer ────────────────────────────────────────────── */
.site-footer {
  margin-top: 40px;
  border-top: 1px solid var(--br);
  padding: 20px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 720px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--tx-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.footer-copy p {
  margin: 0;
  color: var(--tx-mid);
  font-size: 0.88rem;
  line-height: 1.55;
}

.footer-copy strong {
  color: var(--tx);
  font-weight: 700;
}

.footer-cta {
  margin-top: 2px;
  color: var(--tx-dim);
  font-size: 0.83rem;
  line-height: 1.5;
  border-left: 2px solid var(--a);
  padding-left: 10px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--tx-mid);
  border: 1px solid var(--br-mid);
  background: rgba(255,255,255,0.03);
  border-radius: var(--rx-md);
  padding: 7px 10px;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.footer-link:hover {
  color: var(--a);
  border-color: rgba(249,115,22,0.45);
  background: rgba(249,115,22,0.08);
}

.footer-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100%, calc(100% - 20px));
    margin: 12px auto 24px;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 8px;
  }

  .topbar-brand {
    border-right: none;
    padding-right: 0;
    margin-right: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--br);
    width: 100%;
    flex: 1 0 100%;
    max-width: 100%;
  }

  .topbar-steps {
    width: 100%;
    flex: 1 0 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  .topbar-contact {
    width: 100%;
    flex: 1 0 100%;
    max-width: 100%;
    margin-left: 0;
    padding-top: 8px;
    justify-content: space-between;
  }

  .topbar-contact-copy {
    align-items: flex-start;
    min-width: 0;
  }

  .topbar-socials {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .social-btn {
    padding-inline: 10px;
  }

  .site-map {
    height: 260px;
  }

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

  .lead-heading,
  .section-head {
    flex-direction: column;
  }

  .chart-canvas {
    height: 330px;
    min-height: 290px;
  }

  .notebook-grid,
  .eng-grid,
  .stamp-grid {
    grid-template-columns: 1fr;
  }

  .eng-grid > :last-child:nth-child(odd) {
    grid-column: 1;
  }

  .hbar-item {
    grid-template-columns: 90px 1fr 32px;
  }

  .wizard-nav {
    flex-direction: column;
  }

  .wizard-btn-back,
  .wizard-btn-next {
    flex: 1;
  }

  .stage-actions {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .stage-actions-right {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .stage-action-btn,
  .quick-export-pdf-btn {
    min-width: 0;
  }

  .result-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .rt-tab {
    flex: 0 0 auto;
  }

  .footer-inner {
    align-items: flex-start;
  }

  .footer-links {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .topbar-contact {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-socials {
    justify-content: flex-start;
  }
}

/* ── Exports Dashboard ───────────────────────────────────────── */
.exports-panel {
  padding: 24px;
  border-radius: var(--rx-lg);
  background: var(--card);
  border: 1px solid var(--br);
  margin-bottom: 24px;
}

.export-metadata-banner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--br-mid);
  padding: 14px 20px;
  border-radius: var(--rx-md);
  margin-top: 16px;
  margin-bottom: 24px;
}

.emb-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.emb-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tx-dim);
}

.emb-val {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.export-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.export-card {
  --card-accent: var(--br-mid);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--br);
  border-radius: var(--rx-lg);
  padding: 22px;
  min-height: 260px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.export-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent);
  transition: background-color 0.25s ease;
}

.export-card:hover {
  transform: translateY(-4px);
  border-color: var(--br-hi);
  box-shadow: var(--sh-lg);
}

#export-card-pdf { --card-accent: var(--a); }
#export-card-csv { --card-accent: var(--db); }
#export-card-json { --card-accent: #34d399; }
#export-card-save { --card-accent: #14b8a6; }
#export-card-load { --card-accent: #818cf8; }

.export-card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ec-icon-wrapper {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--br-mid);
  border-radius: var(--rx-md);
  padding: 12px;
  color: var(--tx-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.export-card:hover .ec-icon-wrapper {
  color: var(--tx);
  background: rgba(255, 255, 255, 0.05);
}

#export-card-pdf:hover .ec-icon-wrapper { color: #f97316; border-color: rgba(249,115,22,0.3); }
#export-card-csv:hover .ec-icon-wrapper { color: #38bdf8; border-color: rgba(56,189,248,0.3); }
#export-card-json:hover .ec-icon-wrapper { color: #34d399; border-color: rgba(52,211,153,0.3); }
#export-card-save:hover .ec-icon-wrapper { color: #14b8a6; border-color: rgba(20,184,166,0.3); }
#export-card-load:hover .ec-icon-wrapper { color: #818cf8; border-color: rgba(99,102,241,0.3); }

.ec-icon {
  width: 22px;
  height: 22px;
}

.ec-title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ec-title-block h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--tx);
}

.ec-badge {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.pdf-badge { background: rgba(249, 115, 22, 0.08); color: #f97316; border-color: rgba(249, 115, 22, 0.15); }
.csv-badge { background: rgba(56, 189, 248, 0.08); color: #38bdf8; border-color: rgba(56, 189, 248, 0.15); }
.json-badge { background: rgba(52, 211, 153, 0.08); color: #34d399; border-color: rgba(52, 211, 153, 0.15); }

.ec-description {
  max-width: 30ch;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--tx-mid);
  margin: 0 auto 18px;
  flex: 1 1 auto;
}

.btn-export-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--rx-md);
  border: 1px solid var(--br-mid);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--tx);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-export-action:hover {
  background: var(--card-hi);
  border-color: var(--br-hi);
}

#export-card-pdf .btn-export-action {
  background: var(--a);
  color: #fff;
  border-color: var(--a-deep);
}

#export-card-pdf .btn-export-action:hover {
  background: #f98634;
}

.btn-arrow {
  transition: transform 0.2s ease;
}

.btn-export-action:hover .btn-arrow {
  transform: translateX(3px);
}

/* ── Stage Actions Layout ────────────────────────────────────── */
.stage-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.stage-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: var(--rx-md);
  border: 1px solid var(--br);
  background: var(--card-hi);
  color: var(--ts);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.stage-action-btn:hover {
  border-color: var(--a);
  color: var(--a);
  background: var(--a-dim);
}

.stage-action-btn-success {
  border-color: #34d399 !important;
  color: #34d399 !important;
  background: rgba(52, 211, 153, 0.1) !important;
}

.stage-action-btn-active {
  border-color: var(--a) !important;
  color: var(--a) !important;
  background: var(--a-dim) !important;
}

/* ── 3D Viewer Toggles & HUD Overlay ────────────────────────── */
.viewer-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.viewer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tx-mid);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--br-mid);
  padding: 4px 10px;
  border-radius: var(--rx-md);
  transition: all 0.2s ease;
  user-select: none;
}

.viewer-toggle:hover {
  border-color: var(--a);
  color: var(--tx);
  background: var(--a-dim);
}

.viewer-toggle input[type="checkbox"] {
  display: none;
}

.viewer-toggle .vt-box {
  width: 10px;
  height: 10px;
  border: 1px solid var(--tx-dim);
  border-radius: 2px;
  background: transparent;
  display: inline-block;
  position: relative;
  transition: all 0.2s ease;
}

.viewer-toggle input[type="checkbox"]:checked + .vt-box {
  background: var(--a);
  border-color: var(--a);
}

.viewer-toggle input[type="checkbox"]:checked + .vt-box::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 3px;
  height: 5px;
  border: solid #ffffff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* 3D Tooltip Overlay */
.facade-3d-tooltip {
  position: absolute;
  background: rgba(13, 27, 42, 0.95);
  border: 1.5px solid var(--a);
  border-radius: var(--rx-md);
  padding: 10px 14px;
  color: #ffffff;
  pointer-events: none;
  font-family: var(--font-ui);
  box-shadow: var(--sh-lg);
  font-size: 0.76rem;
  z-index: 1000;
  max-width: 200px;
  transform: translate(-50%, -100%);
  margin-top: -15px;
  transition: opacity 0.15s ease;
  opacity: 0;
}

.facade-3d-tooltip strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--a);
  border-bottom: 1px solid var(--br-mid);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.tooltip-grid {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tooltip-grid div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--tx-dim);
}

.tooltip-grid span {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--tx);
}

.tooltip-overall {
  border-top: 1px dashed var(--br-mid);
  padding-top: 4px;
  margin-top: 2px;
}

/* Dynamic premium HUD Sidebar scorecard directly on Canvas */
.facade-3d-hud-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(13, 27, 42, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--rx-md);
  padding: 14px;
  color: #ffffff;
  font-family: var(--font-ui);
  width: 250px;
  box-shadow: var(--sh-lg);
  z-index: 900;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  pointer-events: auto;
  transition: opacity 0.3s ease;
  animation: settle-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.facade-3d-hud-panel-hidden {
  display: none !important;
}

.facade-3d-hud-panel h4 {
  margin: 0 0 10px 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--a);
  border-bottom: 1px solid var(--br-mid);
  padding-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-section {
  margin-bottom: 12px;
}

.hud-section:last-child {
  margin-bottom: 0;
}

.hud-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.74rem;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-row span:first-child {
  color: var(--tx-dim);
}

.hud-row span:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--tx);
}

/* Visual glass exploded schematics inside HUD */
.hud-glass-schematic {
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--rx-sm);
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.2);
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hud-glass-layer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  font-family: var(--font-mono);
}

.hud-glass-glass { color: #5bc0be; border-left: 2px solid #5bc0be; padding-left: 5px; }
.hud-glass-air { color: #f26419; border-left: 2px solid #f26419; padding-left: 5px; }

/* ── Upgraded Comparison Strip ────────────────────────────────── */
.comparison-strip {
  background: var(--card);
  border: 1px solid var(--a);
  border-radius: var(--rx-md);
  padding: 16px 20px 20px;
  margin-bottom: 12px;
  animation: settle-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.comparison-strip-hidden {
  display: none;
}

.cs-site-comparison-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--br-mid);
  padding-bottom: 12px;
}

.cs-sites-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cs-site-box {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--br-mid);
  padding: 6px 14px;
  border-radius: var(--rx-md);
  min-width: 140px;
}

.cs-baseline-box {
  border-left: 3px solid #6366f1;
}

.cs-current-box {
  border-left: 3px solid var(--a);
}

.cs-site-role {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--tx-dim);
  letter-spacing: 0.05em;
}

.cs-site-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--tx);
}

.cs-swap-btn {
  background: var(--card-hi);
  border: 1px solid var(--br);
  color: var(--ts);
  padding: 6px 12px;
  border-radius: var(--rx-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.cs-swap-btn:hover {
  border-color: var(--a);
  color: var(--a);
  background: var(--a-dim);
}

.cs-swap-btn svg {
  transition: transform 0.3s ease;
}

.cs-swap-btn:hover svg {
  transform: rotate(180deg);
}

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

.cs-action-btn {
  background: var(--card-hi);
  border: 1px solid var(--br);
  color: var(--tx-mid);
  padding: 7px 12px;
  border-radius: var(--rx-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.cs-action-btn:hover {
  border-color: #34d399;
  color: #34d399;
  background: rgba(52, 211, 153, 0.08);
}

.cs-shortlist-select {
  background: var(--surface);
  border: 1px solid var(--br);
  color: var(--tx);
  padding: 6px 10px;
  border-radius: var(--rx-md);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.cs-shortlist-select:hover {
  border-color: var(--a);
}

.cs-clear-btn {
  background: none;
  border: none;
  color: var(--tx-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--rx-md);
  transition: all 0.2s ease;
}

.cs-clear-btn:hover {
  color: var(--tx);
  background: var(--card-hi);
}

.cs-comparison-verdict {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(260px, 1.4fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.cs-verdict-main,
.cs-verdict-drivers {
  background: var(--surface);
  border: 1px solid var(--br);
  border-radius: var(--rx-md);
  padding: 13px 15px;
}

.cs-verdict-main {
  border-left: 4px solid var(--a);
}

.cs-verdict-main strong {
  display: block;
  color: var(--tx);
  font-size: 0.98rem;
  line-height: 1.3;
  margin: 4px 0 5px;
}

.cs-verdict-main p {
  margin: 0;
  color: var(--ts);
  font-size: 0.76rem;
  line-height: 1.45;
}

.cs-verdict-kicker {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx-dim);
}

.cs-verdict-drivers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: center;
}

.cs-driver-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--br-mid);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--tx);
  font-size: 0.74rem;
  background: var(--card-hi);
}

.cs-driver-chip span {
  font-family: var(--font-mono);
  font-weight: 700;
}

.cs-driver-chip-better span { color: #34d399; }
.cs-driver-chip-worse span { color: #ef4444; }
.cs-driver-chip-neutral span { color: var(--tx-dim); }

@media (max-width: 900px) {
  .cs-comparison-verdict {
    grid-template-columns: 1fr;
  }
}

/* Comparison side-by-side visual cards */
.cs-comparison-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.cs-comp-card {
  --card-accent: var(--db);
  background: var(--surface);
  border: 1px solid var(--br);
  border-radius: var(--rx-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.cs-comp-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--card-accent);
  border-radius: var(--rx-lg) var(--rx-lg) 0 0;
}

.cs-comp-card:hover {
  border-color: var(--br-hi);
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}

.cs-comp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed var(--br-mid);
  padding-bottom: 8px;
}

.cs-comp-header h3 {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--tx);
}

.cs-comp-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-comp-value-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cs-comp-val {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cs-comp-val span:first-child {
  font-size: 0.64rem;
  font-family: var(--font-mono);
  color: var(--tx-dim);
  text-transform: uppercase;
}

.cs-comp-val strong {
  font-size: 0.88rem;
  font-family: var(--font-mono);
  color: var(--tx);
}

.cs-comp-delta-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  width: max-content;
}

.cs-comp-goal {
  margin-top: 8px;
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--tx-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cs-comp-delta-neutral { background: rgba(255, 255, 255, 0.05); color: var(--tx-dim); }
.cs-comp-delta-better { background: rgba(52, 211, 153, 0.1); color: #34d399; }
.cs-comp-delta-worse { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

.cs-comp-impact {
  font-size: 0.72rem;
  color: var(--tx-mid);
  line-height: 1.4;
  border-left: 2px solid var(--br-hi);
  padding-left: 8px;
  margin-top: 4px;
  font-style: italic;
}

/* Save / Load badges fallback */
.save-badge { background: rgba(20, 184, 166, 0.14); color: #14b8a6; }
.load-badge { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

/* ── Export cards: Save / Load badges ───────────────────────── */

/* ── Stage Toolbar Quick Export Button ───────────────────────── */
.quick-export-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--rx-md);
  border: 1px solid var(--a);
  background: var(--a-dim);
  color: var(--a);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-export-pdf-btn:hover {
  background: var(--a);
  color: #fff;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.25);
}

.quick-export-pdf-btn svg {
  flex: 0 0 auto;
}

@media (max-width: 860px) {
  .export-metadata-banner {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Compliance tab */
.card-note {
  margin-bottom: 12px;
  font-size: 0.83rem;
  color: var(--tx-mid);
}

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

.perf-spec-section {
  margin-bottom: 1.2rem;
}

.perf-spec-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 0.4rem;
}

.perf-spec-clause {
  font-size: 0.83rem;
  color: var(--tx-mid);
  padding: 4px 0 4px 1rem;
  border-left: 2px solid var(--db);
  margin-bottom: 4px;
}

.perf-spec-clause strong {
  color: var(--tx);
  margin-right: 0.4em;
}

/* Stamp colour variants (replaces per-element --stamp inline overrides) */
.stamp-db   { --stamp: var(--db); }
.stamp-teal { --stamp: #14b8a6; }
.stamp-r1   { --stamp: var(--r1); }
.stamp-r3   { --stamp: var(--r3); }

/* Utility alignment */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--tx-mid); }

/* Hidden file inputs and screen-reader-only elements */
.visually-hidden {
  display: none;
}

/* Result badge chips (PASS / FAIL / CHECK) */
.result-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

.badge-pass  { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.badge-fail  { background: rgba(239,  68,  68, 0.15); color: #ef4444; }
.badge-check { background: rgba(251, 191,  36, 0.15); color: #fbbf24; }

.card-note-top { margin-top: 10px; }

/* Responsive adjustments for wizard progress bar on small devices */
@media (max-width: 480px) {
  .wp-num {
    width: 32px;
    height: 32px;
    font-size: 0.72rem;
  }
  .wp-line {
    margin-top: 16px;
  }
  .wp-label {
    font-size: 0.68rem;
    letter-spacing: 0.03em;
  }
  .wp-step {
    min-width: 54px;
    gap: 5px;
  }
}

/* ── User Guide Styles ────────────────────────────────────────── */
.guide-panel {
  padding: 24px;
  line-height: 1.6;
}

.guide-panel h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tx);
  margin-bottom: 8px;
}

.guide-panel > p {
  font-size: 0.9rem;
  color: var(--tx-mid);
  margin-bottom: 24px;
}

.guide-section {
  margin-bottom: 36px;
  border-bottom: 1px solid var(--br);
  padding-bottom: 24px;
}

.guide-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.guide-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-step-badge {
  background: var(--a-dim);
  color: var(--a);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 700;
}

.guide-text {
  font-size: 0.88rem;
  color: var(--tx-mid);
  margin-bottom: 16px;
}

.guide-screenshot-wrapper {
  margin: 18px 0;
  border: 1px solid var(--br);
  border-radius: var(--rx-md);
  overflow: hidden;
  background: rgba(7, 16, 30, 0.4);
  box-shadow: var(--sh);
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 760px;
}

.guide-screenshot-wrapper.screenshot-sidebar {
  max-width: 380px;
}

.guide-screenshot-wrapper.screenshot-main {
  max-width: 640px;
}

.guide-screenshot {
  max-width: 100%;
  height: auto;
  display: block;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.guide-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--br);
  border-radius: var(--rx-sm);
  padding: 16px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.guide-card:hover {
  border-color: var(--a-dim);
  background: rgba(255, 255, 255, 0.03);
}

.guide-card h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 6px;
}

.guide-card p {
  font-size: 0.8rem;
  color: var(--tx-dim);
  line-height: 1.5;
}

body.light-theme .guide-card {
  background: rgba(0, 0, 0, 0.01);
}

body.light-theme .guide-card:hover {
  background: rgba(0, 0, 0, 0.02);
}


