/* ============================================================================
   Budget Builder — Application shell & component library
   Prototype stylesheet. Structure mirrors the intended component boundaries in
   the production build (one CSS module per block).
   ========================================================================= */

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-14);
  line-height: var(--lh-body);
  color: var(--ink-700);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(59, 114, 232, .04) 0%, transparent 55%),
    radial-gradient(90% 60% at 0% 100%, rgba(30, 58, 95, .04) 0%, transparent 50%),
    linear-gradient(168deg, var(--ink-050) 0%, #eef2f8 42%, var(--ink-100) 100%);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  color: var(--navy-700);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
}
p { margin: 0; }
button { font: inherit; cursor: pointer; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-500); }
.tiny { font-size: var(--fs-12); }
.mono-key { font-family: var(--font-num); font-size: var(--fs-12); color: var(--ink-500); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── App frame ─────────────────────────────────────────────────────────── */
.app { display: grid; grid-template-rows: var(--topbar-h) 1fr; height: 100dvh; max-height: 100dvh; min-height: 0; }

/* ── Top bar ───────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-4) 0 0;
  background: var(--white);
  border-bottom: 1px solid var(--ink-200);
  box-shadow: var(--sh-1), 0 4px 16px rgba(16, 32, 52, .04);
  position: relative; z-index: 40;
}
.topbar__mark {
  width: var(--rail-w); height: var(--topbar-h);
  display: grid; place-items: center;
  background: var(--navy-800); color: var(--white);
  font-weight: 700; font-size: var(--fs-13); letter-spacing: .04em;
  overflow: hidden; transition: width var(--dur-panel) var(--ease);
}
/* Stays aligned with the rail below it when the rail collapses. */
.topbar__mark--collapsed { width: var(--sidebar-fold-w); }
.topbar__brand { display: flex; align-items: center; gap: var(--s-2); padding-left: var(--s-3); }
.topbar__brand-logo {
  width: 28px; height: 28px; object-fit: contain; flex-shrink: 0;
}
.topbar__brand-name {
  font-family: var(--font-display);
  font-size: var(--fs-11); font-weight: var(--fw-bold); letter-spacing: .1em;
  text-transform: uppercase; color: var(--navy-700); line-height: 1.1;
}
.topbar__brand-sub { font-size: var(--fs-11); color: var(--ink-400); letter-spacing: .1em; }
.topbar__sep { width: 1px; height: 24px; background: var(--ink-200); }
.topbar__history {
  display: flex; align-items: center; gap: 2px; padding-left: var(--s-2);
}
.topbar__history-btn {
  min-width: 28px; padding: 0 var(--s-1); font-size: var(--fs-16); line-height: 1;
}
.topbar__title { display: flex; flex-direction: column; min-width: 0; }
.topbar__title h1 { font-family: var(--font-display); font-size: var(--fs-16); font-weight: var(--fw-semibold); }
.topbar__title span { font-size: var(--fs-12); color: var(--ink-500); }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: var(--s-2); }
.topbar__user { display: flex; align-items: center; gap: var(--s-2); padding-left: var(--s-2); }
.avatar {
  width: 28px; height: 28px; border-radius: var(--r-pill);
  background: var(--steel-100); color: var(--navy-700);
  display: grid; place-items: center; font-size: var(--fs-11); font-weight: 700;
  box-shadow: 0 2px 6px rgba(16, 32, 52, .12), 0 0 0 2px var(--white);
}
.topbar__user-meta { line-height: 1.15; }
.topbar__user-meta b { font-size: var(--fs-12); color: var(--ink-700); font-weight: 600; }
.topbar__user-meta span { display: block; font-size: var(--fs-11); color: var(--ink-400); }

/* ── Body: rail | step nav | content ───────────────────────────────────── */
.body {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-w) auto 1fr;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns var(--dur-panel) var(--ease);
}

.rail {
  background: var(--navy-800);
  display: flex; flex-direction: column; align-items: center;
  padding: 0; gap: 0;
  overflow: hidden;
  box-shadow: var(--sh-edge-rail);
}
.rail__stack {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--s-1);
  padding: var(--s-2) 0 var(--s-3);
  min-height: 0;
  opacity: 1;
  transition: opacity var(--dur-panel) var(--ease), flex var(--dur-panel) var(--ease);
}
.rail__btn {
  width: 36px; height: 36px; border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--steel-100);
  display: grid; place-items: center;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease);
}
.rail__btn:hover { background: rgba(255, 255, 255, .1); transform: scale(1.06); }
.rail__btn[aria-current="page"] {
  background: var(--blue-600); color: var(--white);
  box-shadow: 0 2px 8px rgba(59, 114, 232, .45);
}
.rail__btn svg { width: 18px; height: 18px; }
.rail__spacer { flex: 1; }

.rail__fold {
  flex-shrink: 0;
  display: grid; place-items: center;
  width: 100%; height: 36px;
  border: 0; border-bottom: 1px solid rgba(255, 255, 255, .12);
  background: transparent; color: var(--steel-100);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.rail__fold:hover { background: rgba(255, 255, 255, .1); color: var(--white); }
.rail__fold svg {
  width: 14px; height: 14px;
  transition: transform var(--dur-panel) var(--ease);
}
.body--rail-collapsed .rail__fold svg { transform: rotate(180deg); }
.body--rail-collapsed .rail__stack {
  opacity: 0; flex: 0; pointer-events: none; overflow: hidden;
}
.body--rail-collapsed .rail__spacer { display: none; }

/* ── Step navigation (scope-resolved wizard rail) ──────────────────────── */
.stepnav {
  position: relative;
  width: var(--stepnav-w);
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  display: flex; flex-direction: column;
  background: var(--white);
  border-right: 1px solid var(--ink-200);
  box-shadow: 2px 0 12px rgba(16, 32, 52, .04);
  overflow: hidden;
  transition: width var(--dur-panel) var(--ease);
}
.stepnav__head {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--ink-200);
  background: var(--ink-050);
  min-height: 36px;
  opacity: 1;
  overflow: hidden;
  transition: opacity var(--dur-panel) var(--ease),
    max-height var(--dur-panel) var(--ease),
    padding var(--dur-panel) var(--ease),
    border-color var(--dur-panel) var(--ease);
}
.stepnav__head-title {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-500);
  min-width: 0;
}
/* Collapse control in header — always reachable without scrolling the step list */
.stepnav__fold--head {
  position: static;
  transform: none;
  flex-shrink: 0;
  width: 28px; height: 28px;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: var(--white);
  box-shadow: none;
}
.stepnav__fold--head:hover {
  background: var(--ink-050); color: var(--ink-700); border-color: var(--ink-300);
}
.body--stepnav-collapsed .stepnav__fold--head {
  width: 28px; height: 28px;
  border-radius: var(--r-pill);
  transform: none;
}
.stepnav__body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-3) 0 var(--s-3);
  opacity: 1;
  transition: opacity var(--dur-panel) var(--ease);
}
.body--stepnav-collapsed .stepnav { width: var(--sidebar-fold-w); }
.body--stepnav-collapsed .stepnav__head {
  opacity: 1;
  min-height: 40px;
  max-height: none;
  padding: var(--s-2);
  justify-content: center;
  border-bottom: 1px solid var(--ink-200);
  pointer-events: auto;
}
.body--stepnav-collapsed .stepnav__head-title { display: none; }
.body--stepnav-collapsed .stepnav__body {
  opacity: 0; pointer-events: none; flex: 0; min-height: 0; padding: 0;
}
.body--stepnav-collapsed .stepnav__fold svg { transform: rotate(180deg); }
.stepnav__fold svg {
  width: 14px; height: 14px;
  transition: transform var(--dur-panel) var(--ease);
}
.stepnav__group {
  padding: var(--s-4) var(--s-4) var(--s-1);
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-400);
  display: flex; align-items: center; gap: var(--s-2);
}
.stepnav__group .chip { text-transform: none; letter-spacing: 0; }
.stepnav__item {
  display: grid; grid-template-columns: 22px 1fr; gap: var(--s-2);
  align-items: center;
  width: 100%; text-align: left; border: 0; background: transparent;
  padding: var(--s-2) var(--s-4);
  font-size: var(--fs-13); color: var(--ink-700);
  border-left: 3px solid transparent;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.stepnav__item:hover { background: var(--ink-050); }
.stepnav__item[aria-current="page"] {
  background: var(--blue-050); border-left-color: var(--blue-600);
  color: var(--navy-700); font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}
.stepnav__item[disabled] { color: var(--ink-400); cursor: not-allowed; }
.stepnav__num {
  width: 20px; height: 20px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  font-size: var(--fs-11); font-weight: 700;
  background: var(--ink-100); color: var(--ink-500);
}
.stepnav__item[aria-current="page"] .stepnav__num { background: var(--blue-600); color: var(--white); }
.stepnav__num--done { background: var(--ok-100); color: var(--ok-600); }
.stepnav__num--warn { background: var(--warn-100); color: var(--warn-600); }
.stepnav__label { min-width: 0; }
.stepnav__oos {
  margin: var(--s-2) var(--s-3); padding: var(--s-2) var(--s-3);
  border: 1px dashed var(--ink-300); border-radius: var(--r-md);
  font-size: var(--fs-11); color: var(--ink-500); background: var(--ink-050);
}

/* Collapsing a sidebar narrows it to a labelled fold strip — controls stay
   inside the panel they belong to, so the grid never gains extra items and
   main content always occupies the last column. */
.body--rail-collapsed { grid-template-columns: var(--sidebar-fold-w) auto 1fr; }
.body--rail-collapsed.body--subnav { grid-template-columns: var(--sidebar-fold-w) auto 180px 1fr; }

/* ── Rail / stepnav right-click menu ───────────────────────────────────── */
.nav-ctx {
  position: fixed;
  z-index: 75;
  min-width: 168px;
  padding: var(--s-1) 0;
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
}
.nav-ctx__item {
  display: block;
  width: 100%;
  padding: var(--s-2) var(--s-3);
  border: none;
  background: none;
  font-size: var(--fs-13);
  color: var(--ink-800);
  text-align: left;
  cursor: pointer;
}
.nav-ctx__item:hover,
.nav-ctx__item:focus-visible {
  background: var(--ink-050);
  outline: none;
}
.nav-ctx__hint {
  font-weight: 600;
  color: var(--ink-600);
}

/* ── Screen-specific sub-nav (e.g. M2.4's category jump-nav) — its own .body
   grid column, next to the step-nav, so it stays fixed while .content
   scrolls independently. Only present when a screen renders one. ── */
.body--subnav { grid-template-columns: var(--rail-w) auto 180px 1fr; transition: grid-template-columns var(--dur-panel) var(--ease); }
.subnav {
  width: 180px;
  background: var(--white);
  border-right: 1px solid var(--ink-200);
  overflow-y: auto;
  padding: var(--s-3) var(--s-2) var(--s-8);
}
.subnav__title {
  padding: var(--s-2) var(--s-2) var(--s-2);
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-400);
}
.subnav__item {
  display: block; width: 100%; padding: var(--s-2) var(--s-2);
  border: 0; border-radius: var(--r-md); font-size: var(--fs-12); color: var(--ink-700);
  text-decoration: none; text-align: left; font-family: inherit;
  background: transparent; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.subnav__item:hover { background: var(--ink-050); }
.subnav__item[aria-current="true"] {
  background: var(--blue-050); border-left-color: var(--blue-600);
  color: var(--navy-700); font-weight: 600;
}

/* ── Content column ───────────────────────────────────────────────────── */
.content { overflow-y: auto; padding: var(--s-5) var(--s-6) var(--s-12); min-width: 0; min-height: 0; }
.content__inner { max-width: var(--content-max); margin: 0 auto; display: grid; gap: var(--s-4); }
/* MDM / console / rules — fill the content column; avoids huge side gutters when zoomed out. */
.content--wide { padding-left: var(--s-4); padding-right: var(--s-4); }
.content__inner--wide { max-width: none; width: 100%; margin: 0; }

/* ── Page header card ─────────────────────────────────────────────────── */
.pagehead {
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  display: grid; grid-template-columns: 1fr auto; gap: var(--s-4); align-items: start;
  box-shadow: var(--sh-2), var(--sh-surface);
}
.pagehead h2 { font-size: var(--fs-18); font-family: var(--font-display); }
.pagehead__sub { font-size: var(--fs-13); color: var(--ink-500); max-width: 68ch; margin-top: var(--s-1); }
.pagehead__aside { display: grid; gap: var(--s-3); justify-items: end; }


/* ── Toolbar strip ────────────────────────────────────────────────────── */
.toolbar {
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-4);
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  box-shadow: var(--sh-1);
}
.toolbar__spacer { flex: 1; }
.savestate { font-size: var(--fs-12); color: var(--ink-500); font-style: italic; }
.savestate--saved { color: var(--ok-600); font-style: normal; }

/* ── Cards / sections ─────────────────────────────────────────────────── */
.card {
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--sh-2), var(--sh-surface);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  --section-control-h: var(--field-h);
}
.modal__panel {
  --section-control-h: var(--field-h);
}
.card__head {
  padding: var(--s-3) var(--s-4);
  background: var(--steel-050); border-bottom: 1px solid var(--ink-200);
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
}
.card__head h3 { font-size: var(--fs-14); letter-spacing: .01em; font-family: var(--font-display); }
.card__head--navy { background: var(--cell-section); border-bottom-color: var(--navy-700); }
.card__head--navy h3, .card__head--navy .muted { color: var(--white); }
.card__head--navy .muted { opacity: .75; }
.card__spacer { flex: 1; }
.card__body { padding: var(--s-3) var(--s-4); }
.card__body--flush { padding: 0; }
.card__foot {
  padding: var(--s-3) var(--s-4); border-top: 1px solid var(--ink-200);
  background: var(--ink-050); display: flex; gap: var(--s-2); align-items: center;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: var(--field-h); padding: 0 var(--s-4);
  border: 1px solid var(--ink-300); border-radius: var(--r-md);
  background: var(--white); color: var(--ink-700);
  font-size: var(--fs-13); font-weight: 600; white-space: nowrap;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease-spring);
}
.btn:hover { background: var(--ink-050); border-color: var(--ink-400); }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn--primary {
  background: var(--blue-600); border-color: var(--blue-600); color: var(--white);
  box-shadow: var(--sh-interactive);
}
.btn--primary:hover {
  background: var(--blue-700); border-color: var(--blue-700);
  box-shadow: var(--sh-interactive-hover);
  transform: translateY(-1px);
}
.btn--primary:active:not([disabled]) { transform: translateY(0); box-shadow: var(--sh-interactive); }
.btn--danger { background: var(--white); border-color: var(--danger-100); color: var(--danger-600); }
.btn--danger:hover { background: var(--danger-100); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--ink-100); border-color: transparent; }
.btn--sm { height: 30px; padding: 0 var(--s-3); font-size: var(--fs-12); }
.btn--pill { border-radius: var(--r-pill); }
.btn--assist {
  border-color: var(--blue-100); background: var(--blue-050); color: var(--blue-700);
  box-shadow: 0 1px 3px rgba(59, 114, 232, .12);
}
.btn--assist:hover { box-shadow: 0 3px 10px rgba(59, 114, 232, .18); transform: translateY(-1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

/* ── Chips / badges ───────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: 2px var(--s-2); border-radius: var(--r-pill);
  font-size: var(--fs-11); font-weight: 600;
  background: var(--ink-100); color: var(--ink-600);
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(16, 32, 52, .06);
}
.chip--ok { background: var(--ok-100); color: var(--ok-600); }
.chip--warn { background: var(--warn-100); color: var(--warn-600); }
.chip--danger { background: var(--danger-100); color: var(--danger-600); }
.chip--info { background: var(--info-100); color: var(--info-600); }
.chip--blue { background: var(--blue-100); color: var(--blue-700); }
.chip--zero { background: var(--ink-100); color: var(--state-zero); }
.chip--outline { background: transparent; border: 1px solid var(--ink-300); }
.chip--btn {
  border: 0; cursor: pointer; font-family: inherit;
  transition: filter var(--dur) var(--ease);
}
.chip--btn:hover { filter: brightness(0.95); }
.chip--btn:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 1px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── Notices ──────────────────────────────────────────────────────────── */
.notice {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-3);
  align-items: start;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  border: 1px solid var(--info-100); background: var(--info-100);
  font-size: var(--fs-13); color: var(--navy-700);
  box-shadow: var(--sh-2);
}
.notice--scope { background: var(--blue-050); border-color: var(--blue-100); }
.notice--warn { background: var(--warn-100); border-color: #EFD79A; color: var(--warn-600); }
.notice--danger { background: var(--danger-100); border-color: #F0C1BA; color: var(--danger-600); }
.notice--ok { background: var(--ok-100); border-color: #B9E2C9; color: var(--ok-600); }
.notice__icon { font-weight: 700; }

/* ── Engine Console ───────────────────────────────────────────────────── */
.console-tabs {
  display: flex; gap: 0; background: var(--navy-700); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 0 var(--s-4); margin-bottom: var(--s-4); overflow-x: auto;
}
.console-tab {
  padding: var(--s-2) var(--s-5); font: inherit; font-size: var(--fs-13); font-weight: 600;
  background: none; border: none; border-bottom: 3px solid transparent;
  color: rgba(255,255,255,.5); cursor: pointer; white-space: nowrap; transition: .15s;
}
.console-tab:hover { color: rgba(255,255,255,.85); }
.console-tab.is-on { color: #fff; border-bottom-color: var(--blue-500); background: rgba(255,255,255,.06); }

/* Engine Console — rule diagram (WHEN / AND / OR / applicability / THEN) */
.rb-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); margin-bottom: var(--s-4);
}
.rb-toolbar__pick { flex: 1 1 280px; max-width: 420px; margin: 0; }
.rb-toolbar__filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); flex: 2 1 320px; }
.rb-pill {
  font: inherit; font-size: var(--fs-11); font-weight: 600; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--ink-200); background: var(--surface-1); cursor: pointer;
}
.rb-pill.is-on { border-color: var(--blue-500); background: var(--blue-50); color: var(--navy-800); }

.rb-canvas {
  padding: var(--s-5); background: linear-gradient(180deg, var(--ink-50) 0%, #fff 120px);
  border: 1px solid var(--ink-150); border-radius: var(--r-lg); min-height: 420px;
}
.rb-logic-line {
  font-size: var(--fs-13); margin: 0 0 var(--s-3); padding: var(--s-2) var(--s-3);
  background: var(--steel-50); border: 1px solid var(--ink-200); border-radius: var(--r-md);
}
.rb-join-row td { padding: var(--s-1) 0; border: none; }
.rb-between--inline { justify-content: flex-start; padding-left: var(--s-2); }

.rb-canvas--conditions {
  padding: 0; background: var(--white); min-height: 360px; overflow: hidden;
}
.rb-element-bar {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-4) var(--s-5); background: linear-gradient(135deg, var(--navy-700), var(--navy-800)); color: #fff;
}
.rb-element-bar__title { margin: 0 0 var(--s-1); font-size: var(--fs-18); font-weight: 700; }
.rb-element-bar code { color: rgba(255,255,255,.88); font-size: var(--fs-12); }
.rb-element-bar__chips { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.rb-when-panel { padding: var(--s-4) var(--s-5) var(--s-5); }
.rb-when-panel__title {
  margin: 0 0 var(--s-3); font-size: var(--fs-13); font-weight: 700; color: var(--navy-800);
}
.rb-panel--empty {
  padding: var(--s-4); border: 1px dashed var(--ink-200); border-radius: var(--r-md);
  background: var(--ink-50); text-align: center;
}
.rb-blocks { display: flex; flex-direction: column; gap: var(--s-2); }
.rb-block__label {
  font-size: var(--fs-11); font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-500); margin-bottom: var(--s-2);
}
.rb-cond-tablewrap {
  border: 1px solid var(--ink-200); border-radius: var(--r-md); overflow: auto;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.rb-cond-table {
  width: 100%; border-collapse: collapse; font-size: var(--fs-13);
}
.rb-cond-table thead th {
  text-align: left; font-size: var(--fs-10); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-500); padding: var(--s-2) var(--s-3);
  background: var(--ink-50); border-bottom: 1px solid var(--ink-200);
}
.rb-cond-table thead th:nth-child(1) { width: 42%; }
.rb-cond-table thead th:nth-child(2) { width: 22%; }
.rb-cond-row td {
  padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--ink-100); vertical-align: top;
}
.rb-cond-row:last-child td { border-bottom: none; }
.rb-cond-row:nth-child(even) { background: rgba(248, 250, 252, .8); }
.rb-cond-row__fact { font-weight: 600; color: var(--navy-800); }
.rb-cond-row__op { color: var(--ink-600); font-style: italic; }
.rb-cond-row__val { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--ink-800); word-break: break-word; }
.rb-empty, .rb-loading {
  display: grid; place-items: center; min-height: 320px; gap: var(--s-3); color: var(--ink-500);
}
.rb-node {
  position: relative; max-width: 520px; margin: 0 auto; padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg); border: 2px solid var(--ink-200); background: #fff;
  box-shadow: 0 4px 20px rgba(15, 23, 42, .06);
}
.rb-node--element { border-color: var(--navy-600); background: linear-gradient(135deg, var(--navy-700), var(--navy-800)); color: #fff; }
.rb-node--element.rb-node--compact { max-width: 100%; }
.rb-node--element .rb-node__title { color: #fff; }
.rb-node--element code { color: rgba(255,255,255,.85); }
.rb-node--rule { border-color: var(--blue-400); }
.rb-node--apply.rb-node--ok { border-color: var(--ok-500); background: var(--ok-50); }
.rb-node--apply.rb-node--danger { border-color: var(--danger-500); background: var(--danger-50); }
.rb-node--then { border-color: #0d9488; background: #f0fdfa; }
.rb-node--flat { border-color: var(--warn-500); background: var(--warn-50); }
.rb-node__badge {
  display: inline-block; font-size: var(--fs-10); font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: 2px 8px; border-radius: var(--r-sm); background: var(--ink-100); margin-bottom: var(--s-1);
}
.rb-node--element .rb-node__badge { background: rgba(255,255,255,.15); color: #fff; }
.rb-node__title { margin: 0 0 var(--s-1); font-size: 1.05rem; }
.rb-node__row { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-bottom: var(--s-1); }
.rb-node__chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.rb-node__body { margin: 0; font-size: var(--fs-13); }

.rb-vline {
  width: 2px; height: 28px; margin: 0 auto; background: var(--ink-300);
}
.rb-vline--arrow::after {
  content: ''; display: block; width: 8px; height: 8px; margin: -2px auto 0;
  border-right: 2px solid var(--ink-300); border-bottom: 2px solid var(--ink-300);
  transform: rotate(45deg) translateX(3px);
}
.rb-vline--fork { height: 36px; }
.rb-fork-label { text-align: center; margin: 0 0 var(--s-3); }

.rb-rule { max-width: 640px; margin: 0 auto var(--s-5); }
.rb-rule-sep { height: var(--s-4); border-bottom: 1px dashed var(--ink-200); margin: var(--s-5) auto; max-width: 200px; }

.rb-section { max-width: 640px; margin: 0 auto; }
.rb-section__label {
  font-size: var(--fs-11); font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-500); margin-bottom: var(--s-2); text-align: center;
}

.rb-join {
  display: flex; align-items: center; gap: var(--s-3); margin: 0 auto var(--s-3); max-width: 480px;
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
}
.rb-join--or { background: #fff7ed; border: 1px dashed #fdba74; }
.rb-join--and { background: #eff6ff; border: 1px dashed #93c5fd; }
.rb-join__label {
  font-weight: 800; font-size: var(--fs-12); padding: 4px 10px; border-radius: var(--r-sm);
  background: #fff; border: 2px solid currentColor;
}
.rb-join--or .rb-join__label { color: #c2410c; }
.rb-join--and .rb-join__label { color: #1d4ed8; }
.rb-join__hint { font-size: var(--fs-11); color: var(--ink-600); }

.rb-groups { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.rb-group {
  width: 100%; max-width: 520px; padding: var(--s-3); border-radius: var(--r-md);
  border: 1px solid var(--ink-200); background: #fff;
}
.rb-group--default { border-style: dashed; }
.rb-group__head { font-weight: 700; font-size: var(--fs-12); margin-bottom: var(--s-2); color: var(--navy-800); }
.rb-group__sub { font-weight: 500; color: var(--ink-500); }
.rb-group__body { display: flex; flex-direction: column; align-items: stretch; gap: var(--s-2); }

.rb-clause {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--ink-50);
  border-left: 4px solid var(--blue-500);
}
.rb-clause__fact { font-weight: 600; color: var(--navy-800); }
.rb-clause__op { font-size: var(--fs-12); color: var(--ink-600); font-style: italic; }
.rb-clause__val { font-family: var(--font-mono); font-size: var(--fs-12); }

.rb-and {
  display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-size: var(--fs-10); font-weight: 800; color: #1d4ed8; text-transform: uppercase;
}
.rb-and::before, .rb-and::after {
  content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #93c5fd, transparent);
}
.rb-between {
  display: flex; justify-content: center; margin: var(--s-1) 0;
}
.rb-between span {
  font-size: var(--fs-10); font-weight: 800; padding: 2px 12px; border-radius: 999px;
  background: #fff7ed; color: #c2410c; border: 2px solid #fdba74;
}

.rb-legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-4); margin-top: var(--s-5);
  padding-top: var(--s-3); border-top: 1px solid var(--ink-100); font-size: var(--fs-11); color: var(--ink-500);
}
.rb-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.rb-legend__dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.rb-legend__dot--and { background: #93c5fd; }
.rb-legend__dot--or { background: #fdba74; }

/* Engine Console — elements ↔ rules coverage map (legacy list — unused) */
.coverage-stats {
  display: flex; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-4);
}
.coverage-stat {
  flex: 1 1 120px; min-width: 100px; padding: var(--s-3) var(--s-4);
  background: var(--surface-1); border: 1px solid var(--ink-150); border-radius: var(--r-lg);
  text-align: center;
}
.coverage-stat--warn { border-color: var(--warn-300); background: var(--warn-50); }
.coverage-stat__n { display: block; font: 600 1.35rem/1.2 var(--font-display); color: var(--navy-800); }
.coverage-stat__l { font-size: var(--fs-11); color: var(--ink-500); text-transform: uppercase; letter-spacing: .04em; }

.coverage-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3);
}
.coverage-layout {
  display: inline-flex; border: 1px solid var(--ink-200); border-radius: var(--r-md); overflow: hidden;
}
.coverage-layout__btn {
  font: inherit; font-size: var(--fs-12); font-weight: 600; padding: 6px 14px; border: none;
  background: var(--surface-1); color: var(--ink-600); cursor: pointer;
}
.coverage-layout__btn.is-on { background: var(--navy-700); color: #fff; }
.coverage-toolbar__filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); flex: 1; min-width: 200px;
}
.coverage-toolbar__search { flex: 1 1 180px; max-width: 280px; }
.coverage-pill {
  font: inherit; font-size: var(--fs-11); font-weight: 600; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--ink-200); background: var(--surface-1); color: var(--ink-600); cursor: pointer;
}
.coverage-pill.is-on { border-color: var(--blue-500); background: var(--blue-50); color: var(--navy-800); }

.coverage-split {
  display: grid; grid-template-columns: minmax(280px, 36%) 1fr; gap: var(--s-4); min-height: 52vh;
  align-items: stretch;
}
@media (max-width: 960px) {
  .coverage-split { grid-template-columns: 1fr; }
}
.coverage-list {
  display: flex; flex-direction: column; gap: 2px; max-height: 58vh; overflow-y: auto;
  padding: var(--s-2); background: var(--surface-1); border: 1px solid var(--ink-150); border-radius: var(--r-lg);
}
.coverage-list__empty { padding: var(--s-4); text-align: center; }
.coverage-pick {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-2) var(--s-3); align-items: center;
  width: 100%; text-align: left; padding: var(--s-2) var(--s-3); border: 1px solid transparent;
  border-radius: var(--r-md); background: transparent; font: inherit; cursor: pointer; transition: .12s;
}
.coverage-pick:hover { background: var(--ink-50); border-color: var(--ink-100); }
.coverage-pick.is-on { background: var(--blue-50); border-color: var(--blue-300); box-shadow: 0 0 0 1px var(--blue-200); }
.coverage-pick.is-gap { border-left: 3px solid var(--danger-500); }
.coverage-pick__name { font-weight: 600; font-size: var(--fs-13); color: var(--ink-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coverage-pick__meta { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

.coverage-pane {
  padding: var(--s-4); background: var(--surface-1); border: 1px solid var(--ink-150); border-radius: var(--r-lg);
  max-height: 58vh; overflow-y: auto;
}
.coverage-detail__hero {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4);
  padding-bottom: var(--s-3); border-bottom: 1px solid var(--ink-100);
}
.coverage-detail__title { margin: var(--s-1) 0; font-size: 1.15rem; }
.coverage-detail__chips { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.coverage-detail__section-head {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--s-3);
}
.coverage-detail__section-head h4 { margin: 0; font-size: var(--fs-13); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-500); }

.coverage-rule-stack { display: flex; flex-direction: column; gap: var(--s-3); }
.coverage-rule-card {
  padding: var(--s-3); border: 1px solid var(--ink-150); border-radius: var(--r-md); background: #fff;
}
.coverage-rule-card__head { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-bottom: var(--s-1); }
.coverage-rule-card__name { margin: 0 0 var(--s-2); font-size: var(--fs-14); }
.coverage-rule-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--s-2); }
.coverage-rule-card__outcome { margin: 0 0 var(--s-2); color: var(--ink-600); }
.coverage-rule-card__foot { margin-top: var(--s-2); }

.coverage-el-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.coverage-el-chip {
  font: inherit; font-size: var(--fs-12); padding: 6px 12px; border-radius: var(--r-md);
  border: 1px solid var(--ink-200); background: var(--ink-50); cursor: pointer; text-align: left;
}
.coverage-el-chip:hover { border-color: var(--blue-400); background: var(--blue-50); }

/* ── Forms · unified layout & controls ────────────────────────────────── */
.form-grid,
.grid2,
.grid3,
.grid4 {
  display: grid;
  gap: var(--form-row-gap) var(--form-col-gap);
  align-items: stretch;
}
.grid2, .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3, .form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4, .form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: stretch; }
.grid2, .form-grid--2 { align-items: stretch; }
.grid3, .form-grid--3 { align-items: stretch; }
.form-grid--auto { grid-template-columns: repeat(auto-fit, minmax(var(--form-min-col), 1fr)); }
.form-stack { display: grid; gap: var(--form-row-gap); }
.form-section { margin-top: var(--form-section-gap); }
.form-section--tight { margin-top: var(--s-2); }
.card__subhead {
  margin: 0 0 var(--s-3);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-700);
}
.card__body--flush > .form-section > .card__subhead { padding: 0 var(--s-4); }
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--form-col-gap);
  align-items: flex-end;
}
.form-row--start { align-items: flex-start; }
.form-row > .field { flex: 1 1 var(--form-min-col); min-width: 0; }
.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--form-col-gap);
  align-items: flex-start;
}
.field-row__fixed { flex: 0 0 168px; min-width: 140px; }
.field-row__grow { flex: 1 1 var(--form-min-col); min-width: 0; }
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: center;
}
@media (max-width: 1100px) {
  .grid2, .grid3, .grid4,
  .form-grid--2, .form-grid--3, .form-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .grid2, .grid3, .grid4,
  .form-grid--2, .form-grid--3, .form-grid--4,
  .form-grid--auto {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  min-width: 0;
}
/* Card forms (wizard): compact density, smaller controls */
.card__body .grid2,
.card__body .grid3,
.card__body .grid4 {
  gap: 0.5rem 0.875rem;
  --section-control-h: var(--field-h-sm);
}
.card__body .field__label {
  font-size: var(--fs-11);
  line-height: 1.3;
}
.card__body .field__hint { font-size: var(--fs-10, 0.6875rem); }
.card__body .field__note {
  font-size: var(--fs-10, 0.6875rem);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.grid2 > .field,
.grid3 > .field,
.grid4 > .field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  min-width: 0;
}
.grid2 > .field > .field__ctrl,
.grid3 > .field > .field__ctrl,
.grid4 > .field > .field__ctrl,
.grid2 > .field > select.field__ctrl,
.grid3 > .field > select.field__ctrl,
.grid4 > .field > select.field__ctrl {
  margin-top: 0;
  width: 100%;
}
.grid2 > .field--span-2 { grid-column: span 2; }
.grid3 > .field--span-2 { grid-column: span 2; }
.grid3 > .field--span-3 { grid-column: span 3; }
.grid4 > .field--span-2 { grid-column: span 2; }
.grid4 > .field--span-3 { grid-column: span 3; }
.grid4 > .field--span-4 { grid-column: 1 / -1; }
.form-grid > .field > textarea.field__ctrl,
.grid2 > .field > textarea.field__ctrl,
.grid3 > .field > textarea.field__ctrl,
.grid4 > .field > textarea.field__ctrl {
  margin-top: 0;
  flex: 1 1 auto;
  min-height: 96px;
}
.grid2 > .field-row,
.grid3 > .field-row,
.grid4 > .field-row {
  display: flex;
  align-items: stretch;
  min-height: 0;
  gap: var(--form-col-gap);
}
.grid2 > .field-row.field-row--span-2 { grid-column: span 2; }
.grid3 > .field-row.field-row--span-2 { grid-column: span 2; }
.grid3 > .field-row.field-row--span-3 { grid-column: span 3; }
.grid4 > .field-row.field-row--span-2 { grid-column: span 2; }
.cover-sheet-fields.grid3 > .field > .field__ctrl,
.cover-sheet-fields.grid3 > .field-row .field > .field__ctrl {
  width: 100%;
  box-sizing: border-box;
}
.cover-sheet-fields .cover-sheet-phone-row {
  align-items: flex-end;
  min-width: 0;
}
.cover-sheet-fields .cover-sheet-phone-row .field-row__code {
  flex: 0 0 6.25rem;
  max-width: 38%;
  min-width: 0;
}
.cover-sheet-fields .cover-sheet-phone-row .field-row__tel {
  flex: 1 1 0;
  min-width: 0;
}
.cover-sheet-fields .cover-sheet-phone-row .field-row__tel .field__ctrl {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.cover-sheet-fields > .field--span-3 > textarea.field__ctrl {
  min-height: 5.5rem;
  resize: vertical;
}
.grid3 > .field-row > .field-row__code,
.grid3 > .field-row > .field-row__tel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.grid3 > .field-row .field-row__code .field,
.grid3 > .field-row .field-row__tel .field {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  gap: var(--s-1);
}
.cover-sheet-ref .field {
  max-width: calc((100% - 2 * var(--form-col-gap)) / 3);
}
.grid2 > .field-row > .field-row__fixed,
.grid2 > .field-row > .field-row__grow,
.grid3 > .field-row > .field-row__fixed,
.grid3 > .field-row > .field-row__grow {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.grid2 > .field-row .field,
.grid3 > .field-row .field {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  gap: var(--s-1);
}
.grid2 > .field-row .field > .field__ctrl,
.grid3 > .field-row .field > .field__ctrl {
  margin-top: 0;
}
.field--inline { margin-bottom: 0; }
.field__label {
  font-family: var(--font-ui);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  color: var(--ink-600);
  display: flex;
  align-items: baseline;
  gap: var(--s-1);
  flex-wrap: wrap;
  line-height: 1.35;
}
.field__label .req { color: var(--danger-600); }
.field__hint { font-size: var(--fs-11); color: var(--ink-400); font-weight: var(--fw-regular); }
.field__checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0.5rem;
  min-height: var(--section-control-h, var(--field-h-sm));
  align-content: flex-start;
  border: 1px solid var(--ink-300);
  border-radius: var(--r-md);
  background: var(--white);
  box-sizing: border-box;
}
.grid4 > .field.field--checks {
  gap: 0.25rem;
}
.grid4 > .field.field--checks > .field__checks { margin-top: 0.15rem; }

/* Shared control chrome — inputs, selects, rule-builder dropdowns */
.field__ctrl,
.sel,
.cellinput,
.asst-input {
  font-family: var(--font-ui);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  color: var(--ink-700);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.field__ctrl,
.sel {
  height: var(--section-control-h, var(--field-h));
  width: 100%;
  padding: 0 var(--s-3);
  border: 1px solid var(--ink-300);
  background: var(--white);
  box-sizing: border-box;
}
.card .field__ctrl:not(.field__ctrl--sm):not(textarea),
.card select.field__ctrl:not(.field__ctrl--sm),
.modal__panel .field__ctrl:not(.field__ctrl--sm):not(textarea),
.modal__panel select.field__ctrl:not(.field__ctrl--sm) {
  height: var(--section-control-h);
}
.field__ctrl:focus,
.sel:focus,
.cellinput:focus,
.asst-input:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--blue-100);
}
textarea.field__ctrl {
  height: auto;
  min-height: 96px;
  padding: var(--s-2) var(--s-3);
  resize: vertical;
  line-height: 1.45;
}
.field__ctrl[readonly],
.field__ctrl:disabled,
.sel:disabled,
.cellinput:disabled {
  background: var(--ink-050);
  color: var(--ink-500);
  cursor: not-allowed;
}
.field__ctrl--sm,
.sel--sm {
  height: var(--field-h-sm);
  font-size: var(--fs-12);
  padding: 0 var(--s-2);
}
.field__ctrl--filter { width: min(11rem, 100%); }
.field__ctrl--filter-wide { width: min(10rem, 100%); }
.mdm-col-filter {
  width: 100%;
  min-width: 4.25rem;
  max-width: 11rem;
  font-size: var(--text-xs, 0.75rem);
  padding: 0.2rem 0.35rem;
}
.mdm-data-table thead .mdm-head-filter th {
  vertical-align: top;
  padding-top: 0;
  border-top: none;
}
.mdm-data-table thead .mdm-head-sort th { padding-bottom: 0.15rem; }

/* MDM master-detail shell */
.mdm-shell {
  display: grid;
  grid-template-columns: min(17rem, 22%) minmax(0, 1fr);
  gap: var(--s-3);
  align-items: start;
  width: 100%;
  min-height: 50vh;
}
@media (max-width: 960px) {
  .mdm-shell { grid-template-columns: 1fr; }
  .mdm-shell__nav { max-height: 40vh; }
}
.mdm-shell__nav {
  position: sticky;
  top: var(--s-2);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 8rem);
  padding: var(--s-3);
  background: var(--surface-elevated, #fff);
  border: 1px solid var(--ink-150, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-sm, 0 1px 2px rgb(0 0 0 / 6%));
}
.mdm-nav-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-2);
}
.mdm-nav-head__title { font-weight: 600; font-size: 0.95rem; }
.mdm-nav-search { width: 100%; margin-bottom: var(--s-2); }
.mdm-nav-cat {
  display: grid;
  gap: 0.2rem;
  margin-bottom: var(--s-2);
}
.mdm-nav-cat__label { font-size: 0.68rem; }
.mdm-nav-cat__select { width: 100%; }
.mdm-shell__nav .mdm-nav-scroll {
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: var(--ink-450, #9ca3af) var(--ink-100, #f3f4f6);
}
.mdm-shell__nav .mdm-nav-scroll::-webkit-scrollbar { width: 12px; }
.mdm-shell__nav .mdm-nav-scroll::-webkit-scrollbar-track {
  background: var(--ink-100, #f3f4f6);
  border-radius: 6px;
  margin: 2px 0;
}
.mdm-shell__nav .mdm-nav-scroll::-webkit-scrollbar-thumb {
  background: var(--ink-450, #9ca3af);
  border-radius: 6px;
  border: 2px solid var(--ink-100, #f3f4f6);
  min-height: 2.5rem;
}
.mdm-shell__nav .mdm-nav-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--ink-600, #4b5563);
}
.mdm-nav-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 8rem;
  margin: var(--s-1) 0;
  padding-right: var(--s-1);
  border: 1px solid var(--ink-100, #f3f4f6);
  border-radius: var(--radius-sm, 6px);
  background: var(--ink-025, #fafafa);
}
.mdm-cat-pill {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--ink-200, #d1d5db);
  background: var(--ink-50, #f9fafb);
  cursor: pointer;
  color: var(--ink-700, #374151);
}
.mdm-cat-pill:hover { border-color: var(--blue-400, #60a5fa); }
.mdm-cat-pill.is-on {
  background: var(--blue-50, #eff6ff);
  border-color: var(--blue-500, #3b82f6);
  color: var(--blue-800, #1e40af);
}
.mdm-cat-pill__n { opacity: 0.75; margin-left: 0.15rem; }
.mdm-nav-group { margin-bottom: var(--s-2); }
.mdm-nav-group__title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500, #6b7280);
  padding: 0.25rem 0.35rem;
}
.mdm-nav-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.mdm-nav-item:hover { background: var(--ink-50, #f3f4f6); }
.mdm-nav-item.is-active {
  background: var(--blue-50, #eff6ff);
  border-color: var(--blue-200, #bfdbfe);
}
.mdm-nav-item--overview { font-weight: 600; margin-bottom: var(--s-2); }
.mdm-nav-item__label { font-size: 0.82rem; line-height: 1.25; }
.mdm-nav-item__meta { font-size: 0.68rem; color: var(--ink-500, #6b7280); margin-top: 0.1rem; }
.mdm-nav-foot { margin-top: auto; padding-top: var(--s-2); border-top: 1px solid var(--ink-100, #f3f4f6); }
.mdm-shell__main { min-width: 0; }
.mdm-main-head { margin-bottom: var(--s-3); }
.mdm-breadcrumb b { color: var(--ink-900, #111); }
.mdm-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--s-2);
}
.mdm-overview-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: var(--s-3);
  border: 1px solid var(--ink-150, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  background: var(--surface-elevated, #fff);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mdm-overview-card:hover {
  border-color: var(--blue-300, #93c5fd);
  box-shadow: var(--shadow-sm, 0 1px 3px rgb(0 0 0 / 8%));
}
.mdm-overview-card__cat { font-weight: 600; font-size: 0.9rem; }
.mdm-recent {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
}
.mdm-recent-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--ink-150, #e5e7eb);
  border-radius: var(--radius-sm, 6px);
  background: var(--ink-50, #f9fafb);
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.mdm-recent-item:hover { border-color: var(--blue-300, #93c5fd); }
.field__ctrl--search { width: min(11rem, 100%); }

/* workbook convention */
.is-input { background: var(--cell-input); border-color: var(--cell-input-border); }
.is-calc {
  background: var(--cell-calc);
  border-color: var(--cell-calc-border);
  font-weight: var(--fw-semibold);
  color: var(--navy-700);
}
.field__note { font-size: var(--fs-11); color: var(--ink-500); line-height: 1.4; }
.field__err { font-size: var(--fs-11); color: var(--danger-600); font-weight: var(--fw-semibold); }

.table--valpick td.r:nth-child(5) { min-width: 6.5rem; }

/* M1.6 crewing summary — drill-down tree table */
.sumtree {
  --sumtree-cols: 28px minmax(14rem, 1fr) 7.75rem 7.75rem 6.75rem;
  --sumtree-indent: 1.25rem; /* one tab step per expanded level */
  font-size: var(--fs-13);
  background: var(--white);
}
.sumtree__row {
  display: grid;
  grid-template-columns: var(--sumtree-cols);
  gap: 0 var(--s-3);
  align-items: center;
  min-height: 40px;
  padding: var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--ink-100);
}
.sumtree__head {
  background: var(--ink-050);
  border-bottom: 1px solid var(--ink-200);
  min-height: 34px;
  padding-top: var(--s-2);
  padding-bottom: var(--s-2);
}
.sumtree__num--head {
  font-family: var(--font-ui);
  font-size: var(--fs-11);
  font-weight: var(--fw-bold);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-500);
  text-align: right;
}
.sumtree__caret {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--ink-400);
  font-size: 11px;
  line-height: 1;
  transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.sumtree__caret::before { content: '▸'; }
.sumtree__caret--empty::before { content: ''; }
.sumtree__branch[open] > summary .sumtree__caret {
  transform: rotate(90deg);
  color: var(--blue-600);
}
.sumtree__branch > summary {
  list-style: none;
  cursor: pointer;
}
.sumtree__branch > summary::-webkit-details-marker { display: none; }
.sumtree__row--branch:hover { background: var(--blue-050); }
.sumtree__branch--root > summary.sumtree__row {
  background: var(--white);
  border-bottom: 1px solid var(--ink-200);
  min-height: 44px;
}
.sumtree__branch--root > summary .sumtree__title {
  font-family: var(--font-display);
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  color: var(--navy-700);
}
.sumtree__branch--root[open] > summary.sumtree__row {
  background: var(--blue-050);
  box-shadow: inset 3px 0 0 var(--blue-600);
}
.sumtree__branch--sub > summary.sumtree__row {
  background: var(--ink-025);
  min-height: 36px;
}
.sumtree__branch--sub > summary .sumtree__title {
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  color: var(--ink-700);
}
.sumtree__title { display: block; line-height: 1.3; }
.sumtree__sub {
  display: block;
  font-size: var(--fs-11);
  color: var(--ink-500);
  line-height: 1.35;
  margin-top: 1px;
}
.sumtree__label {
  min-width: 0;
  display: block;
}
.sumtree__row--leaf {
  background: var(--white);
  min-height: 36px;
  padding-top: var(--s-1);
  padding-bottom: var(--s-1);
}
.sumtree__row--leaf:nth-child(even) { background: var(--ink-025); }
.sumtree__row--synthetic .sumtree__elname { font-weight: 500; }
.sumtree__row--synthetic .sumtree__sub { margin-top: 2px; }

.sumtree__row--leaf .sumtree__label {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: var(--s-2);
  align-items: center;
}
.sumtree__elid {
  font-family: var(--font-num);
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  color: var(--blue-700);
}
.sumtree__elname {
  font-size: var(--fs-13);
  color: var(--ink-700);
  line-height: 1.35;
  min-width: 0;
}
.sumtree__elmeta {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  flex-shrink: 0;
}
.sumtree__elmeta .chip { font-size: 10px; padding: 1px 6px; }
.sumtree .why {
  width: 22px;
  height: 22px;
  font-size: 10px;
}
.sumtree__num {
  font-family: var(--font-num);
  font-size: var(--fs-13);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink-800);
  white-space: nowrap;
}
.sumtree__branch--root > summary .sumtree__num,
.sumtree__branch--sub > summary .sumtree__num {
  font-weight: var(--fw-semibold);
  color: var(--navy-700);
}
.sumtree__children {
  background: var(--white);
}
.sumtree__branch--root > .sumtree__children {
  padding-left: var(--sumtree-indent);
  padding-bottom: var(--s-1);
}
.sumtree__branch--sub > .sumtree__children {
  padding-left: var(--sumtree-indent);
  border-left: 2px solid var(--ink-100);
  margin-left: var(--sumtree-indent);
}
/* Nested branch inside root — second tab step */
.sumtree__branch--root > .sumtree__children > .sumtree__branch--sub > .sumtree__children {
  margin-left: var(--sumtree-indent);
}
.sumtree__row--total {
  background: var(--navy-700);
  color: var(--white);
  border-bottom: none;
  min-height: 44px;
  margin-top: var(--s-1);
}
.sumtree__row--total .sumtree__title {
  font-family: var(--font-display);
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sumtree__row--total .sumtree__num {
  color: var(--white);
  font-weight: var(--fw-semibold);
}
.sumtree__hint {
  padding: var(--s-3) var(--s-4);
  margin: 0;
  background: var(--ink-050);
  border-top: 1px solid var(--ink-100);
  line-height: 1.45;
}
@media (max-width: 960px) {
  .sumtree { --sumtree-cols: 24px minmax(10rem, 1fr) 6.5rem 6.5rem; }
  .sumtree__num:nth-child(5),
  .sumtree__num--head:nth-child(5) { display: none; }
}

.radiorow { display: flex; gap: var(--s-4); flex-wrap: wrap; align-items: center; }
.radio { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-13); cursor: pointer; }
.radio input, .check input { accent-color: var(--blue-600); width: 15px; height: 15px; }
.check { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-13); cursor: pointer; }

.switchgroup {
  border: 1px solid var(--ink-200); border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4); background: var(--steel-050);
  display: grid; gap: var(--s-2);
}
.switchgroup__title {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--navy-700);
}
.switchgroup__title em { font-style: normal; color: var(--ink-500); text-transform: none; letter-spacing: 0; font-weight: 600; }

/* master / your value / remark — the reusable three-column override pattern */
.myr { display: grid; grid-template-columns: 1.6fr 7.5rem 7.5rem 1.4fr; gap: var(--form-col-gap); align-items: center; }
.myr--head {
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-400);
  padding-bottom: var(--s-1); border-bottom: 1px solid var(--ink-200);
}
.myr + .myr { margin-top: var(--s-3); }

/* ── Data tables ──────────────────────────────────────────────────────── */
.tablewrap { overflow-x: auto; scrollbar-gutter: stable; }
.table { font-size: var(--fs-13); }
.table th {
  text-align: left; font-size: var(--fs-11); font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-500);
  padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--ink-200);
  background: var(--ink-050); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.table td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--ink-100); vertical-align: middle; transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover td { background: var(--steel-050); }
.table .r { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.table .c { text-align: center; }
.table .is-emphasised { font-weight: 700; color: var(--blue-700); background: var(--blue-050); }
.table__sect td {
  background: var(--cell-section); color: var(--white);
  font-weight: 700; font-size: var(--fs-12); letter-spacing: .06em; text-transform: uppercase;
}
.table__sect--sub td {
  background: var(--steel-600); color: var(--white);
  font-size: var(--fs-11); letter-spacing: .04em; padding-top: var(--s-1); padding-bottom: var(--s-1);
}
/* OT / wage rank group label — same row surface as detail lines (not section band). */
.table__group-head td {
  background: var(--white); color: var(--ink-800);
  font-weight: 700; font-size: var(--fs-12);
  letter-spacing: normal; text-transform: none;
  border-top: 1px solid var(--ink-200);
}
.table tbody tr.table__group-head:hover td { background: var(--steel-050); }
.table__sub td { background: var(--cell-subtotal); font-weight: 700; border-top: 1px solid var(--cell-subtotal-border); }
.table__total td {
  background: var(--navy-700); color: var(--white); font-weight: 700; font-size: var(--fs-14);
}
/* Technical Accounts M2.4 — "Adjust by %" control in each category header. */
.pctadj { display: inline-flex; align-items: center; gap: 4px; margin-right: 14px; }
.pctadj .pctadj__base { width: auto; min-width: 0; padding-top: 2px; padding-bottom: 2px; }
.pctadj .pctadj__input { width: 58px; text-align: right; }
.pctadj .pctadj__btn { min-width: 30px; padding-left: 8px; padding-right: 8px; }

/* Previous-year (PY) budget — Technical Accounts M2.4. Light blue so it reads as a
   reference figure, distinct from the navy total rows that carry current estimates. */
.table tr.table__py td { background: var(--info-100); color: var(--navy-700); }
.table tr.table__py td .muted, .table tr.table__py td.muted { color: var(--ink-600); }
.table th.th-py { background: var(--info-100); color: var(--navy-700); }
.table td.td-py { background: var(--info-100); color: var(--navy-700); }
.table tr.is-officer td:first-child { box-shadow: inset 3px 0 0 var(--steel-500); }
.table tr.is-rating td:first-child { box-shadow: inset 3px 0 0 var(--ink-300); }
.table tr.is-excluded td { color: var(--ink-400); }
.table tr.is-unresolved td { background: var(--danger-100); }
.cellinput {
  width: 100%;
  height: var(--section-control-h, var(--field-h-sm));
  padding: 0 var(--s-2);
  text-align: right;
  border: 1px solid var(--cell-input-border);
  background: var(--cell-input);
  font-family: var(--font-num);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}
.card .tablewrap .cellinput,
.modal__panel .tablewrap .cellinput {
  height: var(--section-control-h);
}
.cellinput--left { text-align: left; }
.cellinput--w-xs { width: 3.25rem; max-width: 100%; }
.cellinput--w-sm { width: 3.5rem; max-width: 100%; }
.cellinput--w-md { width: 3.75rem; max-width: 100%; }
.cellinput--w-pos { width: 3.75rem; max-width: 100%; }
.cellinput--w-nat { width: 7rem; max-width: 100%; text-align: left; }
.cellinput--w-rate { width: 4.75rem; max-width: 100%; }
.cellinput--w-money { width: 5.25rem; max-width: 100%; }
.cellinput--w-money-lg { width: 6rem; max-width: 100%; }
.cellinput--w-money-xl { width: 6.5rem; max-width: 100%; }
.cellinput--w-pct { width: 4.75rem; max-width: 100%; }
.cellinput--full { width: 100%; min-width: 9.5rem; }
/* One numeric / money / nationality width per card or modal table */
.card .tablewrap,
.modal__panel .tablewrap {
  --table-in-w-num: var(--section-table-num-w);
  --table-in-w-nat: var(--section-table-nat-w);
  --table-in-w-money: var(--section-table-money-w);
}
.card .tablewrap .cellinput--w-xs,
.card .tablewrap .cellinput--w-sm,
.card .tablewrap .cellinput--w-md,
.card .tablewrap .cellinput--w-pos,
.card .tablewrap .cellinput--w-rate,
.card .tablewrap .cellinput--w-pct,
.modal__panel .tablewrap .cellinput--w-xs,
.modal__panel .tablewrap .cellinput--w-sm,
.modal__panel .tablewrap .cellinput--w-md,
.modal__panel .tablewrap .cellinput--w-pos,
.modal__panel .tablewrap .cellinput--w-rate,
.modal__panel .tablewrap .cellinput--w-pct {
  width: var(--table-in-w-num);
}
.card .tablewrap .cellinput--w-money,
.card .tablewrap .cellinput--w-money-lg,
.card .tablewrap .cellinput--w-money-xl,
.modal__panel .tablewrap .cellinput--w-money,
.modal__panel .tablewrap .cellinput--w-money-lg,
.modal__panel .tablewrap .cellinput--w-money-xl {
  width: var(--table-in-w-money);
}
.card .tablewrap .cellinput--w-nat,
.modal__panel .tablewrap .cellinput--w-nat {
  width: var(--table-in-w-nat);
}
.card .tablewrap .cellreadonly,
.modal__panel .tablewrap .cellreadonly {
  height: var(--section-control-h);
}
.card .tablewrap .cellreadonly--w-xs,
.card .tablewrap .cellreadonly--w-sm,
.modal__panel .tablewrap .cellreadonly--w-xs,
.modal__panel .tablewrap .cellreadonly--w-sm {
  width: var(--table-in-w-num);
}
.cellreadonly {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  box-sizing: border-box;
  height: var(--section-control-h, var(--field-h-sm));
  padding: 0 var(--s-2);
  text-align: right;
  font-family: var(--font-num);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  color: var(--ink-700);
  background: var(--cell-input);
  border: 1px solid var(--cell-input-border);
  border-radius: var(--r-md);
  vertical-align: middle;
}
.cellreadonly--w-sm { width: 3.5rem; max-width: 100%; }
.cellreadonly--w-xs { width: 3.25rem; max-width: 100%; }
.th-money,
.td-money {
  white-space: nowrap;
  min-width: 6rem;
}
.td-rate { min-width: 7.25rem; }
.rate-with-unit {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-1);
  max-width: 100%;
}
.rate-with-unit .cellinput,
.rate-with-unit > .muted {
  flex: 0 1 auto;
  min-width: 0;
}
.rate-with-unit__u {
  flex-shrink: 0;
  font-size: var(--fs-11);
  font-weight: 500;
  color: var(--ink-500);
  line-height: 1.2;
  white-space: nowrap;
}
.th-unit {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-10);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-450, var(--ink-500));
}
.td-deriv { max-width: 22rem; }

/* M1.2 allowances & M1.5 crew expenses — aligned money inputs and remark fields */
.table--budget-edit {
  --budget-edit-money-w: 7.5rem;
  --budget-edit-rate-w: 13.75rem;
  --budget-edit-unit-w: 5.75rem;
  --budget-edit-remark-w: 12rem;
  table-layout: fixed;
  width: 100%;
}
.table--budget-edit col.col-regime { width: 6.5rem; }
.table--budget-edit col.col-rate { width: var(--budget-edit-rate-w); }
.table--budget-edit col.col-pct,
.table--budget-edit col.col-money { width: var(--budget-edit-money-w); }
.table--budget-edit col.col-remark { width: var(--budget-edit-remark-w); }
.table--budget-edit col.col-actions { width: 5.5rem; }
.table--budget-edit th.th-money:not(.th-rate),
.table--budget-edit td.td-money:not(.td-rate) {
  width: var(--budget-edit-money-w);
  min-width: var(--budget-edit-money-w);
  max-width: var(--budget-edit-money-w);
  vertical-align: middle;
}
.table--budget-edit th.th-rate,
.table--budget-edit td.td-money.td-rate {
  width: var(--budget-edit-rate-w);
  min-width: var(--budget-edit-rate-w);
  max-width: var(--budget-edit-rate-w);
  vertical-align: middle;
}
.table--budget-edit td.col-desc {
  overflow: hidden;
  text-overflow: ellipsis;
}
.table--budget-edit th.col-remark,
.table--budget-edit td.col-remark {
  width: var(--budget-edit-remark-w);
  min-width: var(--budget-edit-remark-w);
  max-width: var(--budget-edit-remark-w);
  vertical-align: middle;
}
.table--budget-edit th.col-actions,
.table--budget-edit td.col-actions {
  width: 5.5rem;
  min-width: 5.5rem;
  white-space: nowrap;
}
.card .tablewrap .table--budget-edit .cellinput--w-money,
.card .tablewrap .table--budget-edit .cellinput--w-money-lg,
.card .tablewrap .table--budget-edit .cellinput--w-money-xl,
.card .tablewrap .table--budget-edit .cellinput--w-sm {
  width: 100%;
  max-width: none;
}
.card .tablewrap .table--budget-edit .rate-with-unit .cellinput--w-money {
  width: var(--budget-edit-money-w);
  max-width: var(--budget-edit-money-w);
  flex: 0 0 var(--budget-edit-money-w);
}
.table--budget-edit td.col-remark .cellinput {
  width: 100%;
  min-width: 0;
  text-align: left;
}
.table--budget-edit .rate-with-unit {
  display: grid;
  grid-template-columns: var(--budget-edit-money-w) var(--budget-edit-unit-w);
  column-gap: var(--s-1);
  align-items: center;
  justify-content: end;
  width: 100%;
  margin-left: auto;
  max-width: calc(var(--budget-edit-money-w) + var(--budget-edit-unit-w) + var(--s-1));
}
.table--budget-edit .rate-with-unit .cellinput,
.table--budget-edit .rate-with-unit > .muted {
  width: 100%;
  max-width: var(--budget-edit-money-w);
  justify-self: end;
}
.table--budget-edit .rate-with-unit__u {
  font-size: var(--fs-11);
  font-weight: 500;
  color: var(--ink-500);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table--budget-edit td.td-money .cellcalc--slot {
  display: flex;
  width: 100%;
  min-height: var(--section-control-h);
  height: var(--section-control-h);
  box-sizing: border-box;
  justify-content: flex-end;
  align-items: center;
  font-weight: var(--fw-medium);
  color: var(--ink-600);
  background: var(--ink-050);
  border-color: var(--ink-150);
}
/* Calculated annual/monthly figures — same box size as editable per-month inputs */
.table--budget-edit td.td-money .deriv-hint {
  display: block;
  width: 100%;
}
.table--budget-edit td.td-money .cellcalc {
  width: 100%;
  min-height: var(--section-control-h);
  height: var(--section-control-h);
  box-sizing: border-box;
}
.table--budget-edit tfoot td.td-money,
.table--budget-edit tfoot td.r.td-money {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}

/* M2.4 technical accounts — uniform Optimal / Benchmark pickers */
.valpick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 5.75rem;
  width: 5.75rem;
  height: var(--field-h-sm);
  padding: 0 var(--s-2);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--ink-700);
  font-family: var(--font-num);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}
.valpick:hover {
  border-color: var(--blue-400);
  background: var(--blue-050);
  color: var(--blue-700);
}
.valpick--on,
.valpick--on:hover {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: var(--white);
  box-shadow: var(--sh-interactive);
}
.valpick--on:hover {
  background: var(--blue-700);
  border-color: var(--blue-700);
}
.valpick--range-warn {
  border-color: var(--danger-600);
  box-shadow: 0 0 0 1px var(--danger-600);
}
.valpick--range-warn:hover {
  border-color: var(--danger-600);
  background: var(--danger-100);
  color: var(--danger-600);
}
/* M2.4 — valpick buttons and money columns share budget-edit column widths */
.table--budget-edit.table--tech-accounts td.td-money {
  text-align: right;
  vertical-align: middle;
}
.table--budget-edit.table--tech-accounts .valpick {
  width: 100%;
  min-width: 0;
  max-width: none;
  height: var(--section-control-h);
  justify-content: flex-end;
  padding-right: var(--s-2);
}
.table--budget-edit.table--tech-accounts td.td-money .deriv-hint {
  display: block;
  width: 100%;
}
.table--budget-edit.table--tech-accounts td.td-money .cellcalc {
  width: 100%;
  min-height: var(--section-control-h);
  height: var(--section-control-h);
  box-sizing: border-box;
}
.table--budget-edit.table--tech-accounts tfoot td.td-money {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}
.cellinput:disabled {
  background: var(--ink-050); color: var(--ink-400); cursor: not-allowed;
}
.cellcalc {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  box-sizing: border-box;
  height: var(--field-h-sm);
  padding: 0 var(--s-2);
  text-align: right;
  font-family: var(--font-num);
  font-size: var(--fs-13);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--navy-700);
  background: var(--cell-calc);
  border: 1px solid var(--cell-calc-border);
  border-radius: var(--r-md);
  vertical-align: middle;
}
.cellcalc--w-sm { width: 3.5rem; max-width: 100%; }
.cellcalc--w-xs { width: 3.25rem; max-width: 100%; }
.cellcalc--w-md { width: 3.75rem; max-width: 100%; }

/* M2.3 — compact table; derivation notes sit under the line name */
.table--lube { min-width: 46rem; }
.table--budget-edit.table--lube {
  table-layout: fixed;
  width: 100%;
}
.table--budget-edit.table--lube col.col-money { width: var(--budget-edit-money-w); }
.table--budget-edit.table--lube td.td-money {
  text-align: right;
  vertical-align: middle;
}
.table--budget-edit.table--lube td.td-money .deriv-hint {
  display: block;
  width: 100%;
}
.table--budget-edit.table--lube td.td-money .cellcalc {
  width: 100%;
  min-height: var(--section-control-h);
  height: var(--section-control-h);
  box-sizing: border-box;
}
.table--budget-edit.table--lube td.is-calc {
  background: transparent;
  font-weight: inherit;
  color: inherit;
}
.table--budget-edit.table--lube tbody tr:hover td.is-calc {
  background: transparent;
  filter: none;
}
.table--budget-edit.table--lube tfoot td.td-money {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}
.table--lube .th-mdm-ref {
  font-size: var(--fs-10);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-500);
}
.table--lube .lube-mdm-ref {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-1);
  box-sizing: border-box;
  width: 100%;
  min-height: var(--section-control-h);
  height: var(--section-control-h);
  padding: 0 var(--s-2);
  border: 1px solid var(--ink-150, var(--ink-200));
  border-radius: var(--r-md);
  background: var(--ink-050);
  color: var(--ink-700);
  font-family: var(--font-num);
  font-size: var(--fs-11);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}
.table--lube .lube-mdm-ref__tag {
  font-size: var(--fs-10);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-450, var(--ink-500));
}
.table--lube .lube-mdm-ref--warn {
  border-color: var(--danger-500);
  background: var(--danger-100);
  color: var(--danger-700);
}
.table--lube .lube-mdm-ref--warn .lube-mdm-ref__tag { color: var(--danger-600); }
.table--lube .lube-line__desc { vertical-align: middle; min-width: 12rem; max-width: 22rem; }
.table--lube .lube-line__title {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem;
  font-size: var(--fs-13); line-height: 1.35;
}
.table--lube .lube-line__hint { margin-top: 0.15rem; }
.table--lube tbody tr { height: auto; }
.table--lube tbody td { padding-top: 0.45rem; padding-bottom: 0.45rem; }
.table--lube .lube-line__meta { display: none; }
.table--lube td.is-calc {
  background: var(--cell-calc); font-weight: var(--fw-semibold); color: var(--navy-700);
}
.table--lube tbody tr:hover td.is-calc { background: var(--cell-calc); filter: brightness(.97); }
.table--lube tfoot td.is-calc,
.table--lube tfoot .r { font-weight: 700; }
.table--compact td, .table--compact th { padding: var(--s-1) var(--s-3); }

/* M1.1 nationality mix sub-rows (positions > 1) */
.mixtoggle {
  border: none; background: transparent; color: var(--blue-600);
  cursor: pointer; padding: 0 0.25rem 0 0; font-weight: 700;
}
.table--composition .mix-cell {
  min-width: 11rem;
  vertical-align: middle;
}
.table--composition .mix-cell .mixsummary { margin-bottom: 0; }
.mixsummary { font-size: var(--fs-12); color: var(--ink-600); display: block; margin-bottom: var(--s-1); }
.mixmodal-btn {
  margin-top: var(--s-2);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--blue-600);
  background: var(--blue-050);
  color: var(--blue-700);
  font-weight: var(--fw-semibold);
  box-shadow: var(--sh-1);
  white-space: nowrap;
}
.mixmodal-btn:hover {
  background: var(--blue-100);
  border-color: var(--blue-700);
  color: var(--navy-700);
  box-shadow: var(--sh-2);
}
.mixmodal-btn:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}
.mixmodal-btn__icon {
  font-size: var(--fs-13);
  line-height: 1;
  opacity: 0.85;
}
.mixmodal .table { margin-top: var(--s-2); }

/* “why?” affordance on every computed line */
.why {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--ink-300); background: var(--white);
  color: var(--ink-500); font-size: var(--fs-11); font-weight: 700;
  display: inline-grid; place-items: center;
  box-shadow: var(--sh-1);
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease);
}
.why:hover {
  border-color: var(--blue-600); color: var(--blue-600); background: var(--blue-050);
  transform: scale(1.08); box-shadow: var(--sh-2);
}

/* ── Stat tiles ───────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s-3); }
.stat {
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  padding: var(--s-3) var(--s-4);
  box-shadow: var(--sh-1);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-2);
  border-color: var(--ink-300);
}
.stat__label { font-size: var(--fs-11); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-400); }
.stat__value { font-family: var(--font-num); font-size: var(--fs-22); font-weight: 600; color: var(--navy-700); margin-top: 2px; }
.stat__note { font-size: var(--fs-11); color: var(--ink-500); }
.stat--calc { background: var(--cell-calc); border-color: var(--cell-calc-border); }
.stat--derived .stat__value { color: var(--ok-600); }

/* M1.5 crew expenses — compact flag / nationality context row */
.m15-context-tiles {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.m15-context-tiles .stat {
  padding: var(--s-2) var(--s-2);
  border-radius: var(--r-md);
}
.m15-context-tiles .stat:hover {
  transform: none;
  box-shadow: var(--sh-1);
  border-color: var(--ink-200);
}
.m15-context-tiles .stat__label {
  font-size: var(--fs-10);
  letter-spacing: .05em;
  line-height: 1.2;
}
.m15-context-tiles .stat__value {
  font-family: var(--font-sans, inherit);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1px;
  word-break: break-word;
}
.m15-context-tiles .stat--derived .stat__value { color: var(--ok-700); }

/* ── Applicability preview ────────────────────────────────────────────── */
.applist { display: grid; gap: 1px; background: var(--ink-100); }
.appitem {
  display: grid; grid-template-columns: 22px 1fr auto; gap: var(--s-3);
  align-items: baseline; padding: var(--s-2) var(--s-4); background: var(--white);
  font-size: var(--fs-13);
}
.appitem__glyph { font-weight: 700; text-align: center; }
.appitem--in .appitem__glyph { color: var(--state-included); }
.appitem--zero { color: var(--ink-500); }
.appitem--zero .appitem__glyph { color: var(--state-zero); }
.appitem--out { color: var(--ink-500); }
.appitem--out .appitem__glyph { color: var(--state-excluded); }
.appitem--unresolved { background: var(--danger-100); color: var(--danger-600); font-weight: 600; }
.appitem__why { font-size: var(--fs-11); color: var(--ink-500); }

/* ── Derivation hint (hover tooltip + click for full trace) ───────────── */
.deriv-hint {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted color-mix(in srgb, var(--ink-500) 55%, transparent);
}
.deriv-hint--trace { cursor: pointer; }
/* All derivation hovers use the fixed .deriv-float-tip (scrollable, structured). */
.deriv-hint[data-deriv]:hover::after,
.deriv-hint[data-deriv]:focus-visible::after {
  content: none;
}

.deriv-float-tip {
  position: fixed;
  z-index: 500;
  max-width: min(28rem, calc(100vw - 16px));
  display: flex;
  flex-direction: column;
  padding: 0;
  font-size: var(--fs-11);
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink-800);
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  white-space: normal;
  word-break: break-word;
  pointer-events: auto;
  overflow: hidden;
}
.deriv-float-tip__head {
  flex-shrink: 0;
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-10);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-500);
  border-bottom: 1px solid var(--ink-150);
}
.deriv-float-tip__body {
  padding: var(--s-1) var(--s-3);
  overflow-y: auto;
  max-height: min(20rem, 55vh);
  overscroll-behavior: contain;
}
.deriv-float-tip__step {
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--ink-100);
  font-family: var(--font-num);
  font-size: var(--fs-11);
  line-height: 1.5;
}
.deriv-float-tip__step:last-child { border-bottom: none; }
.deriv-float-tip__foot {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s-1);
  padding: var(--s-2) var(--s-3);
  border-top: 1px solid var(--ink-150);
  font-size: var(--fs-10);
  color: var(--ink-500);
}
.deriv-float-tip__foot-hint {
  font-size: var(--fs-10);
  color: var(--ink-500);
  line-height: 1.35;
}
.deriv-float-tip__open {
  width: 100%;
  justify-content: center;
}

.trace-lookup-detail {
  margin: var(--s-2) 0 0;
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-11);
  line-height: 1.45;
  white-space: pre-wrap;
  background: var(--ink-50);
  border-radius: var(--r-sm);
  color: var(--ink-700);
  max-height: min(12rem, 30vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ── Trace drawer ─────────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; background: rgba(15, 35, 55, .42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease); z-index: 60;
}
.scrim.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  max-height: 100dvh;
  background: var(--white); box-shadow: var(--sh-4);
  transform: translateX(100%); transition: transform var(--dur) var(--ease);
  z-index: 61;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer.is-open { transform: none; }
.drawer__head {
  padding: var(--s-4); border-bottom: 1px solid var(--ink-200);
  display: flex; align-items: start; gap: var(--s-3);
  flex: 0 0 auto;
}
.drawer__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.drawer__foot {
  padding: var(--s-3) var(--s-4); border-top: 1px solid var(--ink-200);
  display: flex; gap: var(--s-2);
  flex: 0 0 auto;
}
/* Long tables inside drawer cards — scroll inside the panel, not the page behind */
.drawer__body .card { overflow: visible; }
.drawer__body .drawer-scroll {
  max-height: min(52vh, 28rem);
  overflow-y: auto;
  overflow-x: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--ink-100);
  border-radius: var(--r-md);
  background: var(--white);
}
body.is-drawer-open {
  overflow: hidden;
}
body.is-drawer-open .content {
  overflow: hidden;
}

.trace { display: grid; gap: var(--s-2); }
.tracepass {
  border: 1px solid var(--ink-200); border-radius: var(--r-md); overflow: hidden;
}
.trace-drawer .tracepass { overflow: visible; }
.trace-drawer .tracepass__head {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--ink-200);
}
.tracepass__head {
  padding: var(--s-2) var(--s-3); background: var(--ink-050);
  font-size: var(--fs-11); font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-500); display: flex; gap: var(--s-2); align-items: center;
}
.tracepass__body { padding: var(--s-3); display: grid; gap: var(--s-2); font-size: var(--fs-13); }
.tracerule {
  display: grid; grid-template-columns: minmax(72px, 88px) minmax(0, 1fr);
  gap: var(--s-2) var(--s-3); align-items: start;
}
.tracerule__id {
  font-family: var(--font-num); font-size: var(--fs-12); color: var(--blue-700); font-weight: 600;
  word-break: break-word;
}
.tracerule__detail { min-width: 0; }
.tracerule__outcome { line-height: 1.45; word-break: break-word; }
.tracerule__outcome-text { font-weight: 500; }
.tracerule__because { font-size: var(--fs-12); color: var(--ink-500); line-height: 1.45; word-break: break-word; }
.tracerule__rowkey { word-break: break-word; }
.tracemath {
  font-family: var(--font-num); font-size: var(--fs-13); line-height: 1.5;
  background: var(--ink-050); border: 1px solid var(--ink-200); border-radius: var(--r-md);
  padding: var(--s-3); word-break: break-word; overflow-wrap: anywhere;
}
.tracemath--steps { padding: var(--s-2) var(--s-3); }
.tracemath--steps .trace-steps { margin: 0; }
.trace-summary .notice { align-items: flex-start; }
.trace-summary .notice > div:last-child { min-width: 0; flex: 1; }
.trace-summary__scroll {
  margin-top: var(--s-2);
  max-height: min(14rem, 36vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: var(--s-1);
}
.trace-summary__scroll--detail { max-height: min(12rem, 32vh); }
.trace-summary__scroll--detail .trace-lookup-detail {
  margin: 0;
  max-height: none;
  overflow: visible;
}
.trace-steps {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: var(--s-2);
  font-family: var(--font-num);
  font-size: var(--fs-12);
  line-height: 1.5;
  color: var(--ink-800);
}
.trace-steps li { padding-left: var(--s-1); }
.trace-summary__text {
  margin-top: var(--s-1); font-size: var(--fs-13); line-height: 1.5;
  word-break: break-word; overflow-wrap: anywhere;
}
.trace-effective {
  display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); align-items: baseline;
  padding: var(--s-2) 0; line-height: 1.5;
}
.trace-effective__amount { font-size: var(--fs-14); color: var(--ink-900); }
.trace-effective--row-total {
  margin-top: var(--s-2);
  padding: var(--s-3);
  background: var(--ink-050);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  font-size: var(--fs-13);
}
.trace-drawer {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding-right: var(--s-1);
  scrollbar-gutter: stable;
}
.trace-drawer .trace-summary__scroll {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.trace-conditions-block {
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  overflow: visible;
  background: var(--white);
  flex-shrink: 0;
}
.trace-conditions-block__body {
  padding: var(--s-2) var(--s-3) var(--s-3);
  overflow: visible;
}
.trace-conditions-list {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
  font-size: var(--fs-13);
  line-height: 1.55;
  color: var(--ink-800);
}
.trace-conditions-list li {
  margin-bottom: var(--s-2);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.trace-conditions-list li:last-child { margin-bottom: 0; }
.tracepass__body--regimes {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  overflow: visible;
}
.trace-regime-block {
  border: 1px solid var(--ink-150);
  border-radius: var(--r-md);
  padding: var(--s-3);
  display: grid;
  gap: var(--s-2);
  background: var(--white);
}
.trace-regime-block__head {
  font-weight: 600;
  font-size: var(--fs-12);
  color: var(--ink-700);
  line-height: 1.4;
}
.trace-regime-block__math {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: var(--font-num);
  font-size: var(--fs-12);
  line-height: 1.55;
  background: var(--ink-050);
  border: 1px solid var(--ink-100);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
}
.trace-regime-block__total {
  font-size: var(--fs-12);
  color: var(--ink-600);
}
.drawer__body:has(.trace-drawer) {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: var(--s-3);
}
.drawer__body:has(.trace-drawer) > .trace-drawer {
  flex: 1 1 auto;
  min-height: 12rem;
}
.drawer__body:has(.trace-drawer) .trace-effective,
.drawer__body:has(.trace-drawer) .notice {
  flex-shrink: 0;
}
/* Visible scrollbars in trace drawer (Windows / WebKit) */
.trace-drawer,
.deriv-float-tip__body {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-400) var(--ink-100);
}
.trace-drawer::-webkit-scrollbar,
.deriv-float-tip__body::-webkit-scrollbar {
  width: 10px;
}
.trace-drawer::-webkit-scrollbar-track,
.deriv-float-tip__body::-webkit-scrollbar-track {
  background: var(--ink-100);
  border-radius: var(--r-sm);
}
.trace-drawer::-webkit-scrollbar-thumb,
.deriv-float-tip__body::-webkit-scrollbar-thumb {
  background: var(--ink-400);
  border-radius: var(--r-sm);
  border: 2px solid var(--ink-100);
}
.trace-drawer::-webkit-scrollbar-thumb:hover,
.deriv-float-tip__body::-webkit-scrollbar-thumb:hover {
  background: var(--ink-500);
}
.deriv-float-tip__body {
  max-height: min(24rem, 60vh);
  overflow-y: scroll;
  scrollbar-gutter: stable;
}
.col-checklist {
  display: grid; gap: 2px; max-height: 168px; overflow-y: auto;
  border: 1px solid var(--ink-200); border-radius: var(--r-md);
  padding: var(--s-2); background: var(--white);
}
.col-checklist--empty {
  padding: var(--s-3); text-align: center; background: var(--ink-050);
}
.col-checklist__item {
  display: flex; align-items: flex-start; gap: var(--s-2);
  padding: var(--s-1) var(--s-2); border-radius: var(--r-sm);
  font-size: var(--fs-13); line-height: 1.35;
}
.col-checklist__item:hover { background: var(--ink-050); }
.col-checklist__name { word-break: break-word; flex: 1; min-width: 0; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 62;
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease);
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal__panel {
  width: min(600px, 94vw); max-height: 90vh; background: var(--white);
  border-radius: var(--r-lg); box-shadow: var(--sh-5);
  overflow: hidden;
  display: flex; flex-direction: column;
  transform: translateY(12px) scale(.98); transition: transform var(--dur) var(--ease-out), opacity var(--dur) var(--ease);
}
.modal.is-open .modal__panel { transform: none; }
.modal__head { padding: var(--s-4); border-bottom: 1px solid var(--ink-200); flex: 0 0 auto; }
.modal__body { padding: var(--s-4); display: grid; gap: var(--s-3); overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal__foot { padding: var(--s-3) var(--s-4); background: var(--ink-050); border-top: 1px solid var(--ink-200); display: flex; gap: var(--s-2); justify-content: flex-end; align-items: center; flex-wrap: wrap; flex: 0 0 auto; }
.modal__foot-spacer { flex: 1 1 auto; min-width: var(--s-2); }
.pdf-proposal-include-proj {
  margin-right: auto;
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  color: var(--ink-700);
  max-width: min(100%, 22rem);
}
.pdf-proposal-include-proj.is-disabled { opacity: .65; cursor: not-allowed; }
.pdf-proposal-include-proj.is-disabled input { cursor: not-allowed; }
.modal__panel--workflow {
  width: min(920px, 96vw);
  max-height: 92vh;
}
.modal__panel--editor {
  width: min(960px, 96vw);
  max-height: 92vh;
}
.modal__panel--wide {
  width: min(720px, 96vw);
  max-height: 92vh;
}
.modal__head--editor {
  padding: var(--s-4) var(--s-5);
  background: linear-gradient(135deg, var(--blue-700) 0%, var(--blue-600) 100%);
  color: var(--white);
  border-bottom: none;
}
.modal__head--editor h3 { color: var(--white); font-size: var(--fs-16); margin: 0; }
.modal__head--editor .muted { color: rgba(255,255,255,.85); }

/* ── Cost element editor (modal tabs + detail hero) ───────────────────── */
.editor-tabs {
  display: flex; gap: var(--s-1); padding: var(--s-2); background: var(--ink-050);
  border-radius: var(--r-md); border: 1px solid var(--ink-200);
}
.editor-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3); border: none; border-radius: var(--r-sm);
  background: transparent; font-size: var(--fs-13); font-weight: 600;
  color: var(--ink-600); cursor: pointer; transition: background var(--dur-fast), color var(--dur-fast);
}
.editor-tab:hover { background: var(--white); color: var(--ink-800); }
.editor-tab.is-on {
  background: var(--white); color: var(--blue-700);
  box-shadow: var(--sh-1); border: 1px solid var(--ink-200);
}
.editor-tabpanel { padding-top: var(--s-3); }
.editor-tabpanel .field { margin-bottom: 0; }

.el-hero {
  padding: var(--s-4); border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--blue-050) 0%, var(--white) 60%);
  border: 1px solid var(--blue-200); margin-bottom: var(--s-4);
}
.el-hero__row { display: flex; align-items: flex-start; gap: var(--s-4); flex-wrap: wrap; }
.el-hero__id {
  font-family: var(--font-num); font-size: var(--fs-20); font-weight: 800;
  color: var(--blue-700); line-height: 1.1;
}
.el-hero__name { font-size: var(--fs-18); font-weight: 700; color: var(--ink-900); margin: var(--s-1) 0; }
.el-hero__meta { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.el-stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--s-3); margin-bottom: var(--s-4);
}
.el-stat {
  padding: var(--s-3); border-radius: var(--r-md); border: 1px solid var(--ink-200);
  background: var(--white);
}
.el-stat__label { font-size: var(--fs-11); color: var(--ink-500); text-transform: uppercase; letter-spacing: .04em; }
.el-stat__value { font-size: var(--fs-14); font-weight: 700; color: var(--ink-800); margin-top: var(--s-1); }
.el-stat__value.mono-key { font-family: var(--font-num); }

.el-pricing-block {
  border: 1px solid var(--ink-200); border-radius: var(--r-md);
  padding: var(--s-4); background: var(--ink-025);
}
.el-pricing-block__head {
  display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3);
  font-weight: 700; font-size: var(--fs-13);
}
.el-empty-pricing {
  text-align: center; padding: var(--s-6) var(--s-4);
  border: 1px dashed var(--ink-300); border-radius: var(--r-md);
  background: var(--ink-025);
}
.el-empty-pricing__icon { font-size: 2rem; opacity: .35; margin-bottom: var(--s-2); }

/* Action rule form — labelled rows instead of cramped inline sentence */
.action-form {
  display: grid; gap: var(--s-3);
  padding: var(--s-3); border: 1px solid var(--ink-200);
  border-radius: var(--r-md); background: var(--white);
}
.action-form__row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: var(--form-col-gap);
  align-items: center;
}
.action-form__label {
  font-size: var(--fs-12); font-weight: 600; color: var(--ink-600);
}
.action-form__fields {
  display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center;
}
.action-form__fields .sel { min-width: 0; }
.action-form__fields .sel--wide { flex: 1; min-width: 200px; }
.action-form__hint { margin-top: var(--s-2); padding-left: var(--s-1); }

/* Centre pane — full-height element showcase */
.el-showcase {
  display: flex; flex-direction: column; min-height: min(520px, calc(100vh - 220px));
  border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--blue-050) 0%, var(--white) 55%);
  overflow: hidden;
}
.el-showcase__card {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center; padding: var(--s-8) var(--s-6);
  max-width: 720px; margin: 0 auto; width: 100%;
}
.el-showcase__top {
  display: flex; align-items: center; justify-content: center; gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.el-showcase__id {
  font-family: var(--font-num); font-size: var(--fs-24); font-weight: 800;
  color: var(--blue-700); line-height: 1.1;
}
.el-showcase__ref { font-size: var(--fs-13); color: var(--ink-500); }
.el-showcase__name {
  font-size: var(--fs-22); font-weight: 700; color: var(--ink-900);
  margin: 0 0 var(--s-4); line-height: 1.35; max-width: 100%;
}
.el-showcase__meta {
  display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center;
  align-items: center; margin-bottom: var(--s-4);
}
.el-showcase__bit { font-size: var(--fs-12); color: var(--ink-600); }
.el-showcase__param {
  margin-bottom: var(--s-4); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md); background: var(--white);
  border: 1px solid var(--blue-200); max-width: 100%;
}
.el-showcase__param-label {
  display: block; font-size: var(--fs-11); text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-500); margin-bottom: var(--s-1);
}
.el-showcase__param-value { font-size: var(--fs-14); font-weight: 600; color: var(--ink-800); }
.el-showcase__live { margin-bottom: var(--s-5); }
.el-showcase__live-label {
  display: block; font-size: var(--fs-11); text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-500); margin-bottom: var(--s-1);
}
.el-showcase__live-value {
  font-family: var(--font-num); font-size: var(--fs-28); font-weight: 800;
  color: var(--ink-900);
}
.el-showcase__actions {
  display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center;
  align-items: center;
}
.btn--lg { padding: var(--s-2) var(--s-5); font-size: var(--fs-14); min-height: 40px; }
.btn--danger-text { color: var(--danger-600); }
.btn--danger-text:hover { color: var(--danger-600); background: var(--danger-100); }

.ruleitem { position: relative; }
.ruleitem__actions {
  display: flex; gap: var(--s-1); margin-top: var(--s-2);
  opacity: 0; transition: opacity var(--dur-fast);
}
.ruleitem:hover .ruleitem__actions,
.ruleitem.is-on .ruleitem__actions { opacity: 1; }
.ruleitem__actions .btn { font-size: var(--fs-11); padding: 2px 8px; height: 24px; }

.rb--hub { grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) minmax(300px, 360px); }

/* Cost Elements — single-row list (replaces tile grid) */
.ce-list-wrap {
  max-height: calc(100vh - 220px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--ink-025) 0%, var(--white) 48%, var(--ink-025) 100%);
  border-radius: var(--r-md);
}
.ce-list-head {
  display: grid;
  grid-template-columns: minmax(72px, 88px) minmax(0, 1.4fr) minmax(88px, 110px) minmax(120px, 1fr) minmax(100px, auto) auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--ink-200);
  background: var(--ink-050);
  flex-shrink: 0;
}
.ce-list-head__r { text-align: right; }
.ce-list-head__actions { text-align: right; }
.ce-list__body {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.ce-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding: var(--s-3);
  background: linear-gradient(180deg, var(--ink-025) 0%, var(--white) 48%, var(--ink-025) 100%);
}
.ce-list__empty { padding: var(--s-6); text-align: center; }

.ce-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-11);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-500);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.ce-sort:hover { color: var(--ink-800); background: var(--ink-100); }
.ce-sort.is-on { color: var(--blue-700); }
.ce-sort--r { justify-content: flex-end; width: 100%; }
.ce-sort--c { justify-content: center; width: 100%; }
.ce-sort__arrow {
  font-size: var(--fs-10);
  color: var(--blue-600);
  line-height: 1;
}
.table thead .ce-sort {
  font-size: var(--fs-11);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
  color: var(--ink-600);
}

.ce-row {
  display: grid;
  grid-template-columns: minmax(72px, 88px) minmax(0, 1.4fr) minmax(88px, 110px) minmax(120px, 1fr) minmax(100px, auto) auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--ink-100);
  background: linear-gradient(135deg, var(--white) 0%, var(--ink-025) 100%);
  cursor: pointer;
  text-align: left;
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
  animation: ce-row-in 0.42s var(--ease) both;
  animation-delay: var(--ce-delay, 0s);
  border-left-width: 4px;
  border-left-style: solid;
  border-left-color: var(--ink-200);
}
.ce-row:nth-child(even) {
  background: linear-gradient(135deg, var(--ink-025) 0%, var(--white) 100%);
}
.ce-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  border-color: var(--blue-200);
}
.ce-row.is-on {
  border-color: var(--blue-400);
  border-left-color: var(--blue-600);
  background: linear-gradient(135deg, var(--blue-050) 0%, var(--white) 92%);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15), 0 8px 22px rgba(37, 99, 235, 0.1);
}
.ce-row.is-inactive { opacity: 0.55; }
.ce-row--crewing { border-left-color: var(--blue-500); }
.ce-row--technical { border-left-color: #0d9488; }
.ce-row--lube-oil { border-left-color: #7c3aed; }
.ce-row--insurance { border-left-color: #d97706; }
.ce-row--management { border-left-color: var(--ink-400); }

.ce-row__id {
  font-size: var(--fs-12);
  font-weight: 700;
  color: var(--blue-700);
}
.ce-row__name {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--ink-800);
  line-height: 1.35;
}
.ce-row__meta { margin-top: 2px; }
.ce-row__dot { margin: 0 var(--s-1); opacity: 0.45; }
.ce-row__module { justify-self: start; }
.ce-row__amount {
  font-family: var(--font-num);
  font-size: var(--fs-12);
  color: var(--ink-700);
  text-align: right;
  line-height: 1.35;
}
.ce-row__amount.is-empty { color: var(--ink-400); }
.ce-row__status {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  justify-content: flex-end;
  align-items: center;
}
.ce-row__actions {
  opacity: 0;
  transform: translateX(4px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.ce-row:hover .ce-row__actions,
.ce-row.is-on .ce-row__actions {
  opacity: 1;
  transform: translateX(0);
}
.ce-row__actions .btn { font-size: var(--fs-11); padding: 2px 10px; height: 26px; }

@keyframes ce-row-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .ce-row { animation: none; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
  .ce-row:hover { transform: none; }
  .ce-row__actions { opacity: 1; transform: none; }
}
@media (max-width: 960px) {
  .ce-row {
    grid-template-columns: 1fr 1fr;
    gap: var(--s-2);
  }
  .ce-row__id { grid-column: 1; }
  .ce-row__main { grid-column: 1 / -1; }
  .ce-row__actions { grid-column: 1 / -1; opacity: 1; transform: none; }
}

/* ── Region / multi-select picker ─────────────────────────────────────── */
.area-colour-legend {
  margin: 0 0 var(--s-3);
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-12);
  line-height: 1.45;
  color: var(--ink-600);
  background: var(--blue-050);
  border: 1px solid var(--blue-100);
  border-radius: var(--r-md);
  text-align: left;
}
.area-colour-legend__low { color: hsl(140, 55%, 30%); font-weight: 600; }
.area-colour-legend__high { color: hsl(0, 55%, 40%); font-weight: 600; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-3); }
.picker--lube { grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); gap: var(--s-2); }
.pick {
  border: 1px solid var(--ink-200); border-radius: var(--r-md);
  padding: var(--s-2) var(--s-3) var(--s-3); display: grid; gap: var(--s-2); cursor: pointer;
  background: var(--white);
  box-shadow: var(--sh-1);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.pick:hover {
  border-color: var(--blue-500);
  box-shadow: var(--sh-2);
  transform: translateY(-2px);
}
.pick.is-on {
  border-color: var(--blue-600); background: var(--blue-050);
  box-shadow: inset 0 0 0 1px var(--blue-600), var(--sh-2), 0 0 0 3px rgba(59, 114, 232, .12);
}
.pick__top {
  display: flex; align-items: flex-start; gap: var(--s-2);
  font-weight: 600; font-size: var(--fs-12); line-height: 1.35;
}
.pick__top input[type="checkbox"] { margin-top: 0.2rem; flex-shrink: 0; }
.pick__top .chip { margin-left: auto; flex-shrink: 0; }
.pick__blend { font-size: var(--fs-12); color: var(--ink-700); }
.pick__blend b { font-family: var(--font-num); color: var(--blue-700); font-size: var(--fs-14); margin-left: var(--s-1); }
.pick__blend--lube {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: var(--s-2);
  row-gap: 0.1rem;
  align-items: baseline;
  padding: 0.4rem 0.55rem;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--ink-150, #e8eaed);
}
.pick.is-on .pick__blend--lube { background: rgba(255, 255, 255, 0.85); }
.pick__blend-label { font-size: var(--fs-11); font-weight: var(--fw-semibold); color: var(--ink-500); }
.pick__blend-val {
  font-family: var(--font-num);
  font-size: var(--fs-15, 0.9375rem);
  font-weight: 700;
  color: var(--blue-700);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.pick__blend-unit {
  grid-column: 1 / -1;
  font-size: var(--fs-10, 0.6875rem);
  color: var(--ink-400);
  line-height: 1.25;
}
.pick__rate-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 0.65rem;
  row-gap: 0.15rem;
  padding: 0.35rem 0 0.15rem;
  border-top: 1px solid var(--ink-100);
  font-size: var(--fs-11);
}
.pick__rate-name {
  color: var(--ink-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.pick__rate-val {
  font-family: var(--font-num);
  font-weight: 600;
  color: var(--ink-800);
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-left: 0.25rem;
}
.pick__ports-btn {
  justify-self: stretch;
  width: 100%;
  margin-top: 0.15rem;
  font-size: var(--fs-11);
  height: var(--field-h-sm);
}
.pick__rates { display: flex; gap: var(--s-3); font-size: var(--fs-11); color: var(--ink-500); }
.pick__rates--lube { flex-wrap: wrap; row-gap: var(--s-2); column-gap: var(--s-3); max-width: 100%; }
.pick__rates b { font-family: var(--font-num); color: var(--ink-700); }

/* ── Rule builder (admin, 3-pane) ─────────────────────────────────────── */
.rb { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; gap: var(--s-4); align-items: start; }
@media (max-width: 1400px) { .rb { grid-template-columns: 260px minmax(0, 1fr); } .rb__sim { grid-column: 1 / -1; } }
.rulelist { display: grid; gap: 1px; background: var(--ink-100); max-height: 62vh; overflow-y: auto; }
.ruleitem {
  background: var(--white); border: 0; border-left: 3px solid transparent; text-align: left;
  padding: var(--s-2) var(--s-3); display: grid; gap: 2px; width: 100%; cursor: pointer;
}
.ruleitem:hover { background: var(--ink-050); }
.ruleitem.is-on { background: var(--blue-050); border-left-color: var(--blue-600); }
.ruleitem__top { display: flex; align-items: center; gap: var(--s-2); }
.ruleitem__id { font-family: var(--font-num); font-size: var(--fs-12); font-weight: 700; color: var(--blue-700); }
.ruleitem__name { font-size: var(--fs-12); color: var(--ink-600); }

/* the sentence-shaped condition builder */
.sentence { display: grid; gap: var(--s-3); font-size: var(--fs-14); }
.sentence__row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.sentence__lead { color: var(--ink-500); min-width: 11rem; flex: 0 0 11rem; }
.sel {
  background: var(--cell-input);
  border-color: var(--cell-input-border);
  color: var(--navy-700);
  font-weight: var(--fw-semibold);
}
.sel--wide { min-width: 16rem; flex: 1 1 16rem; }
.sel--multi { min-width: 12rem; min-height: 4.5rem; vertical-align: middle; }
.sentence__row--values { align-items: flex-start; }
.sentence__row--values .spec,
.sentence__row--values .btn { margin-top: var(--s-2); }
.cond-pick {
  flex: 1 1 18rem; min-width: 14rem; max-width: 32rem;
  display: grid; gap: var(--s-1);
}
.cond-pick__search { width: 100%; font-size: var(--fs-13); }
.cond-pick__list { max-height: 11rem; }
.condblock {
  border: 1px solid var(--ink-200); border-radius: var(--r-md); padding: var(--s-3);
  display: grid; gap: var(--s-2); background: var(--ink-050);
}
.condblock__label { font-size: var(--fs-11); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-500); }
.condblock__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.cond-join { display: flex; justify-content: center; margin: var(--s-1) 0; }
.cond-join__pill {
  font-size: var(--fs-11); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--navy-700); background: var(--steel-100); border: 1px solid var(--ink-200);
  border-radius: var(--r-sm); padding: 2px var(--s-3);
}
.cond-join-row {
  display: flex; align-items: center; gap: var(--s-2); padding: var(--s-1) 0;
}
.cond-join-row__sel { width: 5.5rem; font-weight: 700; }
.cond-group-box {
  border: 1px dashed var(--ink-300); border-radius: var(--r-md); padding: var(--s-2) var(--s-3);
  background: var(--white); display: grid; gap: var(--s-2);
}
.cond-group-box--readonly { background: var(--ink-050); }
.cond-group-box__head {
  font-size: var(--fs-12); font-weight: 700; color: var(--navy-700);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1);
}
.cond-group-box__paren { font-family: var(--font-num); color: var(--ink-400); font-size: var(--fs-14); }
.cond-logic-preview {
  font-size: var(--fs-13); padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  background: var(--steel-50); border: 1px solid var(--ink-200); margin-bottom: var(--s-2);
}
.cond-path-stack { display: grid; gap: var(--s-2); }
.cond-path-card {
  border: 2px solid var(--navy-200); border-radius: var(--r-md); padding: var(--s-3);
  background: var(--white); display: grid; gap: var(--s-2);
}
.cond-path-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.cond-path-card__badge {
  font-size: var(--fs-11); font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--navy-800); background: var(--steel-100); padding: 2px var(--s-2); border-radius: var(--r-sm);
}
.cond-path-connector {
  display: flex; align-items: center; gap: var(--s-2); padding: var(--s-1) 0 var(--s-1) var(--s-2);
  border-left: 3px solid var(--steel-400);
}
.cond-path-connector__sel { width: 5.25rem; font-weight: 800; }
.cond-path-connector__label { font-size: var(--fs-12); color: var(--ink-500); }
.cond-path-add { flex-direction: column; align-items: flex-start; gap: var(--s-2); }
.cond-when-help { margin: 0 0 var(--s-2); max-width: 42rem; }
.spec {
  display: inline-flex; align-items: center; gap: var(--s-1);
  font-family: var(--font-num); font-size: var(--fs-12); font-weight: 700;
  padding: 1px var(--s-2); border-radius: var(--r-sm);
  background: var(--steel-100); color: var(--navy-700);
}

/* ── Simulator ────────────────────────────────────────────────────────── */
.simrow { display: grid; grid-template-columns: 1fr auto; gap: var(--s-2); align-items: center; font-size: var(--fs-13); padding: var(--s-2) 0; border-bottom: 1px solid var(--ink-100); }
.simverdict { padding: var(--s-3); border-radius: var(--r-md); font-size: var(--fs-13); font-weight: 600; }
.simverdict--fire { background: var(--ok-100); color: var(--ok-600); }
.simverdict--nofire { background: var(--ink-100); color: var(--ink-500); }
.simverdict--conflict { background: var(--danger-100); color: var(--danger-600); }

/* ── Home / dashboard ─────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 45%, var(--steel-600) 100%);
  color: var(--white); border-radius: var(--r-lg); padding: var(--s-6);
  display: grid; grid-template-columns: 1fr auto; gap: var(--s-6); align-items: center;
  box-shadow: var(--sh-3), 0 16px 40px rgba(14, 35, 55, .22);
  position: relative; overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(80% 120% at 100% 0%, rgba(255, 255, 255, .12) 0%, transparent 55%);
}
.hero > * { position: relative; z-index: 1; }
.hero h2 { color: var(--white); font-size: var(--fs-22); font-family: var(--font-display); }
.hero p { color: rgba(255, 255, 255, .8); font-size: var(--fs-13); max-width: 60ch; margin-top: var(--s-1); }
.hero .btn { border-color: transparent; }
.hero--home {
  grid-template-columns: 1fr minmax(12rem, auto);
  align-items: start;
}
.hero__eyebrow {
  margin: 0 0 var(--s-1);
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}
.hero__lead { max-width: 42ch; line-height: 1.5; }
.hero__aside {
  display: grid;
  gap: var(--s-4);
  justify-items: end;
  text-align: right;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(4.5rem, 1fr));
  gap: var(--s-2) var(--s-4);
  margin: 0;
}
.hero-stats dt {
  font-size: var(--fs-10);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .55);
}
.hero-stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-20);
  font-weight: 600;
  color: var(--white);
  line-height: 1.1;
}
.home-page { display: grid; gap: var(--s-5); }
.home-section__title {
  margin: 0 0 var(--s-3);
  font-family: var(--font-display);
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--ink-600);
}
.tiles--home { margin-top: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s-4); }
.tile {
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  padding: var(--s-4); display: grid; gap: var(--s-2); text-align: left;
  cursor: pointer; font-family: inherit;
  box-shadow: var(--sh-1);
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-3);
  border-color: var(--blue-200);
}
.tile:active { transform: translateY(-2px); }
.tile__icon {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: var(--blue-050); color: var(--blue-700);
  display: grid; place-items: center; font-weight: 700;
  box-shadow: 0 2px 6px rgba(59, 114, 232, .15);
}
.tile h4 { font-size: var(--fs-14); }
.tile p { font-size: var(--fs-12); color: var(--ink-500); }

/* ── Wizard footer ────────────────────────────────────────────────────── */
.wizfoot {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  position: sticky; bottom: var(--s-3);
  box-shadow: var(--sh-3), 0 -4px 20px rgba(16, 32, 52, .06);
  flex-wrap: wrap;
}
.wizfoot__spacer { flex: 1; }

/* ── Utility ──────────────────────────────────────────────────────────── */
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.row--tight { gap: var(--s-2); }
.stack { display: grid; gap: var(--s-3); }
.stack--sm { gap: var(--s-2); }
.right { margin-left: auto; }
.legend { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--fs-11); color: var(--ink-500); }
.legend span { display: inline-flex; align-items: center; gap: var(--s-1); }
.swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--ink-300); }
.sw-input { background: var(--cell-input); border-color: var(--cell-input-border); }
.sw-calc { background: var(--cell-calc); border-color: var(--cell-calc-border); }
.sw-sub { background: var(--cell-subtotal); border-color: var(--cell-subtotal-border); }
.sw-sect { background: var(--cell-section); }
.sw-off { background: var(--cell-officer); }
.sw-rat { background: var(--cell-rating); }

/* ── New budget · step 1, which register ───────────────────────────────── */
.srcpicks { display: grid; gap: var(--s-3); margin: var(--s-3) 0; }
.srcpick {
  display: grid; grid-template-columns: 40px 1fr auto; gap: var(--s-3);
  align-items: center; text-align: left; width: 100%;
  padding: var(--s-4); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  background: var(--white); cursor: pointer; font-family: inherit;
  box-shadow: var(--sh-1);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.srcpick:hover { border-color: var(--blue-600); box-shadow: var(--sh-3); transform: translateY(-2px); }
.srcpick__icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: var(--blue-050); color: var(--blue-700);
  display: grid; place-items: center; font-size: var(--fs-18);
  box-shadow: 0 2px 8px rgba(59, 114, 232, .18);
}
.srcpick__body { display: grid; gap: 2px; }
.srcpick__body b { font-size: var(--fs-14); color: var(--ink-900); }
.srcpick__go { color: var(--ink-400); font-size: var(--fs-18); }
.srcpick:hover .srcpick__go { color: var(--blue-600); }

/* ── Unresolved-elements popup ─────────────────────────────────────────── */
.unresolved-row {
  display: grid; gap: 2px; cursor: pointer; padding: var(--s-2);
  border: 1px solid var(--ink-200); border-radius: var(--r-md);
}
.unresolved-row:hover { background: var(--blue-050); }
.unresolved-row__head { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

/* ── New budget · step 2, the typeahead ───────────────────────────────── */
/* No max-height/overflow of its own — the modal body is the one scroller
   (see .modal__body), so suggestions get the full available height instead
   of being squeezed into their own small nested scrollbox. */
.vfind__list {
  margin-top: var(--s-2);
  border: 1px solid var(--ink-200); border-radius: var(--r-md); background: var(--white);
}
.vfind__item {
  display: grid; gap: 2px; width: 100%; text-align: left; cursor: pointer;
  padding: var(--s-2) var(--s-3); border: 0; border-bottom: 1px solid var(--ink-100);
  background: transparent; font-family: inherit;
}
.vfind__item:last-child { border-bottom: 0; }
.vfind__item:hover { background: var(--blue-050); }
.vfind__item.is-on { background: var(--ok-100); }
.vfind__name { display: flex; gap: var(--s-2); align-items: baseline; font-size: var(--fs-13); }
.vfind__meta { font-size: var(--fs-11); color: var(--ink-500); }

/* What the register supplied, shown so it can be checked before anything is
   created rather than absorbed into a header nobody re-reads. */
.vchosen {
  border: 1px solid var(--ok-600); border-radius: var(--r-md);
  background: var(--white); padding: var(--s-3); display: grid; gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.vchosen__head { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.vchosen__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: var(--s-3);
  font-size: var(--fs-12);
}
.vchosen__grid > div > div { font-weight: 600; color: var(--ink-900); }

/* A plain-text button that reads as a link — used where a table cell needs to
   be clickable without looking like a form control. */
.linklike {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--blue-700); text-align: left;
}
.linklike:hover { text-decoration: underline; }

/* A deactivated row: still legible, clearly not in play. Not `display:none` —
   the whole point of listing it is that it can be restored. */
.is-muted > td { opacity: .58; }
.is-muted b { font-weight: 600; }
.nowrap { white-space: nowrap; }

/* ── Role switcher ─────────────────────────────────────────────────────────
   The active role is shown at all times, not tucked into a profile menu: it
   decides what the rest of the interface will let you do, so hiding it would
   make every refusal look arbitrary. */
.roleswitch { position: relative; }
.roleswitch__btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 28px; padding: 0 var(--s-3);
  border: 1px solid var(--ink-300); border-radius: var(--r-pill);
  background: var(--white); color: var(--ink-700);
  font-size: var(--fs-12); font-family: inherit; cursor: pointer;
}
.roleswitch__btn:hover { border-color: var(--blue-500); color: var(--blue-700); }
.roleswitch__btn b { color: var(--ink-900); }
.roleswitch__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok-600); box-shadow: 0 0 0 3px var(--ok-100);
}
.roleswitch__caret { font-size: 9px; color: var(--ink-500); }

.roleswitch__menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  width: 320px; padding: var(--s-2);
  background: var(--white); border: 1px solid var(--ink-200);
  border-radius: var(--r-lg); box-shadow: var(--sh-3);
}
.roleswitch__head {
  font-size: var(--fs-11); text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-500); padding: var(--s-2) var(--s-2) var(--s-1);
}
.roleswitch__item {
  display: flex; align-items: flex-start; gap: var(--s-2); width: 100%;
  padding: var(--s-2); border: 0; border-radius: var(--r-md);
  background: transparent; text-align: left; cursor: pointer;
  font-family: inherit; font-size: var(--fs-12); color: var(--ink-700);
}
.roleswitch__item:hover { background: var(--blue-050); }
.roleswitch__item.is-on { background: var(--ok-100); }

/* ── PDF proposal — in-app preview, html2pdf export, and browser print.
   .print-proposal-root holds layout styles; #printProposal stays hidden until print. */
#printProposal { display: none; }

/* Shown briefly before window.print() so Print to PDF has laid-out content (Chrome/Edge). */
body.pdf-print-active #printProposal.pdf-print-slot--active {
  display: block !important;
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  background: #fff;
  overflow: auto;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  pointer-events: none;
}

.print-proposal-root .pp-page {
  width: 100%; min-height: auto; margin: 0 auto; padding: 10mm 8mm;
  box-sizing: border-box;
  page-break-after: always; font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 10pt; color: #1a1a2e;
}
.print-proposal-root .pp-page.pp-assumptions {
  min-height: auto;
  page-break-after: always;
  page-break-inside: auto;
}
.print-proposal-root .pp-assum-body { page-break-inside: auto; }
.print-proposal-root .pp-page:last-child { page-break-after: auto; }

.print-proposal-root table { width: 100%; border-collapse: collapse; }
.print-proposal-root .pp-tbl { font-size: 9.5pt; margin-bottom: 12pt; }
.print-proposal-root .pp-tbl th, .print-proposal-root .pp-tbl td { padding: 5pt 8pt; text-align: left; border-bottom: .5pt solid #e8ecf5; }
.print-proposal-root .pp-tbl thead th {
  background: #152d6e; color: #fff; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .03em;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.print-proposal-root .pp-tbl td.r, .print-proposal-root .pp-tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.print-proposal-root .pp-tbl--narrow { max-width: 280pt; }
.print-proposal-root .pp-2col { display: flex; gap: 18pt; align-items: flex-start; }
.print-proposal-root .pp-2col .pp-tbl { flex: 1; }

.print-proposal-root tr.pp-data td { background: #fff; }
.print-proposal-root tbody tr.pp-data:nth-child(even) td { background: #fafbff; }
.print-proposal-root .pp-ind { padding-left: 16pt; }
.print-proposal-root tr.pp-group td { background: #1e3a6e; color: #fff; font-weight: 700; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .05em;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-proposal-root tr.pp-sub td { background: #e8edf8; font-weight: 700; border-top: .75pt solid #c8d0e8;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-proposal-root tr.pp-total td { background: #152d6e; color: #fff; font-weight: 700; font-size: 10.5pt; border-top: 1.5pt solid #0d2258;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }

.print-proposal-root .pp-cover { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 20mm; }
.print-proposal-root .pp-cover-logo img {
  height: 42pt; width: auto; max-width: 200px; max-height: 56px; object-fit: contain; margin-bottom: 14pt;
}
.print-proposal-root .pp-cover-company { font-size: 15pt; font-weight: 700; color: #152d6e; letter-spacing: .02em; margin-bottom: 22pt; }
.print-proposal-root .pp-cover-divider { width: 50mm; height: 2.5pt; background: linear-gradient(90deg, #152d6e, #3a74d8); border-radius: 2pt; margin-bottom: 22pt; }
.print-proposal-root .pp-cover-title { font-size: 12.5pt; font-weight: 700; color: #152d6e; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5pt; }
.print-proposal-root .pp-cover-vessel { font-size: 12pt; font-weight: 600; color: #2b58b8; margin-bottom: 22pt; }
.print-proposal-root .pp-info-box { width: 100%; max-width: 340pt; margin-left: auto; margin-right: auto; border: 1.25pt solid #c8d0e8; border-radius: 5pt; overflow: hidden; }
.print-proposal-root .pp-info-box table { width: 100%; }
.print-proposal-root .pp-info-box thead th {
  background: #152d6e; color: #fff; font-size: 8pt; letter-spacing: .06em; text-transform: uppercase; padding: 6pt 10pt; text-align: left;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.print-proposal-root .pp-info-box tr:nth-child(odd) td { background: #f4f6fb; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-proposal-root .pp-lbl { color: #5a6a8a; font-weight: 600; width: 42%; white-space: nowrap; padding-right: 8pt; }
.print-proposal-root .pp-val { color: #1a1a2e; }
.print-proposal-root .pp-confidential { font-size: 8pt; color: #c05050; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; margin-top: 12pt; }
.print-proposal-root .pp-cover-foot { width: 100%; max-width: 340pt; margin-left: auto; margin-right: auto; display: flex; justify-content: space-between; font-size: 7.5pt; color: #8892a8; border-top: .5pt solid #d0d8ee; padding-top: 6pt; margin-top: 20pt; }

.print-proposal-root .pp-hdr { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2.5pt solid #152d6e; padding-bottom: 7pt; margin-bottom: 12pt; }
.print-proposal-root .pp-hdr-title { font-size: 13pt; font-weight: 700; color: #152d6e; }
.print-proposal-root .pp-hdr-sub { font-size: 8pt; color: #5a6a8a; margin-top: 2pt; }
.print-proposal-root .pp-hdr-right { text-align: right; }
.print-proposal-root .pp-hdr-vessel { font-weight: 600; font-size: 9.5pt; }
.print-proposal-root .pp-hdr-period { font-size: 7.5pt; color: #8892a8; margin-top: 2pt; }
.print-proposal-root .pp-pagefoot { font-size: 7.5pt; color: #8892a8; border-top: .5pt solid #dde3f0; padding-top: 6pt; margin-top: 14pt; }

.print-proposal-root .pp-vgrid { display: table; width: 100%; border-collapse: separate; border-spacing: 0;
  background: #f5f7fc; border: .75pt solid #dde2f0; border-radius: 5pt; margin-bottom: 12pt;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-proposal-root .pp-vgrid td { width: 25%; vertical-align: top; padding: 8pt 10pt; }
.print-proposal-root .pp-vgrid td.pp-vcell--pad { background: transparent; }
.print-proposal-root .pp-vcell { display: block; }

.print-proposal-root .pp-meta-table {
  width: 100%; border-collapse: collapse; margin-bottom: 12pt;
  border: .75pt solid #dde2f0; border-radius: 5pt; overflow: hidden;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.print-proposal-root .pp-meta-table td { padding: 6pt 10pt; vertical-align: top; border-bottom: .5pt solid #e8ecf5; }
.print-proposal-root .pp-meta-table tr:last-child td { border-bottom: none; }
.print-proposal-root .pp-meta-table tr:nth-child(odd) td { background: #f5f7fc; }
.print-proposal-root .pp-meta-lbl {
  width: 32%; color: #5a6a8a; font-weight: 600; font-size: 7.5pt;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; padding-right: 12pt;
}
.print-proposal-root .pp-meta-val { font-size: 9pt; color: #1a1a2e; line-height: 1.35; }
.print-proposal-root .pp-vlbl { color: #5a6a8a; font-weight: 600; font-size: 7pt; text-transform: uppercase; letter-spacing: .03em; }
.print-proposal-root .pp-vval { font-size: 9pt; }

.print-proposal-root .pp-notes { border: .75pt solid #c8d0e8; border-radius: 5pt; background: #f8f9fd; margin-top: 12pt; }
.print-proposal-root .pp-notes table td { padding: 5pt 10pt; border-bottom: .5pt solid #e4e8f4; vertical-align: top; }
.print-proposal-root .pp-notes table tr:last-child td { border-bottom: none; }
.print-proposal-root .pp-notes-lbl { font-weight: 700; color: #152d6e; width: 26%; white-space: nowrap; }
.print-proposal-root .pp-notes-excl { color: #c0392b; font-weight: 600; }

.print-proposal-root .pp-subtitle { font-size: 9.5pt; font-weight: 700; color: #1e3e90; margin: 12pt 0 6pt; padding-bottom: 3pt; border-bottom: .75pt solid #c8d0e8; }
.print-proposal-root .pp-footnote { font-size: 7.5pt; color: #8892a8; font-style: italic; margin-top: 6pt; }

/* Crewing line-detail page — clean client-facing list (no COA / section codes). */
.print-proposal-root .pp-page--crew-lines .pp-hdr { margin-bottom: 16pt; }
.print-proposal-root .pp-tbl--crew-lines { margin-top: 4pt; }
.print-proposal-root .pp-tbl--crew-lines thead th { padding: 7pt 10pt; font-size: 8pt; }
.print-proposal-root .pp-tbl--crew-lines tbody tr.pp-data td {
  padding: 7pt 10pt;
  vertical-align: top;
  line-height: 1.35;
}
.print-proposal-root .pp-tbl--crew-lines .pp-crew-desc {
  font-weight: 500;
  color: #1a1a2e;
  width: 62%;
}
.print-proposal-root .pp-tbl--crew-lines tbody tr.pp-data:nth-child(even) td { background: #f8faff; }
.print-proposal-root .pp-tbl--crew-lines tr.pp-total td { padding: 8pt 10pt; }

/* Technical account-wise page — description only, zero-value rows omitted. */
.print-proposal-root .pp-page--tech-accounts .pp-hdr { margin-bottom: 16pt; }
.print-proposal-root .pp-tbl--tech-accounts { margin-top: 4pt; }
.print-proposal-root .pp-tbl--tech-accounts thead th { padding: 7pt 10pt; font-size: 8pt; }
.print-proposal-root .pp-tbl--tech-accounts tbody tr.pp-data td {
  padding: 7pt 10pt;
  vertical-align: top;
  line-height: 1.35;
}
.print-proposal-root .pp-tbl--tech-accounts .pp-tech-desc {
  font-weight: 500;
  color: #1a1a2e;
  width: 62%;
}
.print-proposal-root .pp-tbl--tech-accounts tbody tr.pp-data:nth-child(even) td { background: #f8faff; }
.print-proposal-root .pp-tbl--tech-accounts tr.pp-total td { padding: 8pt 10pt; }

.print-proposal-root .pp-assumptions { font-size: 9pt; line-height: 1.45; }
.print-proposal-root .pp-assum-banner {
  border-bottom: 2pt solid #152d6e; margin-bottom: 12pt; padding-bottom: 8pt;
}
.print-proposal-root .pp-assum-banner-title { font-size: 12pt; font-weight: 700; color: #152d6e; }
.print-proposal-root .pp-assum-banner-sub { font-size: 10pt; font-weight: 600; }
.print-proposal-root .pp-assum-banner-period { font-size: 8pt; color: #5a6a8a; }
.print-proposal-root .pp-assum-head { font-weight: 700; margin: 10pt 0 6pt; text-transform: uppercase; }
.print-proposal-root .pp-assum-item { display: grid; grid-template-columns: 18pt 1fr; gap: 6pt; margin-bottom: 5pt; align-items: start; }
.print-proposal-root .pp-assum-crewrow, .print-proposal-root .pp-assum-tenure, .print-proposal-root .pp-assum-data {
  display: grid; grid-template-columns: 90pt 1fr; gap: 6pt; margin-bottom: 3pt; padding-left: 18pt; align-items: start;
}
.print-proposal-root .pp-assum-indent { padding-left: 18pt; margin: 4pt 0; }
.print-proposal-root .pp-assum-letter {
  display: grid; grid-template-columns: 14pt 1fr; gap: 6pt; margin-bottom: 4pt; align-items: start;
}
.print-proposal-root .pp-assum-letterlbl { font-weight: 700; }
.print-proposal-root .pp-assum-txt { line-height: 1.5; word-wrap: break-word; overflow-wrap: break-word; }
.print-proposal-root .pp-assum-txt--flow { min-width: 0; }
.print-proposal-root .pp-assum-closing { margin-top: 10pt; }
.print-proposal-root .pp-assum-body b,
.print-proposal-root .pp-assum-body b.pp-ed,
.print-proposal-root .pp-assum-body b.pp-fmt-b {
  font-weight: 700;
  text-decoration: none !important;
}
.print-proposal-root .pp-assum-body u,
.print-proposal-root .pp-assum-body u.pp-fmt-u,
.print-proposal-root .pp-assum-body b u {
  font-weight: 700;
  text-decoration: underline !important;
  text-underline-offset: 1px;
}
.print-proposal-root .pp-assum-body u .pp-ed-txt {
  font-weight: 700;
  cursor: text;
}
.print-proposal-root .pp-assum-body u .pp-fld {
  font-weight: 700;
  text-decoration: inherit;
  cursor: default;
}
.print-proposal-root .pp-assum-body i,
.print-proposal-root .pp-assum-body i.pp-ed { font-style: italic; }
.print-proposal-root .pp-fld { font-weight: 700; text-decoration: none; }
.print-proposal-root .pp-fld--crewline {
  background: none !important;
  padding: 0;
  border-radius: 0;
  color: inherit;
}
.print-proposal-root .pp-assum-crewval .pp-fld--crewline {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 1px;
}
.print-proposal-root .pp-assum-crewlbl { white-space: nowrap; }
.print-proposal-root .pp-fix { text-decoration: none; }
.print-proposal-root .pp-ed:not(u):not(i):not(.pp-red) { text-decoration: none; }
.print-proposal-root .pp-fix,
.print-proposal-root .pp-ed,
.print-proposal-root .pp-fmt-b,
.print-proposal-root .pp-fmt-b .pp-fix,
.print-proposal-root .pp-fmt-b .pp-st-range { font-weight: 700; text-decoration: none !important; }
.print-proposal-root .pp-fmt-u { text-decoration: underline; }
.print-proposal-root .pp-fmt-i { font-style: italic; text-decoration: none; }
.print-proposal-root .pp-red { color: #c0392b; text-decoration: none; }
/* <st>…</st> — only the span between markers is struck */
.print-proposal-root .pp-st-range {
  text-decoration: none !important;
  font-weight: inherit;
}
.print-proposal-root .pp-assum-body .pp-st-range--active {
  display: inline;
  font-weight: 700;
  text-decoration: line-through !important;
  text-decoration-thickness: 1px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.print-proposal-root .pp-st-range.pp-st--off {
  text-decoration: none !important;
  font-weight: inherit;
}
.print-proposal-root .pp-fld--excl { display: block; }
.print-proposal-root .pp-excl-seg {
  display: block;
  margin-bottom: 3pt;
  line-height: 1.45;
  white-space: normal;
}
.print-proposal-root .pp-excl-seg:last-child { margin-bottom: 0; }

.pdf-proposal-preview {
  max-height: min(70vh, 720px);
  overflow-x: auto;
  overflow-y: auto;
  margin-top: var(--s-3);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: var(--white);
  padding: var(--s-3);
}
.pdf-proposal-preview .pp-page {
  box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: var(--s-4);
}
.pdf-proposal-preview .pp-page--crew-lines .pp-tbl--crew-lines,
.pdf-proposal-preview .pp-page--tech-accounts .pp-tbl--tech-accounts {
  border: 1px solid #e4e8f4; border-radius: 6px; overflow: hidden;
}

/* Visible during html2pdf capture — off-screen clones render blank in Chrome/Edge. */
.pdf-export-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: #fff;
  overflow: auto;
  pointer-events: none;
}

.pdf-capture-host {
  display: block !important;
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 703px !important;
  max-width: 703px !important;
  margin: 0 auto !important;
  max-height: none !important;
  overflow: visible !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: none !important;
  background: #fff !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}
.pdf-capture-host--fallback .pp-page {
  padding: 0 !important;
}

/* Prevent left-edge clipping: page padding + shrink-to-fit grids/tables during capture. */
.pdf-capture-host .pp-page {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: auto !important;
  height: auto !important;
  padding: 10mm 8mm !important;
  overflow: visible !important;
}
.pdf-capture-host .pp-2col { max-width: 100%; gap: 12pt; }
.pdf-capture-host .pp-2col .pp-tbl { min-width: 0; flex: 1 1 0; }
.pdf-capture-host .pp-tbl { width: 100%; }
.pdf-capture-host .pp-meta-table tr:nth-child(odd) td { background: #f5f7fc; }
.pdf-capture-host .pp-info-box thead th,
.pdf-capture-host .pp-tbl thead th,
.pdf-capture-host tr.pp-group td,
.pdf-capture-host tr.pp-sub td,
.pdf-capture-host tr.pp-total td,
.pdf-capture-host .pp-vgrid {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.pdf-capture-host .pp-cover-logo img {
  height: 42pt !important;
  width: auto !important;
  max-width: 200px !important;
  max-height: 56px !important;
  object-fit: contain !important;
}
.pdf-capture-host .pp-assum-item {
  grid-template-columns: 22pt minmax(0, 1fr);
}
.pdf-capture-host .pp-assum-crewrow,
.pdf-capture-host .pp-assum-tenure,
.pdf-capture-host .pp-assum-data {
  grid-template-columns: minmax(64pt, 90pt) minmax(0, 1fr);
  min-width: 0;
}
.pdf-capture-host .pp-assum-letter {
  grid-template-columns: 18pt minmax(0, 1fr);
}
.pdf-capture-host .pp-assum-crewlbl,
.pdf-capture-host .pp-assum-tenlbl,
.pdf-capture-host .pp-assum-datalbl {
  min-width: 0;
  white-space: nowrap;
}
.pdf-capture-host .pp-fld--crewline {
  background: none !important;
  padding: 0;
  display: inline;
  white-space: nowrap;
}
.pdf-capture-host .pp-assum-crewval {
  min-width: 0;
  white-space: nowrap;
}
/* S4.3 — projections: separate % grid and USD grid */
.proj-horizon-picks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--section-control-h);
}
.proj-fill-inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.proj-foot {
  margin: var(--s-2) var(--s-4) var(--s-3);
  line-height: 1.45;
}
.table--projection-rates col.col-pct { width: 5.25rem; }
.table--projection-rates .th-pct { font-size: var(--fs-12); }
.table--projection-rates .td-pct .cellinput { margin-left: auto; }
.table--projection-amounts {
  --budget-edit-money-w: 6.75rem;
}

.pdf-capture-host .pp-page--projections .pp-tbl { font-size: 8.5pt; }
.pdf-capture-host .pp-page--projections .pp-tbl th,
.pdf-capture-host .pp-page--projections .pp-tbl td { padding: 4pt 5pt; }

@media print {
  @page { size: A4; margin: 12mm; }

  body.print-proposal-export,
  body.print-proposal-root.print-proposal-export {
    margin: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.print-proposal-export .print-proposal-root,
  body.print-proposal-export .pp-page {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  body.print-proposal-export .pp-page {
    min-height: auto !important;
    padding: 0;
    page-break-after: always;
  }
  body.print-proposal-export .pp-page:last-child {
    page-break-after: auto;
  }

  body.print-proposal-export .pp-page.pp-cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 15mm;
  }
  body.print-proposal-export .pp-info-box,
  body.print-proposal-export .pp-cover-foot {
    margin-left: auto;
    margin-right: auto;
  }

  body.print-proposal-export .pp-tbl {
    width: 100%;
    table-layout: auto;
  }
  body.print-proposal-export .pp-tbl th.r,
  body.print-proposal-export .pp-tbl td.r {
    white-space: nowrap;
    text-align: right;
  }
  body.print-proposal-export .pp-tbl--lube-breakdown {
    table-layout: fixed;
  }
  body.print-proposal-export .pp-tbl--lube-breakdown th:nth-child(1),
  body.print-proposal-export .pp-tbl--lube-breakdown td:nth-child(1) { width: 11%; }
  body.print-proposal-export .pp-tbl--lube-breakdown th:nth-child(2),
  body.print-proposal-export .pp-tbl--lube-breakdown td:nth-child(2) {
    width: 36%;
    word-break: normal;
    overflow-wrap: normal;
  }
  body.print-proposal-export .pp-tbl--lube-breakdown th:nth-child(3),
  body.print-proposal-export .pp-tbl--lube-breakdown td:nth-child(3) { width: 10%; }
  body.print-proposal-export .pp-tbl--lube-breakdown th:nth-child(4),
  body.print-proposal-export .pp-tbl--lube-breakdown td:nth-child(4) { width: 21%; }
  body.print-proposal-export .pp-tbl--lube-breakdown th:nth-child(5),
  body.print-proposal-export .pp-tbl--lube-breakdown td:nth-child(5) { width: 22%; }

  body.print-proposal-export .pp-tbl--4money {
    table-layout: fixed;
  }
  body.print-proposal-export .pp-tbl--4money th:nth-child(1),
  body.print-proposal-export .pp-tbl--4money td:nth-child(1) { width: 46%; }
  body.print-proposal-export .pp-tbl--4money th.r,
  body.print-proposal-export .pp-tbl--4money td.r { width: 18%; }

  body.print-proposal-export .pp-notes {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  body.print-proposal-export .pp-notes table { table-layout: fixed; width: 100%; }
  body.print-proposal-export .pp-notes-lbl { width: 22%; vertical-align: top; }

  /* In-app browser print (#printProposal) — not server PDF export (body.print-proposal-export). */
  body:not(.print-proposal-export) > *:not(#printProposal) { display: none !important; }
  body:not(.print-proposal-export) #printProposal,
  body.pdf-print-active #printProposal {
    display: block !important;
    position: static !important;
    inset: auto !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }
  body.pdf-print-active #printProposal .pp-page {
    min-height: auto !important;
    padding: 0;
    page-break-after: always;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  body.pdf-print-active #printProposal .pp-page:last-child {
    page-break-after: auto;
  }
  body.pdf-print-active #printProposal .pp-page.pp-cover {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 15mm;
  }
  body.pdf-print-active #printProposal .pp-tbl {
    width: 100%;
    table-layout: auto;
  }
  body.pdf-print-active #printProposal .pp-tbl th.r,
  body.pdf-print-active #printProposal .pp-tbl td.r {
    white-space: nowrap;
    text-align: right;
  }
  body.pdf-print-active #printProposal .pp-notes {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  body.print-proposal-standalone #printProposal .pp-page {
    min-height: auto !important;
    padding: 0;
    page-break-after: always;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  body.print-proposal-standalone #printProposal .pp-page:last-child {
    page-break-after: auto;
  }
  body.print-proposal-standalone #printProposal .pp-page.pp-cover {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 15mm;
  }
  body.print-proposal-standalone {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body.print-proposal-export > .pp-page { display: block !important; visibility: visible !important; }
  body.print-proposal-export .pp-page.pp-cover { display: flex !important; }
  body:not(.print-proposal-export) .print-proposal-root .pp-page:not(.pp-assumptions) { min-height: 265mm; }
}
.roleswitch__item b { display: block; color: var(--ink-900); }
.roleswitch__check { width: 14px; color: var(--ok-600); font-weight: 700; }
.roleswitch__desc { display: block; font-size: var(--fs-11); color: var(--ink-500); }
.roleswitch__foot {
  border-top: 1px solid var(--ink-100); margin-top: var(--s-2);
  padding: var(--s-2); font-size: var(--fs-11); color: var(--ink-500);
}

/* ── Notification bell ────────────────────────────────────────────────── */
.bell { position: relative; }
.bell__badge {
  position: absolute; top: -3px; right: -3px; min-width: 15px; height: 15px;
  padding: 0 3px; border-radius: var(--r-pill);
  background: var(--danger-600); color: var(--white);
  font-size: 9px; font-weight: 700; line-height: 15px; text-align: center;
}

/* ── Notification list (drawer) ───────────────────────────────────────── */
.notif {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3); border-bottom: 1px solid var(--ink-100);
}
.notif:last-child { border-bottom: 0; }
.notif--unread { background: var(--blue-050); }
.notif__icon {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: var(--r-md);
  background: var(--white); border: 1px solid var(--ink-200);
  display: grid; place-items: center; font-size: var(--fs-12);
}
.notif__body { flex: 1; display: grid; gap: 2px; }
.notif__act { display: grid; gap: var(--s-1); }

/* ── Prototype-only banner ────────────────────────────────────────────── */
.protobar {
  background: var(--navy-900); color: rgba(255, 255, 255, .82);
  font-size: var(--fs-11); padding: var(--s-1) var(--s-4);
  display: flex; gap: var(--s-3); align-items: center; letter-spacing: .02em;
}
.protobar b { color: var(--white); }
.protobar a { color: var(--blue-500); }
.protobar select {
  height: 22px; border-radius: var(--r-sm); border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08); color: var(--white); font-size: var(--fs-11);
}

/* ── Ask Assistant drawer ────────────────────────────────────────────────── */
.asst-log { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.asst-hint { color: var(--ink-500); font-size: 13px; }
.asst-hint ul { margin: 6px 0 0; padding-left: 18px; }
.asst-hint li { margin: 3px 0; }
.asst-msg {
  max-width: 92%; padding: 8px 11px; border-radius: 12px; font-size: 14px;
  line-height: 1.5; white-space: pre-wrap; word-wrap: break-word;
}
.asst-msg--user { align-self: flex-end; background: var(--steel-100); color: var(--ink-900); border-bottom-right-radius: 4px; }
.asst-msg--bot  { align-self: flex-start; background: var(--ink-100); color: var(--ink-900); border-bottom-left-radius: 4px; }
.asst-msg--error { align-self: flex-start; background: var(--danger-100); color: var(--danger-600); }
.asst-status { color: var(--ink-500); font-style: italic; }
.asst-foot { display: flex; gap: 8px; align-items: flex-end; width: 100%; }
.asst-input {
  flex: 1; resize: none; font: inherit; font-family: var(--font-ui); font-size: 14px;
  padding: 8px 10px; border: 1px solid var(--ink-300); border-radius: 8px; color: var(--ink-900);
}
.asst-input:focus { outline: 2px solid var(--blue-600); outline-offset: 0; border-color: transparent; }
.asst-input:disabled { background: var(--ink-050); color: var(--ink-400); }

/* ── Configure approval workflow modal ─────────────────────────────────── */
.wf-subtitle { margin: 0 0 var(--s-3); text-align: center; font-weight: 600; }
/* Horizontal scroll lives here — not on the whole modal body. */
.wf-rail-wrap {
  margin: var(--s-3) 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.wf-rail {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: min-content;
  padding: var(--s-4) var(--s-3);
  background: var(--ink-050);
  border-radius: var(--r-md);
  border: 1px solid var(--ink-200);
}
.wf-rail__node {
  flex: 0 0 96px;
  width: 96px;
  text-align: center;
  padding: var(--s-3) var(--s-2);
  border-radius: var(--r-md);
  background: var(--white);
  border: 1px solid var(--ink-200);
  display: grid;
  gap: 4px;
  align-content: center;
  font-size: var(--fs-13);
  line-height: 1.25;
  box-shadow: var(--sh-1);
}
.wf-rail__node b { font-size: var(--fs-14); }
.wf-rail__node.is-on { border-color: var(--blue-600); background: var(--blue-050); box-shadow: inset 0 0 0 1px var(--blue-600); }
.wf-rail__add {
  cursor: pointer; font: inherit; color: var(--blue-700); border-style: dashed;
  background: var(--white); min-width: 112px; width: 112px; flex-basis: 112px;
}
.wf-rail__add:hover { background: var(--blue-050); border-color: var(--blue-600); }
.wf-rail__done {
  color: var(--ok-700); border-color: var(--ok-600); background: var(--ok-100);
  flex-basis: 88px; width: 88px;
}
.wf-rail__connector {
  flex: 0 0 36px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.wf-rail__connector::before {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 2px;
  background: var(--ink-300);
  transform: translateY(-50%);
}
.wf-rail__connector::after {
  content: '›';
  position: relative;
  z-index: 1;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-500);
  background: var(--ink-050);
  padding: 0 2px;
}
.wf-levels { display: grid; gap: var(--s-3); margin-top: var(--s-3); }
.wf-level {
  border: 1px solid var(--ink-200); border-radius: var(--r-md); padding: var(--s-3) var(--s-4);
  background: var(--white);
}
.wf-level__head {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
}
.wf-level__badge {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy-900); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.wf-level__title { flex: 1 1 120px; display: grid; gap: 2px; }
.wf-level__hint { margin: var(--s-2) 0 0; }
.wf-mode {
  display: inline-flex; border: 1px solid var(--ink-200); border-radius: var(--r-md); overflow: hidden;
}
.wf-mode__btn {
  border: 0; background: transparent; font: inherit; font-size: var(--fs-12);
  padding: var(--s-1) var(--s-3); cursor: pointer; color: var(--ink-600);
}
.wf-mode__btn.is-on { background: var(--navy-900); color: var(--white); }
.wf-scope { margin-top: var(--s-3); }
.wf-scope__title { font-size: var(--fs-12); font-weight: 600; margin-bottom: var(--s-2); }
.wf-scope__grid { display: grid; gap: var(--s-2); }
.wf-scope__item {
  display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-13);
}
.wf-pdf {
  display: flex; align-items: flex-start; gap: var(--s-2); margin-top: var(--s-3);
  font-size: var(--fs-13);
}
.wf-add-level {
  display: block; width: 100%; margin: var(--s-3) 0; padding: var(--s-4);
  border: 2px dashed var(--ink-300); border-radius: var(--r-md); background: transparent;
  font: inherit; font-size: var(--fs-13); color: var(--blue-700); cursor: pointer;
}
.wf-add-level:hover { background: var(--blue-050); border-color: var(--blue-600); }

/* Pictorial approval path (submit modal) */
.wf-diagram-wrap {
  margin: var(--s-3) 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--s-2) 0;
}
.wf-diagram {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: min-content;
  padding: var(--s-4);
  background: linear-gradient(180deg, var(--blue-050) 0%, var(--ink-050) 100%);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
}
.wf-diagram__milestone {
  flex: 0 0 auto;
  width: 104px;
  padding: var(--s-3) var(--s-2);
  border-radius: var(--r-md);
  border: 1px solid var(--ink-200);
  background: var(--white);
  display: grid;
  gap: 4px;
  text-align: center;
  align-content: center;
  box-shadow: var(--sh-1);
}
.wf-diagram__milestone-title {
  font-size: var(--fs-13);
  font-weight: 700;
  color: var(--navy-900);
  line-height: 1.25;
}
.wf-diagram__milestone-sub {
  font-size: var(--fs-11);
  color: var(--ink-500);
  line-height: 1.3;
}
.wf-diagram__milestone--start.is-complete {
  border-color: var(--blue-500);
  background: var(--blue-050);
}
.wf-diagram__milestone--end.is-upcoming {
  border: 1px dashed var(--ink-350, #c4c9d0);
  background: var(--white);
  box-shadow: none;
  color: var(--ink-600);
}
.wf-diagram__milestone--end.is-upcoming .wf-diagram__milestone-title {
  color: var(--ink-700);
  font-weight: 600;
}
.wf-diagram__milestone--end.is-complete {
  border-color: var(--ok-600);
  background: var(--ok-100);
}
.wf-diagram__milestone--end.is-complete .wf-diagram__milestone-title {
  color: var(--ok-800, #1a6b3c);
}
.wf-diagram__milestone--end.is-rejected {
  border-color: var(--danger-600, #c53030);
  background: var(--danger-100, #fde8e8);
}
.wf-diagram__milestone--add {
  cursor: pointer;
  font: inherit;
  border: 1px dashed var(--blue-400);
  background: var(--white);
  color: var(--blue-700);
  box-shadow: none;
}
.wf-diagram__milestone--add:hover {
  background: var(--blue-050);
  border-color: var(--blue-600);
}
.wf-diagram__milestone--add .wf-diagram__milestone-title {
  color: var(--blue-700);
}
.wf-diagram__edge {
  flex: 0 0 28px;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-400);
  font-size: 20px;
  height: 48px;
}
.wf-diagram__edge span {
  display: block;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--ink-300), var(--blue-400));
  position: relative;
}
.wf-diagram__edge span::after {
  content: '›';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-58%);
  font-size: 18px;
  color: var(--blue-600);
  background: var(--ink-050);
  padding: 0 2px;
}
.wf-diagram__node {
  flex: 0 0 auto;
  text-align: center;
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: var(--s-2);
}
.wf-diagram__node--start .wf-diagram__avatar--you { background: var(--navy-900); }
.wf-diagram__node--end .wf-diagram__avatar { background: var(--ok-600); color: var(--white); }
.wf-diagram__node--add {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--blue-700);
}
.wf-diagram__node--add .wf-diagram__avatar {
  border: 2px dashed var(--blue-400);
  background: var(--white);
  color: var(--blue-700);
}
.wf-diagram__node--add:hover .wf-diagram__avatar {
  background: var(--blue-050);
  border-color: var(--blue-600);
}
.wf-diagram__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--fs-13);
  background: var(--ink-200);
  color: var(--ink-800);
  box-shadow: var(--sh-1);
}
.wf-diagram__stage {
  flex: 0 0 auto;
  min-width: 120px;
  max-width: 200px;
  padding: var(--s-3);
  border-radius: var(--r-md);
  border: 1px solid var(--ink-200);
  background: var(--white);
  box-shadow: var(--sh-1);
  display: grid;
  gap: var(--s-2);
}
.wf-diagram__stage.is-filled { border-color: var(--blue-400); }
.wf-diagram__stage.is-parallel { border-left: 4px solid var(--warn-600); }
.wf-diagram__stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-2);
}
.wf-diagram__level {
  font-weight: 700;
  font-size: var(--fs-14);
  color: var(--navy-900);
}
.wf-diagram__mode {
  font-size: var(--fs-11);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  background: var(--ink-050);
  padding: 2px 6px;
  border-radius: 4px;
}
.wf-diagram__fork {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  justify-content: center;
}
.wf-diagram__stage.is-parallel .wf-diagram__fork {
  padding: var(--s-2);
  background: var(--warn-100);
  border-radius: var(--r-sm);
  border: 1px dashed var(--warn-600);
}
.wf-diagram__person {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
}
.wf-diagram__person .wf-diagram__avatar {
  width: 36px;
  height: 36px;
  font-size: var(--fs-12);
  background: var(--blue-600);
  color: var(--white);
}
.wf-diagram__person--empty .wf-diagram__avatar {
  background: var(--ink-150);
  color: var(--ink-500);
}
.wf-diagram__person-name {
  font-size: var(--fs-11);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-diagram__scope { text-align: center; line-height: 1.3; }
.wf-approver-list { display: grid; gap: var(--s-3); margin-top: var(--s-3); }
.wf-approver-card {
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  padding: var(--s-3);
  background: var(--ink-050);
}
.wf-level--parallel .wf-approver-card {
  border-left: 3px solid var(--warn-600);
}
.wf-approver-card__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.wf-approver-card__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue-600);
  color: var(--white);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wf-approver-card__who { flex: 1; display: grid; gap: 2px; min-width: 0; }
.wf-approver-card--compact { background: var(--blue-050); border-color: var(--blue-200); }
.wf-approver-card--compact .wf-approver-card__head { margin-bottom: 0; }

/* Live workflow diagram (S4.4 panel) */
.wf-diagram-wrap--live { margin-bottom: var(--s-4); }
.wf-diagram--live { align-items: stretch; }
.wf-diagram__stage--live.is-current {
  box-shadow: 0 0 0 2px var(--blue-600), var(--sh-1);
  border-color: var(--blue-600);
}
.wf-diagram__stage--live.is-done:not(.is-current) {
  border-color: var(--ok-600);
  background: var(--ok-100);
}
.wf-diagram__stage--live.is-rejected {
  border-color: var(--danger-600);
  background: var(--danger-100, #fde8e8);
}
.wf-diagram__stage-label {
  text-align: center;
  margin: calc(-1 * var(--s-1)) 0 0;
}
.wf-diagram__person--live .wf-diagram__avatar {
  box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--ink-300);
}
.wf-diagram__person--live.is-status-pending .wf-diagram__avatar {
  box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--warn-600);
}
.wf-diagram__person--live.is-status-approved .wf-diagram__avatar {
  background: var(--ok-600);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--ok-700);
}
.wf-diagram__person--live.is-status-rejected .wf-diagram__avatar {
  background: var(--danger-600, #c53030);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 3px var(--danger-700, #9b2c2c);
}
.wf-diagram__person--live.is-status-skipped .wf-diagram__avatar {
  background: var(--ink-400);
  opacity: 0.85;
}
.wf-diagram__node--start.is-done .wf-diagram__avatar--you { background: var(--ok-600); }
.wf-diagram__node--end.is-done .wf-diagram__avatar { background: var(--ok-600); }
.wf-diagram__node--end.is-rejected .wf-diagram__avatar { background: var(--danger-600, #c53030); }
.wf-diagram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  justify-content: center;
  margin: var(--s-3) 0 0;
}
.wf-diagram-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wf-diagram-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-300);
}
.wf-diagram-legend__dot.is-current { background: var(--blue-600); }
.wf-diagram-legend__dot.is-pending { background: var(--warn-600); }
.wf-diagram-legend__dot.is-approved { background: var(--ok-600); }
.wf-details { margin-top: var(--s-2); }
.wf-details__title {
  font-size: var(--fs-12);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  margin: 0 0 var(--s-2);
  padding: 0 var(--s-1);
}

/* ── PDF assumptions preview (modal) ───────────────────────────────────── */
.modal__head--assumptions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}
.modal__head--assumptions h3 { margin: 0; flex: 1 1 auto; min-width: 0; }
.pp-assum-autosave {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-12);
  color: var(--ink-500);
  font-style: italic;
}
.pp-assum-autosave--saved {
  color: var(--ok-600);
  font-style: normal;
}
.pp-assum-autosave--error {
  color: var(--danger-600);
  font-style: normal;
  max-width: min(240px, 40vw);
  text-align: right;
}
.pp-assum-autosave-spin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--ink-200);
  border-top-color: var(--blue-600);
  animation: bbt-spin .75s linear infinite;
  flex-shrink: 0;
}
.pp-assumptions-preview {
  max-height: min(58vh, 640px);
  overflow-x: auto;
  overflow-y: auto;
  margin-top: var(--s-3);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  background: var(--white);
}
.pp-assumptions-preview .pp-page { box-shadow: none; padding: var(--s-4); }
.pp-assumptions-preview .pp-assum-body { font-size: var(--fs-13); line-height: 1.55; }
.pp-assumptions-preview .pp-assum-body--editable[contenteditable="true"] {
  cursor: text;
  min-height: 14rem;
  padding: var(--s-2);
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px var(--ink-200);
}
.pp-assumptions-preview--readonly .pp-assum-body { box-shadow: none; }
.pp-assumptions-preview .pp-assum-body b,
.pp-assumptions-preview b.pp-ed,
.pp-assumptions-preview b.pp-fmt-b {
  font-weight: 700;
  text-decoration: none !important;
}
.pp-assumptions-preview .pp-assum-body u,
.pp-assumptions-preview u.pp-fmt-u,
.pp-assumptions-preview b u {
  font-weight: 700;
  text-decoration: underline !important;
  text-underline-offset: 1px;
}
.pp-assumptions-preview u .pp-ed-txt {
  font-weight: 700;
  cursor: text;
  background: var(--blue-050);
  border-radius: 2px;
  padding: 0 2px;
  box-shadow: inset 0 0 0 1px var(--blue-200);
}
.pp-assumptions-preview u .pp-ed-txt:focus {
  background: var(--blue-100);
  box-shadow: inset 0 0 0 1px var(--blue-400);
  outline: none;
}
.pp-assumptions-preview u .pp-ed-txt:hover {
  background: var(--blue-100);
}
.pp-assumptions-preview u .pp-fld {
  font-weight: 700;
  cursor: default;
}
.pp-assum-legend { line-height: 1.6; }
.pp-ed-txt--demo {
  display: inline;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 1px;
  background: var(--blue-050);
  border-radius: 2px;
  padding: 0 4px;
  box-shadow: inset 0 0 0 1px var(--blue-200);
}
.pp-fld--demo {
  display: inline;
  padding: 1px 6px;
  background: var(--ink-100);
  border-radius: 2px;
  color: var(--navy-900);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 1px;
}
.pp-assumptions-preview .pp-assum-body i,
.pp-assumptions-preview i.pp-fmt-i { font-style: italic; }
.pp-fld {
  display: inline; padding: 1px 4px; background: var(--ink-100); border-radius: 2px;
  color: var(--navy-900); font-weight: 600;
}
.pp-fld[contenteditable="true"]:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--blue-500);
  background: var(--blue-050);
}
.pp-fld--manual {
  box-shadow: inset 0 0 0 1px var(--warn-600, #f57c00);
  background: var(--warn-50, #fff8e1);
}
.pp-fix { display: inline; text-decoration: none; }
.pp-ed { display: inline; outline: none; min-width: 2px; text-decoration: none; }
.pp-ed:focus { background: var(--blue-050); box-shadow: inset 0 0 0 1px var(--blue-400); }
.pp-assumptions-preview u.pp-ed:focus,
.pp-assumptions-preview i.pp-ed:focus,
.pp-assumptions-preview span.pp-red.pp-ed:focus {
  text-decoration: underline;
}
.pp-assumptions-preview i.pp-ed:focus { text-decoration: none; font-style: italic; }
.pp-fix,
.pp-ed,
.pp-fmt-b,
.pp-fmt-b .pp-fix,
.pp-fmt-b .pp-st-range { font-weight: 700; text-decoration: none !important; }
.pp-fmt-u { text-decoration: underline; }
.pp-fmt-i { font-style: italic; text-decoration: none; }
.pp-red { color: #c0392b; text-decoration: none; }
.pp-st-range { text-decoration: none !important; cursor: pointer; }
.pp-assumptions-preview .pp-st-range--active,
.pp-st-range--active {
  display: inline;
  font-weight: 700;
  text-decoration: line-through !important;
  text-decoration-thickness: 1px;
}
.pp-st-range.pp-st--off {
  text-decoration: none !important;
  font-weight: inherit;
  cursor: pointer;
}
.pp-st--demo {
  display: inline;
  font-weight: 700;
  text-decoration: line-through;
}
.pp-fld--excl { display: block; }
.pp-excl-seg {
  display: block;
  margin-bottom: var(--s-1);
  line-height: 1.45;
  white-space: normal;
}
.pp-excl-seg:last-child { margin-bottom: 0; }
.pp-assum-txt { line-height: 1.55; word-wrap: break-word; overflow-wrap: break-word; }
.pp-assum-txt--flow { min-width: 0; }
.pp-assum-head { font-weight: 700; margin: var(--s-3) 0 var(--s-2); text-transform: uppercase; }
.pp-assum-item { display: grid; grid-template-columns: 28px 1fr; gap: var(--s-2); margin-bottom: var(--s-2); }
.pp-assum-num { font-weight: 700; color: var(--navy-900); }
.pp-assum-crewrow, .pp-assum-tenure, .pp-assum-data {
  display: grid; grid-template-columns: 120px 1fr; gap: var(--s-2); margin-bottom: var(--s-1);
  padding-left: 28px;
  align-items: baseline;
}
.pp-assum-crewlbl { font-weight: 600; white-space: nowrap; }
.pp-fld--crewline {
  background: none;
  padding: 0;
  font-weight: 700;
}
.pp-assumptions-preview .pp-assum-crewval .pp-fld--crewline {
  text-decoration: underline;
  text-underline-offset: 1px;
}
.pp-assum-indent { padding-left: 28px; margin: var(--s-2) 0; }
.pp-assum-letter { display: grid; grid-template-columns: 22px 1fr; gap: var(--s-2); margin-bottom: var(--s-2); align-items: start; }
.pp-assum-letterlbl { font-weight: 700; }
.pp-assum-closing { margin-top: var(--s-4); font-weight: 600; }
.pp-assum-intro, .pp-assum-para { margin-bottom: var(--s-3); }

/* ── Visual polish · depth, motion, focus ─────────────────────────────── */
.topbar__history-btn {
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease);
}
.topbar__history-btn:hover {
  background: var(--ink-050);
  transform: scale(1.05);
  box-shadow: var(--sh-1);
}

.subnav__item {
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.subnav__item:hover {
  background: var(--ink-050);
  transform: translateX(2px);
  box-shadow: -2px 0 0 var(--blue-600);
}

.console-tabs {
  box-shadow: var(--sh-2);
}
.console-tab {
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.ruleitem {
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.ruleitem:hover { box-shadow: inset 0 0 0 1px var(--ink-200); }
.ruleitem.is-on { box-shadow: inset 0 0 0 1px var(--blue-200); }

.vfind__item {
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.vfind__item:hover { transform: translateX(2px); }

.roleswitch__btn {
  box-shadow: var(--sh-1);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}
.roleswitch__btn:hover {
  box-shadow: var(--sh-2);
  transform: translateY(-1px);
}

.roleswitch__menu {
  box-shadow: var(--sh-4);
  animation: menu-pop var(--dur) var(--ease-out) both;
}
@keyframes menu-pop {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.nav-ctx {
  box-shadow: var(--sh-4);
  animation: menu-pop var(--dur) var(--ease-out) both;
}

.bell .btn,
.bell .rail__btn {
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease);
}
.bell .btn:hover { transform: scale(1.05); }

.notif {
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.notif:hover { box-shadow: inset 0 0 0 1px var(--ink-200); }

.el-showcase {
  box-shadow: var(--sh-2);
}
.el-stat {
  box-shadow: var(--sh-1);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.el-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-2);
}

.editor-tab {
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.editor-tab.is-on {
  box-shadow: var(--sh-2);
  transform: translateY(-1px);
}

.tracepass {
  box-shadow: var(--sh-1);
  transition: box-shadow var(--dur-fast) var(--ease);
}
.tracepass:hover { box-shadow: var(--sh-2); }

.condblock {
  box-shadow: var(--sh-1);
}

.switchgroup {
  box-shadow: var(--sh-1);
  transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.switchgroup:hover { box-shadow: var(--sh-2); }

.pdf-proposal-preview,
.pp-assumptions-preview {
  box-shadow: var(--sh-2);
}

#toast {
  position: fixed;
  bottom: var(--s-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  max-width: min(720px, 92vw);
  box-shadow: var(--sh-4);
  border-radius: var(--r-lg);
  animation: toast-in var(--dur) var(--ease-out) both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#loading.is-active { display: flex; }
#loading .spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid var(--ink-100);
  border-top-color: var(--blue-600);
  animation: bbt-spin .8s linear infinite;
  box-shadow: var(--sh-3);
}
@keyframes bbt-spin { to { transform: rotate(360deg); } }

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .tile:hover,
  .stat:hover,
  .pick:hover,
  .srcpick:hover,
  .btn--primary:hover,
  .btn--assist:hover,
  .ce-row:hover,
  .roleswitch__btn:hover,
  .rail__btn:hover,
  .why:hover,
  .el-stat:hover,
  .editor-tab.is-on {
    transform: none;
  }
  .nav-ctx,
  .roleswitch__menu,
  #toast {
    animation: none;
  }
  .modal__panel {
    transform: none;
  }
}

/* ── Responsive · laptop / compact viewports ──────────────────────────── */
@media (max-width: 1400px) {
  :root {
    --stepnav-w: 200px;
    --content-max: 100%;
  }
  .content { padding: var(--s-4) var(--s-5) var(--s-10); }
  .pagehead__sub { max-width: none; }
}

@media (max-width: 1320px) {
  :root { --stepnav-w: 184px; }
  .topbar__brand-sub { display: none; }
  .topbar__user-meta span { display: none; }
  .pagehead {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }
  .pagehead__aside { justify-items: start; }
  .console-tab { padding: var(--s-2) var(--s-3); }
  .toolbar { gap: var(--s-2); }
}

@media (max-width: 1200px) {
  :root {
    --stepnav-w: 168px;
    --topbar-h: 48px;
  }
  .stepnav__item { font-size: var(--fs-12); padding: var(--s-2) var(--s-3); }
  .stepnav__group {
    padding: var(--s-3) var(--s-3) var(--s-1);
    font-size: 10px;
    letter-spacing: .08em;
  }
  .body--subnav { grid-template-columns: var(--rail-w) auto 150px 1fr; }
  .subnav { width: 150px; }
  .body--rail-collapsed.body--subnav { grid-template-columns: var(--sidebar-fold-w) auto 150px 1fr; }
  .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
  .topbar__brand-name { font-size: 10px; }
  .topbar__title h1 { font-size: var(--fs-14); }
  .topbar__sep,
  .topbar__history { display: none; }
  .card { padding: var(--s-3) var(--s-4); }
  .sel--wide { min-width: 180px; }
  .wizfoot { padding: var(--s-2) var(--s-3); gap: var(--s-2); }
  .wizfoot .btn { font-size: var(--fs-12); }
}

/* Review & Submit proposal summary (S4.4) ───────────────────────────── */
.review-proposal {
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--white);
  margin-bottom: var(--s-4);
  box-shadow: var(--sh-2);
}
.review-proposal__banner {
  background: #152d6e;
  color: var(--white);
  text-align: center;
  padding: var(--s-5) var(--s-4);
}
.review-proposal__company { font-size: var(--fs-15); font-weight: 700; letter-spacing: .04em; }
.review-proposal__title { font-size: var(--fs-13); font-weight: 600; margin-top: var(--s-1); letter-spacing: .06em; }
.review-proposal__section {
  background: #152d6e;
  color: var(--white);
  font-weight: 700;
  font-size: var(--fs-12);
  letter-spacing: .04em;
  padding: var(--s-2) var(--s-3);
  text-transform: uppercase;
}
.review-proposal__table { width: 100%; border-collapse: collapse; font-size: var(--fs-12); }
.review-proposal__table td, .review-proposal__table th {
  border: 1px solid #d8deec;
  padding: 6px 10px;
  vertical-align: top;
}
.review-proposal__vessel .review-proposal__lbl,
.review-proposal__assumptions .review-proposal__lbl {
  width: 38%;
  font-weight: 600;
  color: var(--ink-700);
  background: #f8f9fd;
}
.review-proposal__summary thead th {
  background: #152d6e;
  color: var(--white);
  font-size: var(--fs-11);
  text-transform: uppercase;
}
.review-proposal__summary .review-proposal__subtotal td {
  background: #f0a030;
  font-weight: 700;
}
.review-proposal__summary .review-proposal__grand td {
  background: #e89420;
  color: var(--white);
  font-weight: 700;
  font-size: var(--fs-13);
}
