/* ==========================================================================
   Mysolution Realisatieatlas — Stylesheet
   100% aligned to CPM Design System tokens, typography, object colors,
   badge-vs-button discipline, StageBar, List/DataTable, and 600px Slide-In.
   ========================================================================== */

:root, [data-theme="light"] {
  /* Ink (deep navy-indigo, never pure black) */
  --ink: #1F1D5C;
  --ink-soft: #6E6C8A;
  --ink-faint: #8A88A6;

  /* Brand (brand-gradient for logo/brand moments ONLY) */
  --brand-orange: #FF6B2C;
  --brand-purple: #7C5CFC;
  --brand-indigo: #534AB7;
  --brand-gradient: linear-gradient(90deg, #FF6B2C, #7C5CFC);

  /* Lavender workhorse accent */
  --lavender: #E9E4FA;
  --on-lavender: #3C3489;

  /* Surfaces & border */
  --canvas: #F7F7FB;
  --surface: #FFFFFF;
  --line: #E3E1EF;

  /* Semantic pairs */
  --success-fill: #E1F5EE;
  --success-text: #0F6E56;
  --error-fill: #FCEBEB;
  --error-text: #A32D2D;
  --error-border: #F0B9B9;
  --info-fill: #E6F1FB;
  --info-text: #185FA5;
  --warning-fill: #FAEEDA;
  --warning-text: #854F0B;

  /* Soft purple style (handoff #217) */
  --cta-from: #B38DE6;
  --cta-to: #8E63CC;
  --cta-gradient: linear-gradient(90deg, #B38DE6, #8E63CC);
  --cta-disabled: #DCD9EC;
  --shadow-cta: 0 2px 10px rgba(142, 99, 204, 0.28);
  --accent: #A07CD9;
  --accent-control: #A37BD5;
  --active: #534AB7;
  --tint: #F6F2FB;
  --row-selected: #EEF4FD;
  --row-selected-accent: #F2895C;
  --row-selected-hover: #E1ECFB;
  --row-hover: #EFEDF7;
  --stage-fill: #EEEAFB;
  --stage-done-line: #DCD6F2;
  --stage-future-line: #EFEDF7;
  --orange-wash: #FFF4EE;
  --orange-counter-fill: #FFF1E8;
  --orange-counter-border: #FBDDCB;
  --orange-deep: #D2541E;
  --shortlist-teal: #4FA9A1;
  --state-ok: #1E7B4A;
  --state-miss: #B5410F;

  /* 10 Object Color Families (tile / fill / text) */
  --obj-wayfinding-tile: #9A97AE;
  --obj-wayfinding-fill: #EFEEF4;
  --obj-wayfinding-text: #6E6A85;

  --obj-insight-tile: #6D89A8;
  --obj-insight-fill: #E9EFF6;
  --obj-insight-text: #47637F;

  --obj-clients-tile: #2E6F9E;
  --obj-clients-fill: #E7EFF6;
  --obj-clients-text: #25577C;

  --obj-people-tile: #8CA980;
  --obj-people-fill: #EDF2E8;
  --obj-people-text: #5E7C4B;

  --obj-engagement-tile: #2F8C90;
  --obj-engagement-fill: #E4EFF0;
  --obj-engagement-text: #256E72;

  --obj-demand-tile: #4FA9A1;
  --obj-demand-fill: #E6F1EF;
  --obj-demand-text: #2E7C76;

  --obj-applications-tile: #797AB5;
  --obj-applications-fill: #EBEBF6;
  --obj-applications-text: #575896;

  --obj-matching-tile: #C1665C;
  --obj-matching-fill: #F9E9E6;
  --obj-matching-text: #9A4A42;

  --obj-revenue-tile: #C4913F;
  --obj-revenue-fill: #F8EFDF;
  --obj-revenue-text: #98692A;

  --obj-neutral-tile: #7C7E87;
  --obj-neutral-fill: #EFEFF1;
  --obj-neutral-text: #5A5C64;

  /* Elevation & Rings */
  --shadow-card: 0 4px 16px rgba(31, 29, 92, 0.08);
  --shadow-panel: -4px 0 24px rgba(31, 29, 92, 0.12);
  --shadow-pop: 0 8px 28px rgba(31, 29, 92, 0.14);
  --ring-lavender: 0 0 0 4px #E9E4FA;
  --ring-orange: 0 0 0 4px #FDE3D5;

  /* Spacing & Shape */
  --radius-pill: 999px;
  --radius-card: 16px;
  --radius-card-sm: 12px;
  --radius-icon: 10px;
  --radius-icon-lg: 12px;

  /* Typography */
  --font-sans: 'Nunito Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SFMono-Regular', ui-monospace, 'Cascadia Code', Menlo, monospace;

  /* Z-index tokens */
  --z-sticky: 100;
  --z-overlay-scrim: 9001;
  --z-overlay-panel: 9002;
  --z-overlay-popover: 9010;
  --z-overlay-toast: 9020;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-indigo); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: var(--font-sans); }

.ph-icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ==========================================================================
   AppShell Top Chrome (CPM Reference)
   ========================================================================== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 120;
  border-bottom: 1px solid rgba(227, 225, 239, 0.55);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.brand-heart {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-heart svg { width: 26px; height: 26px; }

.brand-wordmark {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1;
}
.brand-wordmark .dot { color: var(--brand-orange); }
.brand-sub {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.global-search-wrap {
  flex: 1 1 260px;
  min-width: 220px;
  display: flex;
  justify-content: center;
  position: relative;
  max-width: 540px;
  margin: 0 auto;
}

.search-pill {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.search-pill:focus-within {
  border-color: var(--accent-control);
  box-shadow: var(--ring-lavender);
}
.search-pill input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--ink);
}
.search-pill input::placeholder { color: var(--ink-faint); }

.search-results-pop {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card-sm);
  box-shadow: var(--shadow-pop);
  z-index: var(--z-overlay-popover);
  max-height: 380px;
  overflow-y: auto;
  display: none;
}
.search-results-pop.open { display: block; }
.search-res-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--stage-future-line);
}
.search-res-item:last-child { border-bottom: none; }
.search-res-item:hover { background: var(--row-hover); }
.search-res-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.search-res-desc { font-size: 12px; color: var(--ink-soft); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.avatar-pill {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--lavender);
  color: var(--on-lavender);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Horizontal Nav Tab Bar */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  position: sticky;
  top: 63px;
  z-index: 110;
}

.nav-tab {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 13px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 150ms ease, box-shadow 150ms ease;
  position: relative;
}
.nav-tab:hover { color: var(--ink); }
.nav-tab.active {
  font-weight: 700;
  color: var(--ink);
  box-shadow: inset 0 -2.5px 0 var(--ink);
}
.nav-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: var(--radius-pill);
  background: var(--tint);
  color: var(--active);
  font-size: 11px;
  font-weight: 700;
}
.nav-tab.active .nav-step-num {
  background: var(--ink);
  color: #fff;
}

/* ==========================================================================
   Persistent Context Ribbon (Route + Journey Switcher)
   ========================================================================== */
.context-ribbon {
  background: rgba(247, 247, 251, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  position: sticky;
  top: 109px;
  z-index: var(--z-sticky);
}

.context-ribbon-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.ribbon-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.micro-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 3px;
  gap: 2px;
  align-items: center;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 150ms ease, color 150ms ease;
  white-space: nowrap;
  line-height: 1.25;
}
.seg-btn:hover { color: var(--ink); background: var(--tint); }
.seg-btn.active {
  background: var(--active);
  color: #fff;
}

.journey-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 150ms ease;
  white-space: nowrap;
}
.journey-pill:hover {
  border-color: var(--accent);
  background: var(--tint);
}
.journey-pill.active {
  background: var(--lavender);
  border-color: var(--accent-control);
  color: var(--on-lavender);
  box-shadow: 0 0 0 2px rgba(163, 123, 213, 0.2);
}
.journey-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* ==========================================================================
   Main Container & Cards
   ========================================================================== */
.main-content {
  flex: 1;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(227, 225, 239, 0.7);
  padding: 24px;
}
.card + .card, .section-gap { margin-top: 20px; }
.card-sm {
  background: var(--surface);
  border-radius: var(--radius-card-sm);
  border: 1px solid var(--line);
  padding: 16px;
}
.card-hover {
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.card-hover:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-pop);
}

.record-header-card {
  background: linear-gradient(100deg, var(--surface) 64%, var(--orange-wash) 100%);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.record-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.record-title-block {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.obj-tile {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-icon-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.obj-tile-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

/* Object color utility classes */
.fam-clients .obj-tile, .tile-clients { background: var(--obj-clients-tile); }
.fam-people .obj-tile, .tile-people { background: var(--obj-people-tile); }
.fam-engagement .obj-tile, .tile-engagement { background: var(--obj-engagement-tile); }
.fam-demand .obj-tile, .tile-demand { background: var(--obj-demand-tile); }
.fam-applications .obj-tile, .tile-applications { background: var(--obj-applications-tile); }
.fam-matching .obj-tile, .tile-matching { background: var(--obj-matching-tile); }
.fam-revenue .obj-tile, .tile-revenue { background: var(--obj-revenue-tile); }
.fam-insight .obj-tile, .tile-insight { background: var(--obj-insight-tile); }
.fam-wayfinding .obj-tile, .tile-wayfinding { background: var(--obj-wayfinding-tile); }
.fam-neutral .obj-tile, .tile-neutral { background: var(--obj-neutral-tile); }

.counter-chip {
  background: var(--orange-counter-fill);
  border: 1px solid var(--orange-counter-border);
  border-radius: var(--radius-card-sm);
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.counter-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--orange-deep);
  line-height: 1;
}
.counter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  line-height: 1.25;
}

/* ==========================================================================
   Typography & Badge vs Button Discipline
   ========================================================================== */
h1, .h1 { font-size: 22px; font-weight: 700; line-height: 1.2; margin: 0; color: var(--ink); }
h2, .h2 { font-size: 18px; font-weight: 700; line-height: 1.25; margin: 0; color: var(--ink); }
h3, .h3 { font-size: 15.5px; font-weight: 700; line-height: 1.3; margin: 0; color: var(--ink); }
p { margin: 0; }
.meta-text { font-size: 12.5px; color: var(--ink-soft); }

/* BADGES: 11px UPPERCASE, tracked, NO verb, NEVER clickable */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--lavender);
  color: var(--on-lavender);
  white-space: nowrap;
  user-select: none;
}
.badge-success { background: var(--success-fill); color: var(--success-text); }
.badge-warning { background: var(--warning-fill); color: var(--warning-text); }
.badge-error { background: var(--error-fill); color: var(--error-text); border: 1px solid var(--error-border); }
.badge-info { background: var(--info-fill); color: var(--info-text); }
.badge-clients { background: var(--obj-clients-fill); color: var(--obj-clients-text); }
.badge-people { background: var(--obj-people-fill); color: var(--obj-people-text); }
.badge-engagement { background: var(--obj-engagement-fill); color: var(--obj-engagement-text); }
.badge-revenue { background: var(--obj-revenue-fill); color: var(--obj-revenue-text); }
.badge-neutral { background: var(--obj-neutral-fill); color: var(--obj-neutral-text); }
.badge-applications { background: var(--obj-applications-fill); color: var(--obj-applications-text); }

/* BUTTONS: 13-14px sentence case, imperative verb required, pill 999px */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 17px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 100ms ease, box-shadow 150ms ease;
  white-space: nowrap;
}
.btn:hover { background: var(--tint); border-color: var(--accent); }
.btn:active { transform: scale(0.985); }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--cta-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-cta);
}
.btn-primary:hover {
  filter: brightness(0.97);
  background: var(--cta-gradient);
  border-color: transparent;
}
.btn-primary:disabled {
  background: var(--cta-disabled);
  box-shadow: none;
}

.btn-danger {
  background: var(--error-fill);
  color: var(--error-text);
  border-color: var(--error-border);
}
.btn-danger:hover { background: #f8dada; border-color: var(--error-text); }

.btn-sm {
  font-size: 12.5px;
  padding: 6px 13px;
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--active);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 6px;
}
.btn-link:hover { background: var(--tint); text-decoration: underline; }

/* ==========================================================================
   StageBar (CPM Interlocking Pipeline Path)
   ========================================================================== */
.stage-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.stage-step {
  flex: 1;
  min-width: 130px;
  border: 1px solid var(--line);
  background: var(--stage-fill);
  color: var(--ink-soft);
  border-radius: var(--radius-pill);
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 150ms ease;
  text-align: left;
}
.stage-step:hover { border-color: var(--accent); color: var(--ink); }
.stage-step.done {
  background: var(--success-fill);
  border-color: rgba(15, 110, 86, 0.2);
  color: var(--success-text);
}
.stage-step.current {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  box-shadow: var(--ring-lavender);
}
.stage-step-dot {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(31, 29, 92, 0.08);
}
.stage-step.done .stage-step-dot { background: var(--success-text); color: #fff; }
.stage-step.current .stage-step-dot { background: var(--brand-orange); color: #fff; }
.stage-arrow { color: var(--ink-faint); flex-shrink: 0; }

/* ==========================================================================
   Grids, Splits & DataTables (CPM List Pattern)
   ========================================================================== */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.split-main-rail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }

@media (max-width: 1120px) {
  .top-header { flex-wrap: wrap; position: static; }
  .nav-bar { position: static; }
  .context-ribbon { position: static; }
  .split-main-rail { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}

.list-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(227, 225, 239, 0.7);
  overflow: hidden;
}
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.filter-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--tint);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.table-scroll { width: 100%; overflow-x: auto; }

.cpm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.cpm-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface);
}
.cpm-table td {
  padding: 11px 14px;
  color: var(--ink);
  vertical-align: top;
}
.cpm-table tbody tr:nth-child(even) { background: var(--canvas); }
.cpm-table tbody tr:hover { background: var(--row-hover); }
.cpm-table tbody tr.row-selected {
  background: var(--row-selected);
  box-shadow: inset 3px 0 0 var(--row-selected-accent);
}
.cpm-table tbody tr.row-selected:hover { background: var(--row-selected-hover); }
.cpm-table tbody tr.clickable { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* ==========================================================================
   Callouts, Maia/Insight Banner & Code Grounding Pill
   ========================================================================== */
.callout {
  border-radius: var(--radius-card-sm);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  background: var(--tint);
}
.callout-accent {
  border-left: 4px solid var(--brand-purple);
  background: var(--tint);
}
.callout-info { background: var(--info-fill); border-color: rgba(24, 95, 165, 0.2); color: var(--ink); }
.callout-warning { background: var(--warning-fill); border-color: rgba(133, 79, 11, 0.22); }
.callout-success { background: var(--success-fill); border-color: rgba(15, 110, 86, 0.22); }

/* ==========================================================================
   Interactive Visual Widgets
   ========================================================================== */

/* Entity Flow Diagram */
.flow-chain {
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 2px 10px;
}
.flow-node {
  flex: 1;
  min-width: 170px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-card-sm);
  padding: 14px;
  cursor: pointer;
  transition: all 150ms ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flow-node:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-card); }
.flow-node.selected {
  background: var(--row-selected);
  border-color: var(--active);
  box-shadow: var(--ring-lavender);
}
.flow-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 44px;
  text-align: center;
}

/* Hierarchy Ladder */
.hierarchy-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 960px) { .hierarchy-grid { grid-template-columns: 1fr; } }

.ladder {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ladder-item {
  width: 100%;
  text-align: left;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-card-sm);
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 150ms ease;
}
.ladder-item:hover { background: var(--row-hover); border-color: var(--accent); }
.ladder-item.selected {
  background: var(--row-selected);
  border-color: var(--active);
  box-shadow: inset 3px 0 0 var(--row-selected-accent);
}
.ladder-rank {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--tint);
  color: var(--active);
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ladder-item.winner .ladder-rank {
  background: var(--success-text);
  color: #fff;
}

/* Shift Timeline Bar */
.shift-timeline-wrap {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-card-sm);
  padding: 16px;
}
.shift-bar-track {
  height: 44px;
  border-radius: 10px;
  background: var(--stage-future-line);
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
}
.shift-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: width 200ms ease;
}
.shift-seg-norm { background: var(--obj-engagement-fill); color: var(--obj-engagement-text); border-right: 1px solid #fff; }
.shift-seg-break { background: var(--obj-neutral-fill); color: var(--obj-neutral-text); border-right: 1px solid #fff; }
.shift-seg-evening { background: var(--lavender); color: var(--on-lavender); border-right: 1px solid #fff; }
.shift-seg-overtime { background: var(--warning-fill); color: var(--warning-text); }

/* Sliders & Form Inputs */
.field-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.field-val {
  color: var(--active);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent-control);
  cursor: pointer;
}
.input-pill, select.input-pill {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
}
.input-pill:focus {
  outline: none;
  border-color: var(--accent-control);
  box-shadow: var(--ring-lavender);
}

/* KPI Metric Tile */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card-sm);
  padding: 16px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* Stacked Margin Bar */
.stacked-bar {
  height: 16px;
  border-radius: var(--radius-pill);
  background: var(--stage-future-line);
  display: flex;
  overflow: hidden;
}
.sb-wage { background: var(--obj-engagement-tile); }
.sb-cost-overhead { background: var(--obj-applications-tile); }
.sb-margin { background: var(--obj-revenue-tile); }
.sb-loss { background: var(--error-text); }

/* Sub-tabs inside cards */
.subtabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
}
.subtab {
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.subtab:hover { color: var(--ink); }
.subtab.active {
  color: var(--active);
  box-shadow: inset 0 -2.5px 0 var(--active);
}

/* Ledger Entry Visual Pill */
.entry-neg { color: var(--error-text); font-weight: 700; }
.entry-pos { color: var(--success-text); font-weight: 700; }
.entry-struck { text-decoration: line-through; color: var(--ink-faint); }

/* Checkbox (CPM 15px radius 4px accent-control) */
.cpm-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
}
.cpm-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-control);
  cursor: pointer;
}

/* Quiz option button */
.quiz-opt {
  width: 100%;
  text-align: left;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-card-sm);
  padding: 12px 15px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 150ms ease;
}
.quiz-opt:hover { border-color: var(--accent); background: var(--tint); }
.quiz-opt.correct { background: var(--success-fill); border-color: var(--success-text); color: var(--success-text); font-weight: 700; }
.quiz-opt.wrong { background: var(--error-fill); border-color: var(--error-text); color: var(--error-text); }

/* ==========================================================================
   600px Right Slide-In Technical Inspector (CPM Reference Pattern)
   ========================================================================== */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(31, 29, 92, 0.28);
  z-index: var(--z-overlay-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(600px, 95vw);
  background: var(--surface);
  z-index: var(--z-overlay-panel);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(.22, 1, .36, 1);
}
.slide-panel.open { transform: translateX(0); }

.slide-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.slide-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.code-box {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  overflow-x: auto;
  line-height: 1.55;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-pop);
  z-index: var(--z-overlay-toast);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 200ms ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Utility spacing */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }

/* ==========================================================================
   CPM HoverCard Tooltip System (interactive term hints)
   ========================================================================== */
.tip-trigger {
  display: inline;
  padding: 0 2px;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--active);
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  line-height: inherit;
  border-bottom: 1.5px dotted var(--accent);
  cursor: help;
  border-radius: 3px;
  transition: background 140ms ease, color 140ms ease;
}
.tip-trigger:hover, .tip-trigger:focus-visible {
  background: var(--tint);
  color: var(--ink);
  outline: none;
}

.hover-card {
  position: fixed;
  z-index: 9045;
  width: min(340px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  padding: 14px 16px;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}
.hover-card.open {
  opacity: 1;
  transform: translateY(0);
}
.hover-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 6px;
}
.hover-card-body {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.45;
  margin-top: 6px;
}
.hover-card-where {
  font-size: 12px;
  color: var(--active);
  font-weight: 600;
  margin-top: 8px;
}
.hover-card-tech {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* Filter chips for Support FAQ */
.chip-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 140ms ease;
  white-space: nowrap;
}
.chip-btn:hover { background: var(--tint); color: var(--ink); border-color: var(--accent); }
.chip-btn.active { background: var(--lavender); color: var(--on-lavender); border-color: var(--accent-control); }


/* ==========================================================================
   CPM HoverCard Tooltips (for plain-language + technical hints)
   ========================================================================== */
.tip {
  border-bottom: 1.5px dotted var(--accent);
  color: var(--ink);
  cursor: help;
  font-weight: 600;
  transition: color 120ms ease, background 120ms ease;
  border-radius: 3px;
  padding: 0 2px;
}
.tip:hover, .tip:focus-visible {
  background: var(--tint);
  color: var(--active);
  outline: none;
}

.hovercard {
  position: fixed;
  z-index: 9045;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  padding: 12px 14px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}
.hovercard.open {
  opacity: 1;
  transform: translateY(0);
}
.hovercard-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.hovercard-body {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.hovercard-tech {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--stage-future-line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}
