/* Contour Coffee CRM — styles.css
   Modern Minimal (Attio / Linear) theme — indigo accent, airy surfaces,
   thin 1px borders, 8px radius, refined grays, keyboard-hint chips.
   Token-driven: no hardcoded hex outside :root.
*/

/* Inter — loaded from Google Fonts; system font stack is the fallback */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Custom properties ─────────────────────────────────────────── */
:root {
  /* ── Modern Minimal palette (Attio / Linear) ─────────────────── */

  /* Surfaces */
  --bg:           #ffffff;
  --surface:      #fafafa;
  --surface-2:    #f5f5f5;
  --border:       #e5e5e5;
  --border-strong:#262626;

  /* Ink — refined neutral grays */
  --ink:          #0f0f0f;
  --ink-2:        #404040;
  --ink-3:        #737373;
  --ink-4:        #a3a3a3;

  /* Brand accent — indigo (Linear / Attio #5e6ad2) */
  --accent:       #5e6ad2;
  --accent-soft:  rgba(94,106,210,.08);
  --accent-mid:   rgba(94,106,210,.18);
  --accent-deep:  #3d4db7;
  --accent-light: #818cf8;
  --accent-bg:    #f0f1ff;

  /* Semantic */
  --red:          #be123c;
  --red-deep:     #9f1239;
  --red-soft:     rgba(190,18,60,.08);
  --amber:        #b45309;
  --amber-soft:   rgba(180,83,9,.10);
  --amber-deep:   #a74d08;  /* text-on-amber-soft — see issue #61 */
  --green:        #15803d;
  --green-soft:   rgba(21,128,61,.10);
  --green-deep:   #147739;  /* text-on-green-soft — see issue #61 */
  --blue:         #1d4ed8;
  --blue-soft:    rgba(29,78,216,.10);

  /* Fit star */
  --star:         #f59e0b;

  /* Radii + shadows — airy, thin */
  --radius-sm:    6px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --shadow-lg:    0 4px 24px rgba(0,0,0,.08);

  /* Type scale — 14px base, airy line-height */
  --fs-xs:    .72rem;
  --fs-sm:    .82rem;
  --fs-base:  .875rem;
  --fs-lg:    1rem;
  --fs-xl:    1.2rem;
  --fs-2xl:   1.5rem;
  --fs-3xl:   1.875rem;
  --fs-4xl:   2.5rem;

  /* Font stacks */
  --font:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  /* Layout */
  --nav-h:      48px;
  --page-max:   1240px;
  --gutter:     clamp(1rem, 2.5vw, 1.75rem);

  /* Focus ring */
  --focus-ring: 0 0 0 3px rgba(94,106,210,.2);

  /* Compat aliases (used in JS-rendered strings + older components) */
  --paper:         var(--bg);
  --paper-subtle:  var(--surface);
  --ink-muted:     var(--ink-2);
  --ink-faint:     var(--ink-3);
  --border-color:  var(--border);
  --danger:        var(--red);
  --success:       var(--green);
  --accent-text:   var(--accent);
  --shadow-md:     var(--shadow);
  --brand-accent:  var(--accent);

  /* Badge palette tokens */
  --badge-new-bg:    #f5f3ff;  --badge-new-fg:    #5e6ad2;
  --badge-qual-bg:   #eff6ff;  --badge-qual-fg:   #1d4ed8;
  --badge-samp-bg:   #fff7ed;  --badge-samp-fg:   #c2410c;
  --badge-order-bg:  #f0fdf4;  --badge-order-fg:  #15803d;
  --badge-risk-bg:   #fff1f2;  --badge-risk-fg:   #be123c;

  /* ── Operational Family semantic aliases (Phase B slice 1, issue #57 §8c.1) ──
     Pure renames of the tokens above, mapped to whatever real variable already
     produces that visual role today. No new colors, no new values — this block
     is unused by any existing selector, so it cannot change any rendered page.
     See docs/operational-family-design.md §2. */
  --of-surface-canvas: var(--surface-2);
  --of-surface-raised: var(--bg);
  --of-surface-sunken: var(--surface);
  --of-surface-inset:  var(--surface-2);

  --of-border:        var(--border);
  --of-border-soft:   var(--border);
  --of-border-strong: var(--border-strong);

  --of-ink-1: var(--ink);   --of-ink-2: var(--ink-2);
  --of-ink-3: var(--ink-3); --of-ink-4: var(--ink-4);

  --of-radius-sm: var(--radius-sm); --of-radius: var(--radius); --of-radius-lg: var(--radius-lg);
  --of-shadow: var(--shadow); --of-shadow-lg: var(--shadow-lg);

  --of-fs-xs: var(--fs-xs); --of-fs-sm: var(--fs-sm); --of-fs-base: var(--fs-base);
  --of-fs-lg: var(--fs-lg); --of-fs-xl: var(--fs-xl); --of-fs-2xl: var(--fs-2xl); --of-fs-3xl: var(--fs-3xl);

  --of-font: var(--font); --of-font-mono: var(--font-mono);

  --of-green: var(--green); --of-green-soft: var(--green-soft); --of-green-deep: var(--green-deep);
  --of-amber: var(--amber); --of-amber-soft: var(--amber-soft); --of-amber-deep: var(--amber-deep);
  --of-red:   var(--red);   --of-red-soft:   var(--red-soft);   --of-red-deep:   var(--red-deep);
  --of-blue:  var(--blue);  --of-blue-soft:  var(--blue-soft);

  /* Context accent — the ONLY thing that may differ per product (Contour vs
     Village Roaster). Contour's existing --accent is the default; a future
     [data-app="vr"] scope can override --of-accent to teal without touching
     any structural token above. Not applied anywhere yet in this slice. */
  --of-contour-accent: var(--accent); --of-contour-accent-soft: var(--accent-soft);
  --of-vr-accent: #0d9488; --of-vr-accent-soft: rgba(13,148,136,.08);
  --of-accent: var(--of-contour-accent); --of-accent-soft: var(--of-contour-accent-soft);

  --of-space-1:4px; --of-space-2:8px; --of-space-3:12px; --of-space-4:16px; --of-space-5:24px; --of-space-6:32px;

  --of-focus-ring: var(--focus-ring);
}

[data-app="vr"] { --of-accent: var(--of-vr-accent); --of-accent-soft: var(--of-vr-accent-soft); }

/* ─── Reset / base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface-2);
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.2;
}

/* ─── Layout ────────────────────────────────────────────────────── */
.page-wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.main-content {
  padding-top: calc(var(--nav-h) + 1.25rem);
  padding-bottom: 2.5rem;
}

/* Legacy page wrappers used by several pages (retail-coffees uses .page-shell;
   green-map / analytics / feedback / wholesale-pricing use .container). These
   were never defined, so those pages rendered edge-to-edge with no gutter. Mirror
   .page-wrap so every page gets the standard max-width + horizontal padding. */
.container,
.page-shell {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
/* .page-shell is used as the top-level <main>, so it also needs the nav offset. */
.page-shell {
  padding-top: calc(var(--nav-h) + 1.25rem);
  padding-bottom: 2.5rem;
}

/* ─── Top nav ───────────────────────────────────────────────────── */
.top-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 200;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.top-nav .page-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  /* No overflow:hidden — dropdowns must escape the container */
  position: relative;
}

/* ── Workspace switcher ───────────────────────────────────────── */

/* Segmented pill that lives at the left of the nav, after the brand */
.nav-workspace-switcher {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 1px;
  flex-shrink: 0;
  margin-left: .25rem;
}

/* Mobile-drawer workspace switcher: hidden on desktop, shown only inside the
   hamburger drawer at <=820px. Without this base hide it rendered alongside the
   desktop switcher → two switchers / wonky nav. */
.nav-workspace-switcher-mobile { display: none; }

.workspace-btn {
  display: flex;
  align-items: center;
  gap: .3rem;
  height: 26px;
  padding: 0 .65rem;
  border: none;
  border-radius: 4px;
  font-family: var(--font);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-3);
  background: transparent;
  cursor: pointer;
  transition: background .12s, color .12s, box-shadow .12s;
  white-space: nowrap;
  letter-spacing: .01em;
}
.workspace-btn:hover {
  background: var(--bg);
  color: var(--ink-2);
}
.workspace-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.workspace-btn.active {
  background: var(--bg);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.workspace-btn.active .ws-dot { background: var(--accent); }

/* Small coloured dot indicator */
.ws-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-4);
  flex-shrink: 0;
  transition: background .12s;
}

/* Commerce button opens external — give it a slightly different tint */
.workspace-btn[data-workspace="commerce"] .ws-dot { background: var(--green); }
.workspace-btn[data-workspace="commerce"]:hover .ws-dot { background: var(--green); }

.nav-brand {
  font-weight: 700;
  font-size: var(--fs-base);
  letter-spacing: -.025em;
  color: var(--ink);
  flex-shrink: 0;
  text-decoration: none;
  line-height: 1;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand span { color: var(--accent); }

/* ── Hamburger (mobile only) ──────────────────────────────────── */
.nav-hamburger {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--ink-3);
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-hamburger:hover { background: var(--surface-2); color: var(--ink); }

/* ── Nav links container ──────────────────────────────────────── */
.nav-links {
  display: flex;
  gap: .1rem;
  align-items: center;
  margin-left: auto;
  list-style: none;
  flex-wrap: nowrap;
  flex-shrink: 1;
}

/* ── Top-level items ──────────────────────────────────────────── */
.nav-item {
  position: relative;
}

/* Shared styles: top-level link and dropdown trigger button */
.nav-top-link {
  display: flex;
  align-items: center;
  gap: .2rem;
  height: 30px;
  padding: 0 .6rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-3);
  background: none;
  border: none;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  letter-spacing: .005em;
}
.nav-top-link:hover,
.nav-top-link:focus-visible {
  background: var(--surface-2);
  color: var(--ink-2);
  text-decoration: none;
  outline: none;
}
.nav-top-link:focus-visible { box-shadow: var(--focus-ring); }
.nav-top-link.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}
/* When a child page is active, style the parent trigger as "partially active" */
.nav-has-dropdown .nav-top-link.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* Caret indicator */
.nav-caret {
  font-size: .5rem;
  opacity: .6;
  transition: transform .15s;
  display: inline-block;
}
.nav-has-dropdown.nav-open .nav-caret {
  transform: rotate(180deg);
}

/* ── Dropdown panel ───────────────────────────────────────────── */
.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 168px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  list-style: none;
  padding: .25rem 0;
  z-index: 300;
}
/* Right-align last few menus so they don't overflow right edge */
.nav-item:nth-last-child(-n+3) .nav-dropdown {
  left: auto;
  right: 0;
}

.nav-has-dropdown.nav-open .nav-dropdown {
  display: block;
}

.nav-dropdown-item {
  display: block;
  padding: .45rem .9rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background .1s, color .1s;
  white-space: nowrap;
}
.nav-dropdown-item:hover,
.nav-dropdown-item:focus-visible {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  outline: none;
}
.nav-dropdown-item:focus-visible { box-shadow: var(--focus-ring); }
.nav-dropdown-sep { border: 0; border-top: 1px solid var(--border); margin: .35rem 0; }
.nav-dropdown-meta { padding: .35rem .9rem; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.35; }
.nav-dropdown-meta strong { color: var(--ink-2); font-weight: 600; }
.nav-dropdown-signout { color: var(--red, #c0392b); font-weight: 600; }
.nav-dropdown-signout:hover, .nav-dropdown-signout:focus-visible { background: var(--red-bg, #fdecea); color: var(--red, #c0392b); }
.nav-dropdown-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* ── Utility / logout buttons ─────────────────────────────────── */
.nav-links .nav-logout {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 .6rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-3);
  background: none;
  border: none;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.nav-links .nav-logout:hover {
  background: var(--surface-2);
  color: var(--ink-2);
}

/* ── Keyboard hint chips (Minimal aesthetic) ──────────────────── */
.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: .25rem;
}
.kbd {
  font-family: var(--font-mono);
  font-size: .65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  color: var(--ink-4);
  letter-spacing: 0;
  line-height: 1.4;
}

/* ── Responsive: hamburger + mobile drawer ────────────────────── */
@media (max-width: 820px) {
  .nav-hamburger {
    display: flex;
    align-items: center;
  }

  /* Hide workspace switcher in nav on mobile (moved into drawer) */
  .nav-workspace-switcher {
    display: none;
  }

  .nav-links {
    /* Hidden by default — toggled via .nav-mobile-open */
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-left: 0;
    padding: .5rem 0 1rem;
    z-index: 250;
    max-height: calc(100dvh - var(--nav-h));
    overflow-y: auto;
  }
  .nav-links.nav-mobile-open {
    display: flex;
  }

  /* Mobile workspace switcher rendered as full-width pill stack */
  .nav-workspace-switcher-mobile {
    display: flex;
    flex-direction: row;
    gap: 0;
    margin: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }
  .nav-workspace-switcher-mobile .workspace-btn {
    flex: 1;
    height: 40px;
    border-radius: 0;
    justify-content: center;
    font-size: var(--fs-xs);
    border-right: 1px solid var(--border);
  }
  .nav-workspace-switcher-mobile .workspace-btn:last-child { border-right: none; }

  /* Mobile: top-level items take full width */
  .nav-item {
    position: static;
  }
  .nav-top-link {
    width: 100%;
    height: 44px;
    padding: 0 1.25rem;
    border-radius: 0;
    font-size: var(--fs-base);
    justify-content: space-between;
  }
  .nav-top-link:hover,
  .nav-top-link:focus-visible {
    background: var(--surface-2);
  }

  /* Mobile: dropdown expands inline, not absolutely positioned */
  .nav-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: .25rem 0;
    min-width: unset;
  }
  .nav-has-dropdown.nav-open .nav-dropdown {
    display: block;
  }

  .nav-dropdown-item {
    padding: .65rem 2rem;
    font-size: var(--fs-base);
  }

  /* Staff identity + toggle buttons on mobile */
  .nav-staff-identity {
    border-left: none;
    border-top: 1px solid var(--border);
    padding: .65rem 1.25rem;
    margin: 0;
  }
  .nav-links .nav-logout {
    width: 100%;
    height: 44px;
    padding: 0 1.25rem;
    border-radius: 0;
    font-size: var(--fs-base);
    justify-content: flex-start;
  }
}

/* ─── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.card-elevated {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

/* ─── Stat grid ─────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: left;
}
.stat-card .stat-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}
.stat-card .stat-label {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-top: .3rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
}

/* ─── Tables ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
}
td {
  padding: .7rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
tbody tr {
  transition: background .1s;
  cursor: pointer;
}
tbody tr:hover td { background: var(--surface-2); }

/* data-table matches our pattern above */
.data-table th, .data-table td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  background: var(--surface);
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border);
  z-index: 2;
}
.data-table tr:hover td { background: var(--surface-2); }

/* ─── Badge system ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 4px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
  text-transform: uppercase;
}

/* Semantic variants.
   green/amber foregrounds use the darker -deep tokens (issue #61): the base
   --green/--amber hex measured 4.39:1 / 4.38:1 against the composited soft
   background, below the 4.5:1 text floor. -deep clears 4.5:1 (measured
   4.54–4.55:1 against the harder-case #f5f5f5-composited tint, 4.93–4.94:1
   against the white-composited tint). Badge size/padding is unchanged —
   only the foreground color moved. Backgrounds (-soft) are unchanged. */
.badge-ok,
.badge-green  { background: var(--green-soft); color: var(--green-deep); }
.badge-warn,
.badge-amber  { background: var(--amber-soft); color: var(--amber-deep); }
.badge-red    { background: var(--red-soft);   color: var(--red); }
.badge-info,
.badge-blue   { background: var(--blue-soft);  color: var(--blue); }
.badge-neutral,
.badge-gray   { background: var(--surface-2);  color: var(--ink-3); }

/* AI admin compat */
.badge-off    { background: var(--red-soft);   color: var(--red); }

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  height: 36px;
  padding: 0 .9rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: none;
  transition: background .12s, box-shadow .12s, transform .1s;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  min-width: 36px;
  font-family: var(--font);
  letter-spacing: .005em;
}
.btn:active { transform: scale(.97); }
.btn:hover  { text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-secondary {
  background: var(--bg);
  color: var(--ink-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--ink-4);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-3);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--ink-2);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover {
  background: var(--red-deep);
}

.btn-full  { width: 100%; }

.btn-sm {
  height: 30px;
  padding: 0 .65rem;
  font-size: var(--fs-xs);
}

/* Xs button used in dashboard row actions */
.btn-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 .6rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
  font-family: var(--font);
  text-decoration: none;
  min-height: 28px;
}
.btn-xs:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn-xs.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-xs.primary:hover { background: var(--accent-deep); }

/* Large camera-style buttons */
.btn-capture {
  height: 72px;
  font-size: var(--fs-base);
  border-radius: var(--radius-lg);
  font-weight: 700;
}
@media (max-width: 480px) {
  .btn-capture { width: 100%; margin-bottom: .75rem; }
}

/* ─── Forms ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  margin-bottom: .4rem;
}
.form-control {
  width: 100%;
  height: 36px;
  padding: 0 .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--fs-sm);
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
textarea.form-control {
  height: auto;
  padding: .65rem .85rem;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2rem;
}

/* Form row (label + control in grid) */
.form-row {
  display: grid;
  grid-template-columns: minmax(140px, 25%) 1fr;
  gap: .55rem;
  margin-bottom: .65rem;
  align-items: center;
}
.form-row label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  margin: 0;
}

/* Combo search */
.combo-wrap { position: relative; }
.combo-wrap input { width: 100%; }
.combo-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}
.combo-dropdown.open { display: block; }
.combo-option {
  padding: .65rem .85rem;
  cursor: pointer;
  font-size: var(--fs-sm);
}
.combo-option:hover { background: var(--surface); }

/* ─── Progress bar ──────────────────────────────────────────────── */
.progress-wrap {
  background: var(--border);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin: 1rem 0;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0;
  transition: width .25s ease;
}

/* ─── Media gallery ─────────────────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}

.media-thumb {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border);
  cursor: pointer;
  border: 1px solid var(--border);
}
.media-thumb img,
.media-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .2s;
}
.media-thumb:hover img,
.media-thumb:hover video { transform: scale(1.04); }

.media-thumb .media-type-badge {
  position: absolute;
  top: .4rem; left: .4rem;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: .15em .5em;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.media-caption {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-top: .4rem;
  line-height: 1.35;
}

/* ─── Lightbox ──────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lightbox.open { display: flex; }
.lightbox-close {
  position: absolute;
  top: 1rem; right: 1.25rem;
  background: none; border: none;
  color: #fff; font-size: 2rem;
  cursor: pointer; line-height: 1;
}
.lightbox-media {
  max-width: min(90vw, 1000px);
  max-height: 80vh;
  border-radius: var(--radius);
}
.lightbox-actions {
  margin-top: 1rem;
  display: flex;
  gap: .75rem;
}

/* ─── Filter bar ────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-bar .form-control { height: 38px; font-size: var(--fs-sm); }
.filter-bar select, .filter-bar input { flex: 1 1 140px; min-width: 0; }

/* ─── Section headers ───────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.section-header h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -.02em;
}
.section-header .section-action { font-size: var(--fs-sm); color: var(--accent); font-weight: 600; }

/* ─── Page headings ─────────────────────────────────────────────── */
.page-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: .15rem;
  color: var(--ink);
}
.page-subtitle {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-bottom: 1.25rem;
  letter-spacing: .01em;
}

/* ─── Login page ────────────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--surface);
}
.login-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}
.login-brand h1 {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -.03em;
}
.login-brand p { font-size: var(--fs-sm); color: var(--ink-3); margin-top: .4rem; }

/* ─── Upload preview ────────────────────────────────────────────── */
.upload-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 1rem 0;
  background: var(--surface);
}
.upload-preview img,
.upload-preview video {
  border-radius: var(--radius-sm);
  max-height: 280px;
  width: 100%;
  object-fit: cover;
}
.upload-meta {
  margin-top: .5rem;
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

/* ─── Toast ─────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: .65rem 1.25rem;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: auto;
  max-width: 90vw;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.toast.show { opacity: 1; transform: none; }
.toast.toast-success { background: var(--green); }
.toast.toast-error   { background: var(--red); }

/* ─── Recipe lot list ───────────────────────────────────────────── */
.recipe-lot-list { list-style: none; }
.recipe-lot-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-base);
}
.recipe-lot-item:last-child { border-bottom: none; }
.recipe-lot-pct {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--accent);
  min-width: 3rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ─── Origin detail grid ────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem 1.5rem;
  font-size: var(--fs-sm);
}
.detail-row { display: flex; flex-direction: column; gap: .15rem; }
.detail-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.detail-value { color: var(--ink); }

/* ─── Lot header ────────────────────────────────────────────────── */
.lot-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.lot-header-info { flex: 1 1 200px; }
.lot-number {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  margin-bottom: .2rem;
}

/* ─── Ratio input ───────────────────────────────────────────────── */
.ratio-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
}
.ratio-row:last-child { border-bottom: none; }
.ratio-name { flex: 1; font-size: var(--fs-sm); }
.ratio-input {
  width: 80px;
  height: 38px;
  text-align: right;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--fs-base);
  padding: 0 .5rem;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
.ratio-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ratio-pct-label { font-size: var(--fs-sm); color: var(--ink-3); }

/* ─── Empty states ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-3);
}
.empty-state svg { margin: 0 auto 1rem; opacity: .35; }
.empty-state p { font-size: var(--fs-base); }
.empty-state .empty-message {
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--ink-4);
  margin-top: .5rem;
}

/* ─── Loading skeleton ──────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--surface-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  height: 1em;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Error banner ──────────────────────────────────────────────── */
.error-banner {
  display: none;
  background: var(--red-soft);
  border: 1px solid rgba(220,38,38,.2);
  color: var(--red-deep);
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  margin-bottom: 1.25rem;
}
.error-banner.show { display: block; }

/* ─── Loading state: board spinner ─────────────────────────────── */
.board-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 4rem 1rem;
  color: var(--ink-3);
  font-size: var(--fs-base);
  font-weight: 600;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Pipeline bar (dashboard) ──────────────────────────────────── */
.pipeline-bar {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  padding: .65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.pipeline-bar .sep { color: var(--ink-4); margin: 0 .4rem; }

/* ─── Dashboard sections ────────────────────────────────────────── */
.dash-section { margin-bottom: 1rem; }
.dash-section-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  cursor: pointer;
  user-select: none;
  padding: .85rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background .1s;
}
.dash-section-header:hover { background: var(--surface); }
.dash-section-header.collapsed {
  border-radius: var(--radius);
  border-bottom: 1px solid var(--border);
}
.dash-section-header h2 {
  font-size: var(--fs-base);
  font-weight: 700;
  letter-spacing: -.02em;
  flex: 1;
}
.dash-section-count {
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: .2em .65em;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.dash-section-count.empty { background: var(--surface-2); color: var(--ink-3); }
.dash-caret {
  font-size: .75rem;
  color: var(--ink-3);
  transition: transform .15s;
  flex-shrink: 0;
}
.dash-section-header.collapsed .dash-caret { transform: rotate(-90deg); }

.dash-section-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.dash-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  min-height: 56px;
}
.dash-row:last-child { border-bottom: none; }
.dash-row-main { flex: 1; min-width: 0; }
.dash-row-name {
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-base);
}
.dash-row-sub {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-top: .15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-row-actions {
  display: flex;
  gap: .4rem;
  flex-shrink: 0;
}

.dash-empty {
  padding: 1.25rem 1.25rem;
  font-size: var(--fs-sm);
  color: var(--green);
  text-align: center;
}

.route-cluster {
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.route-cluster:last-child { border-bottom: none; }
.route-city {
  font-weight: 700;
  font-size: var(--fs-sm);
  margin-bottom: .25rem;
}
.route-accounts {
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

@media (max-width: 640px) {
  .dash-row { flex-wrap: wrap; padding: .85rem 1rem; }
  .dash-row-actions { width: 100%; }
  .btn-xs { flex: 1; min-height: 44px; }
}

/* ─── Account detail sections ───────────────────────────────────── */
.acct-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.acct-section-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.acct-section-header:hover { background: var(--surface); }
.acct-section-header h2 {
  font-size: var(--fs-base);
  font-weight: 700;
  letter-spacing: -.02em;
  flex: 1;
}
.acct-section-body { padding: 1.25rem; }
.acct-section-caret { font-size: .75rem; color: var(--ink-3); transition: transform .15s; flex-shrink: 0; }
.acct-section-header.collapsed .acct-section-caret { transform: rotate(-90deg); }

/* Snapshot grid */
.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
/* Wide snap item spans the full grid row (e.g. first pitch angle) */
.snap-item--wide {
  grid-column: 1 / -1;
}
.snap-item label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  margin-bottom: .2rem;
}
.snap-item .val {
  font-size: var(--fs-base);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Stage bar */
.stage-bar {
  display: flex;
  gap: 2px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.stage-seg {
  flex: 1;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: default;
  transition: background .12s;
}

/* Next action box */
.next-action-box {
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  margin-bottom: 1rem;
}
.next-action-box .na-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: .25rem;
}
.next-action-box .na-text {
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--ink);
}
.next-action-box .na-sub {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-top: .15rem;
}

/* Action buttons grid */
.action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

/* Coach panel */
.coach-table td,
.coach-table th {
  padding: .5rem .65rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.coach-table th {
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink-3);
  width: 200px;
  vertical-align: top;
  text-transform: none;
  letter-spacing: 0;
  border-bottom: 1px solid var(--border);
}

/* Conversation guide */
.guide-radios { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.guide-radio-label {
  padding: .35rem .75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background .1s, border-color .1s;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.guide-radio-label:hover { background: var(--surface); }
.guide-radio-label input { display: none; }
.guide-radio-label.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Debrief */
.char-counter { font-size: var(--fs-xs); margin-top: .2rem; }

/* Proposal cards (account.html inline) */
.proposal-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.proposal-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.proposal-card h4 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: .5rem; text-transform: capitalize; }

/* Objection library */
.objection-library { margin-top: 1.25rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.objection-library h4 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: .65rem; color: var(--ink-3); }

@media (max-width: 640px) {
  .action-btns .btn { flex: 1 0 45%; font-size: var(--fs-xs); height: 44px; padding: 0 .75rem; }
  .snapshot-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Proposals page cards ──────────────────────────────────────── */
.proposal-page-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.proposal-page-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow .15s;
}
.proposal-page-card:hover { box-shadow: var(--shadow); }

/* Top accent bar — 3px colored strip */
.proposal-page-card .card-accent-bar {
  height: 3px;
  background: var(--blue);
  flex-shrink: 0;
}
.proposal-page-card.version-trial    .card-accent-bar { background: var(--blue); }
.proposal-page-card.version-standard .card-accent-bar { background: var(--accent); }
.proposal-page-card.version-premium  .card-accent-bar { background: #7c3aed; }

.proposal-page-card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; gap: .75rem; }
.proposal-page-card h3 {
  font-size: var(--fs-lg);
  font-weight: 800;
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: -.02em;
}
.proposal-recommended {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

.proposal-field {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.proposal-field label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.proposal-field input,
.proposal-field textarea {
  width: 100%;
  font: inherit;
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .65rem;
  color: var(--ink);
  background: var(--bg);
  transition: border-color .15s, box-shadow .15s;
}
.proposal-field textarea { min-height: 60px; resize: vertical; }
.proposal-field input:focus,
.proposal-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.proposal-status-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: capitalize;
}
.status-draft    { background: var(--surface-2); color: var(--ink-3); }
.status-sent     { background: var(--amber-soft); color: var(--amber); }
.status-accepted { background: var(--green-soft); color: var(--green); }
.status-rejected { background: var(--red-soft);   color: var(--red); }
.status-expired  { background: var(--surface-2);  color: var(--ink-4); }
/* Shared status variants (email-funnels, tickets, etc.) */
.status-active   { background: var(--green-soft);  color: var(--green); }
.status-paused   { background: var(--amber-soft);  color: var(--amber); }
.status-done     { background: var(--blue-soft);   color: var(--blue); }
.status-open     { background: var(--accent-bg);   color: var(--accent); }
.status-needs-reply  { background: var(--red-soft);  color: var(--red); }
.status-responded    { background: var(--green-soft); color: var(--green); }
.status-resolved     { background: var(--surface-2);  color: var(--ink-3); }
.status-closed       { background: var(--surface-2);  color: var(--ink-4); }

.proposal-page-actions {
  display: flex;
  gap: .5rem;
  margin-top: auto;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.proposal-page-actions .btn {
  flex: 1;
  height: 40px;
  font-size: var(--fs-xs);
  padding: 0 .75rem;
}

@media (max-width: 640px) {
  .proposal-page-cards { grid-template-columns: 1fr; }
}

/* ─── AI admin tabs ─────────────────────────────────────────────── */
.ai-tabs {
  display: flex;
  gap: .2rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.ai-tabs::-webkit-scrollbar { display: none; }

.ai-tab {
  padding: .45rem 1rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
  transition: background .12s, color .12s;
  min-height: 36px;
}
.ai-tab:hover { background: var(--surface-2); color: var(--ink-2); }
.ai-tab.active { background: var(--accent); color: #fff; }

.ai-panel { display: none; }
.ai-panel.active { display: block; }

.ai-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .85rem; }
.ai-card {
  padding: 1rem 1.1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ai-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .35rem; }
.ai-card-title { font-weight: 700; font-size: var(--fs-base); color: var(--ink); }
.ai-card-sub { font-size: var(--fs-xs); color: var(--ink-3); }
.ai-stat { display: flex; gap: 1rem; margin-top: .55rem; font-size: var(--fs-xs); color: var(--ink-3); }

.form-actions { display: flex; gap: .55rem; justify-content: flex-end; margin-top: 1rem; }
.empty-state-quip { font-style: italic; color: var(--ink-3); font-size: var(--fs-sm); }

.invoke-result {
  margin-top: 1rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  white-space: pre-wrap;
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.key-status { font-family: var(--font-mono); font-size: var(--fs-xs); }
.key-status-ok { color: var(--green); }
.key-status-ok::before { content: '\2713\00a0'; }
.key-status-no { color: var(--red); }
.key-status-no::before { content: '\2717\00a0'; }
.actions-inline { display: flex; gap: .4rem; }
.actions-inline button { padding: .2em .55em; font-size: var(--fs-xs); }

/* Models panel: per-provider fetch buttons row */
.models-fetch-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  padding: .6rem .85rem;
  margin-bottom: .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* card-grid alias */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .85rem; }

/* ─── Kanban board (leads view) ─────────────────────────────────── */
.kanban-outer {
  overflow-x: auto;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter) 1rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.kanban-board {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
  min-width: max-content;
}

.kanban-lane {
  width: 230px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.kanban-lane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  position: sticky;
  top: calc(var(--nav-h) + .5rem);
  z-index: 10;
}

.kanban-lane-header .lane-count {
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: .15em .55em;
  border-radius: 999px;
  min-width: 1.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ─── AI brief panel ────────────────────────────────────────────── */
.ai-brief-section {
  margin-top: 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-soft), transparent);
}
.ai-brief-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.ai-brief-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.ai-brief-body {
  margin-top: .75rem;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--ink);
}
.ai-brief-body ul { margin: .4rem 0; padding-left: 1.2rem; }
.ai-brief-body strong { color: var(--ink); }
.ai-brief-body code {
  font-size: .85em;
  background: var(--surface-2);
  padding: .05em .35em;
  border-radius: 3px;
}
.ai-brief-meta { margin-top: .5rem; font-size: var(--fs-xs); color: var(--ink-4); font-style: italic; }

/* Lane accent colours — 10-stage pipeline */
.kanban-lane[data-status="new_lead"]              .kanban-lane-header { border-top: 3px solid #94a3b8; }
.kanban-lane[data-status="qualified_account"]     .kanban-lane-header { border-top: 3px solid #60a5fa; }
.kanban-lane[data-status="sample_offered"]        .kanban-lane-header { border-top: 3px solid #38bdf8; }
.kanban-lane[data-status="sample_delivered"]      .kanban-lane-header { border-top: 3px solid #06b6d4; }
.kanban-lane[data-status="tasting_scheduled"]     .kanban-lane-header { border-top: 3px solid #f59e0b; }
.kanban-lane[data-status="quote_sent"]            .kanban-lane-header { border-top: 3px solid #a78bfa; }
.kanban-lane[data-status="trial_order"]           .kanban-lane-header { border-top: 3px solid #ec4899; }
.kanban-lane[data-status="first_wholesale_order"] .kanban-lane-header { border-top: 3px solid #22c55e; }
.kanban-lane[data-status="repeat_order_healthy"]  .kanban-lane-header { border-top: 3px solid #15803d; }
.kanban-lane[data-status="at_risk_dormant"]       .kanban-lane-header { border-top: 3px solid #fb923c; }
.kanban-lane[data-status="lost"]                  .kanban-lane-header { border-top: 3px solid #f87171; }

.kanban-lane-cards {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-height: 80px;
}

/* ─── Lead card ─────────────────────────────────────────────────── */
.lead-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem;
  cursor: pointer;
  transition: box-shadow .12s, border-color .12s, transform .1s;
  min-height: 44px;
  position: relative;
}
.lead-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.lead-card:active { transform: scale(.98); }
.lead-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .4rem;
  margin-bottom: .3rem;
}
.lead-card-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.score-badge {
  display: inline-block;
  min-width: 1.8em;
  text-align: center;
  padding: .15em .45em;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1.4;
}
.score-high { background: var(--green-soft); color: var(--green); }
.score-mid  { background: var(--amber-soft); color: var(--amber); }
.score-low  { background: var(--surface-2);  color: var(--ink-3); }

.lead-card-city { font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: .2rem; }
.lead-card-type { font-size: var(--fs-xs); color: var(--ink-4); }
.lead-card-followup {
  margin-top: .45rem;
  font-size: var(--fs-xs);
  color: var(--ink-4);
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* ─── Disqualified section ──────────────────────────────────────── */
.disqualified-section { margin-top: 2rem; }
.disqualified-toggle {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: .06em;
  min-height: 44px;
}
.disqualified-toggle:hover { color: var(--ink-2); }
.disqualified-toggle .toggle-chevron {
  display: inline-block;
  transition: transform .2s;
  font-style: normal;
}
.disqualified-toggle.open .toggle-chevron { transform: rotate(90deg); }
.disqualified-list { display: none; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.disqualified-list.open { display: flex; }

/* ─── Modals ────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem .85rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -.02em;
}
.modal-subtitle { font-size: var(--fs-xs); color: var(--ink-3); margin-top: .15rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: .25rem;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  transition: background .1s;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }

.modal-body {
  overflow-y: auto;
  padding: 1.25rem;
  flex: 1;
}

.modal-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
  background: var(--surface);
}

/* ─── Lead detail inside modal ──────────────────────────────────── */
.lead-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: var(--fs-sm);
}
.lead-detail-row { display: flex; flex-direction: column; gap: .1rem; }
.lead-detail-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.lead-detail-value { color: var(--ink); }

/* Modal tabs */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  gap: 0;
}
.modal-tab {
  padding: .55rem .9rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .12s, border-color .12s;
  margin-bottom: -1px;
  min-height: 44px;
}
.modal-tab:hover { color: var(--ink-2); }
.modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.modal-tab-panel { display: none; }
.modal-tab-panel.active { display: block; }

/* ─── Stage-move buttons ────────────────────────────────────────── */
.stage-btn-group { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.stage-btn {
  height: 36px;
  padding: 0 .9rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink-3);
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
  min-height: 44px;
}
.stage-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ─── Confirm dialog ────────────────────────────────────────────── */
.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.confirm-dialog.open { display: flex; }
.confirm-box {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.confirm-box h3 { font-size: var(--fs-lg); font-weight: 700; margin-bottom: .6rem; letter-spacing: -.02em; }
.confirm-box p { font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: 1.25rem; }
.confirm-actions { display: flex; gap: .6rem; justify-content: flex-end; }

/* ─── Mobile kanban: accordion ──────────────────────────────────── */
@media (max-width: 767px) {
  .kanban-outer { overflow-x: visible; margin: 0; padding: 0; }
  .kanban-board { flex-direction: column; min-width: unset; gap: .4rem; }
  .kanban-lane { width: 100%; }
  .kanban-lane-header { cursor: pointer; user-select: none; position: relative; top: 0; }
  .kanban-lane-header::after {
    content: '›';
    font-size: 1.1rem;
    color: var(--ink-3);
    transition: transform .2s;
    margin-left: .4rem;
    display: inline-block;
  }
  .kanban-lane.expanded .kanban-lane-header::after { transform: rotate(90deg); }
  .kanban-lane-cards { display: none; }
  .kanban-lane.expanded .kanban-lane-cards { display: flex; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .kanban-lane { width: 210px; }
}

/* ─── Utility ───────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--ink-3); }
.text-sm { font-size: var(--fs-sm); }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.gap-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.tabular { font-variant-numeric: tabular-nums; }
.section-heading { font-size: var(--fs-base); font-weight: 700; margin: 0 0 .5rem; }
.card-flush { padding: 0; overflow: hidden; }
.td-right { text-align: right; font-variant-numeric: tabular-nums; }
.page-narrow { max-width: 640px; margin: 0 auto; }
.inline-action-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.vitals-head-name { flex: 1 1 auto; min-width: 0; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.next-action-required-box { background: var(--accent-soft); border: 1px solid var(--accent-mid); border-radius: var(--radius-sm); padding: 1rem; }
.next-action-required-box .nar-label { font-weight: 700; font-size: var(--fs-sm); color: var(--accent); margin-bottom: 1rem; }
.error-text { color: var(--red); }
.mb-0 { margin-bottom: 0; }
.whatnow-close-btn { margin-left: auto; }
.card-muted { background: var(--surface); }
.btn-block { width: 100%; }
.pipe-full-width { grid-column: 1 / -1; }
.filter-field-grow { flex: 1; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 720px; }
.modal-task { max-width: 680px; }
.filter-input-sm { max-width: 240px; }
.bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
  padding: .65rem .85rem;
  margin-bottom: .75rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius-sm);
}
.bulk-bar-count { font-weight: 700; font-size: var(--fs-sm); color: var(--accent); margin-right: .25rem; }
.bulk-bar select.filter-input-sm { max-width: 200px; }
.required-asterisk { color: var(--red); }
.modal-sm { max-width: 440px; }
.btn-inline-xs { display: inline-flex; height: auto; padding: .15rem .5rem; font-size: var(--fs-sm); }
.filter-quip { margin-top: .75rem; font-size: var(--fs-xs); color: var(--ink-3); font-style: italic; }
.convert-section-divider { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.proposed-commitments-box { margin: .75rem 0; padding: .85rem 1rem; background: var(--amber-soft); border: 1px solid var(--amber); border-radius: var(--radius); }
.proposed-commitments-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.proposed-list { display: flex; flex-direction: column; gap: .5rem; }
.ml-auto { margin-left: auto; }
.lot-body { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.lot-stats { text-align: right; min-width: 140px; }
.lot-kg-stat { font-size: 1.8rem; }
@media (min-width: 768px) { .lot-body { grid-template-columns: 1fr 1fr; } }
.admin-detail-card { padding: 1rem 1.2rem; }
.log-toggle-indicator { pointer-events: none; }
.btn-grow { flex: 1; }
.upload-success-card { text-align: center; padding: 2rem; }
.success-text { color: var(--success); font-size: 1.05rem; }
.justify-center { justify-content: center; }
.modal-xs { max-width: 420px; }
.queue-header { margin-top: 1.25rem; display: flex; align-items: center; justify-content: space-between; }
.queue-heading { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 0; font-weight: 600; }
.queue-filter-select { width: auto; font-size: var(--fs-xs); padding: .25rem .5rem; }
.queue-loading { padding: 1.5rem; }
.load-more-wrap { text-align: center; margin-top: 1.5rem; }
.lightbox-caption { color: var(--ink-4); font-size: var(--fs-sm); text-align: center; margin-top: .75rem; max-width: 600px; line-height: 1.5; }
.brand-accent { color: var(--accent); }
.recipe-layout { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.detail-name-heading { font-size: 1.1rem; font-weight: 800; }
.ratio-sum-row { padding-top: .75rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-sm); }
.ratio-sum-val { color: var(--accent); }
.ml-2 { margin-left: .75rem; }
.accent-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.accent-link:hover { text-decoration: underline; }
.state-center { text-align: center; padding: 3rem; color: var(--ink-3); }
.state-center--error { color: var(--danger); }
.mono-pre { font-family: var(--font-mono); white-space: pre-wrap; font-size: var(--fs-xs); }
.whatnow-panel { position: fixed; bottom: 0; left: 0; right: 0; z-index: 150; background: var(--bg); border-top: 2px solid var(--accent); padding: 1.25rem; max-height: 60vh; overflow-y: auto; box-shadow: 0 -4px 24px rgb(0 0 0/.12); }

/* ─── Stage stepper ─────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: .75rem 0 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .25rem;
}
.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.stepper-track {
  display: flex;
  align-items: center;
  width: 100%;
}
.stepper-node {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--ink-4);
  background: var(--bg);
  transition: background .15s, border-color .15s, color .15s;
}
.stepper-node--past {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.stepper-node--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.stepper-node--future {
  opacity: .45;
}
.stepper-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 4px;
}
.stepper-connector--filled {
  background: var(--accent);
  opacity: .5;
}
.stepper-caption {
  font-size: .74rem;
  color: var(--ink-3);
  margin-top: .4rem;
}
.stepper-caption strong { color: var(--accent); }

/* ─── Inline edit ───────────────────────────────────────────────── */
.ie-wrap {
  position: relative;
  display: block;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 1px 20px 1px 4px;
  margin: 0 -4px;
  transition: background .12s;
}
.ie-wrap:hover { background: var(--surface-2); }
.ie-wrap:hover .ie-pencil { opacity: 1; }
.ie-pencil {
  position: absolute;
  right: 4px;
  top: 3px;
  opacity: 0;
  color: var(--ink-4);
  font-size: .75rem;
  transition: opacity .12s;
  line-height: 1;
  pointer-events: none;
}
.ie-editing .ie-pencil { display: none; }

/* edit controls shown while editing */
.ie-input, .ie-select, .ie-textarea {
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: .15rem .4rem;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.ie-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
.ie-actions {
  display: flex;
  gap: .3rem;
  align-items: center;
  margin-top: .3rem;
  flex-wrap: wrap;
}
.ie-save {
  font-size: .76rem;
  padding: .2rem .55rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
}
.ie-save:hover { background: var(--accent-deep); }
.ie-cancel {
  font-size: .76rem;
  padding: .2rem .5rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-3);
}
.ie-cancel:hover { background: var(--surface-2); }
.ie-saving { opacity: .6; pointer-events: none; }
.ie-tick {
  color: var(--green);
  font-size: .8rem;
  font-weight: 700;
  animation: ie-fade-out 1.4s forwards;
}
@keyframes ie-fade-out {
  0%  { opacity: 1; }
  70% { opacity: 1; }
  100%{ opacity: 0; }
}
.ie-addr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  margin-bottom: .35rem;
}
.ie-addr-grid label { font-size: .72rem; color: var(--ink-3); display: block; margin-bottom: .1rem; }

/* contact card editable mode */
.contact-card.is-editing { background: var(--accent-soft); }
.contact-add-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: 1.5px dashed var(--accent-mid);
  border-radius: var(--radius-sm);
  padding: .35rem .65rem;
  margin-top: .5rem;
}
.contact-add-btn:hover { background: var(--accent-soft); }

/* snap-item vitals make editable */
.snap-item .ie-wrap { width: 100%; }
.vital .ie-wrap { width: 100%; }

/* ─── Roaster Ops: PIN overlay ────────────────────────────────── */

/* Blur the page content behind the PIN overlay */
.ops-blurred { filter: blur(4px); pointer-events: none; user-select: none; }

#pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pin-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9,9,11,.55);
  backdrop-filter: blur(6px);
}
.pin-overlay-panel {
  position: relative;
  z-index: 1;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: min(440px, 92vw);
  max-height: 90dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.pin-overlay-brand { text-align: center; }
.pin-brand-logo {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.035em;
  color: var(--ink);
}
.pin-brand-logo em {
  color: var(--accent);
  font-style: normal;
}
.pin-brand-sub {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  margin-top: .3rem;
}

.pin-step { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.pin-step.hidden { display: none; }

.pin-label {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

/* Staff pick list */
.staff-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 300px;
  overflow-y: auto;
}
.staff-pick-btn {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.staff-pick-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.skeleton-staff {
  height: 56px;
  background: var(--surface-2);
  border-radius: var(--radius);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

/* PIN dots */
.pin-dots {
  display: flex;
  gap: 1.25rem;
  margin: .5rem 0;
}
.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--border-strong);
  background: transparent;
  transition: background .15s, border-color .15s, transform .1s;
}
.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
}

/* PIN keypad */
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  width: 100%;
  max-width: 280px;
}
.pin-key {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pin-key:hover { background: var(--surface-2); border-color: var(--accent); }
.pin-key:active { transform: scale(.93); }
.pin-key.empty { opacity: 0; cursor: default; pointer-events: none; border: none; }
.pin-key[data-key="⌫"] { font-size: 1.25rem; color: var(--ink-3); }
.pin-key:disabled { opacity: .45; cursor: default; }

.pin-error {
  font-size: var(--fs-sm);
  color: var(--red);
  font-weight: 600;
  text-align: center;
  background: var(--red-soft);
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  width: 100%;
}
.pin-error.hidden { display: none; }

.pin-back-btn {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  padding: .25rem 0;
}
.pin-back-btn:hover { color: var(--ink); }

.pin-load-error {
  font-size: var(--fs-sm);
  color: var(--red);
  text-align: center;
  padding: 1rem;
}

/* Nav: ops staff identity */
.nav-staff-identity {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: 0 .4rem;
  border-left: 1px solid var(--border);
  margin-left: .15rem;
}
.nav-staff-name {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.nav-ops-link { border-bottom: 2px solid var(--accent-mid); }
.nav-email-link { border-bottom: 2px solid var(--blue-soft); }

/* Settings gear dropdown — right-aligned */
.nav-item-settings .nav-top-link {
  font-size: .9rem;
  padding: 0 .5rem;
  color: var(--ink-4);
}
.nav-item-settings .nav-top-link:hover { color: var(--ink-2); }
.nav-item-settings .nav-top-link.active { color: var(--accent); background: var(--accent-bg); }

/* ─── Roaster Ops: Signature pad ─────────────────────────────── */

.sig-pad-wrap {
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
  position: relative;
}
.sig-pad-wrap canvas { display: block; width: 100%; }
.sig-pad-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-4);
  font-size: var(--fs-sm);
  font-style: italic;
  pointer-events: none;
  user-select: none;
}
.sig-actions {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
  align-items: center;
}

/* ─── Roaster Ops: Checklist runner ──────────────────────────── */

.ops-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.ops-page-header h1 {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -.03em;
}
.ops-page-header .ops-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  margin-bottom: .3rem;
}

/* Alert banner for due/overdue */
.ops-alert-banner {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  margin-bottom: 1.25rem;
  border: 1px solid;
}
.ops-alert-banner.alert-red {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red-deep);
}
.ops-alert-banner.alert-amber {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber);
}
.ops-alert-banner strong { font-weight: 700; }

/* Checklist template card */
.checklist-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}
.checklist-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.checklist-card-body { flex: 1; min-width: 0; }
.checklist-card-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .3rem;
}
.checklist-card-meta {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .85rem;
}
.checklist-card-actions {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex-shrink: 0;
}

/* Checklist runner */
.runner-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.runner-header h2 { font-size: var(--fs-xl); font-weight: 800; margin-bottom: .25rem; }
.runner-meta { font-size: var(--fs-sm); color: var(--ink-3); }
.runner-timer {
  font-size: var(--fs-2xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin-top: .5rem;
}

.checklist-item-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.checklist-item-row:last-child { border-bottom: none; }
.checklist-item-check {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
  appearance: none;
  background: var(--bg);
  transition: all .15s;
  margin-top: 2px;
}
.checklist-item-check:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M2.5 8l3.5 3.5 7-7'/%3E%3C/svg%3E");
  background-size: 70%;
  background-repeat: no-repeat;
  background-position: center;
}
.checklist-item-body { flex: 1; }
.checklist-item-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.checklist-item-detail {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  margin-top: .2rem;
}
.checklist-item-note {
  margin-top: .5rem;
  width: 100%;
  max-width: 400px;
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  background: var(--bg);
  font-family: inherit;
}

/* Attestation box */
.attestation-box {
  background: var(--accent-soft);
  border: 1.5px solid var(--accent-mid);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}
.attestation-box p {
  font-size: var(--fs-base);
  color: var(--ink);
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.attestation-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  margin-bottom: .5rem;
}

/* Maintenance schedule card */
.maint-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: .75rem;
  transition: border-color .15s, box-shadow .15s;
}
.maint-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.maint-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.maint-card-title { font-size: var(--fs-lg); font-weight: 700; }
.maint-card-asset { font-size: var(--fs-sm); color: var(--ink-3); margin-top: .2rem; }
.maint-card-due {
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: .35rem .75rem;
  border-radius: 999px;
  white-space: nowrap;
}
.due-overdue { background: var(--red-soft); color: var(--red); }
.due-today   { background: var(--amber-soft); color: var(--amber); }
.due-soon    { background: var(--blue-soft); color: var(--blue); }
.due-ok      { background: var(--green-soft); color: var(--green); }

/* Supervisor grid filters */
.filter-row {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-row .field { gap: .25rem; display: flex; flex-direction: column; }
.filter-row label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.filter-row select,
.filter-row input {
  height: 38px;
  padding: 0 .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
}

/* Ops skeleton pulses */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
.ops-skeleton { background: var(--surface-2); border-radius: var(--radius); animation: skeleton-pulse 1.4s ease-in-out infinite; }

/* ═══════════════════════════════════════════════════════════════════
   Components (consolidated 2026-06)
   All values use :root tokens — zero new hardcoded hex/px where a
   token exists.  Pages should import these classes and drop local
   re-declarations.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tab bar (segmented pill tabs) ───────────────────────────────── */
.tab-bar {
  display: flex;
  gap: .3rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
}
.tab-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-3);
  padding: .5rem .85rem;
  border-radius: var(--radius-sm);
  transition: background .12s, color .12s;
  font-family: var(--font);
}
.tab-btn.active { background: var(--accent); color: #fff; }
.tab-btn:hover:not(.active) { background: var(--surface-2); color: var(--ink); }

/* ── Rail card (right-rail side panel within a detail view) ──────── */
.rail-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}
.rail-card-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.rail-card-body { padding: .75rem .85rem; }

/* ── CRM list page shell (accounts.html + leads.html pattern) ────── */
.crm-list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.crm-list-head h1 { margin: 0; font-size: 1.75rem; letter-spacing: -.035em; }
.crm-list-head p   { margin: .3rem 0 0; color: var(--ink-3); font-size: var(--fs-sm); }

.crm-list-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

/* Segmented control — 2-3 button pill toggle */
.segment-control {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.segment-control button {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-3);
  padding: .42rem .72rem;
  font: 600 var(--fs-xs) var(--font);
  cursor: pointer;
}
.segment-control button.active { color: #fff; background: var(--accent); }

.crm-list-tools {
  display: flex;
  gap: .5rem;
  flex: 1;
  justify-content: flex-end;
}
.crm-list-tools .form-control { height: 36px; }
.crm-list-tools input  { width: min(320px, 100%); }
.crm-list-tools select { width: 150px; }

/* CRM table shell */
.crm-table-shell {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.crm-table-wrap { overflow-x: auto; }
.crm-table { width: 100%; border-collapse: collapse; }
.crm-table th {
  padding: .62rem .8rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.crm-table td {
  padding: .68rem .8rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.crm-table tbody tr:last-child td { border-bottom: 0; }
.crm-table tbody tr:hover { background: var(--accent-soft); }

/* Stage pills (traffic-light pattern) */
.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .48rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 650;
}
.stage-pill::before {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}
.stage-early   { color: #687078; background: #f6f7f8; }
.stage-working { color: #9a6700; background: #fff8df; }
.stage-active  { color: #247a52; background: #ebf8f1; }

.business-link { color: var(--ink); font-weight: 650; text-decoration: none; }
.business-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.muted-cell { color: var(--ink-3); }

.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .8rem;
  border-top: 1px solid var(--border);
  color: var(--ink-3);
  font-size: var(--fs-xs);
}
.load-more {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  padding: .38rem .7rem;
  font: 600 var(--fs-xs) var(--font);
  cursor: pointer;
}
.load-more:hover { border-color: var(--accent); color: var(--accent); }
.load-more[hidden] { display: none; }
.state-row { padding: 2.5rem 1rem !important; color: var(--ink-3) !important; text-align: center; }

/* View-toggle (table ↔ kanban) */
.view-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}
.view-toggle button {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  padding: .45rem .55rem;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
}
.view-toggle button.active { background: var(--accent); color: #fff; }
.view-toggle button:first-child { border-right: 1px solid var(--border); }

/* Shared gen-section / gen-grid (genealogy / batch-detail drawers) */
.gen-section { margin-bottom: 1.25rem; }
.gen-section h3 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  font-weight: 700;
  margin-bottom: .5rem;
}
.gen-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .3rem 1rem;
  font-size: var(--fs-sm);
}
.gen-grid dt { color: var(--ink-3); }
.gen-grid dd { font-variant-numeric: tabular-nums; }
.gen-step {
  border-left: 2px solid var(--accent-mid);
  padding: .15rem 0 .15rem .85rem;
  margin-left: .35rem;
  position: relative;
}

/* Shared gen-log-row (used in green.html genealogy) */
.gen-log-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.gen-log-row .num { white-space: nowrap; }

/* Shared stack-card (mobile table replacement — green + roasting) */
.stack-cards { display: none; }
@media (max-width: 640px) {
  .stack-cards { display: block; }
}
.stack-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem;
  margin-bottom: .65rem;
  background: var(--bg);
}
.stack-card .sc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
}
.stack-card .sc-meta {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-top: .35rem;
  display: flex;
  flex-wrap: wrap;
  gap: .15rem .75rem;
}

/* Shared empty-note (green + roasting) */
.empty-note {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--ink-3);
  font-size: var(--fs-sm);
}

/* Shared row-clickable utility */
.row-clickable { cursor: pointer; }

/* Shared num utility (tabular nums) */
.num { font-variant-numeric: tabular-nums; }

/* ── Domain accent token (overridable per page) ───────────────────
   Default: same as --accent (indigo). Coffee/green pages may set
   --domain-accent: var(--amber) or a brown/gold to tint left borders
   and subtle accent details — NOT as a competing primary. */
:root { --domain-accent: var(--accent); }

/* ─── Star ratings (preserved — ★/☆ only, no other emoji) ──────── */
.fit-stars { color: var(--star); font-size: var(--fs-sm); letter-spacing: 1px; }

/* ─── Battle-card warning marker (preserved — ⚠ only) ──────────── */
.battle-card-warn { color: var(--amber); font-size: var(--fs-xs); margin-right: .2em; }

/* ─── 44px touch targets (mobile, WCAG 2.5.5) ──────────────────── */
/* Desktop-only styles are NOT affected — this block is mobile-only. */
@media (max-width: 820px) {
  /* Buttons — primary, secondary, ghost, danger, full variants */
  .btn {
    min-height: 44px;
    padding-top: .6rem;
    padding-bottom: .6rem;
  }

  /* Standalone inline-block buttons that may have fixed heights */
  .btn-xs {
    min-height: 44px;
    padding: 0 .875rem;
  }

  /* Form controls — inputs, selects, textareas */
  .form-control {
    min-height: 44px;
    padding-top: .6rem;
    padding-bottom: .6rem;
  }
  select.form-control {
    min-height: 44px;
  }
  textarea.form-control {
    /* multi-line: keep auto height but ensure minimum */
    min-height: 88px;
  }

  /* Nav drawer links already have height:44px — bump workspace-switcher buttons */
  .nav-workspace-switcher-mobile .workspace-btn {
    height: 44px;
  }

  /* Table row-action buttons (small icon/text buttons inside td) */
  .data-table td .btn,
  .data-table td button,
  td .btn,
  td button {
    min-height: 44px;
    min-width: 44px;
  }

  /* Filter-bar controls */
  .filter-bar .form-control,
  .filter-bar select,
  .filter-bar input {
    min-height: 44px;
  }

  /* Ops/supervisor filter row controls */
  .filter-row select,
  .filter-row input {
    min-height: 44px;
    padding: .5rem .65rem;
  }

  /* Tab buttons (tickets.html .tab-btn pattern + generic pill tabs) */
  .tab-btn,
  [role="tab"],
  .gallery-tab {
    min-height: 44px;
    padding-left: .875rem;
    padding-right: .875rem;
  }

  /* Inline-edit controls */
  .ie-input,
  .ie-select,
  .ie-textarea {
    min-height: 44px;
  }

  /* Checkbox / radio label hit areas — add padding so the label itself is tappable */
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
  }
  label:has(input[type="checkbox"]),
  label:has(input[type="radio"]) {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem 0;
  }
}

/* ===== Mobile-first foundation (2.2) ===== */

/* ── Height tokens ────────────────────────────────────────────────── */
:root {
  --bottom-tab-bar-height: 58px;
  --thumb-action-bar-height: 64px;
}

/* ── Bottom tab bar — fixed, mobile-only ──────────────────────────── */
/*
 * Injected globally by mountBottomNav() in app.js.
 * Visible ONLY at max-width:820px (hidden above).
 * 5 equal .bottom-tab-item columns; active state uses --accent with a
 * top-indicator bar. padding-bottom absorbs the iOS safe-area notch.
 */
.bottom-tab-bar {
  display: none; /* desktop default — shown only inside the media query below */
}

@media (max-width: 820px) {
  .bottom-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300;
    height: calc(var(--bottom-tab-bar-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    align-items: stretch;
  }

  .bottom-tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--ink-3);
    font-size: var(--fs-xs);
    font-weight: 600;
    font-family: var(--font);
    text-decoration: none;
    position: relative;
    transition: color .12s;
    -webkit-tap-highlight-color: transparent;
  }

  /* Top indicator bar for active tab */
  .bottom-tab-item[aria-current="page"]::before,
  .bottom-tab-item.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
  }

  .bottom-tab-item[aria-current="page"],
  .bottom-tab-item.active {
    color: var(--accent);
  }

  .bottom-tab-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  .bottom-tab-item span.bottom-tab-label {
    font-size: var(--fs-xs);
    line-height: 1;
  }

  /* ── Content padding — prevent fixed bar from covering content ── */
  .main-content,
  .page-wrap {
    padding-bottom: calc(var(--bottom-tab-bar-height) + env(safe-area-inset-bottom, 0px) + 8px);
  }
}

/* ── .crm-table--cards — opt-in card-collapse for mobile ─────────────
 *
 * Usage: add class crm-table--cards to any .crm-table wrapper element,
 * e.g. <table class="crm-table crm-table--cards">
 *
 * Each <td> MUST have a data-label attribute matching the column header,
 * e.g. <td data-label="Company">Acme Co.</td>
 * The data-label value is shown as a left-aligned label; the cell value
 * sits right-aligned opposite it.
 *
 * Above 820px: normal table rendering (no change).
 * At max-width:820px: each <tr> becomes a stacked card.
 */
@media (max-width: 820px) {
  .crm-table.crm-table--cards,
  .crm-table.crm-table--cards tbody,
  .crm-table.crm-table--cards tr {
    display: block;
    width: 100%;
  }

  /* Hide the original <thead> row visually but keep it for screen readers */
  .crm-table.crm-table--cards thead tr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  /* Each <tr> becomes a card */
  .crm-table.crm-table--cards tbody tr {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: .75rem;
    padding: .5rem 0;
    display: block;
  }

  .crm-table.crm-table--cards tbody tr:hover {
    background: var(--accent-soft);
  }

  /* Each <td> is a label+value row within the card */
  .crm-table.crm-table--cards td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    padding: .35rem .85rem;
    border-bottom: none;
    font-size: var(--fs-sm);
  }

  /* Column label (from data-label attribute) */
  .crm-table.crm-table--cards td[data-label]::before {
    content: attr(data-label);
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--ink-3);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: .1em;
  }

  /* Specificity boost: override consolidated .crm-table td rules */
  .crm-table.crm-table--cards tbody tr:last-child td {
    border-bottom: none;
  }
}

/* ── .thumb-action-bar — shared sticky primary-action bar ────────────
 *
 * Sits directly above the bottom tab bar on detail / form pages.
 * account.html has its own .thumb-action-bar-primary inline variant;
 * this utility class is for other pages.
 *
 * Usage: <div class="thumb-action-bar">
 *          <button class="btn btn-ghost">Secondary</button>
 *          <button class="btn btn-primary">Primary</button>
 *        </div>
 */
.thumb-action-bar {
  display: none; /* desktop: not shown by default */
}

@media (max-width: 820px) {
  .thumb-action-bar {
    display: flex;
    position: fixed;
    bottom: calc(var(--bottom-tab-bar-height) + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    z-index: 48;
    height: var(--thumb-action-bar-height);
    padding: .6rem .8rem;
    gap: .5rem;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    align-items: center;
  }

  .thumb-action-bar > * {
    flex: 1;
    min-height: 44px;
  }
}

/* ── pointer:coarse — larger hit-area refinements ────────────────────
 * Applied on any touch-primary device regardless of viewport width.
 * Supplements the 820px touch-target block above.
 */
@media (pointer: coarse) {
  .btn {
    min-height: 44px;
  }

  .nav-dropdown-item {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .bottom-tab-item {
    min-height: 48px;
  }
}

/* ─── Brain-dump needs-input gentle highlight ───────────────────
   Apply to inputs, selects, textareas, or snap-item wrappers
   to signal "still needs a value". Remove the class once the user edits. */
.needs-input { background: var(--amber-soft) !important; border-color: var(--amber) !important; }

/* ─── Onboard highlight states ──────────────────────────────────
   Applied after AI parse. Remove the class once the user edits.
   ─────────────────────────────────────────────────────────────── */

/* Low-confidence parse — soft yellow tint, muted border */
.field-uncertain {
  background: #fefce8 !important;           /* tailwind yellow-50 */
  border-color: #ca8a04 !important;         /* yellow-600 */
  box-shadow: 0 0 0 2px rgba(202,138,4,.12) !important;
}

/* Suspect value (price far from base, implausible data, etc.) — soft red-orange */
.field-suspect {
  background: var(--red-soft) !important;
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px rgba(190,18,60,.10) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   LEFT-RAIL SHELL — renderNav v2
   Replaces the old top-nav horizontal bar with a fixed left rail +
   slim topbar. All 40 pages get it automatically via #top-nav mount.
   Follows the existing Linear/Attio minimal token system.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --rail-w: 240px;
}

/* ── Left rail ──────────────────────────────────────────────────── */
.app-rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: .75rem .6rem;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  /* No double-scrollbar: only rail scrolls, not the body */
}

/* Rail brand */
.rail-brand {
  display: block;
  font-weight: 700;
  font-size: var(--fs-base);
  letter-spacing: -.025em;
  color: var(--ink);
  text-decoration: none;
  padding: .25rem .4rem .5rem;
  flex-shrink: 0;
  line-height: 1;
}
.rail-brand:hover { text-decoration: none; color: var(--accent); }

/* Rail search (faint input look) */
.rail-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 32px;
  padding: 0 .6rem;
  margin-bottom: .6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--ink-3);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
  text-align: left;
  flex-shrink: 0;
}
.rail-search:hover { border-color: var(--ink-4); }
.rail-search:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.rail-search kbd {
  font-family: var(--font-mono);
  font-size: .6rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  color: var(--ink-4);
  letter-spacing: 0;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Rail nav */
.rail-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  /* Hide scrollbar but keep scrollability */
  scrollbar-width: none;
}
.rail-nav::-webkit-scrollbar { display: none; }

/* Pinned single-destination links (Today, Ask AI) */
.rail-link {
  display: flex;
  align-items: center;
  gap: .45rem;
  height: 32px;
  padding: 0 .5rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
  margin-bottom: 1px;
}
.rail-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.rail-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.rail-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.rail-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* Sections with child items */
.rail-group {
  margin-top: .75rem;
}

.rail-group-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  padding: 0 .5rem .3rem;
}

/* Child item links */
.rail-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  height: 30px;
  padding: 0 .5rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background .12s, color .12s;
  position: relative;
  margin-bottom: 1px;
}
.rail-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.rail-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.rail-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.rail-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* External link indicator */
.rail-ext {
  margin-left: auto;
  font-size: .65rem;
  color: var(--ink-4);
  flex-shrink: 0;
}

/* App dots — 6px coloured circles */
.dot-crm,
.dot-vr {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-crm { background: #5e6ad2; }
.dot-vr  { background: #0d9488; }

/* Rail foot — pinned to bottom */
.rail-foot {
  margin-top: auto;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex-shrink: 0;
}

/* Persona switcher */
.rail-persona-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.rail-persona-label {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  flex-shrink: 0;
}
.rail-persona-select {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-xs);
  font-family: var(--font);
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px .35rem;
  cursor: pointer;
  height: 26px;
}
.rail-persona-select:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Signed-in text */
.rail-signed-in {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-signed-in strong { color: var(--ink-2); font-weight: 600; }

/* Sign out link */
.rail-signout {
  font-size: var(--fs-xs);
  color: var(--red);
  font-weight: 600;
  text-decoration: none;
}
.rail-signout:hover { text-decoration: underline; }

/* Staff identity (ops) */
.rail-staff {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
}
.rail-staff-name {
  font-size: var(--fs-xs);
  color: var(--ink-2);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-switch-btn {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.rail-switch-btn:hover { text-decoration: underline; }

/* ── Slim topbar ────────────────────────────────────────────────── */
.app-topbar {
  position: fixed;
  top: 0;
  left: var(--rail-w);
  right: 0;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1rem;
  z-index: 40;
}

/* Hamburger toggle — hidden on desktop, shown on mobile */
.rail-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  color: var(--ink-3);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.rail-toggle:hover { background: var(--surface-2); color: var(--ink); }
.rail-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Topbar brand (mobile; hidden on desktop where rail shows brand) */
.topbar-brand {
  font-weight: 700;
  font-size: var(--fs-base);
  letter-spacing: -.025em;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}
.topbar-brand:hover { text-decoration: none; }

/* Topbar search (flex:1, faint input look) */
.topbar-search {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--ink-3);
  cursor: pointer;
  text-align: left;
  transition: border-color .12s, box-shadow .12s;
}
.topbar-search:hover { border-color: var(--ink-4); }
.topbar-search:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Persona badge pill — also the account-menu trigger (issue #57 §8c slice 3) */
.persona-badge {
  flex-shrink: 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  border-radius: 999px;
  padding: .15rem .55rem;
  white-space: nowrap;
  text-transform: capitalize;
}
.persona-badge:hover { border-color: var(--accent); }
.persona-badge:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ═══ Operational Family — family topbar chrome (issue #57 §8c slices 2–3) ═══ */

/* Product/workspace switcher — plain navigation, never a shared session */
.of-switcher {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px; flex-shrink: 0;
}
.of-switcher-item {
  display: flex; align-items: center; gap: .35rem;
  height: 26px; padding: 0 .65rem; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3);
  text-decoration: none; white-space: nowrap;
}
.of-switcher-item:hover { color: var(--ink-2); text-decoration: none; }
.of-switcher-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.of-switcher-item.is-active { background: var(--bg); color: var(--ink); box-shadow: var(--shadow-sm); }
.of-switcher-ext { font-size: .65rem; color: var(--ink-4); }

/* Account menu — capability stack popover */
.of-account-menu { position: relative; flex-shrink: 0; margin-left: auto; }
.of-account-panel {
  display: none;
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 260px; padding: .9rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.of-account-menu.open .of-account-panel { display: block; }
.of-account-signed-in { font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: .6rem; word-break: break-all; }
.of-account-signed-in strong { color: var(--ink-2); font-weight: 600; }
.of-account-heading {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); margin: 0 0 .45rem;
}

/* Capability stack — overlapping "roast-batch tag" chips, one per active
   surface capability. Reads only the `caps` array the client already has;
   adds no new capability, no new data exposure. */
.of-cap-stack { display: flex; flex-wrap: wrap; align-items: center; gap: 0; }
.of-cap-tag {
  position: relative; display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 700; letter-spacing: .02em;
  padding: .22rem .55rem .22rem .7rem;
  border-radius: 0 5px 5px 0; border: 1px solid var(--border); border-left: none;
  background: var(--surface-2); color: var(--ink-2);
  margin-left: -9px; margin-top: 3px;
  box-shadow: 2px 0 0 var(--bg);
}
.of-cap-tag:first-child { margin-left: 0; border-left: 1px solid var(--border); border-radius: 5px; }
.of-cap-legend { font-size: .7rem; color: var(--ink-3); margin-top: .55rem; line-height: 1.4; }

/* Simplified / Expert mode switch — presentation density only, never
   authorization. See getMode()/setMode() in js/app.js. */
.of-mode-switch {
  display: inline-flex; align-items: center; gap: .15rem; padding: 2px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
  flex-shrink: 0;
}
.of-mode-switch button {
  border: 0; background: transparent; padding: .3rem .75rem; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 700; color: var(--ink-3); cursor: pointer; min-height: 30px;
}
.of-mode-switch button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: var(--shadow-sm); }
/* The pressed-state box-shadow above must never outrank the shared focus
   ring — without this !important, tabbing to the already-active mode button
   shows no visible focus (same bug the Phase A preview found and fixed). */
.of-mode-switch button:focus-visible { outline: none; box-shadow: var(--focus-ring) !important; }
.of-mode-switch .mode-label-short { display: none; }

/* Narrow topbar: collapse text labels, keep dots/icons + aria-labels */
@media (max-width: 900px) {
  .of-switcher-item span:not(.dot-crm):not(.dot-vr):not(.of-switcher-ext) { display: none; }
  .of-mode-switch .mode-label { display: none; }
  .of-mode-switch .mode-label-short { display: inline; }
  .of-mode-switch button { padding: .3rem .5rem; }
}
@media (max-width: 620px) {
  .of-switcher { display: none; }
}

/* ── Simplified/Expert density variants (issue #57 §8c slice 4) ──
   Presentation density only. Rail nav (#top-nav) and the capability stack
   above are rendered from `caps` alone, in code with no dependency on
   document.body.dataset.mode — these two selectors only ever hide/show
   density variants a page opts into inside its own content, never the rail
   or account-menu markup. First (only) applied to roasting.html. */
body[data-mode="expert"] [data-mode-only="simple"] { display: none; }
body[data-mode="simple"] [data-mode-only="expert"] { display: none; }

.of-invariant-line {
  font-size: .74rem; color: var(--ink-3); line-height: 1.5;
  border-top: 1px dashed var(--border-strong); padding: .6rem .9rem 0; margin: 0 0 .8rem;
}
.of-invariant-line b { color: var(--ink-2); }

/* ── Simplified-mode building blocks (issue #57 §8c slice 4+, ported from
   op-family-preview/shell.css — same class names, real tokens) — bigger
   touch targets, plainer language, one glance-card instead of dense tables. */
.of-simple-card {
  display: flex; flex-direction: column; gap: .6rem;
  padding: 1.1rem 1.2rem; border: 1px solid var(--of-border); border-radius: var(--of-radius-lg);
  background: var(--of-surface-raised); box-shadow: var(--of-shadow); margin-bottom: .8rem;
}
.of-simple-card .headline { font-size: 1.05rem; font-weight: 700; }
.of-simple-card .plain { font-size: .9rem; color: var(--of-ink-2); }
.of-simple-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: .7rem 1.1rem; border-radius: var(--of-radius);
  border: 1px solid var(--of-border); background: var(--of-surface-raised);
  font-size: .95rem; font-weight: 700; color: var(--of-ink-1); width: 100%;
}
.of-simple-btn.primary { background: var(--of-accent); border-color: var(--of-accent); color: #fff; }
.of-simple-btn:hover { text-decoration: none; filter: brightness(1.04); }
.of-simple-list { display: flex; flex-direction: column; gap: .6rem; }
.of-simple-row {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .9rem 1rem; border: 1px solid var(--of-border); border-radius: var(--of-radius);
  background: var(--of-surface-raised); min-height: 56px;
}
.of-simple-row .name { font-size: .98rem; font-weight: 700; }
.of-simple-row .meta { font-size: .82rem; color: var(--of-ink-3); margin-top: .15rem; }
.of-simple-pin {
  min-height: 44px; min-width: 64px; border-radius: var(--of-radius);
  border: 1px solid var(--of-border); background: var(--of-surface-raised);
  font-size: .85rem; font-weight: 700; padding: .5rem .8rem; color: var(--of-ink-2);
}
.of-simple-pin:hover { border-color: var(--of-border-strong); color: var(--of-ink-1); }

/* ── Resume / recents card (Expert density) ──────────────────────── */
.of-resume-card {
  display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .8rem;
  border: 1px solid var(--of-border); border-radius: var(--of-radius); background: var(--of-surface-raised);
}
.of-resume-card .why { font-size: .72rem; color: var(--of-ink-3); margin-top: .15rem; }
.of-resume-card .x {
  margin-left: auto; color: var(--of-ink-4); background: none; border: none;
  font-size: .9rem; line-height: 1; padding: .1rem .3rem; cursor: pointer;
}
.of-resume-card .x:hover { color: var(--of-red); }

.of-empty {
  border: 1px dashed var(--of-border-strong); border-radius: var(--of-radius);
  padding: 1rem; color: var(--of-ink-3); font-size: .82rem;
}

/* ── Pinned chip (Expert density) ─────────────────────────────────── */
.of-pinned-chip {
  display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--of-border);
  border-radius: 999px; padding: .35rem .8rem; font-size: .8rem; background: var(--of-surface-raised);
}
.of-pinned-chip button {
  background: none; border: none; color: var(--of-ink-4); font-size: .8rem; cursor: pointer; padding: 0;
}
.of-pinned-chip button:hover { color: var(--of-red); }

/* ── Persona banner ─────────────────────────────────────────────── */
.persona-banner {
  position: fixed;
  top: var(--nav-h);
  left: var(--rail-w);
  right: 0;
  z-index: 39;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  color: #9a3412;
  font-size: .74rem;
  padding: .25rem 1rem;
  line-height: 1.4;
}
.persona-banner-reset {
  color: #9a3412;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.persona-banner-reset:hover { color: #7c2d12; }

/* Push page content down by the banner height when it's visible. Applied once
   on <body> so it works for every container type (.page-wrap, .container,
   .main-content, .page-shell) and never double-applies on nested wrappers. */
body.has-persona-banner {
  padding-top: 22px;
}

/* ── Desktop layout offset ──────────────────────────────────────── */
@media (min-width: 880px) {
  /* Offset the whole document once via body padding, not per-container margins.
     (Per-container margins double-offset pages that nest .page-wrap inside
     .main-content, e.g. lead/nl-order/upload.) Fixed elements — the rail, the
     topbar, the persona banner, the bottom bar — ignore body padding, so only
     in-flow page content shifts right of the fixed rail. */
  body {
    padding-left: var(--rail-w);
  }

  /* Hide hamburger on desktop — rail is always visible */
  .rail-toggle { display: none !important; }

  /* Hide mobile brand in topbar on desktop — rail already has it */
  .topbar-brand { display: none; }
}

/* ── Mobile overrides ───────────────────────────────────────────── */
@media (max-width: 879px) {
  /* Rail slides in from the left; hidden by default */
  .app-rail {
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
    z-index: 200;
  }
  .app-rail.open {
    transform: none;
  }

  /* Topbar spans full width on mobile */
  .app-topbar {
    left: 0;
  }

  /* Persona banner spans full width on mobile */
  .persona-banner {
    left: 0;
  }

  /* No rail offset for page content on mobile */
  .page-wrap,
  .main-content,
  .page-shell,
  .container {
    margin-left: 0;
  }

  /* Show the hamburger on mobile */
  .rail-toggle {
    display: inline-flex;
  }

  /* Overlay backdrop when rail is open */
  .app-rail.open::after {
    content: '';
    position: fixed;
    inset: 0;
    left: var(--rail-w);
    background: rgba(0, 0, 0, .3);
    z-index: -1;
  }
}
