/* ==========================================================================
   Wibits CRM design system: tokens first (SCOLA Web Admin look, see the end of this file).
   Tokens first; components only ever reference tokens.
   ========================================================================== */

@font-face {
  font-family: "Lexend";
  src: url("/static/vendor/lexend/lexend-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --font-sans: "Lexend", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  /* Surfaces: warm neutral canvas, white cards (SCOLA) */
  --bg: #eeede9;
  --bg-sidebar: #eeede9;
  --surface: #ffffff;
  --surface-hover: #f7f7f4;
  --surface-sunken: #f5f4f0;
  --surface-zebra: #f6f6f3;
  --border: #dddbd4;
  --border-strong: #c9c7bf;

  --text: #1c1c1a;
  --text-muted: #5d5c57;
  --text-subtle: #8a8983;

  /* Actions: SCOLA blue. Brand: SCOLA green. */
  --accent: #1a6dff;
  --accent-hover: #0d5ae6;
  --accent-soft: #e7efff;
  --accent-text: #1456d6;
  --on-accent: #ffffff;
  --brand: #0f9f6e;
  --brand-soft: #e2f5ec;

  /* Status (reserved for state; always paired with a label or icon) */
  --success: #138a4b;
  --success-soft: #e3f6ea;
  --warning: #b86a00;
  --warning-soft: #fff3e0;
  --danger: #d9304a;
  --danger-strong: #d1253f;
  --danger-soft: #fdebee;

  /* Icon badge tones (decorative identity for KPI cards) */
  --tone-purple: #8a3ffc;
  --tone-blue: #1a6dff;
  --tone-orange: #ff8a1f;
  --tone-green: #14b37d;
  --tone-red: #f0435c;
  --tone-teal: #0ea5a4;

  /* Lead categories: validated categorical slots 1-3 (blue, orange, aqua) */
  --cat-school: #2a78d6;
  --cat-partner: #eb6834;
  --cat-connector: #1baf7a;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(28, 28, 26, 0.04);
  --shadow: 0 1px 3px rgba(28, 28, 26, 0.08), 0 1px 2px rgba(28, 28, 26, 0.04);
  --shadow-lg: 0 14px 36px rgba(28, 28, 26, 0.14);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);

  --sidebar-width: 248px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #131312;
    --bg-sidebar: #131312;
    --surface: #1c1c1a;
    --surface-hover: #242422;
    --surface-sunken: #181817;
    --surface-zebra: #20201e;
    --border: #2f2e2b;
    --border-strong: #45443f;
    --text: #eeede9;
    --text-muted: #b0afa8;
    --text-subtle: #7c7b75;
    --accent: #4c8dff;
    --accent-hover: #6aa0ff;
    --accent-soft: #1b2a47;
    --accent-text: #8db4ff;
    --brand: #2cc28c;
    --brand-soft: #123326;
    --success: #4ade80;
    --success-soft: #12301f;
    --warning: #fbbf24;
    --warning-soft: #2e2410;
    --danger: #ff6b7f;
    --danger-strong: #ff6b7f;
    --danger-soft: #3a1820;
    --cat-school: #3987e5;
    --cat-partner: #d95926;
    --cat-connector: #199e70;
    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.55);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a.link { color: var(--accent-text); }
a.link:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- App shell ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0;
  width: var(--sidebar-width); height: 100vh; flex: none;
  display: flex; flex-direction: column; gap: 2px;
  padding: 20px 14px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 18px; }
.brand-mark { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.brand-text { line-height: 1; }
.brand-sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.02em; margin-bottom: 2px; }
.brand-name { display: block; font-weight: 600; font-size: 22px; letter-spacing: -0.02em; color: var(--brand); }

.sidebar-search { position: relative; margin: 0 0 10px; }
.sidebar-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); width: 15px; height: 15px; }
.sidebar-search input {
  width: 100%; height: 38px; padding: 0 12px 0 34px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13.5px; outline: none;
}
.sidebar-search input:focus { border-color: var(--accent); box-shadow: var(--focus); }

.nav-section { margin-top: 16px; padding: 0 12px 6px; font-size: 11px; font-weight: 600; color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.08em; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 12px; border-radius: var(--radius);
  color: var(--text); font-weight: 400; font-size: 15px;
}
.nav-item .icon { width: 19px; height: 19px; color: var(--text-muted); }
.nav-item:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.nav-item.active { background: var(--surface); box-shadow: var(--shadow); font-weight: 500; }
.nav-item.active .icon { color: var(--text); }
.nav-item .dot { width: 9px; height: 9px; margin: 0 5px; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.nav-item .badge-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger-strong); color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-footer { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-footer form { display: contents; }
.sidebar-footer button.nav-item { background: none; border: 0; cursor: pointer; width: 100%; text-align: left; font: inherit; font-size: 15px; }
.demo-flag { margin: 8px 4px 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning); font-size: 12px; line-height: 1.4; }
.demo-flag a { font-weight: 600; text-decoration: underline; }

.main { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 16px 40px 0; }
.user-chip { display: flex; align-items: center; gap: 10px; text-align: right; line-height: 1.15; }
.user-chip small { display: block; font-size: 12px; color: var(--text-muted); }
.user-chip strong { font-weight: 600; font-size: 15px; }
.user-chip .avatar { width: 40px; height: 40px; font-size: 14px; }
.page { max-width: 1320px; margin: 0 auto; padding: 8px 40px 64px; }
.page.narrow { max-width: 860px; }
.page.wide { max-width: none; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-header h1 { font-size: 30px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
.page-header .subtitle { margin-top: 6px; color: var(--text-muted); font-size: 14px; }
.page-header .meta-right { text-align: right; }
.page-header .meta-right .big { font-size: 20px; font-weight: 500; }
.page-header .meta-right .small { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--text-muted); font-size: 13.5px; }
.back-link:hover { color: var(--text); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); border-color: transparent; color: var(--text); }
.btn-danger { color: var(--danger-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-square { width: 44px; height: 44px; padding: 0; }
.btn-outline-accent { border-color: var(--accent); color: var(--accent); background: var(--surface); }
.btn-outline-accent:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn-outline-danger { border-color: var(--danger-strong); color: var(--danger-strong); }
.btn-outline-danger:hover { background: var(--danger-soft); border-color: var(--danger-strong); }
.btn-icon { width: 28px; height: 28px; padding: 0; }
.btn-icon.btn-sm { width: 26px; height: 26px; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 14px; font-weight: 500; }
.hint { font-size: 12px; color: var(--text-subtle); }
.error { font-size: 12.5px; color: var(--danger-strong); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 13px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger-strong); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238f8f97' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.form-section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: -6px; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input + span { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 500; font-size: 13px; cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { box-shadow: var(--focus); }

/* ---------- Surfaces ---------- */

.card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-body { padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { font-size: 16px; font-weight: 500; }
.section + .section { margin-top: 32px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; margin-bottom: 12px; color: var(--text); }
.section-heading { font-size: 21px; font-weight: 500; letter-spacing: -0.01em; margin: 28px 0 14px; }
.section-heading:first-child { margin-top: 0; }
.section-title .count { color: var(--text-subtle); font-weight: 500; }
.section-title.danger { color: var(--danger-strong); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; background: var(--surface-sunken); color: var(--text-muted); border: 1px solid var(--border); white-space: nowrap; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger-strong); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-subtle); }
.dot-school { background: var(--cat-school); }
.dot-partner { background: var(--cat-partner); }
.dot-connector { background: var(--cat-connector); }
.dot-wl_client { background: var(--cat-wl_client); }
.dot-wl_partner { background: var(--cat-wl_partner); }

.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; background: var(--surface-sunken); color: var(--text-muted); border: 1px solid var(--border); }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; border-radius: 50%; }
.avatar.tone { border: 0; color: #fff; }
.avatar.tone-0 { background: #2b3a8f; } .avatar.tone-1 { background: #8e1b5c; } .avatar.tone-2 { background: #0b74c4; }
.avatar.tone-3 { background: #6d4c3d; } .avatar.tone-4 { background: #b0123f; } .avatar.tone-5 { background: #1d7a5a; }
.avatar.tone-6 { background: #3f3f9c; } .avatar.tone-7 { background: #9a5b00; }

.empty { padding: 28px 20px; text-align: center; color: var(--text-subtle); font-size: 13px; }
.empty-inline { padding: 12px 0; color: var(--text-subtle); font-size: 13px; }

.alert { padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); font-size: 13px; margin-bottom: 20px; }
.alert-danger { background: var(--danger-soft); color: var(--danger-strong); }

/* ---------- Tabs (filter bar) ---------- */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab .count { color: var(--text-subtle); font-size: 12px; font-variant-numeric: tabular-nums; }
.toolbar-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.select-compact { width: auto; height: 34px; min-height: 0; padding-top: 0; padding-bottom: 0; }
.search-input { position: relative; width: 260px; max-width: 100%; }
.search-input .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-subtle); width: 14px; height: 14px; }
.search-input .input { padding-left: 30px; height: 34px; min-height: 0; }

/* ---------- Table ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 14.5px; font-weight: 600; color: var(--text); padding: 14px 16px; white-space: nowrap; }
.table td { padding: 12px 16px; vertical-align: middle; font-size: 14.5px; }
.table tbody tr:nth-child(odd) td { background: var(--surface-zebra); }
.table tbody tr td:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.table tbody tr td:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--accent-soft); }
.table .primary { font-weight: 500; }
.table .secondary { font-size: 13px; color: var(--text-muted); }
.table .avatar { width: 42px; height: 42px; font-size: 13px; }
.table .row-icons { display: flex; justify-content: flex-end; gap: 2px; color: var(--text-muted); }
.cell-lead { display: flex; align-items: center; gap: 14px; }
.overdue { color: var(--danger-strong); }

/* Filter bar: labelled fields in one row, like SCOLA lists */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 20px; }
.filter-bar .field { flex: 1 1 130px; min-width: 120px; max-width: 200px; }
.filter-bar .field.grow { flex: 2 1 220px; max-width: 320px; }
.filter-bar .select, .filter-bar .input { min-height: 46px; }
.filter-bar .btn-square { height: 46px; width: 46px; }
.filter-bar .spacer { flex: 1; }

/* Folder tabs on top of a panel (SCOLA "Enrolled Students") */
.folder-tabs { display: flex; gap: 4px; padding-left: 28px; margin-bottom: -1.5px; position: relative; z-index: 1; overflow-x: auto; }
.folder-tab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border: 1.5px solid transparent; border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; color: var(--text-muted); font-size: 15px; white-space: nowrap; }
.folder-tab:hover { color: var(--text); }
.folder-tab.active { background: var(--surface); border-color: var(--border); color: var(--text); font-weight: 500; }
.folder-tab .count { font-size: 12px; color: var(--text-subtle); }
.panel { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 28px 32px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.panel-head h1, .panel-head h2 { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.panel-head p { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }
.panel-head > .page-actions { flex-wrap: nowrap; flex: none; }

/* ---------- Lead detail ---------- */

.detail-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
.detail-header h1 { font-size: 24px; line-height: 1.25; }
.detail-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; color: var(--text-muted); font-size: 13px; }
.detail-meta .sep { color: var(--border-strong); }
.detail-header .page-actions { margin-left: auto; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.detail-side { display: flex; flex-direction: column; gap: 16px; }

/* Status: a single value shown as a pill containing a native select. */
.status-control { display: inline-flex; align-items: center; gap: 8px; }
.status-pill {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 8px 0 9px; border-radius: 12px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent-text);
}
.status-pill .dot { width: 6px; height: 6px; background: currentColor; }
.status-pill select {
  appearance: none; border: 0; background: transparent; color: inherit; font: inherit;
  padding: 0 14px 0 0; margin-right: -14px; cursor: pointer; outline: none;
  field-sizing: content; /* size to the selected status where supported */
}
.status-pill .chevron { width: 12px; height: 12px; pointer-events: none; }
.status-pill:focus-within { box-shadow: var(--focus); }
.status-pill:hover { filter: brightness(0.97); }
.status-pill.static { cursor: default; padding-right: 10px; }
.status-won { background: var(--success-soft); color: var(--success); }
.status-lost { background: var(--surface-sunken); color: var(--text-muted); border: 1px solid var(--border); }
.status-since { font-size: 12.5px; color: var(--text-subtle); }
.status-list { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 12px; font-size: 13px; }
.kv dt { color: var(--text-subtle); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.kv dd.phone-row { display: flex; align-items: center; gap: 4px; margin: -4px 0; }
.quick-actions { display: flex; gap: 8px; margin-top: 16px; }
.quick-actions .btn { flex: 1; }

.composer { padding: 16px; }
.composer .textarea { border: 0; padding: 0; min-height: 64px; box-shadow: none; background: transparent; }
.composer .textarea:focus { box-shadow: none; }
.composer-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 8px; }
.composer-footer .select, .composer-footer .input { width: auto; min-height: 30px; height: 30px; padding-top: 0; padding-bottom: 0; font-size: 13px; }
.composer-footer .spacer { flex: 1; }

/* Timeline */
.timeline { display: flex; flex-direction: column; }
/* Empty states follow their list and hide themselves once the list has children. */
.timeline:has(> *) + .empty-inline,
.follow-ups:has(> *) + .empty-inline { display: none; }
.activity { position: relative; display: flex; gap: 12px; padding: 14px 0 14px; border-bottom: 1px solid var(--border); }
.activity:last-child { border-bottom: 0; }
.activity-icon { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-sunken); color: var(--text-muted); flex: none; }
.activity-icon .icon { width: 14px; height: 14px; }
.activity-main { flex: 1; min-width: 0; }
.activity-head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 6px; row-gap: 0; font-size: 12.5px; color: var(--text-subtle); }
.activity-head strong { color: var(--text); font-weight: 500; }
.activity-body { margin-top: 4px; overflow-wrap: anywhere; }
.activity-lead { font-weight: 500; flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-head time { white-space: nowrap; }
.activity.system { padding: 8px 0; align-items: center; }
.activity.system .activity-icon { width: 20px; height: 20px; margin: 0 4px; background: transparent; }
.activity.system .activity-icon .icon { width: 12px; height: 12px; }
.activity.system .activity-main { font-size: 12.5px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.activity.system .activity-body { margin: 0; }
.activity.system .activity-lead { flex-basis: 100%; font-size: 13px; }
.activity .row-actions { opacity: 0; transition: opacity 0.12s; margin-left: auto; }
.activity:hover .row-actions, .activity:focus-within .row-actions { opacity: 1; }

/* Follow-ups */
.follow-ups { display: flex; flex-direction: column; }
.follow-up { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.follow-up:last-child { border-bottom: 0; }
.follow-up form.check { display: contents; }
.check-btn { width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; flex: none; display: inline-flex; align-items: center; justify-content: center; color: transparent; padding: 0; }
.check-btn:hover { border-color: var(--success); color: var(--success); }
.check-btn .icon { width: 11px; height: 11px; stroke-width: 3; }
.follow-up.done .check-btn { background: var(--success); border-color: var(--success); color: #fff; }
.follow-up-main { flex: 1; min-width: 0; }
.follow-up-title { font-weight: 500; overflow-wrap: anywhere; }
.follow-up.done .follow-up-title { color: var(--text-subtle); text-decoration: line-through; }
.follow-up-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; font-size: 12.5px; color: var(--text-muted); }
.follow-up-meta .overdue { font-weight: 500; }
.follow-up .row-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.follow-up:hover .row-actions, .follow-up:focus-within .row-actions { opacity: 1; }
.follow-up-edit { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.follow-up-edit .row { display: flex; gap: 8px; flex-wrap: wrap; }
.sync-state { display: inline-flex; align-items: center; gap: 4px; }
.sync-state .icon { width: 12px; height: 12px; }
.sync-failed { color: var(--danger-strong); }
.inline-form { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.inline-form .row { display: flex; gap: 8px; }
.inline-form .row .input { min-width: 0; }

/* Contacts */
.contact { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.contact-view { display: flex; gap: 12px; align-items: flex-start; }
.contact-main { flex: 1; min-width: 0; }
.contact-name { display: flex; align-items: center; gap: 8px; font-weight: 500; overflow-wrap: anywhere; }
.primary-tag { margin-left: 6px; padding: 0 6px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 500; }
.contact-designation { font-size: 12.5px; color: var(--text-muted); }
.contact-lines { display: flex; flex-direction: column; margin-top: 4px; font-size: 12.5px; color: var(--text-muted); }
.contact-lines a:hover { color: var(--accent-text); }
.contact-actions { display: flex; gap: 2px; }
.contact-edit { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.contact-edit:last-child { border-bottom: 0; }
.contact-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contact-form-grid .input { min-height: 32px; padding-top: 5px; padding-bottom: 5px; font-size: 13px; }
.row-end { display: flex; justify-content: flex-end; gap: 6px; }
#contacts-card > .contact:last-of-type { border-bottom: 0; }
#contacts-card > .contact-edit[hidden] + * { border-top: 0; }

/* Popover menu (details/summary) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 150px;
  display: flex; flex-direction: column; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu-list button { text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; }
.menu-list button:hover { background: var(--surface-hover); }
.menu-list button.danger { color: var(--danger-strong); }

/* ---------- Dashboard ---------- */

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.kpi {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 172px;
  padding: 20px 22px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color 0.12s, box-shadow 0.12s;
}
a.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.kpi-title { font-size: 15.5px; font-weight: 500; padding-right: 56px; }
.kpi-icon { position: absolute; top: 18px; right: 20px; width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.kpi-icon .icon { width: 22px; height: 22px; stroke-width: 1.9; }
.tone-purple { background: var(--tone-purple); } .tone-blue { background: var(--tone-blue); }
.tone-orange { background: var(--tone-orange); } .tone-green { background: var(--tone-green); }
.tone-red { background: var(--tone-red); } .tone-teal { background: var(--tone-teal); }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.kpi-foot > div { min-width: 0; }
.kpi-foot .chip { flex: none; }
.follow-up-meta .contact-line { flex-basis: 100%; }
.kpi-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--surface-sunken); color: var(--text-muted); }
.chip .icon { width: 13px; height: 13px; }
.chip-up { background: var(--success-soft); color: var(--success); }
.chip-down { background: var(--danger-soft); color: var(--danger-strong); }
.chip-warn { background: var(--warning-soft); color: var(--warning); }
.chip-info { background: var(--accent-soft); color: var(--accent-text); }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-muted); }
.check-label input { width: 16px; height: 16px; accent-color: var(--accent); }
.fill-toggle { margin: -8px 0 20px; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); width: 100%; }
.decision { margin-top: 6px; height: 32px; max-width: 260px; font-size: 13px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.dash-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 20px; align-items: start; }
.dash-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 24px 26px; min-width: 0; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dash-card-head h2 { font-size: 19px; font-weight: 500; letter-spacing: -0.01em; }
.dash-card-head .pill { padding: 4px 12px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 500; white-space: nowrap; }

/* Horizontal bars (status distribution). Single series: one hue; won/lost carry their state colour + label. */
.hbars { display: flex; flex-direction: column; gap: 4px; }
.hbar { display: grid; grid-template-columns: 112px minmax(0, 1fr) 40px; align-items: center; gap: 14px; padding: 6px 8px; border-radius: var(--radius-sm); }
.hbar:hover { background: var(--surface-hover); }
.hbar-label { font-size: 14px; color: var(--text-muted); }
.hbar-label, .hbar-value { display: block; }
.hbar-track { display: block; position: relative; height: 22px; border-left: 1px solid var(--border-strong); }
.hbar-fill { display: block; height: 100%; min-width: 3px; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar.won .hbar-fill { background: var(--success); }
.hbar.lost .hbar-fill { background: var(--text-subtle); }
.hbar-value { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }

/* Column chart (activity per day) */
.cols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; align-items: end; height: 132px; border-bottom: 1px solid var(--border-strong); padding: 0 2px; }
.col { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.col-fill { width: min(70%, 18px); min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.col.today .col-fill { background: var(--tone-purple); }
.col:hover .col-fill { filter: brightness(1.12); }
.col-axis { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; margin-top: 6px; font-size: 11px; color: var(--text-subtle); text-align: center; padding: 0 2px; }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: 6px 9px; border-radius: 6px; background: var(--text); color: var(--surface);
  font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none; z-index: 30;
}
.hbar[data-tip]:hover::after { left: auto; right: 8px; transform: none; bottom: calc(100% - 2px); }

/* Stacked proportion bar with legend (lead mix) */
.mix-bar { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; margin: 6px 0 16px; }
.mix-bar span { display: block; height: 100%; }
.mix-legend { display: flex; flex-direction: column; gap: 10px; }
.mix-legend a { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.mix-legend a:hover .mix-name { text-decoration: underline; }
.mix-legend .mix-name { flex: 1; }
.mix-legend .mix-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.mix-legend .mix-pct { width: 44px; text-align: right; color: var(--text-subtle); font-size: 12.5px; }
.bg-school { background: var(--cat-school); } .bg-partner { background: var(--cat-partner); } .bg-connector { background: var(--cat-connector); }

/* Upcoming agenda */
.agenda { display: flex; flex-direction: column; gap: 4px; max-height: 560px; overflow-y: auto; margin: 0 -10px; padding: 0 10px; }
.agenda-day { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); padding: 12px 0 6px; display: flex; align-items: center; gap: 8px; }
.agenda-day:first-child { padding-top: 0; }
.agenda-day.danger { color: var(--danger-strong); }
.agenda-day .count { font-weight: 500; }
.agenda .follow-up { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.agenda .follow-up + .follow-up { margin-top: 0; }
.agenda .follow-up.is-overdue { border-color: color-mix(in srgb, var(--danger-strong) 35%, var(--border)); background: color-mix(in srgb, var(--danger-soft) 45%, var(--surface)); }
.time-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.is-overdue .time-pill { background: var(--danger-soft); color: var(--danger-strong); }

/* Generic list rows inside dash cards */
.rows { display: flex; flex-direction: column; }
.row-link { display: flex; align-items: center; gap: 12px; padding: 11px 10px; margin: 0 -10px; border-radius: var(--radius); font-size: 14px; }
.row-link:hover { background: var(--surface-hover); }
.row-link .grow { flex: 1; min-width: 0; }
.row-link .grow .name, .row-link .grow .sub { display: block; }
.row-link .grow .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link .grow .sub { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link .avatar { width: 36px; height: 36px; font-size: 12px; }
.row-link > .badge { flex: none; }
.row-link .num { font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.stat-box { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-sunken); }
.stat-box .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-box .l { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* Pagination */
.pager { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 4px 0; font-size: 13.5px; color: var(--text-muted); }
.pager-info { flex: 1; }
.pager-size { display: inline-flex; align-items: center; gap: 8px; }
.pager-size .select { height: 32px; min-height: 0; padding-top: 0; padding-bottom: 0; }
.pager-nav { display: inline-flex; align-items: center; gap: 8px; }
.pager-page { font-variant-numeric: tabular-nums; }
.btn.is-disabled { opacity: 0.4; pointer-events: none; }
.column-more { display: block; padding: 8px; text-align: center; font-size: 12.5px; color: var(--accent-text); border-radius: var(--radius-sm); }
.column-more:hover { background: var(--surface); }

/* ---------- Data screens ---------- */

.import-form { display: flex; flex-direction: column; gap: 20px; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 32px 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface-sunken); text-align: center; cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover, .dropzone:focus-within, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone > .icon { width: 30px; height: 30px; color: var(--accent); }
.dropzone-title { font-size: 16px; font-weight: 500; }
.dropzone-hint { font-size: 13px; color: var(--text-muted); }
.dropzone-file { font-size: 14px; font-weight: 500; color: var(--accent-text); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 16px; }
.mapping-grid .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-table td { font-size: 13.5px; }
.preview-table tr.row-duplicate td, .preview-table tr.row-error td { color: var(--text-muted); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.dash-card-head h2 .icon { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }

/* ---------- Pipeline board ---------- */

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(232px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.column { background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 240px; max-height: calc(100vh - 170px); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-size: 13px; font-weight: 600; }
.column-head .count { color: var(--text-subtle); font-weight: 500; }
.column-head .dot { width: 6px; height: 6px; background: var(--accent); }
.column.won .column-head .dot { background: var(--success); }
.column.lost .column-head .dot { background: var(--text-subtle); }
.column-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 4px 8px 8px; overflow-y: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); transition: background 0.12s; }
.column.drag-over .column-body { background: var(--accent-soft); }
.lead-card { display: block; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); cursor: grab; }
.lead-card:hover { border-color: var(--border-strong); }
.lead-card.dragging { opacity: 0.5; }
.lead-card-title { font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.lead-card-sub { margin-top: 2px; font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--text-subtle); }
.lead-card-foot .icon { width: 12px; height: 12px; }
.lead-card-foot .warn { color: var(--warning); }
.column-empty { padding: 16px 8px; text-align: center; color: var(--text-subtle); font-size: 12.5px; }

/* ---------- Settings ---------- */

.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: 0; }
.settings-row h3 { font-size: 14px; }
.settings-row p { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.steps { padding-left: 18px; color: var(--text-muted); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-sunken); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }

/* ---------- Login ---------- */

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 360px; }
.auth-card .brand { justify-content: center; padding-bottom: 24px; }

/* ---------- Responsive ---------- */

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .detail-grid, .today-grid, .dash-grid, .dash-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .detail-side { order: -1; }
}

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar {
    position: sticky; z-index: 10; width: 100%; height: auto;
    flex-direction: row; align-items: center; gap: 4px;
    padding: 8px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 8px 0 0; }
  .brand-text, .sidebar-search, .nav-section, .nav-item .count, .nav-item .label-long, .demo-flag { display: none; }
  .brand-mark { width: 32px; height: 32px; }
  .nav-item { flex: none; }
  .sidebar-footer { margin: 0 0 0 auto; flex-direction: row; }
  .page { padding: 12px 16px 48px; }
  .topbar { display: none; }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .kpi { min-height: 0; gap: 18px; }
  .panel { padding: 20px 16px; }
  .folder-tabs { padding-left: 8px; }
  .filter-bar .field, .filter-bar .field.grow { flex: 1 1 100%; max-width: none; }
  .panel-head { flex-direction: column; }
  .panel-head > .page-actions { flex-wrap: wrap; }
  .hbar { grid-template-columns: 84px minmax(0, 1fr) 32px; gap: 8px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .detail-header { flex-wrap: wrap; }
  .detail-header .page-actions { margin-left: 0; width: 100%; }
  .toolbar-filters, .toolbar-filters .search-input { width: 100%; }
  .contact-form-grid { grid-template-columns: 1fr; }
  .table .hide-sm { display: none; }
  .search-input { width: 100%; }
  .follow-up .row-actions, .activity .row-actions { opacity: 1; }
}

/* ==========================================================================
   Wibits CRM look (2026-12): SCOLA Web Admin standards.
   Warm canvas #EEEEE7, sidebar gradient #E3E3DB→#DEDED1, green #008060 for actions and the active
   menu, link blue #0175FD, folder tabs, striped tables, ● chips. Overrides the tokens above.
   ========================================================================== */

:root {
  --bg: #EEEEE7;
  --bg-sidebar: linear-gradient(180deg, #E3E3DB 0%, #DEDED1 100%);
  --surface: #ffffff;
  --surface-hover: #F6F6F1;
  --surface-sunken: #F4F4EE;
  --surface-zebra: #F7F7F2;
  --border: #DEDED5;
  --border-strong: #C8C8BD;
  --text: #171717;
  --text-muted: #55575A;
  --text-subtle: #85878A;
  --accent: #008060;
  --accent-hover: #006B50;
  --accent-soft: #E5F2EE;
  --accent-text: #0175FD;
  --brand: #008060;
  --brand-soft: #E5F2EE;
  --cat-wl_client: #0175FD;
  --cat-wl_partner: #8a3ffc;
  --focus: 0 0 0 3px color-mix(in srgb, #008060 26%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-sidebar: #181b20;
    --surface: #1c1f24;
    --surface-hover: #23272d;
    --surface-sunken: #181b20;
    --surface-zebra: #20242a;
    --border: #2c3036;
    --border-strong: #3d424a;
    --text: #ececec;
    --text-muted: #a3a7ad;
    --text-subtle: #7b8088;
    --accent: #16a37e;
    --accent-hover: #2bb891;
    --accent-soft: #16342b;
    --accent-text: #5aa6ff;
    --brand: #2bb891;
    --brand-soft: #16342b;
    --cat-wl_client: #5aa6ff;
    --cat-wl_partner: #b48cff;
  }
}

.sidebar { background: var(--bg-sidebar); border-right: 1px solid var(--border); }
.brand-mark { border-radius: 0; width: 34px; height: 34px; }
.brand-name { color: var(--text); font-size: 21px; font-weight: 700; }
.brand-name em { font-style: normal; font-weight: 500; color: var(--brand); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; padding-bottom: 24px; }
.auth-mark { width: 44px; height: 44px; flex: none; }
.auth-brand .brand-name { font-size: 26px; line-height: 1.1; }
.auth-sub { margin-top: 4px; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.auth-sub .env-flag { margin: 0; font-size: 11.5px; padding: 1px 8px; }
/* Info messages: dark text on soft green (blue on green was hard to read) */
.alert { color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.alert-danger { border-color: color-mix(in srgb, var(--danger-strong) 25%, transparent); }
.alert code { font-size: 12px; }

.nav-item { height: 38px; font-size: 14.5px; border-radius: 8px; }
.nav-item.active { background: #E5F2EE; color: #008060; box-shadow: none; font-weight: 600; }
.nav-item.active .icon { color: #008060; }
.nav-item:hover:not(.active) { background: color-mix(in srgb, #ffffff 55%, transparent); }
@media (prefers-color-scheme: dark) {
  .nav-item.active { background: var(--accent-soft); color: var(--brand); }
  .nav-item.active .icon { color: var(--brand); }
  .nav-item:hover:not(.active) { background: var(--surface-hover); }
}

/* Business switch (SCOLA | Wibits Labs) */
.biz-switch { display: flex; gap: 2px; padding: 3px; margin: 0 2px 12px; border-radius: 9px; background: color-mix(in srgb, #000 8%, transparent); }
.biz-switch form { flex: 1; display: flex; }
.biz-switch button {
  flex: 1; border: 0; background: none; cursor: pointer; padding: 6px 4px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--text-muted); white-space: nowrap;
}
.biz-switch button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.biz-switch button:focus-visible { outline: none; box-shadow: var(--focus); }

.topbar { min-height: 56px; }
.user-chip { padding: 4px 6px 4px 12px; border-radius: 999px; }
.user-chip:hover { background: color-mix(in srgb, #ffffff 60%, transparent); }
.env-flag {
  margin-right: auto; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: #fff3dc; color: #9a5b00; border: 1px solid #f1d39a;
}

/* Cards and panels: white on the warm canvas, fine edge */
.card, .panel, .dash-card, .kpi { border: 1px solid var(--border); box-shadow: none; }

/* Striped tables with a hover line (Web Admin) */
.table tbody tr:nth-child(even) td { background: var(--surface-zebra); }
.table tbody tr:hover td { background: var(--accent-soft); }
.table th { font-size: 13.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.table td { border-bottom: 1px solid var(--border); }

/* Chips: ● label */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; background: var(--accent-soft); color: var(--brand); }
.chip::before { content: "●"; font-size: 9px; }
.chip-sales { background: #e6f0ff; color: #0158c4; }
.chip-viewer { background: var(--surface-sunken); color: var(--text-muted); }
.chip-off { background: #fdebee; color: #c62f45; }
.chip-unclaimed { display: inline-flex; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #fff3dc; color: #9a5b00; white-space: nowrap; }
@media (prefers-color-scheme: dark) {
  .chip-sales { background: #14284a; color: #8ec2ff; }
  .chip-off { background: #3a1c22; color: #ff8696; }
  .chip-unclaimed, .env-flag { background: #3a2c12; color: #f0b45a; border-color: #5a4720; }
}

/* Owner control on the lead page */
.owner-control { display: inline-flex; align-items: center; gap: 8px; }
.owner-pill {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 26px 0 4px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13px;
}
.owner-pill.unclaimed { padding: 0 10px; background: #fff3dc; color: #9a5b00; border-color: #f1d39a; }
.owner-pill select { appearance: none; border: 0; background: none; font-size: 13px; cursor: pointer; padding-right: 2px; }
.owner-pill .chevron { position: absolute; right: 8px; width: 13px; height: 13px; pointer-events: none; color: var(--text-subtle); }
.avatar.avatar-xs { width: 20px; height: 20px; font-size: 9.5px; }
.lead-card-owner { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }

/* Mine | Everyone on the follow-ups page */
.segmented-links { display: inline-flex; padding: 3px; border-radius: 9px; background: color-mix(in srgb, #000 7%, transparent); }
.segmented-links a { padding: 6px 14px; border-radius: 7px; font-size: 13.5px; color: var(--text-muted); }
.segmented-links a.active { background: var(--surface); color: var(--text); font-weight: 600; }
.select-sm { height: 32px; font-size: 13px; padding: 0 8px; width: auto; }
.check { display: inline-flex; align-items: center; gap: 8px; height: 38px; }

/* Phones: the sidebar becomes a top bar */
@media (max-width: 760px) {
  .biz-switch { flex: none; margin: 0 6px; }
  .biz-switch button { padding: 5px 8px; }
}

/* Origin chip: website enquiries stand out; outreach (people we contacted) stays quiet */
.origin { display: inline-flex; align-items: center; padding: 0 7px; height: 19px; border-radius: 5px; font-size: 11.5px; font-weight: 500; vertical-align: 2px; white-space: nowrap; }
.origin-website { background: #e6f0ff; color: #0158c4; }
.origin-outreach { background: var(--surface-sunken); color: var(--text-muted); border: 1px solid var(--border); }
.origin-import { background: var(--surface-sunken); color: var(--text-subtle); }
@media (prefers-color-scheme: dark) { .origin-website { background: #14284a; color: #8ec2ff; } }
.origin-split { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 12px 0 4px; font-size: 14px; color: var(--text-muted); }
.origin-split a:hover { color: var(--text); }
.owner-pill select { field-sizing: content; max-width: 220px; }
.cell-lead .secondary .origin { margin-right: 4px; vertical-align: 1px; }
