/* ============================================================
   VKTR EV Decision Platform — Design Tokens & Components
   Palette graded toward VKTR brand: deep graphite-ink primary
   (replacing corporate navy) + EV green accent.
   ============================================================ */

:root {
  /* Brand */
  --c-primary:        #0F1E27;  /* deep graphite ink — header, active step, primary btn */
  --c-primary-light:  #1C3B49;  /* hover / focus ring */
  --c-accent:         #00A651;  /* EV green */
  --c-accent-light:   #00C264;

  /* Surfaces */
  --bg:        #EDF1F5;
  --surface:   #FFFFFF;
  --surface-2: #F2F5F9;  /* readonly / inset fields */
  --border:    #D5DCE3;
  --border-strong: #C2CCD6;

  /* Text */
  --text:       #16212B;
  --text-muted: #6B7888;

  /* Status */
  --danger:  #DC2626;
  --warning: #F59E0B;

  /* Badges */
  --ev-bg: #D8F3E4;  --ev-fg: #086B43;
  --ice-bg:#FEF1D6;  --ice-fg:#92600E;

  --shadow: 0 2px 10px rgba(13, 30, 41, 0.08);
  --shadow-lg: 0 8px 30px rgba(13, 30, 41, 0.12);
  --radius: 10px;
  --radius-sm: 7px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { min-height: 100vh; }

/* v1.7.5 fix, take 2: the previous fix here was `[data-tooltip] {
   position: relative; }` moved to the top of the file so it would always
   LOSE a same-specificity cascade tie against any component's own
   position:fixed/absolute rule declared later. That's fragile -- it only
   holds as long as every future fixed/absolute component happens to be
   declared after this line, which is exactly the assumption that broke
   .guide-toggle in the first place. Scoping this to .io-toggle
   specifically -- the ONLY one of the 3 data-tooltip elements that is
   actually position:static and needs the assist -- removes the race
   entirely: .guide-toggle and .assistant-handle's own position:fixed
   rules are never touched by the tooltip system at all, regardless of
   file order. */
.io-toggle { position: relative; }

/* ============================================================
   App shell
   ============================================================ */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
.app-header {
  height: 64px;
  background: var(--c-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.app-header .brand { display: flex; align-items: center; gap: 16px; }
.app-header .brand img { height: 26px; display: block; }
.app-header .brand .divider { width: 1px; height: 26px; background: rgba(255,255,255,0.18); }
.app-header .brand .product {
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: .2px;
}
.app-header .brand .product small {
  display: block; font-weight: 400; font-size: 11px;
  color: rgba(255,255,255,0.55); letter-spacing: .3px;
}
.app-header .brand .product .build-tag {
  font-size: 9px; color: rgba(255,255,255,0.35); margin-left: 6px;
}
.lang-badge {
  display: flex; align-items: center; gap: 0;
  border: 1px solid rgba(255,255,255,0.22); border-radius: 999px;
  overflow: hidden; font-size: 12px; font-weight: 600;
}
.lang-badge span { padding: 5px 11px; color: rgba(255,255,255,0.55); cursor: pointer; transition: all .15s; }
.lang-badge span:hover { color: rgba(255,255,255,0.85); }
.lang-badge span.on { background: rgba(255,255,255,0.12); color: #fff; }

/* Header right-side cluster: profile export/import + language */
.header-actions { display: flex; align-items: center; gap: 10px; }
.profile-io { display: flex; align-items: center; gap: 6px; }
.io-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid rgba(255,255,255,0.22); border-radius: 999px;
  background: transparent; color: rgba(255,255,255,0.75);
  font-size: 12px; font-weight: 600; font-family: inherit; line-height: 1;
  padding: 6px 11px; cursor: pointer; transition: all .15s;
}
.io-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.08); }
.io-btn .io-icon { font-size: 13px; }

/* v1.7.5: opt-in "include custom vehicles" toggle, next to Export */
.io-toggle {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.22); border-radius: 999px;
  padding: 5px 9px; font-size: 12px; color: rgba(255,255,255,0.75); transition: all .15s;
}
.io-toggle:has(input:checked) { color: #fff; border-color: var(--c-accent); background: rgba(255,255,255,0.08); }
.io-toggle input { margin: 0; accent-color: var(--c-accent); cursor: pointer; }

@media (max-width: 640px) {
  .app-header .brand .divider, .app-header .brand .product { display: none; }
  .io-btn .io-label { display: none; }
  .io-btn { padding: 6px 9px; }
}

/* Stepper */
.stepper {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky; top: 64px; z-index: 30;
}
.stepper-inner {
  max-width: 1000px; margin: 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between;
}
.step {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; position: relative; cursor: default; text-align: center;
  min-width: 0;
}
.step.clickable { cursor: pointer; }
.step .bubble {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; z-index: 2;
  background: #E5EAEF; color: var(--text-muted);
  border: 2px solid transparent;
  transition: all .2s ease;
}
.step.done  .bubble { background: var(--c-accent); color: #fff; }
.step.active .bubble {
  background: var(--c-primary); color: #fff;
  box-shadow: 0 0 0 4px rgba(15,30,39,0.12);
}
.step .lbl  { font-size: 12px; font-weight: 600; margin-top: 7px; color: var(--text-muted); line-height: 1.25; }
.step .sub  { font-size: 10.5px; color: var(--text-muted); opacity: .8; line-height: 1.2; }
.step.active .lbl { color: var(--c-primary); }
.step.done   .lbl { color: var(--text); }
.step .connector {
  position: absolute; top: 17px; height: 2px; background: var(--border);
  left: 50%; width: 100%; z-index: 1;
}
.step.done .connector { background: var(--c-accent); }
.step:last-child .connector { display: none; }
.step.clickable:hover .bubble { transform: translateY(-1px); }

/* Content area */
.content {
  flex: 1; background: var(--bg);
  padding: 28px 24px 16px;
}
.content-inner { max-width: 960px; margin: 0 auto; }
.screen-head { margin: 2px 0 20px; }
.screen-head h1 { font-size: 21px; font-weight: 700; color: var(--c-primary); margin: 0; letter-spacing: -.2px; }
.screen-head .id-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* Bottom nav */
.bottom-nav {
  height: 64px; background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: fixed; bottom: 0; left: 0; right: 0; z-index: 35;
}
.bottom-nav .counter { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.bottom-nav .counter b { color: var(--text); font-weight: 600; }

/* Copyright footer */
.app-copyright {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 16px 24px; margin-bottom: 64px;
  font-size: 11.5px; color: var(--text-muted); background: var(--bg);
  border-top: 1px solid var(--border); text-align: center;
}
.app-copyright .cr-platform { display: none; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--c-primary); margin: 0; }
.card-title .id-sub { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-top: 2px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }

/* Form layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.row-full { grid-column: 1 / -1; }
@media (max-width: 720px){ .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
@media (max-width: 1100px) and (min-width: 721px){ .grid-4 { grid-template-columns: 1fr 1fr; } }

/* Field */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { line-height: 1.25; }
.field .lab-en { font-size: 13px; font-weight: 600; color: var(--text); }
.field .lab-en .req { color: var(--danger); margin-left: 2px; }
.field .lab-en .opt-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 4px; margin-left: 7px; vertical-align: middle;
}
.field .lab-id { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.field .help { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.input, .select, .textarea {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: #9BA6B2; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--c-primary-light);
  box-shadow: 0 0 0 3px rgba(28,59,73,0.12);
}
.textarea { resize: vertical; min-height: 76px; }
.select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7888' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}

/* Affixed inputs (prefix / suffix) */
.affix {
  display: flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.affix:focus-within { border-color: var(--c-primary-light); box-shadow: 0 0 0 3px rgba(28,59,73,0.12); }
.affix .fix {
  display: flex; align-items: center; padding: 0 11px;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.affix .fix.pre { border-right: 1px solid var(--border); }
.affix .fix.suf { border-left: 1px solid var(--border); }
.affix input {
  border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--text);
  padding: 10px 12px; width: 100%; min-width: 0; text-align: left;
}
.input.readonly, .affix.readonly { background: var(--surface-2); color: var(--text-muted); }
.affix.readonly input { color: var(--text-muted); }

/* Slider */
.slider-field .slider-top { display: flex; align-items: center; justify-content: space-between; }
.slider-field .live {
  font-size: 13px; font-weight: 700; color: var(--c-primary);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 12px;
}
.slider-wrap { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
input[type=range].range { -webkit-appearance: none; appearance: none; flex: 1; height: 6px; border-radius: 999px; background: var(--border); outline: none; }
input[type=range].range::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; }
input[type=range].range::-moz-range-track { height: 6px; border-radius: 999px; background: var(--border); }
input[type=range].range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--c-accent); }
input[type=range].range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -7px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--c-primary); border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer;
}
input[type=range].range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--c-primary); border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer;
}
.slider-wrap .num-sync { width: 78px; flex: none; text-align: center; }

/* AdBlue block in advanced assumptions */
.adblue-block {
  margin-top: 18px; padding: 16px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.adblue-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.adblue-head .ab-title { font-size: 13px; font-weight: 700; color: var(--c-primary); }
.adblue-head .ab-mode {
  font-size: 11px; font-weight: 700; letter-spacing: .2px;
  padding: 3px 9px; border-radius: 999px;
}
.adblue-head .ab-mode.on  { background: var(--ev-bg);  color: var(--ev-fg); }
.adblue-head .ab-mode.off { background: var(--ice-bg); color: var(--ice-fg); }
.adblue-block input:disabled { cursor: not-allowed; }

/* Toggle pill */
.pill-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1px solid var(--border); border-radius: 999px; padding: 4px;
  background: var(--surface-2);
}
.pill-toggle button {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text-muted);
  padding: 10px 14px; border-radius: 999px; transition: all .18s;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.pill-toggle button.on { background: var(--c-primary); color: #fff; box-shadow: var(--shadow); }

/* Buttons */
.btn {
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); padding: 10px 18px; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 8px; transition: all .15s;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-light); }
.btn-accent  { background: var(--c-accent); color: #fff; }
.btn-accent:hover { background: var(--c-accent-light); }
.btn-ghost   { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm      { font-size: 12px; padding: 6px 12px; }
.btn-icon    { background: transparent; border: none; cursor: pointer; font-size: 16px; color: var(--text-muted); line-height: 1; padding: 4px; }
.btn-icon:hover { color: var(--text); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Per-screen reset button + change-log overlay (task #33) ---- */
.changelog-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.changelog-modal {
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden;
}
.changelog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.changelog-head h3 { margin: 0; font-size: 16px; }
.changelog-sub { padding: 10px 20px; font-size: 12.5px; color: var(--text-muted); }
.changelog-empty { padding: 30px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.changelog-list { overflow-y: auto; padding: 0 20px; flex: 1; }
.changelog-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.changelog-row-main { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.changelog-screen-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--c-accent); }
.changelog-field { font-size: 13px; font-weight: 600; }
.changelog-row-vals { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.changelog-row-vals b { color: var(--text); }
.changelog-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 8px; border-radius: 5px; line-height: 1.6;
}
.badge.ev   { background: var(--ev-bg);  color: var(--ev-fg); }
.badge.ice  { background: var(--ice-bg); color: var(--ice-fg); }
.badge.vktr { background: var(--c-primary); color: #fff; }
.badge.win  { background: var(--c-accent); color: #fff; }
.badge.match { background: var(--ev-bg); color: var(--c-accent); border: 1px solid var(--c-accent); }
.badge.muted  { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge.info   { background: var(--ev-bg); color: var(--c-accent); }
.badge.ok     { background: var(--ev-bg); color: var(--ev-fg); }
.badge.danger { background: #FDECEA; color: var(--c-danger, #c0392b); }

/* Alerts */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.5; }
.alert .ic { flex: none; font-size: 15px; line-height: 1.4; }
.alert.info  { background: #EAF0F6; color: #3D5060; border: 1px solid #D5E0EC; }
.alert.warn  { background: var(--ice-bg); color: var(--ice-fg); border: 1px solid #F2D89A; }
.alert.error { background: #FEE2E2; color: #991B1B; border: 1px solid #F6B0B0; }
.sanity-banner { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }

/* Infrastructure (Screen 4) suitability highlights */
.infra-veh-list { margin: 8px 0 0; padding-left: 18px; }
.infra-veh-list li { margin-bottom: 2px; }
.infra-box { display: flex; flex-direction: column; gap: 6px; }
.infra-box .badge { align-self: flex-start; }
.infra-box.matched .sdrop-input input { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
.infra-box.not-relevant { opacity: .55; }
.infra-note { font-size: 11px; color: var(--text-muted); font-style: italic; line-height: 1.4; }
.sdrop.disabled { pointer-events: none; }
.sdrop.disabled .input { background: var(--surface-2); color: var(--text-muted); }
.grid-2.infra-disabled { opacity: .45; pointer-events: none; }

/* Searchable dropdown */
.sdrop { position: relative; }
.sdrop .sdrop-input { position: relative; }
.sdrop .sdrop-input .si {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.sdrop .sdrop-input input { padding-left: 34px; padding-right: 32px; }
.sdrop .sdrop-input .clr {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  border: none; background: var(--surface-2); color: var(--text-muted);
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.sdrop-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 5px); z-index: 20;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 280px; overflow: auto; padding: 5px;
}
.sdrop-item {
  display: flex; flex-direction: column; gap: 3px; padding: 9px 11px;
  border-radius: 6px; cursor: pointer;
}
.sdrop-item:hover, .sdrop-item.hl { background: var(--surface-2); }
.sdrop-item .di-top { display: flex; align-items: center; gap: 7px; }
.sdrop-item .di-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.sdrop-item .di-brand { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
.sdrop-item .di-sub  { font-size: 11.5px; color: var(--text-muted); }
.sdrop-item.none .di-name { color: var(--text-muted); font-weight: 500; font-style: italic; }
.sdrop-group-header {
  position: sticky; top: -5px; z-index: 1;
  margin: 0 -5px; padding: 6px 11px;
  font-size: 11px; font-weight: 800; letter-spacing: .5px;
  color: var(--text-muted); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.sdrop-group-header:first-child { top: -5px; margin-top: -5px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

/* Spec preview */
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-top: 14px; }
.spec-cell { background: var(--surface); padding: 11px 13px; }
.spec-cell .sk { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.spec-cell .sv { font-size: 15px; font-weight: 700; color: var(--text); margin-top: 2px; }
.spec-cell .sv.placeholder { color: var(--warning); font-style: italic; font-weight: 600; font-size: 13px; }

/* Editable price cell in vehicle spec grid */
.spec-cell.editable { background: #F0FAF4; }
.spec-cell.editable .sk { display: flex; align-items: center; gap: 6px; }
.spec-cell.editable .edit-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  color: var(--ev-fg); background: var(--ev-bg); padding: 1px 5px; border-radius: 4px;
}
.price-affix { margin-top: 5px; background: var(--surface); }
.price-affix .fix.pre { font-size: 12px; padding: 0 9px; }
.price-affix input { padding: 7px 10px; font-size: 15px; font-weight: 700; color: var(--text); }

/* Collapsible */
.collapse-head { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.collapse-head .chev { transition: transform .2s; color: var(--text-muted); }
.collapse-head.open .chev { transform: rotate(90deg); }
.collapse-body { overflow: hidden; }

/* VS divider (screen 4) */
.vs-grid { display: grid; grid-template-columns: 1fr 64px 1fr; gap: 0; align-items: stretch; }
@media (max-width: 720px){ .vs-grid { grid-template-columns: 1fr; } }
.vs-divider { display: flex; align-items: center; justify-content: center; }
.vs-divider span { font-size: 26px; font-weight: 800; color: var(--border-strong); letter-spacing: 1px; }
.vs-add-row { grid-column: 1 / -1; display: flex; justify-content: center; padding-top: 12px; }

/* ---- Vehicle Specifications sub-tab (v1.7) ---- */
.vehicle-spec-editor { display: flex; flex-direction: column; gap: 14px; padding: 4px; }
.vehicle-spec-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vehicle-spec-header > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vehicle-spec-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.vehicle-spec-guest-note {
  font-size: 12px; color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px;
}
.vehicle-spec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
@media (max-width: 480px){ .vehicle-spec-grid { grid-template-columns: 1fr; } }
.veh-col .card { margin-bottom: 0; height: 100%; }
.veh-head { font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.veh-type-filter { margin-bottom: 8px; }
.veh-type-filter .select { width: 100%; }

/* ============================================================
   Screen 6 — Report
   ============================================================ */
.report { background: var(--surface); padding: 4px 18px 8px; }
@media (max-width: 720px){ .report { padding: 4px 6px 8px; } }
.report-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding-bottom: 18px; border-bottom: 2px solid var(--c-primary); margin-bottom: 22px;
}
.report-header .rh-left img { height: 30px; display: block; margin-bottom: 14px; }
.report-header h1 { font-size: 22px; font-weight: 700; color: var(--c-primary); margin: 0; }
.report-header .rh-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.report-header .rh-right { text-align: right; }
.report-header .rh-company { font-size: 15px; font-weight: 700; color: var(--text); }
.report-header .rh-date { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 720px){ .kpi-row { grid-template-columns: 1fr 1fr; } }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--c-primary); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 14px; text-align: center;
}
.kpi .kic { font-size: 18px; }
.kpi .kval { font-size: 26px; font-weight: 800; color: var(--c-primary); margin: 6px 0 2px; letter-spacing: -.5px; }
.kpi .kval.green { color: var(--c-accent); }
.kpi .klbl { font-size: 11px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .3px; }
.kpi .ksub { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.35; }

/* TCO table */
.tco-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.tco-table th, .tco-table td { padding: 11px 14px; font-size: 13px; text-align: right; border-bottom: 1px solid var(--border); }
.tco-table th:first-child, .tco-table td:first-child { text-align: left; }
.tco-table thead th { font-size: 12px; vertical-align: bottom; }
.tco-table .colhead { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tco-table .colhead .cn { font-size: 14px; font-weight: 700; color: var(--text); }
.tco-table .colhead .badges { display: flex; gap: 5px; }
.tco-table td.lbl { color: var(--text); }
.tco-table td.lbl small { display: block; color: var(--text-muted); font-size: 11px; font-weight: 400; }
.tco-table tr-num { font-variant-numeric: tabular-nums; }
.tco-table td.num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.tco-table tr.total td { background: var(--c-primary); color: #fff; font-weight: 800; font-size: 15px; border-bottom: none; }
.tco-table tr.total td small { color: rgba(255,255,255,.6); }
.tco-table td.win-border { box-shadow: inset 3px 0 0 var(--c-accent); }
.tco-table td.residual { color: var(--c-accent); }
.tco-table tr.total td.win-border { box-shadow: inset 3px 0 0 var(--c-accent-light); }
.tco-table td.delta { font-size: 12px; }
.tco-table td.delta.fav-a { color: var(--c-accent); }
.tco-table td.delta.fav-b { color: #0EA5E9; }
.tco-table tr.total td.delta.fav-a,
.tco-table tr.total td.delta.fav-b { font-size: 13px; }

/* Key takeaways */
.takeaways-card { padding: 18px 20px; }
.takeaways-card h3 { font-size: 15px; font-weight: 700; color: var(--c-primary); margin: 0 0 10px; }
.takeaways-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.takeaways-list li { font-size: 13px; line-height: 1.6; color: var(--text); }
.takeaways-list li b { color: var(--c-accent); }
.takeaways-list.compact { gap: 4px; }
.takeaways-list.compact li { font-size: 12.5px; line-height: 1.5; }
/* v1.7.8: IRR-vs-WACC hurdle-rate verdict banner, report.jsx C3 */
.irr-verdict { font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: var(--radius-sm); margin-bottom: 10px; }
.irr-verdict.pos { background: var(--ev-bg); color: var(--ev-fg); }
.irr-verdict.neg { background: #FEF3C7; color: #92400E; }

/* Cost distribution donuts */
.donut-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .donut-row { grid-template-columns: 1fr; } }
.donut-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.donut-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.donut-name { font-size: 13px; font-weight: 700; color: var(--text); }
.donut-body { display: flex; gap: 16px; align-items: center; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dl-row { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text); }
.dl-sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.dl-lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-pct { font-weight: 700; color: var(--text-muted); flex: none; }

/* Why-choose decision points */
/* v1.7.8: .decision-row/.decision-col ("Decision Points" card) removed --
   fused into .takeaways-list, see report.jsx C3. */

/* Chart */
.chart-card { padding: 20px 22px; }
.chart-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.chart-legend { display: flex; gap: 18px; margin-bottom: 14px; }
.chart-legend .lg { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-muted); }
.chart-legend .sw { width: 12px; height: 12px; border-radius: 3px; }

.metrics-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 22px 0; }
@media (max-width: 720px){ .metrics-row { grid-template-columns: 1fr; } }
.metric-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.metric-box .mk { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); font-weight: 700; }
.metric-box .mv { font-size: 16px; font-weight: 700; color: var(--text); margin-top: 4px; }
.metric-box .mv small { display:block; font-size: 11px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }

.reco-box { border: 1px solid var(--border); border-left: 4px solid var(--c-primary); border-radius: var(--radius-sm); padding: 18px 20px; background: var(--surface); }
.reco-box h3 { font-size: 15px; font-weight: 700; color: var(--c-primary); margin: 0 0 8px; }
.reco-box p { font-size: 13.5px; line-height: 1.65; color: var(--text); margin: 0; }
.reco-box p .hl { color: var(--c-accent); font-weight: 700; }

/* Report actions row */
.report-actions { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.report-actions .ra-spacer { flex: 1; }

/* Tweaks mount */
#tweaks-root { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }
#tweaks-root > * { pointer-events: auto; }

.inc-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-muted); cursor: pointer; user-select: none;
}
.inc-toggle input { width: 16px; height: 16px; accent-color: var(--c-accent); cursor: pointer; }

/* ---- Print-only input summary ---- */
.print-only { display: none; }
.print-summary { color: var(--text); }
.psum-cover { text-align: center; padding: 8px 0 22px; border-bottom: 2px solid var(--c-primary); margin-bottom: 22px; }
.psum-cover img { height: 30px; margin-bottom: 14px; }
.psum-cover h1 { font-size: 22px; color: var(--c-primary); margin: 0; }
.psum-cover .psum-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.psum-section { margin-bottom: 18px; break-inside: avoid; }
.psum-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700; color: var(--c-primary);
  border-left: 4px solid var(--c-accent); padding-left: 11px; margin-bottom: 10px;
}
.psum-head small { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.psum-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: var(--c-primary);
  color: #fff; font-size: 12px; font-weight: 700;
}
.psum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.psum-row { background: var(--surface); padding: 9px 13px; display: flex; flex-direction: column; gap: 2px; }
.psum-row .psum-k { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.psum-row .psum-k small { font-weight: 400; opacity: .75; margin-left: 4px; }
.psum-row .psum-v { font-size: 13.5px; font-weight: 600; color: var(--text); }

/* ============================================================
   Print — A4, only the report (+ optional input summary)
   ============================================================ */
@media print {
  .app-header, .stepper, .bottom-nav, .report-actions, #tweaks-root { display: none !important; }
  .content { padding: 0 !important; background: #fff !important; }
  body { background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .content-inner { max-width: none !important; }
  .card, .report { box-shadow: none !important; }
  .report { padding: 0 !important; }

  /* copyright repeats at the foot of every printed page */
  .app-copyright {
    position: fixed; bottom: 0; left: 0; right: 0;
    margin: 0 !important; padding: 5px 0 6px !important;
    flex-direction: column; gap: 1px;
    border-top: 1px solid var(--border); background: #fff !important;
  }
  .app-copyright .cr-platform {
    display: block !important; font-size: 9.5px; font-weight: 700; color: var(--c-primary);
  }
  .app-copyright .cr-rights { font-size: 8.5px; color: var(--text-muted); }

  .print-only { display: block !important; }
  .report-after-summary { break-before: page; }

  /* print every tab's content, regardless of which tab is active on screen */
  .report-tab-bar { display: none !important; }
  .report-tab-panel { display: flex !important; }
  .report-tab-panel + .report-tab-panel { break-before: page; }

  /* keep blocks intact across page breaks */
  .kpi, .metric-box, .reco-box, .chart-card, .card, .psum-section,
  .report-header, .kpi-row, .metrics-row,
  .takeaways-card, .donut-row, .donut-block { break-inside: avoid; }
  .tco-table { break-inside: auto; }
  .tco-table tr, .tco-table thead { break-inside: avoid; }
  .tco-table thead { display: table-header-group; }

  /* chart fits page width */
  .chart-card svg { width: 100% !important; height: auto !important; }

  @page { size: A4 portrait; margin: 14mm; }

  /* Estimasi footnote always visible on print */
  .estimasi-footnote { display: block !important; }
}

/* ============================================================
   PM Preset block (Screen 2 — Vehicle Selection)
   ============================================================ */
.pm-preset-block {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-alt, #f4f6f8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.pm-preset-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.pm-preset-years {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.pm-preset-cell {
  text-align: center;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
}
.pm-preset-cell.active {
  border-color: var(--c-primary);
  box-shadow: inset 0 0 0 1px var(--c-primary);
}
.pm-yr {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.pm-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-primary);
}
.pm-preset-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.4;
}

/* ============================================================
   Estimasi footnote (Screen 6 — Results)
   ============================================================ */
.estimasi-footnote {
  display: none;  /* shown only on print (override above) */
  font-size: 10px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 16px;
  line-height: 1.5;
}

/* Show on screen too when in report context */
.report .estimasi-footnote {
  display: block;
  font-size: 12px;
  margin-top: 12px;
}

/* ============================================================
   File System Access preset Explorer (v1.6)
   ============================================================ */
.fs-explorer-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.btn-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--c-primary); font-size: 13px; font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }
.explorer-table { width: 100%; border-collapse: collapse; }
.explorer-table th, .explorer-table td { padding: 9px 12px; font-size: 13px; text-align: left; border-bottom: 1px solid var(--border); }
.explorer-table thead th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); }
.explorer-row { cursor: pointer; }
.explorer-row:hover { background: var(--surface-2); }
.explorer-table tr:last-child td { border-bottom: none; }

/* ============================================================
   Side-by-side comparison table (v1.6)
   ============================================================ */
.sbs-table { width: 100%; border-collapse: collapse; margin-bottom: 0; }
.sbs-table th, .sbs-table td { padding: 11px 14px; font-size: 13px; text-align: right; border-bottom: 1px solid var(--border); }
.sbs-table th:first-child, .sbs-table td:first-child { text-align: left; }
.sbs-table thead th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); vertical-align: bottom; }
.sbs-table td.lbl { color: var(--text); font-weight: 600; }
.sbs-table td.num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
/* v1.7.7: dims the parts-based maintenance breakdown table when it isn't
   the mode actually feeding TCO (manual override set, or the breakdown
   toggle is off) -- still fully editable, just visually deprioritized. */
.sbs-table.maint-inactive { opacity: 0.55; }
.sbs-table td.num.better { color: var(--c-accent); }
.sbs-table td.diff { font-variant-numeric: tabular-nums; }
.sbs-table td.diff small { display: block; color: var(--text-muted); font-size: 11px; font-weight: 400; margin-top: 1px; }
.sbs-table tr:last-child td { border-bottom: none; }
.sbs-table tr.total td { font-weight: 800; font-size: 14px; background: var(--surface-2); }
.sbs-table tr.total td.lbl { color: var(--c-primary); }

.sbs-better-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 12px; font-weight: 800; color: #fff;
}
.sbs-better-badge.a { background: var(--c-primary); }
.sbs-better-badge.b { background: var(--c-accent); }

/* "Leads in" summary cards (v1.6) */
/* v1.7.8: .sbs-leads-row/.sbs-leads-col ("Cost Segment Leadership" card)
   removed -- fused into .takeaways-list, see report.jsx C3. aLeads/bLeads
   themselves (report.jsx) are unchanged, just rendered as one bullet each. */

/* KPI value — negative / unfavorable framing */
.kpi .kval.red { color: var(--danger); }

/* Badge warn kind (amber) */
.badge-warn, .badge.warn {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

/* ============================================================
   v1.3 — Infrastructure CAPEX redesign
   ============================================================ */

/* ---- Expert Mode toggle ---- */
.expert-toggle {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); user-select: none; transition: all .15s;
}
.expert-toggle:hover { border-color: var(--border-strong); }
.expert-toggle.active { border-color: var(--c-accent); background: var(--ev-bg); }
.expert-toggle .et-icon { font-size: 14px; }
.expert-toggle .et-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.expert-toggle.active .et-label { color: var(--ev-fg); }
.expert-toggle .et-switch {
  width: 32px; height: 18px; border-radius: 999px; background: var(--border-strong);
  position: relative; transition: background .15s; flex: none;
}
.expert-toggle .et-switch.on { background: var(--c-accent); }
.expert-toggle .et-knob {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: left .15s;
}
.expert-toggle .et-switch.on .et-knob { left: 16px; }

/* Tab dot indicator when expert mode is on for a tab */
.infra-tab .tab-expert-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-accent); margin-left: 5px; vertical-align: middle;
}

/* ---- Preset card ---- */
.preset-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); margin-bottom: 18px;
}
.preset-card .pc-current { display: flex; align-items: center; gap: 12px; min-width: 0; }
.preset-card .pc-icon { font-size: 26px; flex: none; }
.preset-card .pc-label { font-size: 14px; font-weight: 700; color: var(--c-primary); }
.preset-card .pc-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- Preset modal ---- */
.preset-modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,30,39,0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.preset-modal {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 760px; max-height: 86vh; overflow: auto; padding: 22px 24px;
  position: relative;
}
.preset-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.preset-modal-head h3 { font-size: 16px; font-weight: 700; color: var(--c-primary); margin: 0; }
.preset-filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.preset-filter-tabs button {
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
  border-radius: 999px; padding: 6px 13px; transition: all .15s;
}
.preset-filter-tabs button.on { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 720px){ .preset-grid { grid-template-columns: repeat(2, 1fr); } }
.preset-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px;
  cursor: pointer; transition: all .15s; text-align: center;
}
.preset-item:hover { border-color: var(--c-accent); box-shadow: var(--shadow); }
.preset-item.active { border-color: var(--c-accent); background: var(--ev-bg); }
.preset-item .pi-icon { font-size: 22px; }
.preset-item .pi-label { font-size: 12.5px; font-weight: 700; color: var(--text); margin-top: 6px; }
.preset-item .pi-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.35; }

.preset-confirm-overlay {
  position: absolute; inset: 0; z-index: 210; border-radius: var(--radius);
  background: rgba(15,30,39,0.35); display: flex; align-items: center; justify-content: center; padding: 20px;
}
.preset-confirm {
  background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 18px 20px; max-width: 380px; text-align: center;
}
.preset-confirm p { font-size: 13.5px; color: var(--text); line-height: 1.5; margin: 0 0 14px; }
.preset-confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ---- Needs Intake Wizard (v1.7) ---- */
.needs-intake-modal { max-width: 620px; }
.needs-intake-mode-toggle { display: flex; justify-content: center; margin-bottom: 16px; }
.needs-intake-ai { display: flex; flex-direction: column; gap: 12px; }
.needs-intake-ai textarea { min-height: 120px; }
.needs-intake-ai-gate {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 13.5px;
}
.needs-intake-progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 20px; }
.needs-intake-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all .15s; }
.needs-intake-dot.active { background: var(--c-accent); width: 20px; border-radius: 4px; }
.needs-intake-dot.done { background: var(--c-primary); }
.needs-intake-question { font-size: 16px; font-weight: 700; color: var(--c-primary); text-align: center; margin-bottom: 16px; }
.needs-intake-input { max-width: 260px; margin: 0 auto; }
.needs-intake-hint { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 10px; }
.needs-intake-summary {
  display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 14px;
}
.needs-intake-nav { display: flex; justify-content: space-between; margin-top: 22px; }
.needs-intake-modal.wide { max-width: 920px; }

/* ---- Needs Intake: Recommended Vehicles step (v1.7.8) ---- */
.needs-intake-reco-hint { font-size: 12.5px; color: var(--text-muted); text-align: center; margin: -8px 0 16px; }
.needs-intake-reco-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; overflow-x: auto; }
@media (max-width: 760px) { .needs-intake-reco-grid { grid-template-columns: repeat(2, 1fr); } }
.needs-intake-reco-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; min-width: 0;
  display: flex; flex-direction: column; gap: 8px; background: var(--surface);
}
.needs-intake-reco-card.picked-a { border-color: var(--c-primary); box-shadow: 0 0 0 1px var(--c-primary); }
.needs-intake-reco-card.picked-b { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
.needs-intake-reco-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.needs-intake-reco-name { font-size: 12.5px; font-weight: 700; color: var(--text); line-height: 1.3; }
.needs-intake-reco-brand { font-size: 10.5px; color: var(--text-muted); }
.needs-intake-reco-rows { display: flex; flex-direction: column; gap: 4px; font-size: 11px; }
.needs-intake-reco-rows .r { display: flex; justify-content: space-between; gap: 6px; color: var(--text-muted); }
.needs-intake-reco-rows .r b { color: var(--text); font-weight: 600; }
.needs-intake-reco-tco { font-size: 12.5px; font-weight: 700; color: var(--c-primary); border-top: 1px dashed var(--border); padding-top: 6px; margin-top: 2px; }
.needs-intake-reco-picks { display: flex; gap: 6px; }
.needs-intake-reco-picks button {
  flex: 1; font-size: 10.5px; font-weight: 700; padding: 5px 4px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; color: var(--text-muted);
}
.needs-intake-reco-picks button.on-a { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.needs-intake-reco-picks button.on-b { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }

/* ---- Needs Intake entry card (Screen 1) ---- */
.needs-intake-entry {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border: 1px solid var(--c-accent); background: var(--ev-bg);
  border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 16px;
}
.needs-intake-entry .nie-text { font-size: 13.5px; font-weight: 700; color: var(--ev-fg); }
.needs-intake-entry .nie-text small { display: block; font-weight: 400; font-size: 11.5px; opacity: .85; margin-top: 2px; }

/* ---- Value-change flag ---- */
.value-flag { position: relative; display: inline-flex; margin-left: 6px; vertical-align: middle; }
.value-flag-dot { color: var(--warning); font-size: 10px; cursor: pointer; line-height: 1; }
.value-flag-tooltip {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--c-primary); color: #fff; font-size: 11px; line-height: 1.5;
  padding: 8px 11px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  white-space: nowrap; z-index: 50;
}
.value-flag-tooltip b { color: var(--c-accent-light); }
.value-flag-tooltip em { font-style: normal; color: rgba(255,255,255,.7); }

/* ---- Source citation tooltip (hover-only, non-interactive) ---- */
.source-tag { position: relative; display: inline-flex; margin-left: 6px; vertical-align: middle; cursor: help; }
.source-tag-icon { font-size: 10px; line-height: 1; opacity: .8; }
.source-tag-tooltip {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--c-primary); color: #fff; font-size: 11.5px; line-height: 1.5;
  padding: 8px 11px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  white-space: normal; width: 240px; z-index: 60;
}
.source-tag-tooltip b { color: var(--c-accent-light); }

/* ---- Audit tab caption (v1.9) — small label + InfoHint, replaces the
   full-width "Financial audit for this section..." Alert boxes that used
   to open every Audit sub-tab. ---- */
.audit-caption {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
  color: var(--text-muted); margin-bottom: 10px;
}

/* ---- Yearly expense editor (Operation/Maintenance/Infrastructure/Financial) ---- */
.yearly-table-scroll { overflow-x: auto; }
.yearly-table { white-space: nowrap; }
.yearly-table th, .yearly-table td { text-align: center; padding: 4px 6px; }
.yearly-table td.lbl { text-align: left; white-space: nowrap; }
.yearly-cell-input {
  width: 84px; text-align: right; font-size: 12px; padding: 4px 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}

/* ---- Inline per-line-item price edit (maintenance parts, CAPEX rows) ---- */
.inline-price-edit { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; }
.inline-price-edit .fix.pre { font-size: 11px; color: var(--text-muted); }
.inline-price-input {
  width: 90px; font-size: 11px; padding: 2px 5px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.inline-price-input:focus { border-color: var(--c-accent); outline: none; }

/* ---- Collapsible section ---- */
.collapsible-section { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; }
.collapsible-header {
  display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none;
  padding: 12px 14px; font-size: 13px; font-weight: 700; color: var(--c-primary);
  background: var(--surface-2);
}
.collapsible-header .chevron { display: flex; color: var(--text-muted); transition: transform .2s; }
.collapsible-header.open .chevron { transform: rotate(90deg); }
.collapsible-content { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.collapsible-inner { padding: 14px; border-top: 1px solid var(--border); }

/* ---- Budget alert ---- */
.budget-alert {
  border: 1px solid #F2D89A; background: var(--ice-bg); color: var(--ice-fg);
  border-radius: var(--radius-sm); padding: 13px 16px; margin-bottom: 16px;
}
.budget-alert.infeasible { border-color: #F6B0B0; background: #FEE2E2; color: #991B1B; }
.budget-alert .ba-head { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.budget-alert .ba-reco { font-size: 12.5px; line-height: 1.5; }
.budget-alert .ba-reco-detail { font-size: 11.5px; color: inherit; opacity: .85; margin-top: 2px; }
.budget-alert .ba-link { font-size: 11px; margin-top: 8px; font-weight: 600; opacity: .85; }

/* Budget bar (Screen 5) */
.budget-bar { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 8px; }
.budget-bar-fill { height: 100%; background: var(--c-accent); transition: width .3s; }
.budget-bar-fill.over { background: var(--danger); }

/* ---- Side-by-side tooltip table ---- */
.sstt-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.sstt-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
.sstt-table td:last-child { text-align: right; font-weight: 700; color: var(--text); }
.sstt-table tr:last-child td { border-bottom: none; }

/* ---- Reusability score ---- */
.reusability-score { margin-top: 8px; }
.reusability-top { display: flex; align-items: center; gap: 8px; }
.reusability-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.reusability-badge.high   { background: var(--ev-bg);  color: var(--ev-fg); }
.reusability-badge.medium { background: var(--ice-bg); color: var(--ice-fg); }
.reusability-badge.low    { background: #FEE2E2; color: #991B1B; }
.reusability-bar { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 6px; }
.reusability-bar-fill { height: 100%; transition: width .3s; }
.reusability-bar-fill.high   { background: var(--c-accent); }
.reusability-bar-fill.medium { background: var(--warning); }
.reusability-bar-fill.low    { background: var(--danger); }

/* ---- Infra readiness indicator ---- */
.readiness-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; padding: 7px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.readiness-green  { background: var(--ev-bg);  color: var(--ev-fg); border-color: #BFE8D2; }
.readiness-yellow { background: var(--ice-bg); color: var(--ice-fg); border-color: #F2D89A; }
.readiness-red    { background: #FEE2E2; color: #991B1B; border-color: #F6B0B0; }
.readiness-indicator .ri-icon { font-size: 13px; }

/* ---- CAPEX category row (Tab 5) ---- */
.capex-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; }
.capex-row.not-applicable { opacity: .55; background: var(--surface-2); }
.capex-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.capex-cat-label { font-size: 13.5px; font-weight: 700; color: var(--c-primary); }
.capex-cat-total { font-size: 14px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.badge-na {
  font-size: 9px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 4px;
}
.capex-row-reason { font-size: 11.5px; color: var(--text-muted); font-style: italic; margin-top: 6px; }
.capex-row-items { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 5px; }
.capex-item { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text); }
.capex-item span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- Infrastructure tab bar (Screen 4) ---- */
.infra-tab-bar {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 18px; overflow-x: auto;
}
.infra-tab {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; background: transparent; color: var(--text-muted);
  padding: 11px 16px; border-bottom: 2px solid transparent; white-space: nowrap;
  transition: all .15s;
}
.infra-tab:hover { color: var(--text); }
.infra-tab.active { color: var(--c-primary); border-bottom-color: var(--c-accent); }
.infra-tab-panel { display: flex; flex-direction: column; gap: 18px; }

/* ---- Depot Design tab (Screen 4, embedded depot_floorplan tool) ---- */
.depot-embed-frame {
  width: 100%; height: 82vh; min-height: 640px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface);
}

/* ---- Shift rows (Tab 1 — Fleet Profile) ---- */
.shift-row {
  display: grid; grid-template-columns: auto 1fr 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px;
}
@media (max-width: 720px){ .shift-row { grid-template-columns: 1fr; } }
.shift-row .shift-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
.empty-window-callout {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 12px 14px; font-size: 12.5px;
  color: var(--text-muted); line-height: 1.5;
}

/* ---- Financial expert section (Screen 5) ---- */
.financial-expert-section {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; margin-top: 14px; background: var(--surface-2);
}
.assumption-tag, .future-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle;
}
.assumption-tag { color: var(--ice-fg); background: var(--ice-bg); border: 1px solid #F2D89A; }
.future-tag { color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); }

/* ---- Small pill toggle (e.g. tyre tier) ---- */
.chip {
  font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); }
.chip-active { border-color: var(--c-accent); background: var(--ev-bg); color: var(--ev-fg); }

/* ---- Option card selector (Project Type / Charging Type) ---- */
.option-card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 6px; }
@media (max-width: 720px){ .option-card-grid { grid-template-columns: repeat(2, 1fr); } }
.option-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px;
  cursor: pointer; transition: all .15s; text-align: center; background: var(--surface);
}
.option-card:hover { border-color: var(--border-strong); }
.option-card.active { border-color: var(--c-accent); background: var(--ev-bg); box-shadow: 0 0 0 1px var(--c-accent); }
.option-card .oc-icon { font-size: 22px; }
.option-card .oc-label { font-size: 12.5px; font-weight: 700; color: var(--text); margin-top: 6px; }
.option-card .oc-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.35; }

/* ---- Preset suggestion card (Screen 1) ---- */
.preset-suggestion {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border: 1px dashed var(--c-accent); background: var(--ev-bg); color: var(--ev-fg);
  border-radius: var(--radius-sm); padding: 13px 16px;
}
.preset-suggestion .ps-text { font-size: 13px; font-weight: 600; }
.preset-suggestion .ps-text small { display: block; font-weight: 400; font-size: 11.5px; opacity: .85; margin-top: 2px; }

/* ---- Guide sidebar (per-screen step-by-step help) ---- */
.guide-toggle {
  position: fixed; right: 20px; bottom: 84px; z-index: 45;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--c-primary); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; cursor: pointer; box-shadow: var(--shadow-lg);
  transition: transform .15s, background .15s;
}
.guide-toggle:hover { transform: scale(1.06); }
.guide-toggle.open { background: var(--c-accent); }

.guide-overlay {
  position: fixed; inset: 0; background: rgba(15,30,39,0.35); z-index: 49;
}

.guide-sidebar {
  position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 92vw;
  background: var(--surface); box-shadow: var(--shadow-lg); z-index: 50;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
}
.guide-sidebar.open { transform: translateX(0); }
.guide-sidebar-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  background: var(--c-primary); color: #fff; flex: none;
}
.guide-sidebar-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.35; }
.guide-sidebar-head button {
  background: none; border: none; color: #fff; font-size: 18px; cursor: pointer;
  line-height: 1; opacity: .8; flex: none; padding: 2px;
}
.guide-sidebar-head button:hover { opacity: 1; }
.guide-sidebar-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.guide-step { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-start; }
.guide-step .gs-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ev-bg); color: var(--ev-fg); font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.guide-step .gs-text { font-size: 12.5px; line-height: 1.5; color: var(--text); }
.guide-step .gs-text .gs-id { display: block; color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }

/* ============================================================
   Screen 6 — Report tabs: Summary / Details / Calculation Steps (v1.5)
   ============================================================ */
.report-tab-bar {
  display: flex; gap: 4px; border-bottom: 2px solid var(--border);
  margin-bottom: 4px; overflow-x: auto; position: sticky; top: 0;
  background: var(--bg); z-index: 5;
}
.report-tab {
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  border: none; background: transparent; color: var(--text-muted);
  padding: 12px 20px; border-bottom: 3px solid transparent; white-space: nowrap;
  transition: all .15s; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.report-tab:hover { color: var(--text); background: var(--surface-2); }
.report-tab.active { color: var(--c-primary); border-bottom-color: var(--c-accent); background: var(--surface); }
.report-tab-panel { display: none; flex-direction: column; gap: 18px; }
.report-tab-panel.active { display: flex; }

/* ============================================================
   Screen 6 — TCO Stream Map (v1.4)
   ============================================================ */
.stream-map { display: flex; flex-direction: column; gap: 16px; }

.sm-breadcrumb {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.sm-crumb-btn {
  background: none; border: none; padding: 4px 6px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 700; color: var(--c-accent); cursor: pointer;
}
.sm-crumb-btn:hover:not(:disabled) { background: var(--ev-bg); }

/* ============================================================
   Auth + Admin Panel (v1.7)
   ============================================================ */
.auth-widget { position: relative; }
.auth-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 8px; min-width: 240px;
  display: flex; flex-direction: column; gap: 4px;
}
.auth-menu button {
  font-family: inherit; font-size: 13px; text-align: left; cursor: pointer;
  background: none; border: none; border-radius: var(--radius-sm); padding: 8px 10px;
  color: var(--text); display: flex; align-items: center; gap: 8px;
}
.auth-menu button:hover { background: var(--surface-2); }
.auth-menu-you { font-size: 12px; color: var(--text-muted); padding: 4px 10px 8px; display: flex; align-items: center; gap: 6px; }
.auth-menu-note { font-size: 11px; color: var(--text-muted); padding: 4px 10px 8px; line-height: 1.4; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15,30,39,0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-panel {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 920px; max-height: 86vh; overflow: auto; padding: 22px 24px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 17px; font-weight: 700; color: var(--c-primary); margin: 0; display: flex; align-items: center; gap: 8px; }
.modal-close {
  background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text-muted);
  padding: 4px 8px; border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--surface-2); }

.admin-panel-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 14px; }
.admin-panel-loading { padding: 24px; text-align: center; color: var(--text-muted); }
.admin-panel-hint { font-size: 11px; color: var(--text-muted); margin-top: 14px; line-height: 1.5; }

/* ---- My Library panel (v1.7) ---- */
.library-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.library-tab {
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.library-tab.active { color: var(--c-primary); border-bottom-color: var(--c-accent); }
.library-body { display: flex; flex-direction: column; gap: 2px; min-height: 120px; }
.library-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.library-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.library-row:hover { background: var(--surface-2); }
.library-row-info { flex: 1; min-width: 0; }
.library-row-name { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-row-sub { font-size: 11.5px; color: var(--text-muted); }
.library-row-btn { padding: 5px 7px; font-size: 13px; flex: none; }
.library-row-danger { color: var(--c-danger, #c0392b); }
.library-guest-note, .library-empty {
  font-size: 13px; color: var(--text-muted); text-align: center; padding: 24px 12px; line-height: 1.5;
}

/* ---- Route import panel (v1.7) ---- */
.route-import-panel { margin: 14px 0 4px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.route-import-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.route-import-status { font-size: 12px; color: var(--text-muted); }
.route-import-error { font-size: 12px; color: var(--c-danger, #c0392b); }
.route-import-preview { margin-top: 12px; }
/* Leaflet's own CSS gives .leaflet-container position:relative but no
   explicit z-index, so it never establishes its own isolated stacking
   context -- its internal panes (up to z-index:700 for popups) were
   competing with .app-header's z-index:40 in the PAGE's stacking order,
   rendering the map over the sticky header. An explicit z-index (even 0)
   on a position:relative element DOES create a new stacking context,
   containing Leaflet's internal z-indices inside it (v1.7.5 fix). */
.leaflet-container { z-index: 0; }

/* ---- Route search box (v1.7.5, Nominatim place search) ---- */
.route-search-row { display: flex; gap: 6px; margin-bottom: 8px; }
.route-search-results {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 8px; max-height: 160px; overflow-y: auto;
}
.route-search-result { padding: 7px 10px; font-size: 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.route-search-result:last-child { border-bottom: none; }
.route-search-result:hover { background: var(--surface-2); }
.route-search-empty { padding: 8px 10px; font-size: 12px; color: var(--text-muted); }
.route-roundtrip-toggle { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text); margin-top: 8px; cursor: pointer; }

/* ---- Pure-CSS hover tooltip (v1.7.5) ----
   Lighter than a JS-driven tooltip component: no React state, no extra
   DOM nodes beyond one ::after pseudo-element, no listeners. Reads its
   text straight from the data-tooltip attribute. Kept alongside the
   native title attribute (accessibility/keyboard-focus fallback) on the
   elements that use this, not a replacement for it.
   position:relative for the base [data-tooltip] rule lives at the TOP of
   this file (right after #root), not here -- see that rule's comment for
   why: it must lose any specificity tie against a component's own
   position:fixed/absolute rule, which only happens if it's declared
   first, before every component rule in the file. */
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 8px); right: 0;
  background: #1a1a1a; color: #fff; font-size: 11.5px; font-weight: 600;
  padding: 6px 10px; border-radius: 6px;
  width: max-content; max-width: 260px; white-space: normal; text-align: left;
  opacity: 0; pointer-events: none; transform: translateY(4px);
  transition: opacity .12s ease, transform .12s ease; z-index: 401;
}
[data-tooltip]:hover::after { opacity: 1; transform: translateY(0); }
/* Header-row tooltips (e.g. .io-toggle) sit too close to the viewport top
   for the default upward "bottom: 100%" placement -- it renders partly
   off-screen above the page. Point these downward instead; the resting
   (pre-hover) offset flips sign to match -- :hover still settles to 0
   via the shared rule above, which is correct for either direction. */
.io-toggle::after { bottom: auto; top: calc(100% + 8px); transform: translateY(-4px); }
.route-import-stats { display: flex; gap: 18px; margin-top: 10px; }
.route-import-stats .sk { display: block; font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
.route-import-stats .sv { display: block; font-size: 14px; font-weight: 700; color: var(--text); margin-top: 2px; }
.route-import-guest-note { font-size: 11.5px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.admin-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px;
  color: var(--text-muted); border-bottom: 1px solid var(--border); padding: 8px 8px;
}
.admin-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-user-name { font-weight: 700; color: var(--text); }
.admin-user-email { font-size: 11px; color: var(--text-muted); }
.admin-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.admin-token-limit { display: flex; align-items: center; gap: 8px; }
.admin-unlimited { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); cursor: pointer; }
.sm-crumb-btn:disabled { color: var(--c-primary); cursor: default; }
.sm-sep { color: var(--text-muted); font-size: 13px; }
.sm-crumb-current { font-size: 13px; font-weight: 700; color: var(--c-primary); padding: 4px 6px; }
.sm-spacer { flex: 1; }

/* Macro view — top row of N phases (auto-fit, v1.7.5 added Depot Design
   Engine as a 5th non-synth phase), TCO card centered below */
.sm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
@media (max-width: 540px) { .sm-grid { grid-template-columns: 1fr; } }

.sm-synth-row { display: flex; justify-content: center; }
.sm-synth-row .sm-phase-card { width: 100%; max-width: 320px; align-items: center; text-align: center; }
.sm-synth-row .sm-phase-num { left: 12px; right: auto; }
.sm-synth-row .sm-phase-name { padding-right: 0; }

.sm-phase-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left; position: relative;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: all .15s; font-family: inherit;
}
.sm-phase-card:hover { border-color: var(--c-accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.sm-phase-icon { font-size: 26px; line-height: 1; margin-bottom: 2px; }
.sm-phase-num {
  position: absolute; top: 12px; right: 12px;
  width: 24px; height: 24px; border-radius: 50%; background: var(--c-primary); color: #fff;
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.sm-phase-name { font-size: 14px; font-weight: 700; color: var(--c-primary); padding-right: 24px; }
.sm-phase-desc { font-size: 11.5px; color: var(--text); line-height: 1.4; }
.sm-phase-screen { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.sm-phase-count { font-size: 11px; color: var(--c-accent); font-weight: 600; margin-top: 2px; }

.sm-synth {
  background: var(--ev-bg); border-color: var(--c-accent);
}
.sm-synth .sm-phase-icon { font-size: 36px; }
.sm-synth .sm-phase-num { background: var(--c-accent); }
.sm-synth .sm-phase-name { font-size: 16px; color: var(--ev-fg); }
.sm-synth .sm-phase-screen { color: var(--ev-fg); opacity: .8; }

/* Meso view */
.sm-phase-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.sm-phase-icon-lg {
  font-size: 28px; line-height: 1; flex: none; width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.sm-phase-head h4 { margin: 0; font-size: 16px; font-weight: 700; color: var(--c-primary); }
.sm-meso-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .sm-meso-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .sm-meso-grid { grid-template-columns: 1fr; } }
.sm-meso-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; cursor: pointer; transition: all .15s; font-family: inherit;
}
.sm-meso-card:hover { border-color: var(--c-accent); box-shadow: var(--shadow); }
.sm-meso-icon { font-size: 20px; line-height: 1; }
.sm-meso-name { font-size: 13px; font-weight: 700; color: var(--c-primary); }
.sm-meso-preview { font-size: 12px; color: var(--text-muted); }

/* Micro view */
.sm-micro-head { display: flex; align-items: center; gap: 10px; }
.sm-meso-icon-lg {
  font-size: 24px; line-height: 1; flex: none; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.sm-micro-head h4 { margin: 0; font-size: 15px; font-weight: 700; color: var(--c-primary); }

.sm-formula-box {
  background: var(--c-primary); color: #fff; border-radius: var(--radius-sm);
  padding: 16px 18px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px; line-height: 1.6; overflow-x: auto;
}
.sm-formula-box i { font-style: normal; color: var(--c-accent-light); }

.sm-kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sm-kpi-row.sm-kpi-single { grid-template-columns: 1fr; }
.sm-kpi-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; text-align: center;
}
.sm-kpi-tag {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  margin-bottom: 6px; color: var(--text-muted);
}
.sm-kpi-tag.a { color: var(--c-primary); }
.sm-kpi-tag.b { color: var(--c-accent); }
.sm-kpi-val { font-size: 18px; font-weight: 800; color: var(--c-primary); }
.sm-kpi-single .sm-kpi-label { font-size: 16px; font-weight: 800; color: var(--c-primary); }
.sm-kpi-single .sm-kpi-sub { font-size: 14px; font-weight: 700; color: var(--c-accent); margin-top: 4px; }

.sm-expert-block { display: flex; flex-direction: column; gap: 8px; }
.sm-vartable-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.sm-vartable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sm-vartable td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sm-var-sym { font-family: Consolas, Menlo, monospace; font-weight: 700; color: var(--c-accent); white-space: nowrap; width: 1%; }
.sm-var-desc { color: var(--text); }
.sm-meta { font-size: 11.5px; color: var(--text-muted); }

/* v1.7.5: recursive drill-down — variable rows that carry their own
   nested sub-formula are clickable, arbitrary depth */
.sm-var-clickable { cursor: pointer; transition: background .1s; }
.sm-var-clickable:hover { background: var(--ev-bg); }
.sm-var-clickable:hover .sm-var-sym { color: var(--c-primary); }
.sm-drill-hint { color: var(--c-accent); font-size: 10px; margin-left: 4px; opacity: .7; }

.sm-expert-note {
  background: var(--ice-bg); color: var(--ice-fg); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 12.5px;
}

/* ---- Live Assistant (Function 2, v1.7) ---- */
.assistant-handle {
  position: fixed; z-index: 400; width: 48px; height: 48px; border-radius: 50%;
  background: var(--c-primary); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.25); user-select: none;
}
.assistant-handle:hover { filter: brightness(1.1); }
.assistant-panel {
  position: fixed; z-index: 400; width: 340px; max-height: 70vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.3); overflow: hidden;
  /* v1.7.5: a few px of the panel's own background is left exposed around
     every child (see .assistant-panel-inner) so any edge of the panel --
     not just the header -- is a drag handle, per direct request. The
     header stays the primary, obvious handle; this is a forgiving margin
     for grabbing it without hitting a button/input/log by accident. */
  padding: 4px; cursor: grab;
}
.assistant-panel:active { cursor: grabbing; }
.assistant-panel-inner {
  display: flex; flex-direction: column; overflow: hidden; flex: 1; min-height: 0;
  border-radius: calc(var(--radius) - 4px); cursor: default;
}
.assistant-header {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 12px;
  background: var(--c-primary); color: #fff; cursor: grab; user-select: none; flex: none;
}
.assistant-header:active { cursor: grabbing; }
.assistant-title { font-size: 13px; font-weight: 700; }
.assistant-header-actions { display: flex; gap: 4px; }
.assistant-icon-btn {
  background: rgba(255,255,255,.15); border: none; color: #fff; border-radius: 5px;
  width: 22px; height: 22px; font-size: 12px; cursor: pointer; line-height: 1;
}
.assistant-icon-btn:hover { background: rgba(255,255,255,.28); }
.assistant-body { display: flex; flex-direction: column; padding: 10px 12px; overflow: hidden; flex: 1; min-height: 0; }
.assistant-gated-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; padding: 8px 0; }
.assistant-memory-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.assistant-memory-toggle { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text); cursor: pointer; }
.assistant-memory-hint { font-size: 10.5px; color: var(--text-muted); margin: 2px 0 8px; }
.assistant-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 120px; margin-bottom: 8px; }
.assistant-empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 20px 8px; line-height: 1.5; }
.assistant-msg { max-width: 92%; }
.assistant-msg.user { align-self: flex-end; }
.assistant-msg.assistant { align-self: flex-start; }
.assistant-msg-content {
  font-size: 12.5px; line-height: 1.5; padding: 7px 10px; border-radius: 10px; white-space: pre-wrap;
}
.assistant-msg.user .assistant-msg-content { background: var(--c-primary); color: #fff; }
.assistant-msg.assistant .assistant-msg-content { background: var(--surface-2); color: var(--text); }
.assistant-typing { font-weight: 700; letter-spacing: 1px; }
.assistant-failure { font-size: 12px; color: var(--c-danger, #c0392b); text-align: center; padding: 6px 0; }
.assistant-input-row { display: flex; gap: 6px; flex: none; }
.assistant-proposed { margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.assistant-proposed-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); margin-bottom: 6px; }
.assistant-proposed-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 12px; }
.assistant-proposed-row.accepted { opacity: .6; }
.assistant-proposed-row.rejected { opacity: .5; text-decoration: line-through; }
.apr-label { flex: 1; color: var(--text); }
.apr-diff { color: var(--text-muted); white-space: nowrap; }
.apr-diff b { color: var(--c-accent); }
.apr-actions { display: flex; gap: 4px; }
.apr-btn { width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 11px; line-height: 1; }
.apr-accept:hover { background: var(--ev-bg); color: var(--ev-fg); }
.apr-reject:hover { background: var(--ice-bg); color: var(--ice-fg); }
.apr-status { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ---- Landing page / access gate (v1.7.5) ---- */
.landing-screen {
  position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--c-primary) 0%, #0c2130 100%); padding: 20px;
}
.landing-card {
  position: relative; width: 100%; max-width: 420px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 36px 32px 28px; text-align: center;
}
.landing-lang { position: absolute; top: 16px; right: 18px; display: flex; gap: 8px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.landing-lang span { cursor: pointer; }
.landing-lang span.on { color: var(--c-primary); }
.landing-logo { height: 28px; margin-bottom: 18px; filter: invert(20%) sepia(30%) saturate(600%); }
.landing-card h1 { font-size: 19px; font-weight: 800; color: var(--c-primary); margin: 0 0 10px; }
.landing-sub { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0 0 22px; }
.landing-actions { display: flex; flex-direction: column; gap: 10px; }
.landing-actions .btn { justify-content: center; font-size: 13.5px; padding: 11px 16px; }
.landing-password { text-align: center; font-size: 15px; letter-spacing: 1px; }
.landing-error { font-size: 12px; color: var(--c-danger, #c0392b); }

/* ---- Admin: Guest password + Access Requests (v1.7.5) ---- */
.admin-guest-password { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.admin-guest-password-label { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.admin-guest-password-row { display: flex; gap: 8px; }
