/* ═══════════════════════════════════════════════════════
   LIMICELIA DESIGN SYSTEM  ·  v3.0
   One voice. One accent. Hairlines not shadows.
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=JetBrains+Mono:wght@400;500;600&family=Barlow+Semi+Condensed:wght@500;600;700&display=swap');

:root {
  /* ── Palette — warm paper ── */
  --bg:              oklch(97.0% 0.012 82);   /* warm paper — #F7F3EE */
  --bg2:             oklch(94.5% 0.016 82);   /* ivory well — #F0EBE3 */
  --bg3:             oklch(91.5% 0.020 82);   /* parchment fill */
  --surface:         #ffffff;
  --surface2:        oklch(97.0% 0.012 82);
  --surface3:        oklch(94.5% 0.016 82);
  --surface-elevated:#ffffff;

  --ink:  oklch(22.0% 0.012 80);   /* near-black */
  --ink2: oklch(36.0% 0.013 80);
  --ink3: oklch(52.0% 0.013 80);
  --ink4: oklch(66.0% 0.011 80);
  --ink5: oklch(80.0% 0.009 80);

  /* ── Single accent — ochre ── */
  --amber:     oklch(58.0% 0.130 60);   /* ochre — primary accent */
  --amber-dk:  oklch(44.0% 0.120 55);   /* ochre-deep — text/action */
  --amber-lt:  oklch(72.0% 0.110 65);   /* ochre-light — hover */
  --amber-bg:  oklch(96.0% 0.018 70);   /* ochre tint bg */
  --amber-bdr: oklch(82.0% 0.055 65);   /* ochre border */
  --amber-glow:oklch(58% 0.130 60 / 0.12);

  --gold:      oklch(62.0% 0.120 72);

  /* ── Semantic — desaturated, data states only ── */
  --green:     oklch(58.0% 0.080 150);  /* sage */
  --green-bg:  oklch(95.0% 0.020 150);
  --green-bdr: oklch(80.0% 0.050 150);

  --red:       oklch(55.0% 0.130 35);   /* rust */
  --red-bg:    oklch(95.0% 0.018 35);
  --red-bdr:   oklch(80.0% 0.060 35);

  --blue:      oklch(52.0% 0.110 260);
  --blue-bg:   oklch(95.0% 0.018 260);
  --blue-bdr:  oklch(80.0% 0.055 260);

  --purple:    oklch(52.0% 0.110 310);
  --purple-bg: oklch(95.0% 0.016 310);
  --purple-bdr:oklch(80.0% 0.055 310);

  --border:    oklch(86.5% 0.014 82);   /* slightly warmer hairline */
  --border-s:  oklch(80.0% 0.018 82);
  --border-soft:oklch(91.0% 0.010 82);
  --border-focus: var(--amber-bdr);

  /* ── Shadows — hairlines only ── */
  --shadow-xs:    0 1px 0 oklch(88% 0.010 80 / 0.6);
  --shadow-sm:    0 1px 0 oklch(88% 0.010 80 / 0.6);
  --shadow:       0 1px 0 oklch(85% 0.012 80 / 0.5);
  --shadow-md:    0 2px 4px oklch(22% 0.012 80 / 0.06);
  --shadow-lg:    0 4px 12px oklch(22% 0.012 80 / 0.08);
  --shadow-xl:    0 8px 24px oklch(22% 0.012 80 / 0.10);
  --shadow-inset: inset 0 1px 2px oklch(22% 0.012 80 / 0.05);

  /* ── Fonts ── */
  --font-serif:   'Spectral', 'Iowan Old Style', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
  --font-ui:      'Barlow Semi Condensed', sans-serif;  /* legacy — nav/labels */
  --font-display: var(--font-serif);
  --font-stat:    var(--font-serif);

  /* ── Type scale ── */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15.5px;
  --text-lg:   17px;
  --text-xl:   22px;
  --text-2xl:  26px;
  --text-3xl:  40px;
  --text-hero: 56px;

  /* ── Spacing — 4px grid ── */
  --sp1: 4px;  --sp2: 8px;   --sp3: 12px;
  --sp4: 20px; --sp5: 28px;  --sp6: 40px;
  --sp7: 56px; --sp8: 80px;

  /* ── Component sizes ── */
  --btn-h:      40px;
  --btn-h-lg:   48px;
  --btn-h-sm:   32px;
  --input-h:    44px;
  --nav-h:      48px;
  --sidebar-w:  240px;
  --row-h:      52px;
  --card-pad:   22px;
  --content-w:  640px;
  --wide-w:     1100px;
  --r:          2px;
  --r-lg:       4px;
  --r-xl:       6px;

  /* ── Motion ── */
  --t:      .15s cubic-bezier(.4,0,.2,1);
  --t-fast: .1s  cubic-bezier(.4,0,.2,1);
  --t-slow: .28s cubic-bezier(.16,1,.3,1);
  --t-spring: .4s cubic-bezier(.34,1.56,.64,1);

  /* ─────────────────────────────────────────────────────
     UNIFIED v4 · "gallery soft" alias layer
     Names used by the .u-* atoms and any new page work.
     Re-points to existing tokens so old + new co-exist.
     ───────────────────────────────────────────────────── */
  --paper:        var(--bg);
  --paper-2:      var(--bg2);
  --paper-3:      var(--bg3);
  --surface-2:    var(--surface-elevated);

  --ink-2: var(--ink2);
  --ink-3: var(--ink3);
  --ink-4: var(--ink4);
  --ink-5: var(--ink5);

  --ochre:        var(--amber);
  --ochre-dk:     var(--amber-dk);
  --ochre-lt:     var(--amber-lt);
  --ochre-wash:   var(--amber-bg);
  --ochre-line:   var(--amber-bdr);

  /* Sage + clay re-aliased from existing semantic tokens */
  --sage:         var(--green);
  --sage-wash:    var(--green-bg);
  --sage-line:    var(--green-bdr);

  --clay:         var(--red);
  --clay-wash:    var(--red-bg);
  --clay-line:    var(--red-bdr);

  --line:         var(--border);
  --line-soft:    var(--border-soft);
  --line-strong:  var(--border-s);

  /* Type aliases — short names used by .u-* atoms + page-local CSS */
  --serif: var(--font-serif);
  --mono:  var(--font-mono);
  --ui:    var(--font-ui);

  /* Extra radii used by atoms */
  --r-sm:   4px;
  --r-md:   10px;
  --r-pill: 999px;

  /* Loose spacing scale (4px grid) used by .u-* atoms */
  --s1: 4px;   --s2: 8px;   --s3: 12px;  --s4: 16px;
  --s5: 20px;  --s6: 28px;  --s7: 40px;  --s8: 56px;  --s9: 80px;

  /* Loose type scale used by .u-* atoms */
  --t-meta:    11px;
  --t-xs:      12px;
  --t-sm:      14px;
  --t-base-fs: 15.5px;
  --t-lg:      18px;
  --t-xl:      22px;
  --t-2xl:     28px;
  --t-display: 38px;
  --t-hero:    56px;

  --t-base-anim: .18s cubic-bezier(.4,0,.2,1);
}

/* ── DARK MODE ── */
html[data-theme="dark"] {
  --bg:              oklch(16.0% 0.010 80);
  --bg2:             oklch(13.0% 0.010 80);
  --bg3:             oklch(20.0% 0.012 80);
  --surface:         oklch(20.0% 0.010 80);
  --surface2:        oklch(22.0% 0.012 80);
  --surface3:        oklch(24.0% 0.012 80);
  --surface-elevated:oklch(22.0% 0.010 80);

  --ink:  oklch(94.0% 0.008 80);
  --ink2: oklch(80.0% 0.010 80);
  --ink3: oklch(66.0% 0.011 80);
  --ink4: oklch(52.0% 0.012 80);
  --ink5: oklch(38.0% 0.012 80);

  --amber:     oklch(72.0% 0.110 65);
  --amber-dk:  oklch(58.0% 0.130 60);
  --amber-lt:  oklch(82.0% 0.090 70);
  --amber-bg:  oklch(22.0% 0.030 60);
  --amber-bdr: oklch(38.0% 0.060 58);
  --amber-glow:oklch(72% 0.110 65 / 0.14);

  --gold:      oklch(72.0% 0.110 72);

  --green:     oklch(72.0% 0.080 150);
  --green-bg:  oklch(22.0% 0.030 150);
  --green-bdr: oklch(38.0% 0.055 150);

  --red:       oklch(72.0% 0.120 35);
  --red-bg:    oklch(22.0% 0.035 35);
  --red-bdr:   oklch(38.0% 0.065 35);

  --blue:      oklch(74.0% 0.100 260);
  --blue-bg:   oklch(22.0% 0.030 260);
  --blue-bdr:  oklch(38.0% 0.060 260);

  --purple:    oklch(74.0% 0.100 310);
  --purple-bg: oklch(22.0% 0.030 310);
  --purple-bdr:oklch(38.0% 0.060 310);

  --border:      oklch(28.0% 0.012 80);
  --border-s:    oklch(34.0% 0.014 80);
  --border-soft: oklch(24.0% 0.010 80);
  --border-focus:oklch(58% 0.130 60);

  --shadow-xs:    0 1px 0 oklch(0% 0 0 / 0.30);
  --shadow-sm:    0 1px 0 oklch(0% 0 0 / 0.30);
  --shadow:       0 1px 0 oklch(0% 0 0 / 0.35);
  --shadow-md:    0 2px 6px oklch(0% 0 0 / 0.30);
  --shadow-lg:    0 4px 16px oklch(0% 0 0 / 0.40);
  --shadow-xl:    0 8px 28px oklch(0% 0 0 / 0.50);
  --shadow-inset: inset 0 1px 2px oklch(0% 0 0 / 0.30);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── TWO ROOMS — practice room: same furniture, cooler hue ── */
[data-room="practice"] {
  --bg:      oklch(96.5% 0.012 235);   /* cool paper — visibly blue-gray vs warm home */
  --bg2:     oklch(94.0% 0.016 235);
  --bg3:     oklch(91.0% 0.020 235);
  --surface2: oklch(96.5% 0.012 235);
  --border:   oklch(86.0% 0.014 220);
}
[data-room="practice"] .topbar {
  background: var(--bg);  /* topbar = same page color, no separation */
}
[data-room="practice"] .sidebar {
  background: oklch(97.5% 0.010 235);  /* sidebar fractionally lighter */
}

/* ── TYPOGRAPHY ── */
.t-xs  { font-size: var(--text-xs); }
.t-sm  { font-size: var(--text-sm); }
.t-base{ font-size: var(--text-base); }
.t-lg  { font-size: var(--text-lg); }
.t-xl  { font-size: var(--text-xl); }
.t-2xl { font-size: var(--text-2xl); }
.t-3xl { font-size: var(--text-3xl); }
.mono  { font-family: var(--font-mono); }
.upper { text-transform: uppercase; letter-spacing: .1em; }
.label { font-family: var(--font-ui); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink3); }
.muted { color: var(--ink4); }
.strong{ color: var(--ink); font-weight: 600; }
.italic{ font-style: italic; }
.amber { color: var(--amber); }
.green { color: var(--green); }
.red   { color: var(--red); }
.blue  { color: var(--blue); }

/* ── LAYOUT ── */
.container { max-width: var(--wide-w); margin: 0 auto; padding: var(--sp5) var(--sp6); }
.container-sm { max-width: var(--content-w); margin: 0 auto; padding: var(--sp5) var(--sp5); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--sp1); } .gap-2 { gap: var(--sp2); }
.gap-3 { gap: var(--sp3); } .gap-4 { gap: var(--sp4); }
.gap-5 { gap: var(--sp5); }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: var(--sp2); }
.mt-3 { margin-top: var(--sp3); }
.mt-4 { margin-top: var(--sp4); }
.mt-5 { margin-top: var(--sp5); }

/* ── SURFACE / CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--card-pad);
}
.card-sm { padding: var(--sp4); border-radius: var(--r); }
.card-flat { box-shadow: none; border: 1px solid var(--border); }
.card-amber { background: var(--amber-bg); border-color: var(--amber-bdr); }
.card-green { background: var(--green-bg); border-color: var(--green-bdr); }
.card-red   { background: var(--red-bg);   border-color: var(--red-bdr); }
.card-blue  { background: var(--blue-bg);  border-color: var(--blue-bdr); }
.card-surface3 { background: var(--surface3); }

/* Interactive card — lift on hover */
.card-interactive {
  cursor: pointer;
  transition: border-color var(--t);
}
.card-interactive:hover { border-color: var(--amber-bdr); }
.card-interactive:active { opacity: .92; transition-duration: .06s; }

/* ── TOPBAR ── */
.topbar {
  height: 52px;
  background: var(--bg, #F7F3EE);   /* matches page — no separation */
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: none;   /* hairline only — no drop shadow */
  flex-shrink: 0;
}
.topbar-brand {
  font-size: 13px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--amber, #A8621E);
  font-family: 'Spectral', Georgia, serif;
  font-weight: 400;
  text-decoration: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topbar-product-type {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink4, #9C8E85);
  border: 1px solid var(--border, #DDD5C8);
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.4;
  flex-shrink: 0;
}
.topbar-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink4);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp2);
  height: var(--btn-h);
  padding: 0 var(--sp5);
  border-radius: var(--r);
  border: 1.5px solid transparent;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.btn-primary {
  background: var(--amber-dk);
  color: #fff; border-color: var(--amber-dk);
}
.btn-primary:hover { background: var(--amber); border-color: var(--amber); }
.btn-primary:active { opacity: .88; transition-duration: .06s; }
.btn-secondary {
  background: var(--surface-elevated); color: var(--ink2); border-color: var(--border-s);
}
.btn-secondary:hover { background: var(--bg2); border-color: var(--amber-bdr); color: var(--ink); }
.btn-secondary:active { background: var(--bg3); transition-duration: .06s; }
.btn-ghost { background: transparent; color: var(--amber); border-color: var(--amber-bdr); }
.btn-ghost:hover { background: var(--amber-bg); border-color: var(--amber); }
.btn-ghost:active { background: var(--amber-bg); opacity: .8; transition-duration: .06s; }
.btn-danger { background: transparent; color: var(--red); border-color: var(--red-bdr); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 1px 3px rgba(26,110,66,.2); }
.btn-success:hover { background: #165c38; }
.btn-sm { height: var(--btn-h-sm); padding: 0 var(--sp4); font-size: 11px; }
.btn-lg { height: var(--btn-h-lg); padding: 0 var(--sp6); font-size: 14px; }
.btn-full { width: 100%; }
.btn-icon { padding: 0; width: var(--btn-h); }
.btn-icon.btn-sm { width: var(--btn-h-sm); }

/* ── CHOICE BUTTONS (TurboTax style) ── */
.choice-group { display: flex; flex-direction: column; gap: var(--sp3); }
.choice-group.row { flex-direction: row; flex-wrap: wrap; }
.choice-btn {
  display: flex;
  align-items: center;
  gap: var(--sp4);
  padding: var(--sp4) var(--sp5);
  background: var(--surface-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--t);
  text-align: left;
  min-height: 64px;
  box-shadow: var(--shadow-xs);
  width: 100%;
}
.choice-btn:hover { border-color: var(--amber-bdr); background: var(--amber-bg); box-shadow: var(--shadow-sm); }
.choice-btn.selected {
  border-color: var(--amber); background: var(--amber-bg);
  box-shadow: 0 0 0 3px var(--amber-glow), var(--shadow-sm);
  transform: scale(1.005);
  transition: all var(--t-spring);
}
.choice-icon { font-size: 22px; flex-shrink: 0; width: 32px; text-align: center; }
.choice-label { font-size: var(--text-lg); color: var(--ink); font-family: 'Spectral', Georgia, serif; }
.choice-desc { font-size: var(--text-sm); color: var(--ink3); margin-top: 2px; font-family: var(--font-ui); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.choice-check { margin-left: auto; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; color: transparent; }
.choice-btn.selected .choice-check { background: var(--amber); border-color: var(--amber); color: #fff; }

/* ── FORM INPUTS ── */
.form-group { display: flex; flex-direction: column; gap: var(--sp2); }
.form-label { font-family: var(--font-ui); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink3); }
.form-label .req { color: var(--amber-lt); }
.form-hint { font-size: var(--text-sm); color: var(--ink4); font-style: italic; margin-top: -var(--sp1); }

input[type=text], input[type=number], input[type=email], input[type=password],
textarea, select {
  width: 100%;
  height: var(--input-h);
  padding: 0 var(--sp4);
  border: 2px solid var(--border);
  border-radius: var(--r);
  font-family: var(--font-serif);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  appearance: none;
  -webkit-appearance: none;
}
/* Number inputs — hide spinner arrows that clip text, enforce minimum width */
input[type=number] {
  min-width: 110px;
  -moz-appearance: textfield;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
textarea {
  height: auto;
  min-height: 100px;
  padding: var(--sp3) var(--sp4);
  line-height: 1.65;
  resize: vertical;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow), var(--shadow-xs);
}
input::placeholder, textarea::placeholder { color: var(--ink4); font-style: italic; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B5D55' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; cursor: pointer; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px; border: 1px solid;
  white-space: nowrap; font-weight: 600;
}
.badge-amber  { background: var(--amber-bg);  color: var(--amber-dk); border-color: var(--amber-bdr); }
.badge-green  { background: var(--green-bg);  color: var(--green);    border-color: var(--green-bdr); }
.badge-red    { background: var(--red-bg);    color: var(--red);      border-color: var(--red-bdr); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue);     border-color: var(--blue-bdr); }
.badge-purple { background: var(--purple-bg); color: var(--purple);   border-color: var(--purple-bdr); }
.badge-gray   { background: var(--bg2);       color: var(--ink3);     border-color: var(--border); }

/* ── STAT CARD ── */
.stat-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp5) var(--card-pad);
  box-shadow: var(--shadow);
}
.stat-card.stat-primary { border-color: var(--amber-bdr); background: var(--amber-bg); border-left: 4px solid var(--amber); }
.stat-card.stat-success { border-color: var(--green-bdr); background: var(--green-bg); border-left: 4px solid var(--green); }
.stat-card.stat-warn    { border-color: var(--amber-bdr); background: var(--amber-bg); border-left: 4px solid var(--amber-lt); }
.stat-card.stat-info    { border-color: var(--blue-bdr);  background: var(--blue-bg);  border-left: 4px solid var(--blue); }
.stat-card.stat-alert   { border-color: var(--red-bdr);   background: var(--red-bg);   border-left: 4px solid var(--red); }
.stat-num { font-family: var(--font-stat); font-size: 44px; font-weight: 900; color: var(--ink); line-height: 1; letter-spacing: -.02em; }
.stat-label { font-family: var(--font-ui); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink3); margin-top: var(--sp2); display: block; }
.stat-detail { font-size: var(--text-sm); color: var(--ink4); font-style: italic; margin-top: var(--sp1); }

/* ── TABLE ── */
.tbl-wrap { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead { background: var(--bg2); }
.tbl th { font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink3); padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; transition: color var(--t); }
.tbl th:hover { color: var(--amber); }
.tbl th.sorted { color: var(--amber); }
.tbl td { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: var(--text-sm); color: var(--ink2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { cursor: pointer; transition: background var(--t-fast); }
.tbl tbody tr:hover td { background: var(--amber-bg); }
.tbl tbody tr:active td { background: var(--bg3); transition-duration: .04s; }
.td-primary { font-size: var(--text-lg); color: var(--ink); font-weight: 600; }
.td-secondary { font-size: var(--text-sm); color: var(--ink4); margin-top: 2px; font-family: var(--font-ui); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── SIDEBAR ── */
.sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: width .2s cubic-bezier(.4,0,.2,1), min-width .2s cubic-bezier(.4,0,.2,1); overflow: hidden; }
.sidebar.collapsed { width: 0 !important; min-width: 0 !important; border-right: none; }

/* Thin rail shown when sidebar is collapsed — click to expand */
.sidebar-rail {
  display: none;
  width: 18px; min-width: 18px; flex-shrink: 0;
  background: var(--surface2);
  border-right: 1.5px solid var(--border);
  cursor: pointer; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink4);
  transition: background .12s, color .12s;
}
.sidebar-rail:hover { background: var(--amber-bg); color: var(--amber); }
.sidebar.collapsed ~ .sidebar-rail { display: flex; }

/* Collapse button at bottom of sidebar */
.sidebar-collapse-btn {
  flex-shrink: 0; width: 100%; padding: 9px 16px;
  border: none; border-top: 1.5px solid var(--border);
  background: transparent; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-ui); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink4);
  transition: background .12s, color .12s;
}
.sidebar-collapse-btn:hover { background: var(--amber-bg); color: var(--amber-dk); }
.nav-section-label { font-family: var(--font-ui); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink4); padding: var(--sp4) var(--sp4) var(--sp2); }
.nav-item {
  display: flex; align-items: center; gap: var(--sp3);
  height: var(--nav-h); padding: 0 var(--sp4);
  border: none; background: none; width: 100%; text-align: left;
  cursor: pointer; transition: background var(--t), border-color var(--t);
  border-left: 3px solid transparent;
  position: relative;
}
.nav-item:hover { background: var(--amber-bg); }
.nav-item.active {
  background: var(--amber-bg);
  border-left-color: var(--amber);
  box-shadow: inset 1px 0 0 var(--amber-glow);
}
.nav-item .nav-icon { font-size: 18px; width: 26px; text-align: center; color: var(--amber); opacity: .65; flex-shrink: 0; transition: opacity var(--t); }
.nav-item:hover .nav-icon { opacity: .9; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-label { font-size: var(--text-sm); color: var(--ink3); letter-spacing: .01em; }
.nav-item:hover .nav-label { color: var(--ink2); }
.nav-item.active .nav-label { color: var(--ink); font-weight: 600; font-size: var(--text-sm); }
.nav-badge { margin-left: auto; font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 11px; background: var(--amber); color: #fff; border-radius: 10px; padding: 2px 7px; min-width: 22px; text-align: center; }

/* ── SIDEBAR NAV v4 — two-room design ── */
/* User header */
.sn-user { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.sn-user-eyebrow { font-family: 'Courier New', monospace; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink4); margin-bottom: 3px; }
.sn-user-name { font-family: 'Spectral', Georgia, serif; font-size: 17px; font-weight: 400; font-style: italic; color: var(--ink); }
/* Section label */
.sn-section { font-family: 'Courier New', monospace; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink4); padding: 14px 18px 4px; display: flex; align-items: center; justify-content: space-between; }
/* Nav item */
.sn-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 18px; width: 100%; border: none; border-left: 2px solid transparent;
  background: none; text-align: left; cursor: pointer; text-decoration: none;
  font-family: 'Barlow Semi Condensed', system-ui, sans-serif; font-size: 13.5px;
  font-weight: 500; color: var(--ink3); letter-spacing: .01em;
  transition: background .1s, color .1s; white-space: nowrap;
}
.sn-item:hover { background: var(--amber-bg); color: var(--ink); }
.sn-item.active { background: var(--amber-bg); border-left-color: var(--amber); color: var(--ink); font-weight: 600; }
.sn-item-icon { font-size: 13px; width: 18px; text-align: center; flex-shrink: 0; opacity: .55; line-height: 1; }
.sn-item.active .sn-item-icon { opacity: 1; }
.sn-item-label { flex: 1; }
.sn-item-badge { font-family: 'Courier New', monospace; font-size: 10px; font-weight: 700;
  background: var(--amber); color: #fff; border-radius: 10px; padding: 1px 6px; min-width: 18px;
  text-align: center; flex-shrink: 0; }
.sn-item-badge.quiet { background: var(--bg2); color: var(--ink4); border: 1px solid var(--border); }
/* Page view header (eyebrow + title + subhead) */
.pv-header { padding: 28px 32px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pv-eyebrow { font-family: 'Courier New', monospace; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--amber); margin-bottom: 6px; }
.pv-title { font-family: 'Spectral', Georgia, serif; font-size: 32px; font-weight: 300; color: var(--ink); line-height: 1.1; letter-spacing: -.01em; }
.pv-sub { font-size: 14px; color: var(--ink3); margin-top: 6px; font-style: italic; line-height: 1.5; }
@media (max-width: 680px) {
  .pv-header { padding: 16px 18px 14px; }
  .pv-title { font-size: 24px; }
  .pv-sub { font-size: 13px; }
}
/* Stage KPI strip */
.stage-strip { display: flex; gap: 10px; padding: 16px 32px; flex-wrap: wrap; }
.stage-card { flex: 1; min-width: 110px; padding: 14px 16px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer; transition: border-color .15s; }
.stage-card:hover { border-color: var(--amber-bdr); }
.stage-card.active { border-color: var(--amber); background: var(--amber-bg); }
.stage-card-label { font-family: 'Courier New', monospace; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink4); margin-bottom: 6px; }
.stage-card-count { font-family: 'Spectral', Georgia, serif; font-size: 26px; font-weight: 300; color: var(--ink); line-height: 1; }
.stage-card-band { font-family: 'Courier New', monospace; font-size: 10px; color: var(--ink4); margin-top: 3px; }
/* Confidence pill — High·78%, Med·likely, Low·stale */
.conf-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-family: 'Courier New', monospace; font-size: 10px; font-weight: 600; border: 1px solid; white-space: nowrap; flex-shrink: 0; }
.conf-pill--high { background: var(--sage-wash, #edf6ee); color: var(--sage, #2E7D4F); border-color: var(--sage-line, #b8dcbf); }
.conf-pill--med  { background: var(--ochre-wash, #FFF8EE); color: var(--ochre, #A8621E); border-color: var(--ochre-line, #F0D9B0); }
.conf-pill--low  { background: var(--clay-wash, #f8f0ea); color: var(--clay, #7C5C42); border-color: var(--clay-line, #d9c4b0); }
.conf-pill--stale{ background: var(--bg2, #F5F0EA); color: var(--ink4, #B5AFA8); border-color: var(--border, #DDD5C8); }

/* ── WIZARD ── */
.wizard-overlay { display: none; position: fixed; inset: 0; background: rgba(26,23,20,.5); z-index: 500; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.wizard-overlay.open { display: flex; }
.wizard-modal {
  background: var(--surface-elevated);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  width: 580px; max-width: 95vw;
  max-height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: wizardIn var(--t-spring) both;
}
@keyframes wizardIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.wizard-header { padding: var(--sp5) var(--sp6) var(--sp4); border-bottom: 1px solid var(--border); background: var(--bg2); }
.wizard-step-label { font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--amber); margin-bottom: var(--sp2); }
.wizard-question { font-size: var(--text-xl); color: var(--ink); line-height: 1.4; font-family: 'Spectral', Georgia, serif; }
.wizard-question-hint { font-size: var(--text-base); color: var(--ink3); font-style: italic; margin-top: var(--sp2); }
/* Progress dots */
.wizard-dots { display: flex; gap: var(--sp2); margin-top: var(--sp4); }
.wizard-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all var(--t); }
.wizard-dot.done { background: var(--green); }
.wizard-dot.active { background: var(--amber); width: 24px; border-radius: 4px; }
/* Body + footer */
.wizard-body { flex: 1; overflow-y: auto; padding: var(--sp5) var(--sp6); }
.wizard-footer { padding: var(--sp4) var(--sp6); border-top: 1px solid var(--border); display: flex; gap: var(--sp3); align-items: center; background: var(--surface2); }
.wizard-footer .wizard-back { color: var(--ink3); font-size: var(--text-sm); margin-right: auto; }

/* ── SIDE PANEL ── */
.panel-overlay { display: none; position: fixed; inset: 0; background: rgba(26,23,20,.3); z-index: 300; backdrop-filter: blur(2px); }
.panel-overlay.open { display: block; }
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 540px;
  background: var(--surface-elevated); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl); z-index: 301;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--t-slow);
}
.side-panel.open { transform: translateX(0); }
.panel-header { padding: var(--sp5) var(--sp5) var(--sp4); border-bottom: 1px solid var(--border); background: var(--bg2); display: flex; align-items: flex-start; gap: var(--sp3); }
.panel-title { font-size: var(--text-xl); color: var(--ink); font-family: var(--font-display); font-weight: 700; flex: 1; line-height: 1.2; letter-spacing: -.01em; }
.panel-body { flex: 1; overflow-y: auto; padding: var(--sp5); }
.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border-s); border-radius: 2px; }
.panel-footer { padding: var(--sp4) var(--sp5); border-top: 1px solid var(--border); display: flex; gap: var(--sp3); justify-content: flex-end; background: var(--surface2); }

/* ── TOAST / SAVE INDICATOR ── */
.toast-bar {
  position: fixed; bottom: var(--sp6); left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: #fff; border-radius: 28px;
  padding: 10px var(--sp5); font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  box-shadow: var(--shadow-lg); z-index: 999; opacity: 0;
  transition: opacity var(--t-slow), transform var(--t-slow);
  pointer-events: none;
  display: flex; align-items: center; gap: var(--sp2);
  border: 1px solid rgba(255,255,255,.08);
}
.toast-bar.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-bar.success { background: var(--green); }
.toast-bar.error   { background: var(--red); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: var(--sp8) var(--sp5); color: var(--ink4); }
.empty-state-icon { font-size: 48px; margin-bottom: var(--sp4); opacity: .4; }
.empty-state-title { font-size: var(--text-xl); color: var(--ink3); margin-bottom: var(--sp3); }
.empty-state-body { font-size: var(--text-base); line-height: 1.65; max-width: 380px; margin: 0 auto; }

/* ── FILTER BAR ── */
.filter-bar { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: var(--sp3) var(--sp4); display: flex; gap: var(--sp3); align-items: center; flex-wrap: wrap; box-shadow: var(--shadow-sm); }
.filter-bar input[type=text], .filter-bar select { height: 44px; font-size: var(--text-sm); }
.filter-bar .filter-label { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink4); white-space: nowrap; }

/* ── SECTION BLOCK ── */
.section-block { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); margin-bottom: var(--sp4); }
.section-head { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 14px var(--sp5); display: flex; align-items: center; gap: var(--sp3); }
.section-title { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--amber); flex: 1; }
.section-body { padding: var(--sp4) var(--sp5); }

/* ── SKELETON LOADER ── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--surface2) 50%, var(--bg2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r);
}
.skeleton-text  { height: 16px; margin-bottom: 8px; }
.skeleton-title { height: 24px; width: 60%; margin-bottom: 12px; }
.skeleton-btn   { height: 40px; width: 120px; border-radius: var(--r); }
.skeleton-row   { height: 48px; border-radius: 6px; margin-bottom: 8px; }

/* ── PROGRESS BAR ── */
.progress-bar { background: var(--border); border-radius: 4px; height: 4px; overflow: hidden; box-shadow: var(--shadow-inset); }
.progress-fill { background: linear-gradient(90deg, var(--amber-lt), var(--amber)); height: 100%; border-radius: 4px; transition: width var(--t-slow); }

/* ── DIVIDERS ── */
hr.divider { border: none; border-top: 1px solid var(--border); margin: var(--sp5) 0; }
.form-section-label { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--amber); border-bottom: 1px solid var(--amber-bdr); padding-bottom: var(--sp2); margin: var(--sp5) 0 var(--sp4); }

/* ── MARKDOWN READER ── */
.md-body h1 { font-size: var(--text-2xl); font-weight: 700; color: var(--ink); margin-bottom: var(--sp3); line-height: 1.2; }
.md-body h2 { font-size: var(--text-xl); font-weight: 700; color: var(--ink); margin-top: var(--sp6); margin-bottom: var(--sp3); padding-bottom: var(--sp2); border-bottom: 1px solid var(--border); }
.md-body h3 { font-size: var(--text-lg); font-weight: 600; font-style: italic; color: var(--amber); margin-top: var(--sp5); margin-bottom: var(--sp2); }
.md-body h4 { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink3); margin-top: var(--sp4); margin-bottom: var(--sp2); }
.md-body p { color: var(--ink2); margin-bottom: var(--sp4); font-size: var(--text-base); }
.md-body strong { color: var(--ink); font-weight: 700; }
.md-body em { color: var(--amber-dk); font-style: italic; }
.md-body a { color: var(--amber); text-decoration: none; border-bottom: 1px solid var(--amber-bdr); }
.md-body a:hover { border-bottom-color: var(--amber); }
.md-body ul, .md-body ol { padding-left: var(--sp5); margin-bottom: var(--sp4); color: var(--ink2); }
.md-body li { margin-bottom: var(--sp2); line-height: 1.7; }
.md-body blockquote { border-left: 3px solid var(--amber-bdr); padding: var(--sp3) var(--sp5); margin: var(--sp4) 0; background: var(--amber-bg); border-radius: 0 var(--r) var(--r) 0; }
.md-body blockquote p { color: var(--ink2); font-style: italic; margin-bottom: 0; }
.md-body table { width: 100%; border-collapse: collapse; margin: var(--sp5) 0; box-shadow: var(--shadow-sm); border-radius: var(--r); overflow: hidden; }
.md-body th { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); text-align: left; padding: 12px var(--sp4); border-bottom: 2px solid var(--border); background: var(--bg2); }
.md-body td { padding: 12px var(--sp4); border-bottom: 1px solid var(--border); font-size: var(--text-base); color: var(--ink2); vertical-align: top; }
.md-body tr:hover td { background: var(--amber-bg); }
.md-body code { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 15px; background: var(--bg2); color: var(--amber-dk); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); }
.md-body pre { background: var(--bg2); border: 1px solid var(--border); padding: var(--sp4) var(--sp5); margin: var(--sp4) 0; overflow-x: auto; border-radius: var(--r); font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 14px; line-height: 1.6; }
.md-body pre code { background: none; border: none; padding: 0; font-size: 14px; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: var(--sp6) 0; }

/* ── MOBILE ── */
@media (max-width: 680px) {
  :root { --card-pad: 20px; --btn-h: 56px; --nav-h: 64px; }
  .container { padding: var(--sp4); }
  .container-sm { padding: var(--sp4); }
  .hide-mobile { display: none !important; }
  .choice-group.row { flex-direction: column; }

  /* Wizard footer: stack buttons on small screens */
  .wizard-footer { flex-wrap: wrap; gap: 8px; }
  .wizard-footer > div[style*="margin-left:auto"],
  .wizard-footer > div[style*="margin-left: auto"] {
    margin-left: 0 !important;
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .wizard-footer .btn { flex: 1; justify-content: center; min-height: 44px; }
  .wizard-modal { width: 100% !important; max-width: 100vw !important; border-radius: var(--r-lg) var(--r-lg) 0 0 !important; margin-top: auto; max-height: 92vh; }
  .wizard-overlay { align-items: flex-end !important; }
}

/* ── MOBILE SHELL — hamburger + slide-over sidebar ── */
/* Hamburger button — hidden on desktop */
.lim-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  margin-right: 8px;
  border-radius: var(--r);
  font-size: 20px;
  line-height: 1;
  color: var(--ink2);
  transition: background .12s, color .12s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.lim-hamburger:hover { background: var(--amber-bg); color: var(--amber-dk); }

/* Sidebar overlay — hidden by default */
.lim-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,23,20,.45);
  z-index: 290;
  opacity: 0;
  transition: opacity .22s ease;
}
.lim-nav-overlay.open { opacity: 1; }

@media (max-width: 640px) {
  /* Show hamburger */
  .lim-hamburger { display: flex; align-items: center; justify-content: center; }

  /* Overlay becomes visible when open class added via JS */
  .lim-nav-overlay { display: block; pointer-events: none; }
  .lim-nav-overlay.open { pointer-events: all; }

  /* Slide-over sidebar */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: -280px;
    bottom: 0;
    width: 260px !important;
    min-width: 260px !important;
    z-index: 300;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(26,23,20,.18);
    transition: left .22s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.mobile-open {
    left: 0;
  }
  /* Collapsed state irrelevant on mobile — always treat as expanded when open */
  .sidebar.collapsed {
    width: 260px !important;
    min-width: 260px !important;
    border-right: 1.5px solid var(--border) !important;
    left: -280px;
  }
  .sidebar.collapsed.mobile-open { left: 0; }

  /* Hide desktop collapse rail/button on mobile */
  .sidebar-rail,
  .sidebar-collapse-btn { display: none !important; }

  /* Topbar: ensure hamburger is visible, compress spacing */
  .topbar { padding: 0 14px; }
  .topbar-sub { display: none; }
}

/* ── MOBILE TABLES → STACKED CARDS ── */
/* .tbl used in limicelia-admin (pipeline) and limicelia-crm */
@media (max-width: 640px) {
  .tbl-wrap { border-radius: 0; border-left: none; border-right: none; box-shadow: none; overflow: visible; }

  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }

  .tbl tbody tr {
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--surface);
  }
  .tbl tbody tr:hover td { background: transparent; }
  .tbl tbody tr:first-child { margin-top: 0; }

  .tbl td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
    position: relative;
  }
  .tbl td:last-child { border-bottom: none; }

  /* Label injected via data-label attribute on each td */
  .tbl td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink4);
    margin-bottom: 3px;
  }

  /* Pipeline table in admin — existing .pipe-table uses same .tbl */
  .pipe-table thead { display: none; }

  /* Prevent horizontal scroll on table containers */
  .tbl-wrap,
  [style*="overflow-x:auto"],
  [style*="overflow-x: auto"] { overflow-x: hidden; }
}

/* ── MOBILE TWEAKS PANEL → BOTTOM SHEET ── */
/* Target: .tweaks-panel or #tweaksPanel floating bottom-right */
@media (max-width: 640px) {
  .tweaks-panel,
  #tweaksPanel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
    box-shadow: 0 -4px 24px rgba(26,23,20,.14) !important;
    z-index: 400;
    transform: translateY(100%);
    transition: transform .24s cubic-bezier(.4,0,.2,1);
    max-height: 80vh;
    overflow-y: auto;
  }
  .tweaks-panel.open,
  #tweaksPanel.open {
    transform: translateY(0);
  }

  /* FAB trigger button stays fixed bottom-right */
  .tweaks-fab,
  #tweaksFab {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 401;
  }
}

/* ════════════════════════════════════════════════
   UNIFIED v4 FIX-UP PASS
   ════════════════════════════════════════════════ */

/* 01 · Drop PORTAL badge — mode pill is the separator now */
.topbar-product-type { display: none !important; }

/* 02 · Topbar nav — quiet Spectral mixed-case, ochre underline on active */
.topbar-portal-link {
  /* Hidden at paint-time — nav.js rewrites topbar after lim:ready.
     display:none prevents old hardcoded links from flashing before nav.js runs. */
  display: none !important;
}
/* .topbar-portal-link hover/active rules removed — class is hidden, nav.js uses .nav-link */
/* Hide vertical sep after brand — mode pill is the visual break now */
.topbar > .topbar-sep:first-of-type { display: none; }

/* R3 · Mode pill — Personal / Practice context indicator */
.topbar-mode-pill {
  display: inline-flex; align-items: center;
  font-family: var(--mono, 'JetBrains Mono', monospace);
  font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--r-pill, 20px);
  border: 1px solid var(--ochre-line, #E8C9A0);
  color: var(--ochre, #A8621E);
  background: var(--ochre-wash, #FFF3E6);
  margin-left: 6px; flex-shrink: 0; user-select: none;
}

/* 06c · Quick actions composer */
.qa-composer {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 16px;
  background: var(--paper-2, var(--bg2));
  border: 1px solid var(--line-soft, var(--border));
  border-radius: var(--r-md);
}
.qa-composer-lead {
  font-family: var(--serif); font-style: italic; font-size: 15px;
  color: var(--ink3); padding-right: 4px;
}
.qa-composer-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px;
  background: var(--surface);
  border: 1px solid var(--line, var(--border));
  border-radius: var(--r-pill);
  font-family: var(--serif); font-size: 14px; color: var(--ink);
  cursor: pointer; transition: all .12s ease;
}
.qa-composer-btn:hover {
  border-color: var(--ochre);
  background: var(--ochre-wash);
  color: var(--ochre-dk);
}
.qa-composer-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink4); flex-shrink: 0;
  transition: background .12s ease;
}
.qa-composer-btn:hover .qa-composer-dot { background: var(--ochre); }
.qa-composer-or {
  font-family: var(--serif); font-style: italic;
  font-size: 14px; color: var(--ink4); padding: 0 4px;
}
.qa-composer-ai {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px;
  background: var(--ochre-wash);
  border: 1px solid var(--ochre-line, var(--amber-bdr));
  border-radius: var(--r-pill);
  font-family: var(--serif); font-size: 14px; color: var(--ochre-dk);
  cursor: pointer; transition: all .12s ease;
}
.qa-composer-ai:hover {
  background: var(--ochre); color: var(--paper, var(--bg)); border-color: var(--ochre);
}
.qa-composer-spark { font-size: 13px; }

/* 09 · Sidebar — always warm paper, ochre active accent */
.sidebar,
#mainSidebar { background: var(--paper, var(--bg)) !important; }

/* Shared sidebar nav items — used by shared-nav.js on all portal pages */
/* Sidebar nav container — force block/column stacking */
#mainNav,
.sidebar-nav {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}

.nav-area {
  display: flex !important; align-items: center; gap: 10px;
  width: 100%; padding: 7px 16px;
  border: none; border-left: 3px solid transparent;
  background: transparent; text-align: left;
  font-size: 13px; font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink3, #6B5D55); cursor: pointer;
  transition: background .12s, color .12s;
  text-decoration: none; /* for <a> tags */
  position: relative;
  box-sizing: border-box;
}
.nav-area:hover { background: var(--ochre-wash, #FFF3E6); color: var(--ink, #1A1714); }
.nav-area.active {
  background: var(--ochre-wash, #FFF3E6);
  border-left-color: var(--ochre, #A8621E);
  color: var(--ochre, #A8621E); font-weight: 700;
}
.nav-area-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-group-label {
  display: block !important;
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 700; font-size: 10px; text-transform: uppercase;
  letter-spacing: .09em; color: var(--ink4, #9E908A);
  padding: 14px 16px 4px;
  width: 100%;
}
.nav-group-label:first-child { padding-top: 6px; }
.nav-group-div {
  display: block !important;
  border: none; border-top: 1px solid var(--line, #E0D8CC);
  margin: 6px 12px;
}

.sidebar .nav-area.active,
.sidebar .nav-item.active {
  background: var(--ochre-wash, #FFF3E6) !important;
  color: var(--ochre, #A8621E) !important;
}
.sidebar .nav-area { position: relative; }
.sidebar .nav-area.active::before {
  content: ''; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 14px; background: var(--ochre, #A8621E); border-radius: 1px;
}

/* 10 · FAB — quiet ghost at rest */
.tweaks-fab, #tweaksFab {
  background: var(--surface) !important;
  color: var(--ink4) !important;
  border: 1px solid var(--line, var(--border)) !important;
  box-shadow: 0 4px 12px oklch(22% 0.012 80 / 0.08) !important;
  font-size: 16px !important;
  width: 40px !important; height: 40px !important;
}
.tweaks-fab:hover, #tweaksFab:hover {
  background: var(--ochre-wash) !important;
  color: var(--ochre-dk) !important;
  border-color: var(--ochre-line, var(--amber-bdr)) !important;
}
.tweaks-fab.is-active, #tweaksFab.is-active {
  background: var(--ink) !important;
  color: var(--paper, var(--bg)) !important;
  border-color: var(--ink) !important;
}

/* 12 · Topbar nav — managed by nav.js (uses .nav-link, not .topbar-portal-link) */

/* Presence indicator in sidebar header */
.sn-user-presence {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--serif); font-style: italic; font-size: 12px;
  color: var(--sage, var(--green)); margin-top: 4px;
}
.u-presence-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--sage, var(--green)); flex-shrink: 0;
}

/* ── UTILS ── */
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.rounded { border-radius: var(--r); }
.rounded-lg { border-radius: var(--r-lg); }
.rounded-xl { border-radius: var(--r-xl); }
.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.border { border: 1.5px solid var(--border); }
.elevated { background: var(--surface-elevated); box-shadow: var(--shadow-md); }
.ring-amber { box-shadow: 0 0 0 3px var(--amber-glow); }
.gold { color: var(--gold); }

/* ── INLINE STATUS DOTS ── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-green  { background: var(--green); }
.dot-amber  { background: var(--amber); }
.dot-red    { background: var(--red); }
.dot-blue   { background: var(--blue); }
.dot-gray   { background: var(--ink4); }

/* ── PANEL TABS ── */
.panel-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg2); padding: 0 var(--sp5); gap: var(--sp1); }
.panel-tab {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink4); padding: 10px var(--sp3); border-bottom: 2px solid transparent;
  cursor: pointer; transition: color var(--t), border-color var(--t);
  border: none; background: none; margin-bottom: -1px;
}
.panel-tab:hover { color: var(--ink2); }
.panel-tab.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ── FADE IN ANIMATION ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp var(--t-slow) both; }

/* ── GLOBAL SEARCH PALETTE ── */
#gsOverlay {
  position: fixed; inset: 0; background: rgba(26,23,20,.45);
  z-index: 800; display: none; align-items: flex-start;
  justify-content: center; padding-top: 10vh;
  backdrop-filter: blur(4px);
}
#gsOverlay.open { display: flex; }
#gsBox {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 600px; max-width: 96vw;
  overflow: hidden;
  animation: wizardIn var(--t-spring) both;
}
#gsInput {
  width: 100%; height: 60px;
  padding: 0 var(--sp5);
  border: none; background: transparent;
  font-family: var(--font-serif); font-size: var(--text-lg);
  color: var(--ink); outline: none;
  border-bottom: 1px solid var(--border);
}
#gsInput::placeholder { color: var(--ink4); font-style: italic; }
#gsResults { max-height: 420px; overflow-y: auto; padding: var(--sp2) 0; }
.gs-result {
  display: flex; align-items: center; gap: var(--sp3);
  padding: 10px var(--sp5); cursor: pointer;
  transition: background var(--t-fast);
  border-left: 2px solid transparent;
}
.gs-result:hover, .gs-result.focused {
  background: var(--amber-bg);
  border-left-color: var(--amber);
}
.gs-result-icon { font-size: 16px; width: 22px; text-align: center; color: var(--ink4); flex-shrink: 0; }
.gs-result-main { font-size: var(--text-sm); color: var(--ink); flex: 1; }
.gs-result-sub  { font-size: var(--text-xs); color: var(--ink4); font-family: 'JetBrains Mono', 'Courier New', monospace; text-transform: uppercase; letter-spacing: .06em; margin-top: 1px; }
.gs-result-badge { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 10px; border: 1px solid; flex-shrink: 0; }
.gs-section-label { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink4); padding: 8px var(--sp5) 4px; }
#gsFooter { padding: var(--sp2) var(--sp5); border-top: 1px solid var(--border); display: flex; gap: var(--sp4); font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink4); background: var(--bg2); }

/* ── Command Palette (lim-cmd) ────────────────────────────────────────────────
   Reusable: global search, inline quick-launch, anywhere you need a command
   surface. Works with global-search.js. */
.lim-cmd-wrap {
  position: relative;
  flex: 0 1 280px;
  flex-shrink: 1;
  transition: flex-basis .22s ease;
}
.lim-cmd-wrap.ai-mode { flex-basis: 560px; }
.lim-cmd-input {
  width: 100%; box-sizing: border-box; height: 32px;
  padding: 0 36px 0 30px;
  border: 1.5px solid var(--border); border-radius: 20px;
  background: var(--surface-elevated);
  font-size: 12px; font-family: 'JetBrains Mono', 'Courier New', monospace; color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%239E908A' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center;
}
.lim-cmd-input:focus {
  border-color: var(--amber-bdr);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px var(--amber-glow);
}
.lim-cmd-input::placeholder { color: var(--ink4); }
.lim-cmd-ai-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink4); padding: 2px 4px; border-radius: 4px;
  transition: color .15s, background .15s; line-height: 1;
}
.lim-cmd-ai-toggle:hover,
.lim-cmd-ai-toggle.on { color: var(--amber); background: var(--amber-bg); }
/* Drop panel */
.lim-cmd-drop {
  display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface-elevated);
  border: 1.5px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(26,23,20,.16);
  z-index: 500; overflow: hidden;
}
.lim-cmd-drop.open { display: block; }
/* Expanded AI panel — overlaps normal drop */
.lim-cmd-drop.expanded {
  min-width: 480px; /* ensures it's wide even if wrap hasn't animated yet */
}
.lim-cmd-scroll { max-height: 340px; overflow-y: auto; }
/* Section label */
.lim-cmd-cat {
  padding: 8px 14px 4px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink4);
}
/* Result row */
.lim-cmd-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  cursor: pointer; transition: background .1s; user-select: none;
}
.lim-cmd-item:hover, .lim-cmd-item.active { background: var(--amber-bg); }
.lim-cmd-item-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.lim-cmd-item-label { flex: 1; font-size: 13.5px; color: var(--ink); }
.lim-cmd-item-sub { font-size: 11px; color: var(--ink4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.lim-cmd-item-ext { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 10px; color: var(--ink4); flex-shrink: 0; }
.lim-cmd-divider { height: 1px; background: var(--border); margin: 4px 10px; }
.lim-cmd-empty { padding: 14px; font-size: 13px; color: var(--ink4); font-family: 'JetBrains Mono', 'Courier New', monospace; text-align: center; }
.lim-cmd-hint {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 3px 10px 7px; gap: 4px;
  font-family: var(--font-mono); font-size: 10px; color: var(--ink4);
  border-top: 1px solid var(--border); background: var(--bg2);
}
.lim-cmd-kbd {
  display: inline-flex; align-items: center; padding: 1px 5px;
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 10px; background: var(--surface); color: var(--ink4);
}
/* ── AI expand zone ── */
.lim-cmd-ai-zone {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 14px;
}
.lim-cmd-ai-label {
  font-family: var(--font-mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--amber); margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.lim-cmd-ai-label::before { content: '✦'; }
/* Step log */
.lim-cmd-steps { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.lim-cmd-step {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink4); padding: 2px 0;
  transition: color .2s;
}
.lim-cmd-step::before {
  content: '○'; font-size: 9px; flex-shrink: 0;
  transition: content .2s;
}
.lim-cmd-step.done { color: var(--ink3); }
.lim-cmd-step.done::before { content: '✓'; color: var(--green,#3A9B6F); }
.lim-cmd-step.active { color: var(--ink2); }
.lim-cmd-step.active::before { content: '◌'; color: var(--amber); animation: lim-spin .8s linear infinite; }
@keyframes lim-spin { to { transform: rotate(360deg); } }
/* Answer */
.lim-cmd-answer {
  font-size: 13.5px; color: var(--ink); line-height: 1.6;
  font-family: var(--font-serif);
  border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px;
}
.lim-cmd-cursor {
  display: inline-block; width: 7px; height: 13px;
  background: var(--amber); vertical-align: middle;
  animation: lim-blink .7s step-end infinite;
}
@keyframes lim-blink { 50% { opacity: 0; } }
/* Action buttons row */
.lim-cmd-action-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.lim-cmd-action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 20px; cursor: pointer; font-size: 12px; color: var(--ink2);
  font-family: var(--font-mono);
  transition: border-color .15s, color .15s, background .15s;
  text-decoration: none;
}
.lim-cmd-action-btn:hover {
  border-color: var(--amber); color: var(--amber); background: var(--amber-bg);
}
/* Wizard mini-form */
.lim-cmd-wizard {
  border-top: 1px solid var(--border);
  background: var(--surface); padding: 14px;
}
.lim-cmd-wizard-title {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink3); margin-bottom: 10px;
}
.lim-cmd-wizard-field { margin-bottom: 8px; }
.lim-cmd-wizard-label {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink4); margin-bottom: 3px;
}
.lim-cmd-wizard-val {
  font-size: 13px; color: var(--ink); padding: 6px 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r,6px); display: flex; align-items: center; gap: 6px;
}
.lim-cmd-wizard-val .change {
  margin-left: auto; font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 10px; color: var(--amber); cursor: pointer;
}

/* ── Quick-connect chips (lim-qc) ─────────────────────────────────────────────
   Reusable anywhere: side panels, dashboard, record views, search results.
   Shows contextual links between records — "Related: 2 sessions · 1 proposal" */
.lim-qc-cluster {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0;
}
.lim-qc {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 8px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 20px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink3);
  transition: border-color .15s, color .15s, background .15s;
  text-decoration: none; white-space: nowrap;
}
.lim-qc:hover { border-color: var(--amber); color: var(--amber-dk); background: var(--amber-bg); }
.lim-qc .lim-qc-icon { font-size: 11px; flex-shrink: 0; }
.lim-qc .lim-qc-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--bg2); border-radius: 8px;
  font-size: 10px; color: var(--ink4); margin-left: 2px;
}
.lim-qc.amber { border-color: var(--amber-bdr); color: var(--amber-dk); background: var(--amber-bg); }
.lim-qc.amber:hover { border-color: var(--amber); background: var(--amber-bg); }
.lim-qc.amber .lim-qc-count { background: var(--amber-bdr); color: var(--amber-dk); }
.lim-qc.red { border-color: var(--red,#C0392B)44; color: var(--red,#C0392B); background: var(--red-bg,#FDF0EE); }
.lim-qc.green { border-color: var(--green,#3A9B6F)44; color: var(--green,#3A9B6F); background: var(--green-bg,#EDF7F2); }
.lim-qc.blue { border-color: var(--blue,#2A6EBB)44; color: var(--blue,#2A6EBB); background: var(--blue-bg,#EDF3FA); }
/* lim-qc in dark mode */
html[data-theme="dark"] .lim-qc { background: var(--surface); border-color: var(--border); color: var(--ink3); }
html[data-theme="dark"] .lim-qc:hover { background: var(--amber-bg); border-color: var(--amber-bdr); color: var(--amber); }
html[data-theme="dark"] .lim-cmd-drop { background: var(--surface-elevated); border-color: var(--border); }
html[data-theme="dark"] .lim-cmd-hint { background: var(--bg2); }
html[data-theme="dark"] .lim-cmd-wizard { background: var(--surface); }
html[data-theme="dark"] .lim-cmd-ai-zone { background: var(--bg2); }
@media (max-width: 600px) { .lim-cmd-wrap { display: none; } }
#gsFooter kbd { background: var(--border); color: var(--ink3); padding: 1px 5px; border-radius: 3px; }


/* ═══════════════════════════════════════════════════════
   UNIFIED v4 ATOMS — "gallery soft" component layer
   New, opt-in classes prefixed .u-* for any new page work.
   Existing classes (.card, .btn, .nav-item) keep working
   unchanged. Tokens above (--paper, --ochre, --sage, …)
   resolve to existing DS variables.
   ═══════════════════════════════════════════════════════ */

/* ── Type roles ── */
.u-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 500;
}
.u-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ochre-dk);
  font-weight: 500;
}
.u-label {
  font-family: var(--ui);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-3);
  font-weight: 500;
}
.u-display {
  font-family: var(--serif);
  font-size: var(--t-display);
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -.012em;
  color: var(--ink);
}
.u-title {
  font-family: var(--serif);
  font-size: var(--t-2xl);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -.008em;
  color: var(--ink);
}
.u-h3 {
  font-family: var(--serif);
  font-size: var(--t-xl);
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
}
.u-h4 {
  font-family: var(--serif);
  font-size: var(--t-lg);
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}
.u-body   { color: var(--ink-2); }
.u-muted  { color: var(--ink-4); }
.u-italic { font-style: italic; color: var(--ink-3); }
.u-num    { font-family: var(--serif); font-feature-settings: 'onum'; font-variant-numeric: oldstyle-nums proportional-nums; }
.u-mono   { font-family: var(--mono); }

/* ── Card surfaces ── */
.u-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s6);
}
.u-card--well  { background: var(--paper-2); border-color: var(--line-soft); }
.u-card--ochre { background: var(--ochre-wash); border-color: var(--ochre-line); }
.u-card--sage  { background: var(--sage-wash);  border-color: var(--sage-line); }

/* ── Dividers + section heads ── */
.u-divider { height: 1px; background: var(--line-soft); border: 0; width: 100%; }
.u-section-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: var(--s5);
}

/* ── Buttons (calmer than .btn — ink-led primary, hairline borders) ── */
.u-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 36px; padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--serif); font-size: var(--t-sm); font-weight: 500;
  cursor: pointer; transition: all .12s ease;
  text-decoration: none; white-space: nowrap;
}
.u-btn:hover { border-color: var(--ochre); color: var(--ochre-dk); background: var(--ochre-wash); }
.u-btn--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.u-btn--primary:hover { background: var(--ochre-dk); border-color: var(--ochre-dk); color: var(--paper); }
.u-btn--ghost { background: transparent; border-color: var(--line); }
.u-btn--sm { height: 28px; padding: 0 12px; font-size: var(--t-xs); }

/* ── Pills + status dots ── */
.u-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  color: var(--ink-3);
  font-family: var(--ui);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: .02em;
  border: 1px solid var(--line-soft);
  white-space: nowrap;
}
.u-pill--ochre { background: var(--ochre-wash); color: var(--ochre-dk); border-color: var(--ochre-line); }
.u-pill--sage  { background: var(--sage-wash);  color: var(--sage);     border-color: var(--sage-line); }
.u-pill--clay  { background: var(--clay-wash);  color: var(--clay);     border-color: var(--clay-line); }
.u-pill--quiet { background: transparent; color: var(--ink-4); }

.u-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.u-dot--ochre { background: var(--ochre); }
.u-dot--sage  { background: var(--sage); }
.u-dot--clay  { background: var(--clay); }
.u-dot--quiet { background: var(--ink-5); }

/* ── Inputs (lighter than .btn-like inputs above) ── */
.u-input, .u-select, .u-textarea {
  width: 100%; height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface);
  font-family: var(--serif); font-size: var(--t-sm);
  color: var(--ink);
  outline: none;
  transition: border-color .12s ease;
}
.u-input:focus, .u-select:focus, .u-textarea:focus { border-color: var(--ochre); }
.u-input::placeholder, .u-textarea::placeholder { color: var(--ink-4); font-style: italic; }
.u-search {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2398908A' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center;
  padding-left: 36px;
}

/* ── Linkish ── */
.u-link {
  color: var(--ochre-dk);
  text-decoration: none;
  border-bottom: 1px solid var(--ochre-line);
  transition: border-color .12s ease;
  cursor: pointer;
}
.u-link:hover { border-bottom-color: var(--ochre); }

/* ──────────────────────────────────────────────
   ROOM SIGNALS — Personal vs Practice
   Drop a .u-mode-pill in the topbar; switch its
   modifier class per page. Add .u-presence in the
   topbar's right cluster on shared (Admin) pages.
   ────────────────────────────────────────────── */
.u-mode-pill {
  display: inline-flex; align-items: center;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  border: 1px solid;
  font-weight: 500;
}
.u-mode-pill--personal {
  color: var(--ochre-dk);
  background: var(--ochre-wash);
  border-color: var(--ochre-line);
}
.u-mode-pill--practice {
  /* Half a step cooler — same chroma family, blue hue */
  color: oklch(40% 0.07 250);
  background: oklch(96% 0.020 250);
  border-color: oklch(82% 0.04 250);
}

/* Mode pill hides on cramped topbars to avoid wrap */
@media (max-width: 740px) { .u-mode-pill { display: none; } }

/* Presence — "Carol is here · 2m ago" on shared views */
.u-presence {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 6px;
  border-radius: var(--r-pill);
  border: 1px solid oklch(82% 0.04 250);
  background: oklch(96% 0.020 250);
  font-family: var(--serif); font-size: 12px;
  color: oklch(40% 0.07 250);
}
.u-presence-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); flex-shrink: 0; }

/* Presence avatar cluster (topbar) */
#presenceRail.u-presence { padding:0; border:none; background:none; gap:4px; margin-right:10px; }
.u-presence-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: #fff; border: 2px solid var(--surface,#fff);
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: opacity .2s, transform .2s;
}
.u-presence-avatar.stale { opacity: .45; }
.u-presence-avatar:hover { transform: scale(1.12); z-index: 10; }

/* Admin sub-bar — group / sort / filter / export */
.u-subbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 18px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line-soft);
}
.u-sub-btn {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--ink-3);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
}
.u-sub-btn:hover { border-color: var(--ochre-line); color: var(--ochre-dk); background: var(--ochre-wash); }
.u-sub-btn--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ──────────────────────────────────────────────
   CONTINUITY HERO — "Pick up where you left"
   Use once on Home, never on Admin.
   ────────────────────────────────────────────── */
.u-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s6) var(--s7);
  display: flex; gap: var(--s5); align-items: flex-start;
  position: relative; overflow: hidden;
}
.u-hero-mark {
  width: 3px; align-self: stretch;
  background: var(--ochre); border-radius: 2px;
}
.u-hero-title {
  font-family: var(--serif);
  font-size: 32px; font-weight: 300;
  letter-spacing: -.015em; line-height: 1.12;
  color: var(--ink); margin-top: 6px;
  max-width: 22ch;
}
.u-hero-title em { font-style: italic; }

/* ──────────────────────────────────────────────
   STAGE STRIP — Admin opening shape
   ────────────────────────────────────────────── */
.u-stages { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s3); }
.u-stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s4) var(--s5);
  display: flex; flex-direction: column; gap: 4px;
}
.u-stage-label {
  font-family: var(--ui);
  font-size: 12px; letter-spacing: .04em;
  color: var(--ink-3); font-weight: 500;
}
.u-stage-n {
  font-family: var(--serif);
  font-size: 32px; font-weight: 300;
  color: var(--ink); line-height: 1; letter-spacing: -.01em;
}
.u-stage-v {
  font-family: var(--serif); font-style: italic;
  font-size: 13px; color: var(--ink-4);
}
.u-stage--ochre { background: var(--ochre-wash); border-color: var(--ochre-line); }
.u-stage--ochre .u-stage-label { color: var(--ochre-dk); }
.u-stage--sage  { background: var(--sage-wash);  border-color: var(--sage-line); }
.u-stage--sage  .u-stage-label { color: var(--sage); }
.u-stage--clay  { background: var(--clay-wash);  border-color: var(--clay-line); }
.u-stage--clay  .u-stage-label { color: var(--clay); }

/* Pipeline confidence pills */
.conf-pill {
  display: inline-flex; align-items: center;
  font-family: var(--mono, 'JetBrains Mono', monospace);
  font-size: 9px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 20px; white-space: nowrap; flex-shrink: 0;
}
.conf-pill--high { background: var(--ochre-wash, #FFF3E6); color: var(--ochre, #A8621E); border: 1px solid var(--ochre-line, #E8C9A0); }
.conf-pill--med  { background: var(--bg2, #F1EBE0); color: var(--ink3, #6B5D55); border: 1px solid var(--line, #E0D8CC); }
.conf-pill--low  { background: #FBEAEA; color: #C0392B; border: 1px solid #F5C6C6; }

/* End unified v4 atoms */

/* ── SIMPLICITY LAYER ── */

/* Ghost/example cards for empty states */
.ghost-example {
  border: 1.5px dashed rgba(60,60,67,.18);
  opacity: .72;
  pointer-events: none;
}
.ghost-example::before {
  content: 'Example';
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #8590a2;
  margin-bottom: 6px;
}

/* Context/state-aware banners */
.context-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 12px;
  animation: bannerIn .2s ease;
}
.context-banner.amber { background: #fff3e0; color: #92400e; border-left: 3px solid #e8a020; }
.context-banner.blue  { background: #e8f0fe; color: #1a56db; border-left: 3px solid #3b82f6; }
.context-banner.red   { background: #fef2f2; color: #991b1b; border-left: 3px solid #c9372c; }
.context-banner.grey  { background: #f1f2f4; color: #44546f; border-left: 3px solid #8590a2; }
.context-banner .banner-dismiss {
  margin-left: auto; cursor: pointer; opacity: .5; font-size: 16px; line-height: 1;
  background: none; border: none; padding: 0;
}
.context-banner .banner-dismiss:hover { opacity: 1; }
@keyframes bannerIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }

/* First-visit welcome banners */
.welcome-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  color: #1e40af;
  line-height: 1.5;
  margin-bottom: 16px;
}
.welcome-banner .banner-dismiss {
  margin-left: auto; cursor: pointer; opacity: .5; font-size: 16px; line-height: 1;
  background: none; border: none; padding: 0; color: inherit; flex-shrink: 0;
}
.welcome-banner .banner-dismiss:hover { opacity: 1; }

/* Error states */
.error-state {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  color: #c9372c;
  font-size: 13px;
}
.error-state button {
  padding: 4px 12px;
  border: 1px solid #c9372c;
  border-radius: 6px;
  background: none;
  color: #c9372c;
  cursor: pointer;
  font-size: 12px;
}
.error-state button:hover { background: #fef2f2; }

/* Loading skeleton screens */
.skeleton-row {
  height: 48px;
  background: linear-gradient(90deg, #f1f2f4 25%, #e4e5e9 50%, #f1f2f4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
  margin-bottom: 8px;
}
.skeleton-card {
  height: 80px;
  background: linear-gradient(90deg, #f1f2f4 25%, #e4e5e9 50%, #f1f2f4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  margin-bottom: 10px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Nudge chips on cards */
.nudge-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.nudge-chip.red    { background: #ffd5d2; color: #c9372c; }
.nudge-chip.amber  { background: #fff3e0; color: #92400e; }
.nudge-chip.blue   { background: #e8f0fe; color: #1a56db; }
.nudge-chip.grey   { background: #f1f2f4; color: #44546f; }
.nudge-chip:hover  { filter: brightness(.95); }
