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

:root {
  /* ── THEME TOKENS ──────────────────────────────────────────────────────
     The palette is expressed through two RGB *triplets* — --fg-rgb (the
     foreground: text, icons, hairlines) and --bg-rgb (the page background) —
     so every `rgba(var(--fg-rgb), α)` value inverts automatically when the
     theme flips. Only these few lines differ between dark and light; the
     light values live in the `[data-theme="light"]` block just below.
     --ink is the page background, --paper the primary text colour. */
  --fg-rgb: 245,242,235;         /* paper — light foreground on dark */
  --bg-rgb: 14,14,13;            /* ink  — dark page background */
  --ink: rgb(var(--bg-rgb));
  --ink-2: #16161480;
  --paper: rgb(var(--fg-rgb));
  --green: #2a6e3f;
  --green-mid: #4a9e65;
  --amber: #c8812a;
  --red: #c0392b;
  --blue: #5b9bd5;
  --muted: rgba(var(--fg-rgb),.35);
  --border: rgba(var(--fg-rgb),.1);
  --border-strong: rgba(var(--fg-rgb),.2);
  --surface: rgba(var(--fg-rgb),.03);
  --surface-hover: rgba(var(--fg-rgb),.06);
  /* Solid surfaces (can't be alpha layers — they sit over the page or need to
     be opaque): the sidebar, raised panels/dropdowns, and native <option>s. */
  --sidebar-bg: #0a0a09;         /* sidebar / mobile bar — slightly under page */
  --panel-bg: #16161e;           /* raised modals & dropdown menus */
  --option-bg: #1a1a18;          /* native <select> option list */
  /* Global defaults for the analytics-scheme tokens (--bg2/--bg3/--text/
     --border2). On analytics pages .corey-legacy/.corey-page override these;
     defining them here means shared components that read them (the studio
     drawer / sd-modal from studio-extras.css) theme correctly on portal-chrome
     pages too (Deals, Clients) instead of falling back to hardcoded darks. */
  --text: var(--paper);
  --bg2: var(--panel-bg);        /* raised panel — #16161e dark / white light */
  --bg3: #20202a;                /* nested/hover — overridden light below */
  --border2: var(--border-strong);
  --font-h: 'Work Sans', sans-serif;
  --font-b: 'DM Sans', sans-serif;
  --font-m: 'DM Mono', monospace;
  --sidebar-w: 240px;
}

/* ── LIGHT THEME ─────────────────────────────────────────────────────────
   Opt-in per user (profile modal → Appearance), applied via data-theme on
   <html> and server-rendered so there's no flash. Flipping the two triplets
   carries the whole token system; the rest are tuned so that alpha layers
   (borders/surfaces/muted text) read correctly over a light background —
   the same low opacities that sit softly on dark need a touch more weight
   on light. Accent hues (green/amber/red) are shared; they already have
   enough contrast on both backgrounds. */
html[data-theme="light"] {
  /* Adjust-style: a cool neutral light-grey canvas (NO warm/paper tint) with a
     white sidebar and white cards raised on top; subtle surfaces (table
     headers, hovers) a touch greyer. Text/borders are cool-neutral too. */
  --fg-rgb: 30,33,38;            /* cool dark slate ink */
  --bg-rgb: 247,248,250;         /* cool light-grey canvas */
  --ink-2: #ffffffb0;
  --muted: rgba(var(--fg-rgb),.55);
  --border: rgba(var(--fg-rgb),.12);
  --border-strong: rgba(var(--fg-rgb),.20);
  --surface: #ffffff;            /* cards / controls — pure white, raised */
  --surface-hover: #e8eaef;      /* subtle cool grey hover / header */
  --sidebar-bg: #ffffff;         /* nav bar pure white */
  --panel-bg: #ffffff;           /* modals & dropdowns */
  --option-bg: #ffffff;
  --bg3: #e8eaef;                /* nested/hover default (light) */
  --blue: #2f6fb0;
}

/* ── GLOBAL SCROLLBAR THEME ───────────────────────────────────────────
   Paper-toned thumb on a transparent track — matches the sidebar nav.
   Per-component rules with higher specificity (cohorts table, sidebar)
   override this safely. */
* {
  scrollbar-width: thin;                                     /* Firefox */
  scrollbar-color: rgba(var(--fg-rgb),.18) transparent;         /* Firefox: thumb track */
}
*::-webkit-scrollbar { width: 8px; height: 8px; }            /* WebKit */
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(var(--fg-rgb),.18);
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--fg-rgb),.32);
}
*::-webkit-scrollbar-corner { background: transparent; }    /* corner where H+V meet */

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-b);
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ─── PORTAL LAYOUT ───────────────────────────────────── */
.portal-wrap {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
/* Embed mode (page rendered inside the Analytics workspace iframe): no sidebar,
   content fills the full width. The page supplies its own padding via .main. */
.portal-wrap.embed { grid-template-columns: 1fr; }

/* ─── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  overflow: scroll;
  top: 0;
  height: 100vh;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
/* Absolutely positioned in the existing bottom padding so it never shifts the
   icon / title / subtitle (which sit in the centered flex row above). Hidden by
   default; fades in only while hovering the brand (icon / name / subtitle). */
.sidebar-brand-ver {
  position: absolute;
  left: calc(1.5rem + 30px);
  bottom: .4rem;
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.sidebar-brand:hover .sidebar-brand-ver {
  opacity: .8;
}
.sidebar-brand-name {
  font-family: var(--font-h);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -.03em;
  text-transform: uppercase;
}
.sidebar-brand-sub {
  font-family: var(--font-m);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--fg-rgb),.15) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(var(--fg-rgb),.12);
  border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(var(--fg-rgb),.25); }
.nav-section-label {
  font-family: var(--font-m);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 1rem 1.5rem 0.5rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 1.5rem;
  font-family: var(--font-m);
  font-size: 12px;
  color: rgba(var(--fg-rgb),.6);
  border-left: 2px solid transparent;
  transition: all .15s;
  letter-spacing: .02em;
}
.nav-link:hover {
  background: var(--surface-hover);
  color: var(--paper);
}
.nav-link.active {
  background: rgba(42,110,63,.08);
  border-left-color: var(--green);
  color: var(--paper);
}
.nav-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--green-mid);
  flex-shrink: 0;
}

.sidebar-bottom {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  padding: 0 1.5rem 0.5rem;
  font-family: var(--font-m);
  font-size: 10px;
  color: var(--muted);
  line-height: 1.8;
  letter-spacing: .06em;
}
.sidebar-user strong {
  color: var(--paper);
  font-weight: 500;
}

/* ─── MAIN CONTENT ────────────────────────────────────── */
.main {
  padding: 2rem 2.5rem;
  /* Keep this overflow visible: .portal-wrap is min-height:100vh, so the window
     scrolls — .main never scrolls internally, and an overflow scroll container
     here would silently break position:sticky in page content (offer-builder
     sidebar, etc.). */
  overflow: visible;
  /* Let the content column shrink to the viewport so a wide child (e.g. the
     underwriting plot grid) reflows instead of widening the whole page. */
  min-width: 0;
}

.page-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-kicker {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green-mid);
  margin-bottom: 0.35rem;
}
.page-title {
  font-family: var(--font-h);
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: -.03em;
  text-transform: uppercase;
  line-height: 1;
}
.page-sub {
  font-family: var(--font-b);
  font-size: 13px;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* ─── CARDS / STATS ───────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.stat-label {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.stat-value {
  font-family: var(--font-h);
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -.03em;
  color: var(--paper);
  line-height: 1;
}
.stat-sub {
  font-family: var(--font-m);
  font-size: 11px;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* ─── RELATIONSHIP CARDS (deal detail: client / games / contacts) ─── */
.rel-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
.rel-group { display: flex; flex-direction: column; gap: 0.65rem; }
.rel-group-title {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green-mid);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.rel-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  text-decoration: none;
}
a.rel-card { transition: background .12s, border-color .12s; }
a.rel-card:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.rel-card--game { display: flex; align-items: center; gap: 0.75rem; }
.rel-card--game .rel-card-body { min-width: 0; }
.rel-card-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 10px; object-fit: cover;
  background: var(--surface-hover); border: 1px solid var(--border);
}
.rel-card-icon--empty {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-m); font-size: 16px; color: var(--muted);
}
.rel-card-name {
  font-family: var(--font-b);
  font-size: 14px;
  font-weight: 500;
  color: var(--paper);
}
.rel-card-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.rel-card-sub {
  display: inline-block;
  font-size: 11px;
  color: var(--green-mid);
  margin-top: 6px;
  text-decoration: none;
}
a.rel-card-sub:hover { text-decoration: underline; }
.rel-empty {
  font-family: var(--font-m);
  font-size: 12px;
  color: var(--muted);
  padding: 0.85rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.stat-strip {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2rem;
}
.stat-strip-item {
  flex: 1;
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--border);
  text-align: center;
}
.stat-strip-item:last-child { border-right: none; }
.stat-strip-count {
  font-family: var(--font-h);
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--paper);
}
.stat-strip-label {
  font-family: var(--font-m);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ─── TABLES ──────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
table.portal-table {
  width: 100%;
  border-collapse: collapse;
}
.portal-table thead th {
  text-align: left;
  padding: 12px 14px;
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: rgba(var(--fg-rgb),.01);
  font-weight: 500;
}
/* Light: give the header row a faint grey so it separates from the white
   body rows instead of blending. Dark keeps the near-transparent tint. */
html[data-theme="light"] .portal-table thead th { background: var(--surface-hover); }

/* Light: the analytics dropdowns (Leads/Cohorts) bake white-fill caret and
   calendar SVGs as background-images for the dark theme — invisible on white.
   Swap in dark-fill versions. (.mon-root selects are handled in monitor.css.) */
html[data-theme="light"] .corey-legacy .filter-select,
html[data-theme="light"] .corey-legacy .filter-row .filter-select,
html[data-theme="light"] .corey-legacy .ms-trigger {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'><path fill='%23666' d='M4 0L0 4h8L4 0zm0 12l4-4H0l4 4z'/></svg>");
}
html[data-theme="light"] .corey-legacy .date-range-pill .date-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>");
}

/* Light: the dark theme's heavy drop shadows (rgba(0,0,0,.4–.6)) read too
   strong on a light background. Soften floating menus and modals to a subtle
   cool shadow (Adjust-style). */
html[data-theme="light"] .ms-dropdown,
html[data-theme="light"] .remf-dropdown,
html[data-theme="light"] .msf-menu,
html[data-theme="light"] :is(.sd-drawer, #studio-drawer, .sd-modal) .selectize-dropdown,
html[data-theme="light"] .selectize-dropdown {
  box-shadow: 0 6px 18px rgba(17,24,39,.10) !important;
}
html[data-theme="light"] .gcu-modal__panel,
html[data-theme="light"] .sd-modal,
html[data-theme="light"] .sd-drawer,
html[data-theme="light"] .modal-card {
  box-shadow: 0 12px 32px rgba(17,24,39,.12) !important;
}
.portal-table tbody td {
  padding: 12px 14px;
  font-family: var(--font-m);
  font-size: 12px;
  color: var(--paper);
  border-bottom: 1px solid var(--border);
}
.portal-table tbody tr:last-child td { border-bottom: none; }
.portal-table tbody tr:hover { background: var(--surface-hover); }
.portal-table td a {
  color: var(--green-mid);
  text-decoration: none;
}
.portal-table td a:hover { text-decoration: underline; }

.table-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-m);
  font-size: 12px;
}

/* ─── BADGES ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 500;
}
.badge-intake       { background: rgba(var(--fg-rgb),.08); color: var(--paper); }
.badge-underwriting { background: rgba(200,129,42,.12);  color: var(--amber); }
.badge-offer_sent   { background: rgba(82,72,255,.15);   color: #7d73ff; }
.badge-signed       { background: rgba(82,72,255,.15);   color: #7d73ff; }
.badge-funded       { background: rgba(42,110,63,.15);   color: var(--green-mid); }
.badge-repaying     { background: rgba(42,110,63,.15);   color: var(--green-mid); }
.badge-closed       { background: rgba(var(--fg-rgb),.04); color: var(--muted); }

.badge-scheduled { background: rgba(var(--fg-rgb),.08); color: var(--paper); }
.badge-paid      { background: rgba(42,110,63,.15);   color: var(--green-mid); }
.badge-partial   { background: rgba(200,129,42,.12);  color: var(--amber); }
.badge-late      { background: rgba(192,57,43,.15);   color: #e67364; }
.badge-waived    { background: rgba(var(--fg-rgb),.04); color: var(--muted); }

.badge-active    { background: rgba(42,110,63,.15);   color: var(--green-mid); }
.badge-completed { background: rgba(var(--fg-rgb),.08); color: var(--paper); }
.badge-defaulted { background: rgba(192,57,43,.15);   color: #e67364; }

.badge-auto      { background: rgba(82,72,255,.15);   color: #7d73ff; }
.badge-manual    { background: rgba(var(--fg-rgb),.08); color: var(--paper); }

/* ─── FILTER BAR ──────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.filter-bar input,
.filter-bar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--font-m);
  font-size: 12px;
  color: var(--paper);
  outline: none;
  min-width: 180px;
}
.filter-bar input:focus,
.filter-bar select:focus { border-color: rgba(42,110,63,.6); }
.filter-bar select { cursor: pointer; }
.filter-bar select option { background: var(--option-bg); }

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-m);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: background .15s;
}
.btn:hover { background: var(--green-mid); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--paper);
}
.btn-ghost:hover { background: var(--surface-hover); border-color: rgba(var(--fg-rgb),.4); }
.btn-sm { padding: 6px 10px; font-size: 10px; }
.btn-danger { color: #d9888a; }
.btn-danger:hover { color: #fff; background: rgba(192,57,43,.22); border-color: #c0392b; }

.action-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* ─── DETAIL PANELS ───────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.panel-title {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green-mid);
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem 1.5rem;
}
.kv-label {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.kv-value {
  font-family: var(--font-m);
  font-size: 13px;
  color: var(--paper);
}
.kv-value.big {
  font-family: var(--font-h);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.02em;
}
.kv-value a { color: var(--green-mid); }
.kv-value a:hover { text-decoration: underline; }

/* ─── FACILITY RAMP (staged deployment row on deal detail) ─── */
.ramp {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: .65rem;
  overflow-x: auto;
}
.ramp-cell {
  flex: 1;
  min-width: 110px;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  text-align: center;
}
.ramp-cell-now {
  border-color: rgba(82,72,255,.45);
  background: rgba(82,72,255,.10);
}
.ramp-amount {
  font-family: var(--font-h);
  font-weight: 900;
  font-size: 14px;
  letter-spacing: -.02em;
  color: var(--paper);
  line-height: 1;
}
.ramp-cell-now .ramp-amount { color: #9d95ff; }
.ramp-month {
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 5px;
}
.ramp-cell-now .ramp-month { color: #9d95ff; }

/* ─── FORMS ───────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.75rem;
  max-width: 600px;
}
.form-field { margin-bottom: 1.1rem; }
.form-field label {
  display: block;
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  background: rgba(var(--fg-rgb),.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  font-family: var(--font-m);
  font-size: 12px;
  color: var(--paper);
  outline: none;
  transition: border-color .15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: rgba(42,110,63,.6); }
.form-field select option { background: var(--option-bg); }
.form-error {
  font-family: var(--font-m);
  font-size: 11px;
  color: #e67364;
  margin-top: 4px;
}

/* ─── TOGGLE SWITCH (e.g. deal active/inactive) ─── */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  position: absolute;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
}
.switch .slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: rgba(var(--fg-rgb),.12);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background .15s, border-color .15s;
}
.switch .slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s, background .15s;
}
.switch input:checked + .slider {
  background: rgba(42,110,63,.3);
  border-color: rgba(42,110,63,.6);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
  background: var(--green-mid);
}
.switch input:focus + .slider { border-color: rgba(42,110,63,.6); }
/* Beat `.form-field label { display:block }` so the toggle stays inline. */
.form-field label.switch { display: inline-flex; margin: 0; }
.switch-row { display: flex; align-items: center; gap: 12px; }
.switch-state {
  font-family: var(--font-m);
  font-size: 12px;
  color: var(--paper);
}

/* ─── MESSAGES ────────────────────────────────────────── */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: 6px;
  font-family: var(--font-m);
  font-size: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid;
}
.alert-success { background: rgba(42,110,63,.08); border-color: rgba(42,110,63,.2); color: var(--green-mid); }
.alert-error   { background: rgba(192,57,43,.08);  border-color: rgba(192,57,43,.2);  color: #e67364; }
.alert-warn    { background: rgba(200,129,42,.08); border-color: rgba(200,129,42,.2); color: var(--amber); }

/* ─── LOGIN PAGE ──────────────────────────────────────── */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(ellipse at top, rgba(42,110,63,.08) 0%, var(--ink) 60%);
}
.login-card {
  background: rgba(var(--fg-rgb),.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.login-title {
  font-family: var(--font-h);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -.02em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 0.35rem;
}
.login-sub {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-bottom: 2rem;
}
.login-field { margin-bottom: 1rem; }
.login-field label {
  display: block;
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  background: rgba(var(--fg-rgb),.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 14px;
  font-family: var(--font-m);
  font-size: 13px;
  color: var(--paper);
  outline: none;
  transition: border-color .15s;
}
.login-field input:focus { border-color: rgba(42,110,63,.6); }
.login-submit {
  width: 100%;
  padding: 13px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-m);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  transition: background .15s;
}
.login-submit:hover { background: var(--green-mid); }
.login-error {
  font-family: var(--font-m);
  font-size: 11px;
  color: #e67364;
  text-align: center;
  margin-bottom: 1rem;
}

/* ─── OFFER FORM 2-COL LAYOUT ─────────────────────────── */
.offer-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}
.form-col { min-width: 0; }

.section { margin-bottom: 2.5rem; }
.section-title {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green-mid);
  margin-bottom: 1.25rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.offer-sidebar {
  position: sticky;
  top: 1rem;
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  overflow-y: auto;
}

.rule-block { margin-bottom: 1.5rem; }
.rule-block:last-child { margin-bottom: 0; }
.rule-title {
  font-family: var(--font-m);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-mid);
  margin-bottom: .65rem;
}
.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: .5rem;
  font-family: var(--font-m);
  font-size: 11px;
  line-height: 1.5;
  color: rgba(var(--fg-rgb),.6);
}
.rule-item::before { content: '—'; color: var(--border-strong); flex-shrink: 0; }
.rule-item strong { color: var(--paper); font-weight: 500; }

.rate-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: .5rem;
}
.rate-table td {
  font-family: var(--font-m);
  font-size: 11px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  color: rgba(var(--fg-rgb),.6);
}
.rate-table td:first-child {
  color: var(--paper);
  font-weight: 500;
  width: 60px;
}
.rate-table tr:last-child td { border-bottom: none; }

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

.preview-card {
  background: rgba(var(--fg-rgb),.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.preview-title {
  font-family: var(--font-m);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-mid);
  margin-bottom: .75rem;
}
.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.preview-row:last-child { border-bottom: none; }
.preview-label {
  font-family: var(--font-m);
  font-size: 10px;
  color: rgba(var(--fg-rgb),.4);
}
.preview-value {
  font-family: var(--font-m);
  font-size: 11px;
  color: var(--paper);
  text-align: right;
}

@media (max-width: 1100px) {
  .offer-layout { grid-template-columns: 1fr; }
  .offer-sidebar { position: static; max-height: none; }
}

/* ─── UTILITY ─────────────────────────────────────────── */
.muted { color: var(--muted); }
.mono { font-family: var(--font-m); }
.nowrap { white-space: nowrap; }

/* ─── KANBAN BOARD ────────────────────────────────────── */
.kanban-wrap {
  overflow-x: auto;
  margin: 0 -2.5rem;
  padding: 0 2.5rem 2rem;
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
}
.kanban-wrap::-webkit-scrollbar {
  display: none;               /* Chrome/Safari */
}
.kanban {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  min-width: min-content;
}
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
}
.kanban-col-head {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;                 /* keep the count bubble off the $ summary */
  flex-shrink: 0;
}
.kanban-col-title {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-mid);
}
.kanban-col-count {
  font-family: var(--font-m);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-hover);
  padding: 2px 8px;
  border-radius: 10px;
}
.kanban-col-body {
  padding: 0.75rem;
  overflow-y: auto;
  flex: 1;
  min-height: fit-content;
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
}
.kanban-col-body::-webkit-scrollbar {
  display: none;               /* Chrome/Safari */
}
.kanban-col.drop-target {
  border-color: var(--green-mid);
  background: rgba(42, 110, 63, .06);
}

.deal-card {
  background: rgba(var(--fg-rgb), .04);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.5rem;
  cursor: grab;
  transition: background .15s, border-color .15s, transform .1s;
  color: var(--paper);
  text-decoration: none;
  display: block;
  /* Prevent accidental text selection interfering with drag-to-reorder.
     Vendor prefixes included because native HTML5 drag on some browsers
     (especially Firefox + Safari) still triggers selection without them. */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  /* Disable mobile long-press context menu / text callout so touch drag works. */
  -webkit-touch-callout: none;
}
.deal-card:hover {
  background: rgba(var(--fg-rgb), .08);
  border-color: rgba(var(--fg-rgb), .35);
}
.deal-card:active { cursor: grabbing; }
.deal-card.dragging {
  opacity: 0.4;
  transform: rotate(1deg);
}
.deal-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.4rem;
  gap: 6px;
}
.deal-card-id {
  font-family: var(--font-m);
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
}
.deal-card-studio {
  font-family: var(--font-h);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--paper);
  margin-bottom: 2px;
  line-height: 1.2;
}
.deal-card-game {
  font-family: var(--font-b);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 0.6rem;
  line-height: 1.3;
}
.deal-card-meta {
  /* 1fr auto 1fr keeps the middle (created date) at the card's true center
     regardless of how wide the amount / close-date items are. */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  font-family: var(--font-m);
  font-size: 10px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.1rem;
}
.deal-card-meta .deal-card-amount { justify-self: start; }
.deal-card-amount {
  color: var(--green-mid);
  font-weight: 500;
}
/* Estimate fallback — when there's no actual deal size yet, the card shows the
   client's estimated funding size in blue to flag it as a forecast. */
.deal-card-amount.is-estimate {
  color: var(--blue);
}
/* Created date — true card-center (middle grid column). */
.deal-card-created { justify-self: center; text-align: center; white-space: nowrap; }
/* Expected close date — right-aligned, blue. */
.deal-card-close { justify-self: end; color: var(--blue); white-space: nowrap; }
.kanban-empty {
  font-family: var(--font-m);
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 1.25rem 0.5rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  margin: 0.5rem 0;
}

.kanban-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--green);
  color: #fff;
  padding: 10px 18px !important;
  border-radius: 6px;
  font-family: var(--font-m);
  font-size: 12px;
  /* Must sit above the lead/inactive drawers (9998-9999) and the
     create-deal / activity / lead-edit modals (10000) so the toast stays
     visible even when one of those surfaces is still open behind it. */
  z-index: 10001;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .2s, transform .2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  pointer-events: none;
}
.kanban-toast.show {
  opacity: 1;
  transform: none;
}
.kanban-toast.error {
  background: var(--red);
}

/* ─── MOBILE / TABLET ──────────────────────────────────────
   Sidebar collapses into a slide-in drawer behind a hamburger button.
   <body class="sidebar-open"> is toggled by the button in base.html. */
.mobile-bar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  /* Top bar with hamburger — sticky so it stays visible while scrolling. */
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1100;
    height: 48px;
    padding: 0 12px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
  }
  .mobile-bar-title {
    font-family: var(--font-h);
    font-weight: 900;
    font-size: 14px;
    letter-spacing: -.02em;
    text-transform: uppercase;
    color: var(--paper);
  }
  .mobile-bar-toggle {
    width: 36px; height: 32px;
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
  }
  .mobile-bar-toggle span {
    display: block; height: 2px; width: 100%;
    background: var(--paper);
    transition: transform .15s, opacity .15s;
  }
  body.sidebar-open .mobile-bar-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.sidebar-open .mobile-bar-toggle span:nth-child(2) { opacity: 0; }
  body.sidebar-open .mobile-bar-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* The portal-wrap grid collapses to a single column. */
  .portal-wrap {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 48px);
  }

  /* Sidebar becomes a fixed drawer that slides in from the left. */
  .sidebar {
    position: fixed;
    top: 48px;
    left: 0;
    bottom: 0;
    height: auto;
    width: 80vw;
    max-width: 280px;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }

  /* Backdrop dims the page when the drawer is open. Click it to close. */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 48px;
    inset: 48px 0 0 0;
    background: rgba(0,0,0,.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    z-index: 1040;
  }
  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Main content takes full width. Tighter padding on small screens. */
  .main {
    padding: 1rem;
  }

  /* Analytics pages are content-dense — trim the side padding on mobile so
     the filter cards and tables get more usable width. */
  body[data-active="leads"] .main,
  body[data-active="cohorts"] .main {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  /* Stat / table layouts that assumed desktop widths. */
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ── Selectize multi-select chips — theme green, everywhere ─────────────
   Selectize's default skin paints selected items blue (#1da7ee gradient).
   This loads in base.html so it covers every page; !important because the
   CDN selectize.default.css loads after it in the extra_css blocks. */
.selectize-control.multi .selectize-input [data-value],
.selectize-control.multi .selectize-input [data-value].active {
  background-color: var(--green, #2a6e3f) !important;
  background-image: none !important;
  border: 1px solid var(--green-mid, #4a9e65) !important;
  color: #fff !important;
  text-shadow: none !important;
  box-shadow: none !important;
}
.selectize-control.plugin-remove_button [data-value] .remove {
  border-left: 1px solid rgba(255, 255, 255, .25) !important;
}

/* ─── PROFILE BUTTON (sidebar) + MODAL ─────────────────── */
/* Button form of the sidebar identity (opens the profile modal). */
button.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 1.5rem);
  margin: 0 0.75rem 0.5rem;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  letter-spacing: normal;
  transition: background .12s, border-color .12s;
}
button.sidebar-user:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.sidebar-user-avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #fff;                 /* always white on the green avatar (both themes) */
  font-family: var(--font-h);
  font-weight: 700;
  font-size: 12px;
}
.sidebar-user-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-user-name {
  font-family: var(--font-b);
  font-size: 12px;
  color: var(--paper);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-family: var(--font-m);
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-badge {
  flex: 0 0 auto;
  font-family: var(--font-m);
  font-size: 8px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--muted);
  border: 1px solid var(--border);
}
.sidebar-user-badge--admin {
  color: var(--green-mid);
  border-color: color-mix(in srgb, var(--green-mid) 45%, transparent);
}
.sidebar-user-badge--super_admin {
  color: #e0b64a;
  border-color: color-mix(in srgb, #e0b64a 50%, transparent);
}
.sidebar-user-badge--banned {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 55%, transparent);
}

/* Modal shell */
.gcu-modal { position: fixed; inset: 0; z-index: 10000; }
.gcu-modal[hidden] { display: none; }
.gcu-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(10,10,15,.6);
  backdrop-filter: blur(3px);
}
.gcu-modal__panel {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--panel-bg);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
}
.gcu-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.gcu-modal__head h2 {
  margin: 0;
  font-family: var(--font-h); font-weight: 900;
  font-size: 1.15rem; letter-spacing: -.02em; color: var(--paper);
}
.gcu-modal__x {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1;
  padding: 4px 8px; border-radius: 6px;
}
.gcu-modal__x:hover { color: var(--paper); background: var(--surface-hover); }
.gcu-modal__body { padding: 20px 22px 22px; }

.gcu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gcu-field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.gcu-field label {
  font-family: var(--font-m); font-size: 9px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.gcu-static { font-family: var(--font-b); font-size: 13px; color: var(--paper); }
.gcu-mono { font-family: var(--font-m); }
.gcu-field input {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 9px 11px;
  font-family: var(--font-b); font-size: 13px; color: var(--paper);
}
.gcu-field input:focus { outline: none; border-color: var(--green-mid); }

.gcu-badge {
  display: inline-block;
  font-family: var(--font-m); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 5px;
  color: var(--muted); border: 1px solid var(--border);
}
.gcu-badge--admin { color: var(--green-mid); border-color: color-mix(in srgb, var(--green-mid) 45%, transparent); }
.gcu-badge--super_admin { color: #e0b64a; border-color: color-mix(in srgb, #e0b64a 50%, transparent); }
.gcu-badge--banned { color: var(--red); border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.gcu-lock { font-size: 11px; opacity: .7; margin-left: 4px; }

.gcu-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin-top: 6px;
}
.gcu-msg { font-family: var(--font-m); font-size: 11px; color: var(--muted); }
.gcu-msg--ok { color: var(--green-mid); }
.gcu-msg--err { color: var(--red); }
.gcu-btn {
  font-family: var(--font-b); font-size: 13px; font-weight: 500;
  padding: 9px 18px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--paper); cursor: pointer;
}
.gcu-btn--primary { background: var(--green); border-color: var(--green); color: #fff; }
.gcu-btn--primary:hover { filter: brightness(1.15); }
.gcu-btn:disabled { opacity: .55; cursor: default; }

/* Appearance (theme) segmented toggle in the profile modal. */
.gcu-theme {
  display: inline-flex; gap: 4px; padding: 4px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); width: fit-content;
}
.gcu-theme-opt {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-b); font-size: 13px; color: var(--muted);
  padding: 7px 14px; border: none; border-radius: 5px;
  background: transparent; cursor: pointer; transition: background .15s, color .15s;
}
.gcu-theme-opt:hover { color: var(--paper); }
.gcu-theme-opt.is-active { background: var(--surface-hover); color: var(--paper); }
.gcu-theme-swatch {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--border-strong); flex-shrink: 0;
}
.gcu-theme-swatch--dark { background: #0e0e0d; }
.gcu-theme-swatch--light { background: #f5f2eb; }

/* Admin user table */
.gcu-admin { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.gcu-admin__head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.gcu-admin__head span:first-child {
  font-family: var(--font-h); font-weight: 700; font-size: 13px; color: var(--paper);
}
.gcu-admin__hint { font-family: var(--font-m); font-size: 9px; color: var(--muted); }
.gcu-admin__tablewrap { overflow-x: auto; }
.gcu-table { width: 100%; border-collapse: collapse; }
.gcu-table th {
  text-align: left; font-family: var(--font-m); font-size: 9px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.gcu-table td {
  padding: 8px 10px 8px 0; font-family: var(--font-b); font-size: 12px;
  color: var(--paper); border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.gcu-table .gcu-email-cell { color: var(--muted); font-size: 11px; }
.gcu-you {
  font-family: var(--font-m); font-size: 8px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--green-mid);
  border: 1px solid color-mix(in srgb, var(--green-mid) 40%, transparent);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px;
}
.gcu-access-select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 5px; padding: 5px 8px;
  font-family: var(--font-b); font-size: 12px; color: var(--paper); cursor: pointer;
}
.gcu-access-select:focus { outline: none; border-color: var(--green-mid); }
.gcu-access-select:disabled { opacity: .5; }

@media (max-width: 520px) {
  .gcu-grid { grid-template-columns: 1fr; }
}

/* ─── FOLLOW-UP REMINDERS ─────────────────────────────── */
/* Sidebar reminders row. Sits directly above the profile button and mirrors its
   card metrics so the two read as a pair, but shorter — it's one line, not a
   identity block. */
.sidebar-bell {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 1.5rem);
  margin: 0 0.75rem 6px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.sidebar-bell:hover { background: var(--surface-hover); border-color: var(--border-strong); }

/* Deliberately a drawn circle, not an emoji: emoji render at their own colour
   and weight, which pulled the eye straight to the quietest row in the nav. */
.sidebar-bell-icon {
  flex: 0 0 22px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-family: var(--font-m);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  transition: background .12s, border-color .12s, color .12s;
}
.sidebar-bell-label {
  flex: 1;
  font-family: var(--font-m);
  font-size: 12px;
  letter-spacing: .02em;
  color: rgba(var(--fg-rgb),.6);
}
.sidebar-bell:hover .sidebar-bell-label { color: var(--paper); }

/* Something's due: the circle picks up green and the label comes to full
   strength. A *ring*, not a filled disc — a solid green circle sits directly
   above the profile avatar and the two read as a matching pair, which puts the
   same weight on "you have a reminder" as on "this is who you are". */
.sidebar-bell.has-due .sidebar-bell-icon {
  border-color: var(--green);
  color: var(--green);
}
.sidebar-bell.has-due .sidebar-bell-label { color: var(--paper); }

/* Hidden at zero — an always-visible "0" reads as a broken badge. */
.sidebar-bell-count {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-family: var(--font-m);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}
.sidebar-bell.has-due .sidebar-bell-count {
  border-color: transparent;
  background: rgba(125, 217, 168, .14);
  color: var(--green);
}
.sidebar-bell-count[hidden] { display: none; }

/* The reminders panel keeps a standing shape — half again as tall as it is
   wide — instead of shrinking to fit its rows. Two reminders and twelve then
   open the same size, so the tabs and the close button stay where your eye and
   cursor last left them rather than jumping with the row count.
   Scoped to #reminder-modal: the profile modal still sizes to its content.
   A fixed height, not a min-height: a floor alone still let a long Scheduled
   tab grow the panel, so switching tabs resized it under the cursor. */
#reminder-modal .gcu-modal__panel {
  --rem-panel-w: min(560px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  height: min(calc(var(--rem-panel-w) * 1.5), calc(100vh - 48px));
  overflow: hidden;                  /* the list scrolls, not the whole panel */
}
/* min-height:0 on both — a flex item defaults to min-content height, which
   would let the list push the panel taller instead of scrolling inside it. */
#reminder-modal .gcu-modal__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#reminder-modal .rem-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* Room for the last row's shadow/border against the panel edge. */
  padding-bottom: 2px;
}

/* Owner picker + close button in the panel head. The picker deliberately
   mirrors the kanban's stakeholder filter (.stkf-* in kanban.html) — same
   checkbox list, same per-row "only", same select-all, and the same rule that
   none-selected and all-selected both mean everyone. */
.rem-head-actions { display: flex; align-items: center; gap: 10px; }
.remf-wrap { position: relative; }
.remf-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--paper); font-family: var(--font-m); font-size: 10.5px;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 6px; cursor: pointer;
  transition: background .12s, border-color .12s; white-space: nowrap;
}
.remf-trigger:hover { background: var(--surface-hover); border-color: rgba(var(--fg-rgb),.4); }
.remf-wrap.remf-active .remf-trigger { border-color: var(--green-mid); color: var(--green-mid); }
.remf-arrow { font-size: 9px; opacity: .7; }
.remf-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  width: 240px; background: var(--panel-bg); border: 1px solid var(--border-strong);
  border-radius: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.5);
  display: none; overflow: hidden;
}
.remf-wrap.open .remf-dropdown { display: block; }
.remf-search-wrap { padding: 8px; border-bottom: 1px solid var(--border); }
.remf-search {
  width: 100%; box-sizing: border-box; background: var(--surface);
  border: 1px solid var(--border); border-radius: 5px; padding: 7px 9px;
  color: var(--paper); font-family: var(--font-b); font-size: 12px; outline: none;
}
.remf-search:focus { border-color: var(--green-mid); }
.remf-search::placeholder { color: var(--muted); }
.remf-list { max-height: 260px; overflow-y: auto; padding: 4px; }
.remf-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px;
  border-radius: 5px; cursor: pointer; font-family: var(--font-b);
  font-size: 12px; color: var(--paper);
}
.remf-item:hover { background: var(--surface-hover); }
.remf-item input { accent-color: var(--green-mid); cursor: pointer; }
.remf-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remf-only {
  flex: 0 0 auto; opacity: .85; cursor: pointer;
  font-family: var(--font-m); font-size: 9px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--green-mid);
  border: 1px solid color-mix(in srgb, var(--green-mid) 40%, transparent);
  border-radius: 4px; padding: 1px 6px;
}
.remf-item:hover .remf-only { opacity: 1; }
.remf-only:hover { background: color-mix(in srgb, var(--green-mid) 18%, transparent); }
.remf-all {
  margin: 6px 8px; border-bottom: 1px solid var(--border);
  padding-bottom: 10px; font-family: var(--font-m); font-size: 11px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.remf-empty { padding: 12px; color: var(--muted); font-size: 12px; text-align: center; }

/* Due / Scheduled tabs. Both sets arrive in one fetch, so switching is local. */
.rem-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.rem-tab {
  padding: 7px 14px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font-m);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--muted);
  cursor: pointer;
}
.rem-tab:hover { color: var(--paper); }
.rem-tab.active { color: var(--paper); border-bottom-color: var(--green); }

/* Panel rows — reuses the .gcu-modal shell from the profile modal. */
.rem-list { display: flex; flex-direction: column; gap: 8px; }
.rem-empty {
  padding: 18px 4px;
  color: var(--muted);
  font-size: 13px;
}
.rem-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
/* Overdue rows carry a left edge, so the ones that need action read first. */
.rem-row--due { border-left: 3px solid var(--green); }
/* Cleared rows are a record of what's been dealt with — present, not pressing. */
.rem-row--done { opacity: .6; }
.rem-row--done:hover { opacity: 1; }
.rem-main { flex: 1; min-width: 0; }
.rem-title {
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rem-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 3px;
  font-family: var(--font-m);
  font-size: 10.5px;
  color: var(--muted);
}
.rem-row--due .rem-when { color: var(--green); }
/* Cleared rows carry three dates — set / due / cleared — so they need
   separating from each other and from the owner pill beside them. */
.rem-date + .rem-date { padding-left: 8px; border-left: 1px solid var(--border); }
.rem-date--done { color: var(--paper); }
/* Own line between the title and the timing — free text, so it wraps rather
   than stretching the row, and stays clear of the Open/Clear buttons. Full
   strength: it's what you actually wrote, not metadata about the reminder. */
.rem-reason {
  margin-top: 3px;
  font-family: var(--font-b);
  font-size: 12px;
  color: var(--paper);
  overflow-wrap: anywhere;
}
.rem-who {
  padding: 1px 5px; border-radius: 3px;
  background: rgba(var(--fg-rgb),.07);
}
/* Leads the meta line: what kind of thing the reminder hangs off. Same filled
   grey chip as the notes history's system/author badges (.sn-sys-badge) — the
   two lists sit a click apart, so a reminder's pill and a note's pill reading
   the same is worth more than colour-coding the kinds. */
.rem-kind {
  display: inline-block;
  padding: 1px 5px; border-radius: 3px;
  background: rgba(var(--fg-rgb),.07);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 9px;
  white-space: nowrap;
}
.rem-actions { flex: 0 0 auto; display: flex; gap: 6px; }
.rem-actions .gcu-btn { padding: 5px 12px; font-size: 12px; }


