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

:root {
  --ink: #0e0e0d;
  --ink-2: #16161480;
  --paper: #f5f2eb;
  --green: #2a6e3f;
  --green-mid: #4a9e65;
  --amber: #c8812a;
  --red: #c0392b;
  --muted: rgba(245,242,235,.35);
  --border: rgba(245,242,235,.1);
  --border-strong: rgba(245,242,235,.2);
  --surface: rgba(245,242,235,.03);
  --surface-hover: rgba(245,242,235,.06);
  --font-h: 'Work Sans', sans-serif;
  --font-b: 'DM Sans', sans-serif;
  --font-m: 'DM Mono', monospace;
  --sidebar-w: 240px;
}

/* ── 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(245,242,235,.18) transparent;         /* Firefox: thumb track */
}
*::-webkit-scrollbar { width: 8px; height: 8px; }            /* WebKit */
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(245,242,235,.18);
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(245,242,235,.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;
}

/* ─── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  background: #0a0a09;
  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;
}
.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(245,242,235,.15) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(245,242,235,.12);
  border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(245,242,235,.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(245,242,235,.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;
  overflow-y: auto;
}

.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;
}

.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(245,242,235,.01);
  font-weight: 500;
}
.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(245,242,235,.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(245,242,235,.04); color: var(--muted); }

.badge-scheduled { background: rgba(245,242,235,.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(245,242,235,.04); color: var(--muted); }

.badge-active    { background: rgba(42,110,63,.15);   color: var(--green-mid); }
.badge-completed { background: rgba(245,242,235,.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(245,242,235,.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: #1a1a18; }

/* ─── 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(245,242,235,.4); }
.btn-sm { padding: 6px 10px; font-size: 10px; }

.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(245,242,235,.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: #1a1a18; }
.form-error {
  font-family: var(--font-m);
  font-size: 11px;
  color: #e67364;
  margin-top: 4px;
}

/* ─── 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(245,242,235,.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(245,242,235,.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(245,242,235,.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(245,242,235,.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(245,242,235,.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(245,242,235,.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;
  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(245, 242, 235, .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(245, 242, 235, .08);
  border-color: rgba(245, 242, 235, .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 {
  display: flex;
  justify-content: space-between;
  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-amount {
  color: var(--green-mid);
  font-weight: 500;
}
.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;
  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: #0a0a09;
    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;
  }

  /* 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; }
}
