/* Cairn Life — design system */

/* ── Mobile warning overlay ─────────────────────────────────────────────────── */
#mobile-warning {
  display: none;
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
}
#mobile-warning-inner {
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
@media (max-width: 767px) {
  #mobile-warning { display: flex; }
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Brand stones — Cairn Life ─────────────────────────────────────────────
     App-specific names now ALIAS the design-system tokens in css/tokens/*.css
     (same values as before — pure refactor, no colour changed). Names that the
     token files already define (--forest, --sage, greys, --radius, …) are no
     longer reduplicated here; they come straight from the tokens.
     (app.css ↔ tokens wiring, 22 Jun 2026.) */
  --brand-forest:   var(--forest-deep);
  --brand-forest-d: var(--forest-deeper);
  --stone-life:     var(--forest);
  --stone-general:  var(--sage);
  --stone-estate:   var(--clay);

  /* Legacy aliases (used throughout CSS) */
  --teal:       var(--forest);
  --teal-dark:  var(--forest-dark);
  --teal-light: var(--sage-tint);
  --teal-mid:   var(--sage-soft);

  /* LifeBook nav accent */
  --plan-nav-bg:   var(--sage-tint);
  --plan-nav-text: var(--forest);
  --plan-nav-bar:  var(--forest);

  /* Support colour (app uses --support-light; token is --support-tint) */
  --support-light: var(--support-tint);

  /* Estate accent */
  --estate-nav-bg:      var(--clay-tint);
  --estate-nav-text:    var(--clay-deep);
  --estate-nav-bar:     var(--estate);
  --estate-accent:      var(--estate);
  --estate-accent-dark: var(--estate-dark);
  --estate-accent-mid:  var(--estate-mid);
  --estate-accent-light:var(--estate-tint);

  /* ── Action buttons (values unchanged) ── */
  --btn-primary-bg:    var(--forest);
  --btn-primary-text:  var(--white);
  --btn-primary-hover: var(--forest-dark);
  --btn-clay-bg:    var(--forest);
  --btn-clay-text:  var(--white);
  --btn-clay-hover: var(--forest-dark);
  --btn-ghost-colour: var(--forest-dark);

  /* App-specific spacing/type aliases (token provides the rest by name) */
  --shadow:    var(--shadow-sm);
  --nav-width: 240px;
  --font:      var(--font-sans);
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 15px;
  color: var(--black);
  background: var(--grey-100);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; width: 100%; overflow: hidden; }
#auth-screen { display: flex; align-items: stretch; width: 100%; min-height: 100vh; }

/* Marketing panel */
.auth-marketing {
  flex: 1;
  background: var(--brand-forest);   /* deep forest — matches the logo background */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  min-height: 100vh;
}
.auth-marketing-inner {
  max-width: 860px;
  width: 100%;
}

/* Hero: big green logo + beta badge */
.auth-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.auth-hero-logo {
  width: 300px;
  max-width: 70%;
  height: auto;
  display: block;
  border-radius: 12px;     /* soften the jpg edge against the panel */
}
.auth-beta {
  align-self: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.14);
  padding: 3px 10px;
  border-radius: 20px;
}

/* Two columns: Products (left) + Benefits (right) */
.auth-cols {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 48px;
  align-items: start;
  margin-bottom: 36px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.auth-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 18px;
}

/* Products — larger than benefits */
.auth-col-products .auth-product + .auth-product { margin-top: 22px; }
.auth-product-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.auth-product-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.auth-product-name {
  font-size: 21px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.auth-soon {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone-estate);
  background: rgba(240,99,31,0.16);
  padding: 3px 8px;
  border-radius: 20px;
}
.auth-product-body {
  font-size: 14px;
  color: rgba(255,255,255,0.72);
  line-height: 1.55;
}

.auth-usps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-usp {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.auth-usp-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.9);
  margin-top: 1px;
}
.auth-usp-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 3px;
}
.auth-usp-body {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
}
.auth-marketing-quote {
  border-left: 2px solid rgba(255,255,255,0.3);
  padding-left: 16px;
  margin-bottom: 32px;
}
.auth-marketing-quote-text {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 6px;
}
.auth-marketing-quote-name {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
}
.auth-marketing-footer {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.03em;
}

/* Auth form panel */
.auth-form-panel {
  width: 480px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grey-50, #f9fafb);
  padding: 40px 32px;
  min-height: 100vh;
}

@media (max-width: 980px) {
  .auth-cols { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 820px) {
  #auth-screen { flex-direction: column; }
  .auth-marketing { min-height: auto; padding: 32px 24px; }
  .auth-hero-logo { width: 220px; }
  .auth-col-benefits { display: none; }
  .auth-marketing-quote { display: none; }
  .auth-form-panel { width: 100%; min-height: auto; padding: 32px 24px; }
}
#main-screen { display: flex; width: 100%; height: 100vh; }

/* ── Sidebar nav ───────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--nav-width);
  min-width: var(--nav-width);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow: hidden;
}

#nav-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  width: var(--nav-width);
  height: 96px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  background-color: #fff;
  background-image: url('../assets/logo_wide_white.png');
  background-size: auto 62px;
  background-repeat: no-repeat;
  background-position: center center;
  overflow: hidden;
}
.sidebar-logo img {
  display: none;
}

/* Consistent base colour for all nav links regardless of section */
.nav-section-plans a,
.nav-section-estates a { color: var(--grey-700); }

/* LifeBooks nav — white active bg + forest green left border, black text */
.nav-section-plans a.active {
  background: var(--white) !important;
  color: var(--black) !important;
  border-left: 4px solid var(--plan-nav-bar) !important;
  font-weight: 600;
}

/* Estates nav — white active bg + clay left border, black text */
.nav-section-estates a.active {
  background: var(--white) !important;
  color: var(--black) !important;
  border-left: 4px solid var(--estate-nav-bar) !important;
  font-weight: 600;
}

/* Nav section headers (collapsible) */
.nav-section {
  border-bottom: 1px solid var(--border);
}

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--black);
  cursor: pointer;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.nav-section-header:hover { background: var(--grey-100); }

.nav-chevron {
  transition: transform 0.2s;
  font-size: 13px;
  color: var(--grey-500);
  font-weight: 700;
}

.nav-section.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-section.collapsed .nav-section-body { display: none; }

.nav-section-body { padding: 2px 0 6px; }

/* Group label (My LifeBook / Shared with me) */
.nav-group-label {
  padding: 8px 16px 2px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--grey-500);
}

/* Nav links */
nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--grey-700);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.1s, color 0.1s;
}

nav a:hover { background: var(--border); color: var(--black); }
nav a.active { background: var(--white); color: var(--teal); font-weight: 600; border-left: 3px solid var(--teal); }

.nav-sub-item {
  padding: 5px 16px 5px 28px !important;
  font-size: 13px;
}

.nav-top-link { font-size: 14px !important; font-weight: 600 !important; }
.nav-create { color: var(--teal) !important; }

.nav-empty {
  font-size: 12px;
  color: var(--grey-300);
  padding: 3px 16px 4px 28px;
}

.nav-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }


/* Pinned footer */
.nav-footer-links {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.nav-footer-links button {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--grey-500);
  cursor: pointer;
  padding: 0;
}

.nav-footer-links button:hover {
  color: var(--teal);
}

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--grey-700);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  min-height: 44px;
}
nav a svg { flex-shrink: 0; }
nav a:hover { background: var(--border); color: var(--black); }
nav a.active { background: var(--white); color: var(--black); border-left: 4px solid var(--black); font-weight: 600; }
nav a.active:hover { background: var(--white); color: var(--black); }
nav a.estate-link { color: var(--grey-700); }
nav a.estate-link:hover { background: var(--border); color: var(--black); }
nav a.estate-link.active { background: var(--white) !important; color: var(--black) !important; border-left: 4px solid var(--estate-accent) !important; font-weight: 600 !important; }
nav a.estate-link.active:hover { background: var(--white) !important; color: var(--black) !important; }

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--white);
  position: relative;
}


.footer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
}
.footer-user:hover { background: var(--grey-100); }

.footer-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--teal-light);
  color: var(--teal);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.footer-user-info { flex: 1; min-width: 0; }
.footer-user-name { font-size: 13px; font-weight: 600; color: var(--black); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.footer-user-email { font-size: 11px; color: var(--grey-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.footer-chevron { font-size: 10px; color: var(--grey-300); transition: transform 0.2s; flex-shrink: 0; align-self: flex-start; margin-top: 4px; }
.footer-chevron.open { transform: rotate(180deg); }

.footer-popover {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 4px 0;
}

.footer-popover button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--grey-700);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
}
.footer-popover button:hover { background: var(--grey-100); color: var(--black); }

.popover-divider { border-top: 1px solid var(--border); margin: 4px 0; }
.popover-version { font-size: 10px; color: var(--grey-300); padding: 6px 16px 8px; }

/* ── Main content area ─────────────────────────────────────────────────────── */
#content {
  margin-left: var(--nav-width);
  flex: 1;
  overflow-y: auto;
  height: 100vh;
  padding: 32px;
  /* Clear the floating Help & feedback launcher so page buttons (Save etc.)
     are never hidden underneath it. */
  padding-bottom: 110px;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 18px; font-weight: 700; color: var(--black); margin-bottom: 4px; }
.card-subtitle { font-size: 14px; color: var(--grey-500); margin-bottom: 20px; }

/* ── Dashboard ─────────────────────────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dashboard-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.panel-header { padding: 20px 24px 16px; background: var(--white); color: var(--black); }
.panel-header.teal { }
.panel-header.clay { }
.dashboard-panel.plan-card { border-left: 4px solid var(--teal); }
.dashboard-panel.estate-card { border-left: 4px solid var(--estate-accent); }
.panel-header.black { background: var(--black); color: var(--white); }
.panel-header h2 { font-size: 20px; font-weight: 700; }
.panel-header p { font-size: 13px; color: var(--grey-500); margin-top: 4px; }
.panel-body { padding: 20px 24px 24px; }
.panel-progress { background: var(--grey-200); border-radius: 2px; height: 4px; margin-top: 12px; }
/* Progress is always Support Blue — assistance is progress (Assist_Types_and_Treatment.md) */
.panel-header.teal .panel-progress-fill { background: var(--support); border-radius: 2px; height: 4px; transition: width 0.4s; }
.panel-header.clay .panel-progress-fill { background: var(--support); border-radius: 2px; height: 4px; transition: width 0.4s; }
.panel-header.black .panel-progress { background: rgba(255,255,255,0.2); }
.panel-header.black .panel-progress-fill { background: var(--support-mid); border-radius: 2px; height: 4px; transition: width 0.4s; }
.panel-progress-fill { background: var(--support); border-radius: 2px; height: 4px; transition: width 0.4s; }

.purpose-callout { background: var(--teal-light); border: 1px solid var(--teal-mid); border-radius: var(--radius-sm); padding: 16px 20px; margin-top: 20px; font-size: 14px; color: var(--teal-dark); font-style: italic; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; text-decoration: none; min-height: 36px; white-space: nowrap; }

/* Stone 1 — forest green: primary action */
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); border-color: var(--btn-primary-bg); }
.btn-primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }
.btn-primary:active { background: var(--forest-dark, #142e22); border-color: var(--forest-dark, #142e22); }

/* Stone 5 — clay/copper: estate accent action */
.btn-clay { background: var(--btn-clay-bg); color: var(--btn-clay-text); border-color: var(--btn-clay-bg); }
.btn-clay:hover { background: var(--btn-clay-hover); border-color: var(--btn-clay-hover); }

/* Neutral */
.btn-secondary { background: var(--white); color: var(--black); border-color: var(--border); }
.btn-secondary:hover { background: var(--grey-300); border-color: var(--grey-400); }
.btn-secondary:active { background: var(--grey-400); border-color: var(--grey-500); }
/* Support button — used in Help, Guidance, and 3rd-party areas */
.btn-support { background: var(--support); color: #fff; border-color: var(--support); }
.btn-support:hover { background: var(--support-dark); border-color: var(--support-dark); }
.btn-ghost { background: transparent; color: var(--forest); border-color: var(--border); }
.btn-ghost:hover { background: var(--grey-100); }
.btn-black { background: var(--black); color: var(--white); border-color: var(--black); }
.btn-black:hover { background: var(--grey-900); }
/* btn-sm = same as base (legacy alias — no visual difference) */
.btn-sm { padding: 7px 16px; font-size: 13px; min-height: 36px; }
.btn-lg { padding: 10px 20px; font-size: 14px; min-height: 44px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }

/* Action button row — right-justified, used in cards and toolbars */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; margin-top: 14px; }
.full-plan-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--grey-700); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--black);
  background: var(--white);
  transition: border-color 0.15s;
  min-height: 44px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(27,107,107,0.1);
}
.form-textarea { min-height: 100px; resize: vertical; }
/* Dropdowns size to their longest option, not the container (field-width convention) */
.form-select { width: auto; min-width: 110px; max-width: 100%; }
/* One height for every single-line field — inputs and selects match exactly, everywhere. */
.form-input, .form-select { height: 44px; }
.form-textarea { height: auto; }
/* Contacts list — two columns on desktop, one on mobile. */
.ct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; grid-auto-rows: 1fr; }
.ct-grid > .card { margin: 0 !important; height: 100%; }
@media (max-width: 760px) { .ct-grid { grid-template-columns: 1fr; } }
.form-error { font-size: 12px; color: #C0392B; margin-top: 4px; }
.form-hint { font-size: 12px; color: var(--grey-500); margin-top: 4px; }
.address-lookup-wrap { display: flex; flex-direction: column; gap: 6px; }
.address-lookup-bar { display: flex; gap: 8px; align-items: center; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: var(--grey-100); }
.doc-thumb { flex-shrink: 0; }
.security-label { font-size: 11px; color: var(--teal); font-weight: 600; margin-top: 4px; }

.field-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.field-grid .full   { grid-column: 1 / -1; }
.field-grid .span-1 { grid-column: span 1; }
.field-grid .span-2 { grid-column: span 2; }
.field-grid .span-3 { grid-column: span 3; }
.field-grid .span-4 { grid-column: 1 / -1; }
.field-grid .group-divider { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: 4px 0; }
.group-header { grid-column: 1 / -1; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--grey-400); padding-bottom: 2px; border-bottom: 1px solid var(--border); margin-top: 4px; }

/* ── Repeating-card lists (accounts, policies, beneficiaries, etc.) ─────────── */
.repeater-field > .form-label { display: block; margin-bottom: 4px; }
.repeater-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; background: var(--white); }
.repeater-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; }
.repeater-head strong { font-size: 14px; }
.repeater-remove { color: var(--danger); }
.repeater-empty { font-size: 13px; color: var(--grey-400); padding: 8px 0 12px; }
.repeater-card .field-grid { gap: 12px; }

/* Brand-logo on the card header (e.g. social accounts) */
.repeater-icon { display: inline-flex; align-items: center; margin-right: 2px; flex: 0 0 auto; }
.repeater-icon svg { display: block; }
.repeater-head strong { flex: 1 1 auto; }

/* ── Logo picker (click a brand to select) ─────────────────────────────────── */
.logo-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.logo-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px 7px 10px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--white); cursor: pointer;
  font-size: 13px; color: var(--grey-500);
  transition: border-color .12s, background .12s, color .12s;
}
.logo-chip:hover { border-color: var(--teal-mid); background: var(--grey-100); }
.logo-chip svg { display: block; flex: 0 0 auto; }
.logo-chip-label { line-height: 1; white-space: nowrap; }
.logo-chip.selected {
  border-color: var(--teal); background: var(--teal-light);
  color: var(--teal-dark); font-weight: 600;
}
.logo-selected { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-chip-static { cursor: default; }
.logo-chip-static:hover { border-color: var(--teal); background: var(--teal-light); }

/* ── Lifebook sticky header ────────────────────────────────────────────────── */
.lifebook-sticky-header {
  position: sticky;
  top: -32px;
  margin: -32px -32px 24px;
  z-index: 40;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  height: 88px;              /* FIXED (not min-): a constant height keeps the
                                sidenav's sticky offset valid in every section */
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
/* Keep the left block on one line so the header can't grow/shrink per section */
.lifebook-sticky-header > div { min-width: 0; }
.lifebook-sticky-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.3px;
}
.lifebook-sticky-sub {
  font-size: 13px;
  color: var(--grey-500);
  margin-top: 3px;
}
.lifebook-sticky-pct {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--grey-500);
  margin-top: 4px;
  white-space: nowrap;          /* "Next: <section>" never wraps to a 2nd line */
  overflow: hidden;
}
.lifebook-sticky-pct > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.lifebook-sticky-bar-track {
  width: 120px;
  height: 5px;
  background: var(--grey-300);
  border-radius: 3px;
  overflow: hidden;
}
.lifebook-sticky-bar-fill {
  height: 100%;
  background: var(--support); /* progress is always Support Blue — assistance is progress */
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ── Lifebook two-column layout ────────────────────────────────────────────── */
.lifebook-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.lifebook-main { flex: 1; min-width: 0; }
.lifebook-sidenav {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  /* Header sticks at top:-32px and is 88px tall → its bottom sits 56px below
     the scroll top. +24px breathing room = 80px. Keep these in sync. */
  top: 80px;
  align-self: flex-start;              /* don't stretch in the flex row, or sticky has no room */
  max-height: calc(100vh - 104px);     /* tall navs scroll internally and always fit */
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.section-nav-title {
  padding: 10px 14px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--grey-500);
  border-bottom: 1px solid var(--border);
}
.section-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.section-nav-item:last-child { border-bottom: none; }
.section-nav-item:hover { background: var(--border); border-left: 4px solid var(--teal); padding-left: 10px; }
.section-nav-item.active { background: var(--white); border-left: 4px solid var(--teal); padding-left: 10px; }
/* Help & guidance nav uses Support Blue (the "here to help" colour) instead of plan green. */
.section-nav-item.section-nav-support:hover,
.section-nav-item.section-nav-support.active { border-left-color: var(--support, #3B5BDB); }
.section-nav-icon { flex-shrink: 0; display: flex; }
.section-nav-label { flex: 1; font-size: 12px; color: var(--black); line-height: 1.3; }
.section-nav-item.active .section-nav-label { color: var(--black); font-weight: 600; }
.section-nav-pct { font-size: 11px; font-weight: 600; flex-shrink: 0; }

/* ── Wizard ────────────────────────────────────────────────────────────────── */
/* ── Section helper panels (Documents / Guidance / 3rd Party) ────────────── */
/* Recessed helper strip — deliberately lighter than content cards */
.section-helper-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  align-items: stretch;
  margin-bottom: 24px;
  background: var(--grey-100);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.section-panel {
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.section-panel:last-child { border-right: none; }
.section-panel-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--grey-400);
  margin-bottom: 10px;
}

/* Documents panel — same label treatment as other panels */
.section-panel--documents .section-panel-label { color: var(--grey-400); }
.estate-context .section-panel--documents .section-panel-label { color: var(--grey-400); }

/* Guidance panel */
.section-panel--info .section-panel-label { color: var(--grey-400); }
.section-panel--info a {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--black);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.section-panel--info a:last-of-type { border-bottom: none; }
.section-panel--info a:hover { text-decoration: underline; }
.section-panel--info .info-source {
  font-size: 10px;
  font-weight: 500;
  color: var(--grey-400);
  margin-left: 5px;
}
.section-panel--info .info-note {
  font-size: 11px;
  color: var(--grey-500);
  opacity: 0.9;
  margin: 2px 0 6px;
  line-height: 1.4;
}

/* 3rd Party Help panel — neutral, consistent */
.section-panel--third .section-panel-label { color: var(--grey-500); }
.section-panel-empty {
  font-size: 12px;
  color: var(--grey-500);
  opacity: 0.6;
  font-style: italic;
}
.coming-soon-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--grey-400);
  margin-bottom: 8px;
}
.section-panel--third .third-desc {
  font-size: 12px;
  color: var(--grey-500);
  opacity: 0.7;
  line-height: 1.45;
}
@media (max-width: 640px) {
  .section-helper-row { grid-template-columns: 1fr; }
}

.wizard-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); border-left: 4px solid var(--teal); }
.estate-context .wizard-card { border-left-color: var(--estate-accent); }
.estate-context .card { border-left: 4px solid var(--estate-accent); }
.plan-context .card { border-left: 4px solid var(--teal); }
.wizard-card-icon { color: var(--teal); margin-bottom: 10px; }
.wizard-card-icon svg { width: 28px; height: 28px; }
.wizard-section-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.wizard-section-subtitle { font-size: 14px; color: var(--grey-500); margin-bottom: 24px; }

.wizard-nav { display: flex; align-items: center; gap: 12px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.wizard-nav .spacer { flex: 1; }
.save-indicator { font-size: 13px; color: var(--teal); font-weight: 600; opacity: 0; transition: opacity 0.3s; }
.save-indicator.visible { opacity: 1; }

/* ── Scan button ───────────────────────────────────────────────────────────── */
.scan-area { margin-bottom: 20px; }
.scan-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}
.scan-btn:hover { background: var(--grey-100); border-color: var(--grey-300); }
.scan-btn.scanning {
  cursor: not-allowed;
  background: var(--support);
  color: var(--white);
  border-color: var(--support);
  animation: scan-pulse 1.2s ease-in-out infinite;
}

/* Accelerator chip — the uniform assist button (LifeBook + estate). Scanning
   state lives here (unscoped) so it works outside #lb2-section too. */
.lb2-accel { display: inline-flex; align-items: center; gap: 8px; }
.lb2-accel.scanning {
  cursor: not-allowed;
  background: var(--support) !important;
  border-color: var(--support) !important;
  animation: scan-pulse 1.2s ease-in-out infinite;
}
.lb2-accel.scanning, .lb2-accel.scanning * { color: #fff !important; opacity: 1 !important; }
.lb2-accel.scanning svg { stroke: #fff; animation: scan-spin 1.2s linear infinite; }
.scan-btn.scanning svg { stroke: var(--white); animation: scan-spin 1.2s linear infinite; }
.scan-btn.scanning .scan-cost { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.3); color: rgba(255,255,255,0.85); }

@keyframes scan-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}
@keyframes scan-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.scan-cost {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--grey-500);
  background: var(--white);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ── Scan overlay ──────────────────────────────────────────────────────────── */
.scan-overlay { background: var(--white); border: 1px solid var(--teal-mid); border-radius: var(--radius-sm); padding: 20px; margin-bottom: 20px; }
.scan-overlay h4 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.scan-overlay p { font-size: 13px; color: var(--grey-500); margin-bottom: 16px; }
.scan-field-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grey-100); }
.scan-field-row:last-of-type { border-bottom: none; }
.scan-field-row input[type=checkbox] { margin-top: 3px; accent-color: var(--teal); width: 16px; height: 16px; }
.scan-field-label { font-size: 13px; font-weight: 600; min-width: 120px; }
.scan-field-value { font-size: 13px; color: var(--grey-700); }
.scan-overlay-actions { margin-top: 16px; display: flex; gap: 10px; }

/* ── Auth screen ───────────────────────────────────────────────────────────── */
.auth-box { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 400px; box-shadow: var(--shadow-md); }
.auth-logo { margin-bottom: 20px; text-align: center; }
.auth-tagline { font-size: 12px; color: var(--grey-400); margin-bottom: 28px; }
/* Hide in-box logo on desktop — the marketing panel carries it */
@media (min-width: 821px) {
  .auth-box .auth-tagline { display: none; }
}
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { font-size: 14px; color: var(--grey-500); margin-bottom: 24px; }
.auth-switch { font-size: 13px; color: var(--grey-500); text-align: center; margin-top: 20px; }
.auth-switch a { color: var(--teal); font-weight: 600; text-decoration: none; cursor: pointer; }

/* ── Share modal ───────────────────────────────────────────────────────────── */
.share-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--grey-400); margin-bottom: 8px;
}
.share-access-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: all .15s;
}
.share-access-opt:hover { border-color: var(--teal-mid); background: var(--grey-100); }

/* ── Page headers ──────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-title { font-size: 26px; font-weight: 700; color: var(--black); }
.page-subtitle { font-size: 15px; color: var(--grey-500); margin-top: 4px; }

/* ── Full plan view ────────────────────────────────────────────────────────── */
.plan-section { background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--teal); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 24px; scroll-margin-top: 104px; }
.plan-group-header { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--grey-400); margin: 16px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.plan-group-header:first-child { margin-top: 0; }
.plan-section-empty { opacity: 0.6; }
.plan-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.plan-section-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.plan-section-title svg { width: 28px; height: 28px; }
.plan-edit-btn { opacity: 0.5; transition: opacity 0.15s; }
.plan-section:hover .plan-edit-btn { opacity: 1; }
.plan-empty-row { font-size: 13px; color: var(--grey-300); }
.plan-field-empty .plan-field-label { color: var(--grey-400); }
.plan-field-empty { opacity: 0.7; }
.plan-field-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--grey-100); font-size: 14px; }
.plan-field-row:last-child { border-bottom: none; }
.plan-field-label { font-weight: 600; min-width: 180px; color: var(--grey-700); }
.plan-field-value { color: var(--black); flex: 1; }
.redacted { color: var(--grey-300); letter-spacing: 2px; }

/* ── Tags / badges ─────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-teal { background: var(--teal-light); color: var(--teal); }
.badge-black { background: var(--grey-100); color: var(--black); }
.badge-green { background: #E8F5E9; color: #2E7D32; }
.badge-amber { background: #FFF8E1; color: #E65100; }
.badge-red { background: #FFEBEE; color: #C62828; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--grey-500); border-bottom: 2px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--grey-100); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--grey-100); }

/* ── Modals ────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--white); border-radius: var(--radius); padding: 32px; width: 100%; max-width: 480px; box-shadow: var(--shadow-md); position: relative; }
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal-subtitle { font-size: 14px; color: var(--grey-500); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; margin-top: 24px; justify-content: flex-end; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--grey-500);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--grey-100); color: var(--black); }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--black); color: var(--white); padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; z-index: 2000; opacity: 0; transform: translateY(8px); transition: all 0.2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-error { background: #C62828; }

/* ── Empty states ──────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--grey-500); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--black); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* ── Nudge cards ───────────────────────────────────────────────────────────── */
.nudge { background: #FFF8E1; border: 1px solid #FFE082; border-radius: var(--radius-sm); padding: 14px 16px; font-size: 13px; color: #5D4037; margin-top: 16px; }
.nudge strong { display: block; margin-bottom: 4px; }

/* ── Estate manager ────────────────────────────────────────────────────────── */
.institution-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--grey-100); }
.institution-row:last-child { border-bottom: none; }
.institution-name { font-weight: 600; flex: 1; }
.institution-type { font-size: 12px; color: var(--grey-500); }
.status-pill { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-not_started { background: var(--grey-100); color: var(--grey-500); }
.status-letter_ready { background: #E3F2FD; color: #1565C0; }
.status-sent { background: #E8F5E9; color: #2E7D32; }
.status-acknowledged { background: #F3E5F5; color: #6A1B9A; }
.status-complete { background: #E8F5E9; color: #1B5E20; }

/* ── Estate context — clay/copper accent throughout estate views ───────────── */

/* Sticky header — accent on text and bar only */
.estate-context .lifebook-sticky-name { color: var(--black); }
.estate-context .lifebook-sticky-pct  { color: var(--grey-500); }
/* (no bar-fill override — progress is always Support Blue, in every context) */

/* Section nav (right-hand sidebar in wizard) — clay border, black text */
.estate-context .section-nav-item.active {
  background: var(--white);
  border-left: 4px solid var(--estate-accent);
  padding-left: 10px;
}
.estate-context .section-nav-item.active .section-nav-label { color: var(--black); font-weight: 600; }

/* Wizard card */
.estate-context .wizard-card-icon { color: var(--estate-accent); }
.estate-context .save-indicator { color: var(--estate-accent); }

/* Progress bar inside completion card (estate dashboard) — Support Blue like all progress */
.estate-context .estate-progress-fill { background: var(--support); }

/* Form focus ring */
.estate-context .form-input:focus,
.estate-context .form-select:focus,
.estate-context .form-textarea:focus {
  border-color: var(--estate-accent);
  box-shadow: 0 0 0 3px rgba(196, 122, 74, 0.12);
}

/* Badge / teal accents in estate context */
.estate-context .badge-teal { background: var(--estate-accent-light); color: var(--estate-accent-dark); }
.estate-context .nav-create { color: var(--estate-accent) !important; }

/* ── Plan context — accent on text and bar only ──── */
.plan-context .lifebook-sticky-name { color: var(--black); }
.plan-context .lifebook-sticky-pct  { color: var(--grey-500); }
/* (no bar-fill override — progress is always Support Blue, in every context) */

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { width: 100%; height: auto; min-width: unset; position: static; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  #main-screen { flex-direction: column; }
  #content { margin-left: 0; padding: 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field-grid .span-1, .field-grid .span-2, .field-grid .span-3 { grid-column: span 2; }
  .field-grid .full, .field-grid .span-4 { grid-column: 1 / -1; }
  .sidebar-footer { display: none; }
}

/* ── Print ─────────────────────────────────────────────────────────────────── */
@media print {
  #sidebar, .full-plan-toolbar, .scan-area, .wizard-nav,
  .section-helper-row, .lifebook-sticky-header,
  .lifebook-sidenav, .lb2-sidenav { display: none !important; }
  * { overflow: visible !important; max-height: none !important; }
  #content { margin-left: 0 !important; padding: 0 !important; overflow: visible !important; }
  #main-screen { overflow: visible !important; }
  .plan-section { border: 1px solid #ddd; padding: 16px; margin-bottom: 16px; page-break-inside: avoid; break-inside: avoid; }
  .plan-section:not(:first-child) { page-break-before: auto; }
  body { font-family: Georgia, serif; font-size: 12pt; }
}

/* Mobile-only sign-in intro (explains what Cairn Life is); shown on phones via mobile.css */
.auth-mobile-intro{display:none}

/* ── Dark-forest sidebar chrome (new shell design, Jun 2026) ───────────────────
   Appended as scoped overrides so the existing nav markup (incl. the Estates
   section and the floating Feedback button) is untouched. Logo band kept light
   because logo_wide_white.png has a white background. */
#sidebar{ background:#062922 !important; border-right:1px solid #0c3a30 !important; }
#sidebar .nav-group-label{ color:#9DB6A4 !important; }
#sidebar nav a, #sidebar .nav-top-link{ color:#C3D2C8 !important; }
#sidebar nav a:hover{ background:rgba(255,255,255,.06) !important; color:#fff !important; }
#sidebar #nav-my-plan-name{ color:#fff !important; }
#sidebar #nav-my-plan-sub{ color:#9DB6A4 !important; }
/* The owner's own LifeBook is the clear primary; shared books are secondary.
   Subtle tint for prominence — DON'T override the hover/active vertical accent. */
#sidebar #nav-my-plan-link{ background:rgba(143,178,157,.14); }
#sidebar #nav-my-plan-name{ color:#fff !important; }
/* Shared books sit indented beneath "Your LifeBook" so the owner's book reads as the parent. */
#sidebar #nav-shared-plans{ padding-left:14px; margin-left:6px; border-left:1px solid rgba(255,255,255,.08); }
#sidebar #nav-shared-plans a{ opacity:.62; }
#sidebar #nav-shared-plans a:hover{ opacity:1; }
/* Estates isn't shipped — show only the 'coming soon' link, not a live estate. */
#sidebar #nav-my-estates{ display:none !important; }
#sidebar .nav-section{ border-bottom-color:rgba(255,255,255,.08) !important; }
#sidebar .nav-section-header{ color:#9DB6A4 !important; }
#sidebar .nav-section-header:hover{ background:rgba(255,255,255,.06) !important; }
#sidebar .nav-chevron{ color:#9DB6A4 !important; }
#sidebar .nav-section-plans a.active,
#sidebar .nav-section-estates a.active,
#sidebar nav a.active{ background:rgba(255,255,255,.07) !important; color:#fff !important; border-left:3px solid #F0631F !important; }
.sidebar-footer{ background:#062922 !important; border-top:1px solid rgba(255,255,255,.10) !important; }
.sidebar-footer .nav-top-link{ color:#C3D2C8 !important; }
.footer-user:hover{ background:rgba(255,255,255,.06) !important; }
.footer-user-name{ color:#fff !important; }
.footer-user-email{ color:#8fa094 !important; }
.footer-user-avatar{ background:rgba(255,255,255,.08) !important; color:#9DB6A4 !important; }
.footer-chevron{ color:#9DB6A4 !important; }
.footer-popover{ background:#0a3329 !important; border-top-color:rgba(255,255,255,.10) !important; }
.footer-popover button{ color:#C3D2C8 !important; }
.footer-popover button:hover{ background:rgba(255,255,255,.06) !important; }

/* ── Warm cream content canvas + dark logo band (new home shell) ──────────── */
#content{ background:#F5F0EB; }
.sidebar-logo{ background-color:#062922 !important; border-bottom:1px solid rgba(255,255,255,.10) !important; }
.sidebar-logo span{ color:#fff !important; }

/* ── Fix: #sidebar IS the <nav>, so hover/active must target #sidebar a ──────
   (the earlier "#sidebar nav a" rules never matched, so the light-grey hover
   leaked through as a big pale box). Subtle dark highlight + orange marker. */
#sidebar a, #sidebar .nav-top-link{ color:#C3D2C8 !important; }
#sidebar a:hover, #sidebar a.estate-link:hover{ background:rgba(255,255,255,.06) !important; color:#fff !important; }
#sidebar #nav-my-plan-link:hover #nav-my-plan-name, #sidebar a:hover #nav-my-plan-name{ color:#fff !important; }
#sidebar .nav-section-plans a.active,
#sidebar .nav-section-estates a.active,
#sidebar a.active{ background:rgba(255,255,255,.05) !important; color:#fff !important; border-left:3px solid #F0631F !important; }
#sidebar a.active.estate-link{ border-left-color:#F0631F !important; }
#sidebar #nav-my-plan-name{ color:#fff !important; }

/* ── Section-coloured active markers: LifeBook = forest, Estate = slate ─────── */
#sidebar .nav-section-plans a.active,
#sidebar a.active{ border-left-color:#365D49 !important; }
#sidebar .nav-section-estates a.active,
#sidebar a.active.estate-link{ border-left-color:#46606E !important; }

/* Brighter, token-driven active markers (edit css/tokens/colors.css to recolour) */
#sidebar .nav-section-plans a.active,
#sidebar a.active{ border-left-color: var(--nav-active-life, #859E84) !important; }
#sidebar .nav-section-estates a.active,
#sidebar a.active.estate-link{ border-left-color: var(--nav-active-estate, #9FB1BB) !important; }

/* ── Completion-order table (Account → Completion order) ───────────────────── */
.plan-wrap{ overflow-x:auto; border:1px solid var(--border,#e5e5e5); border-radius:10px; }
.plan-tbl{ width:100%; border-collapse:collapse; font-size:13px; }
.plan-tbl th{ text-align:left; font-size:11px; letter-spacing:.04em; text-transform:uppercase; color:var(--grey-500,#767676); font-weight:700; padding:10px 14px; background:var(--grey-50,#f7f7f5); border-bottom:1px solid var(--border,#e5e5e5); position:sticky; top:0; }
.plan-tbl td{ padding:9px 14px; border-bottom:1px solid var(--grey-100,#f1f1f1); vertical-align:top; line-height:1.45; }
.plan-tbl tbody tr:last-child td{ border-bottom:none; }
.plan-tbl td:first-child{ white-space:nowrap; color:var(--grey-700,#3a3a3a); }
.plan-tbl td:nth-child(2){ color:var(--grey-600,#555); }
.plan-q{ color:var(--grey-500,#767676); font-style:italic; max-width:340px; }
.plan-pri{ display:inline-block; font-size:11px; font-weight:700; padding:2px 9px; border-radius:999px; background:var(--grey-100,#eee); color:var(--grey-500,#767676); }
.plan-pri.ess{ background:rgba(143,178,157,.18); color:#3c6b4f; }
.plan-tbl td.plan-num{ width:38px; text-align:right; color:var(--grey-400,#9ca3af); font-variant-numeric:tabular-nums; font-weight:600; }
.plan-tbl tr.plan-grp td{ background:var(--grey-50,#f7f7f5); font-size:11px; letter-spacing:.05em; text-transform:uppercase; font-weight:700; color:var(--grey-500,#767676); padding:8px 14px; }
.plan-tbl tr.plan-grp.ess td{ background:rgba(143,178,157,.14); color:#3c6b4f; }

/* ── UI consistency pass (22 Jun 2026) ─────────────────────────────────────────
   One page shell: centred to the LifeBook column width, Playfair page titles,
   fully boxy cards (no left-accent stripes), calmer section nav, and top tabs. */
#content > *:not(#lb3root){ max-width:1180px; margin-left:0; margin-right:0; }
.page-title{ font-family:var(--font-display); font-weight:600; font-size:30px; letter-spacing:-.01em; }
/* Uniform boxy cards — neutralise inline left-accent stripes app-wide */
#content .card[style*="border-left"]{ border-left:1px solid var(--border) !important; }
/* Calmer section-nav (used by Settings) — soft background, no sliding bar */
.section-nav-item:hover{ background:var(--grey-100); border-left:none !important; padding-left:14px !important; }
.section-nav-item.active{ background:var(--sage-tint); border-left:none !important; padding-left:14px !important; }
.section-nav-item.section-nav-support.active{ background:var(--support-tint); }
/* Top anchor tabs — consistent in-page section nav, single column, mobile-friendly */
.page-tabs{ display:flex; flex-wrap:wrap; gap:8px; margin:0 0 22px; }
.page-tab{ font-size:13px; font-weight:600; color:var(--grey-600); background:var(--white); border:1px solid var(--border); border-radius:999px; padding:6px 14px; cursor:pointer; transition:all .12s; }
.page-tab:hover{ border-color:var(--sage-soft); color:var(--grey-800); }
.page-tab.active{ background:var(--forest); border-color:var(--forest); color:#fff; }
.page-tab.tab-support.active{ background:var(--support); border-color:var(--support); }
/* Trusted-sources logo grid (Knowledge Base) */
.kb-srcgrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:10px; margin-top:6px; }
.kb-src{ display:flex; gap:10px; align-items:flex-start; padding:12px; border:1px solid var(--border); border-radius:10px; background:var(--white); text-decoration:none; transition:border-color .12s; }
.kb-src:hover{ border-color:var(--sage-soft); }
.kb-src img{ width:22px; height:22px; border-radius:5px; flex:none; margin-top:1px; background:var(--grey-100) }
.kb-src .kb-src-b{ font-size:13px; font-weight:700; color:var(--grey-800); display:block }
.kb-src .kb-src-s{ font-size:12px; color:var(--grey-500); line-height:1.4 }

/* ── Consistency pass 2 (22 Jun 2026): header continuity + sticky sub-tabs + rounded ──
   Page headers sit on the cream surface (not white) so they're continuous with the
   page, like the LifeBook. Sub-tabs stick beneath the header. Rounded corners everywhere. */
.lifebook-sticky-header{ background:var(--cream,#F5F0EB) !important; }
.page-tabs{ position:sticky; top:56px; z-index:30; background:var(--cream,#F5F0EB); padding:12px 0; margin:0 0 8px; }
/* Rounded everywhere — retire the home page's square one-off + heavy glow */
.hm-card,.hm-plan,.hm-tile,.hm-kbcard,.hm-shared,.hm-next{ border-radius:var(--radius,12px) !important; }
.hm-card{ box-shadow:var(--shadow-md) !important; }

/* Page titles use Playfair to match the LifeBook (continuity). renderPageHeader
   emits .lifebook-sticky-name, so style that — not just .page-title. */
.lifebook-sticky-name{ font-family:var(--font-display,'Playfair Display',Georgia,serif) !important; font-weight:600 !important; letter-spacing:-.01em; }

/* Header text aligns with the page column (no extra left indent over the modules) */
.lifebook-sticky-header{ padding-left:0 !important; padding-right:0 !important; }
