/* ===========================================================================
   Next Automation — visual identity
   Palette: deep indigo #15156B · emerald #05D89C · lavender-white #F5F5FF
   Light UI. Works identically in LTR and RTL (logical properties only).
   =========================================================================== */

:root {
  /* Brand — adaptive: these shift between light and dark mode */
  --indigo: #15156b;
  --indigo-hi: #232399;
  --indigo-press: #0f0f4f;
  --emerald: #05d89c;
  --emerald-hi: #2ce7b1;
  --emerald-press: #04b482;
  --emerald-glow: rgba(5, 216, 156, 0.28);

  /* Surfaces */
  --bg: #f5f5ff;
  --bg-tint: #ececfb;
  --surface: #ffffff;
  --surface-2: #f7f7fe;
  --line: rgba(21, 21, 107, 0.1);
  --line-strong: rgba(21, 21, 107, 0.18);

  /* Text */
  --text: #15156b;          /* headings */
  --text-body: #3b3b5c;     /* body copy */
  --text-dim: #6f6f92;
  --text-faint: #9a9ab5;

  /* Fixed brand marks — deliberately constant in both themes: the login hero
     panel and the logo's light backing chip are a fixed identity, not UI chrome. */
  --brand-panel: #15156b;
  --on-indigo: #eef0ff;     /* text on the brand panel */
  --logo-chip: #ffffff;

  /* Priority scale — distinct from both brand hues, same in both themes */
  --p-low: #3b82f6;   /* blue  */
  --p-med: #f59e0b;   /* amber */
  --p-high: #ef4444;  /* red   */

  /* Board column accents */
  --st-pending: #8888a8;
  --st-progress: #f59e0b;
  --st-done: var(--emerald);

  /* Due-date signals */
  --due-soon: #f59e0b;
  --due-over: #ef4444;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(21, 21, 107, 0.06), 0 2px 8px rgba(21, 21, 107, 0.05);
  --shadow: 0 12px 32px -10px rgba(21, 21, 107, 0.18);
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Dark mode: follows the OS by default (unstamped root), or the explicit
   choice made with the theme toggle (data-theme attribute wins either way). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --indigo: #8385f5;
    --indigo-hi: #a0a2ff;
    --indigo-press: #6668d6;
    --emerald: #1de9ab;
    --emerald-hi: #5ff5c8;
    --emerald-press: #14c496;
    --emerald-glow: rgba(29, 233, 171, 0.25);

    --bg: #23264a;
    --bg-tint: #2d3059;
    --surface: #2a2d56;
    --surface-2: #363968;
    --line: rgba(190, 194, 255, 0.18);
    --line-strong: rgba(190, 194, 255, 0.32);

    --text: #eef0ff;
    --text-body: #c7c9ec;
    --text-dim: #9698c4;
    --text-faint: #6c6e9c;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  --indigo: #8385f5;
  --indigo-hi: #a0a2ff;
  --indigo-press: #6668d6;
  --emerald: #1de9ab;
  --emerald-hi: #5ff5c8;
  --emerald-press: #14c496;
  --emerald-glow: rgba(29, 233, 171, 0.25);

  --bg: #23264a;
  --bg-tint: #2d3059;
  --surface: #2a2d56;
  --surface-2: #363968;
  --line: rgba(190, 194, 255, 0.18);
  --line-strong: rgba(190, 194, 255, 0.32);

  --text: #eef0ff;
  --text-body: #c7c9ec;
  --text-dim: #9698c4;
  --text-faint: #6c6e9c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.6);
}

/* Extra background presets — same accent/text tokens as light or dark,
   just a different tint for the page's own surfaces. */
:root[data-theme="light-warm"] {
  --bg: #faf6ef;
  --bg-tint: #f3ead9;
  --surface: #fffdf9;
  --surface-2: #f7f1e6;
  --line: rgba(120, 96, 40, 0.12);
  --line-strong: rgba(120, 96, 40, 0.2);
}
:root[data-theme="light-cool"] {
  --bg: #eef2fa;
  --bg-tint: #e3e9f5;
  --surface: #ffffff;
  --surface-2: #f4f7fc;
  --line: rgba(30, 64, 130, 0.1);
  --line-strong: rgba(30, 64, 130, 0.18);
}
:root[data-theme="light-mint"] {
  --bg: #f0faf5;
  --bg-tint: #e2f5ea;
  --surface: #ffffff;
  --surface-2: #eefaf3;
  --line: rgba(6, 120, 80, 0.1);
  --line-strong: rgba(6, 120, 80, 0.18);
}
:root[data-theme="dark-slate"] {
  --indigo: #8385f5;
  --indigo-hi: #a0a2ff;
  --indigo-press: #6668d6;
  --emerald: #1de9ab;
  --emerald-hi: #5ff5c8;
  --emerald-press: #14c496;
  --emerald-glow: rgba(29, 233, 171, 0.25);

  --bg: #1c1d22;
  --bg-tint: #26272e;
  --surface: #222329;
  --surface-2: #2a2b32;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  --text: #f2f2f5;
  --text-body: #cacace;
  --text-dim: #96969e;
  --text-faint: #6a6a72;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.6);
}
:root[data-theme="dark-navy"] {
  --indigo: #8385f5;
  --indigo-hi: #a0a2ff;
  --indigo-press: #6668d6;
  --emerald: #1de9ab;
  --emerald-hi: #5ff5c8;
  --emerald-press: #14c496;
  --emerald-glow: rgba(29, 233, 171, 0.25);

  --bg: #0f1626;
  --bg-tint: #17203a;
  --surface: #141b30;
  --surface-2: #1b2440;
  --line: rgba(140, 170, 255, 0.14);
  --line-strong: rgba(140, 170, 255, 0.24);

  --text: #eef0ff;
  --text-body: #c7c9ec;
  --text-dim: #9698c4;
  --text-faint: #6c6e9c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.6);
}
:root[data-theme="dark-forest"] {
  --indigo: #8385f5;
  --indigo-hi: #a0a2ff;
  --indigo-press: #6668d6;
  --emerald: #1de9ab;
  --emerald-hi: #5ff5c8;
  --emerald-press: #14c496;
  --emerald-glow: rgba(29, 233, 171, 0.25);

  --bg: #12201a;
  --bg-tint: #1a2b23;
  --surface: #17251e;
  --surface-2: #1e3128;
  --line: rgba(150, 220, 190, 0.12);
  --line-strong: rgba(150, 220, 190, 0.2);

  --text: #eef7f1;
  --text-body: #c3d8cc;
  --text-dim: #8fab9a;
  --text-faint: #62786c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--text-body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

a { color: var(--emerald-press); }

/* --- Corner controls: language + theme toggles (sit over the light form
   panel in both directions, adapt their own chrome to the active theme) -- */
.corner-controls {
  position: fixed;
  inset-block-start: 18px;
  inset-inline-end: 18px;
  z-index: 50;
  display: flex;
  gap: 8px;
}
.corner-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
}
.corner-btn:hover { color: var(--indigo); border-color: var(--indigo); transform: translateY(-1px); }
.corner-btn svg { width: 15px; height: 15px; opacity: 0.75; }
.theme-toggle__moon[hidden] { display: none; }

/* --- Auth screen --------------------------------------------------------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

/* Left: indigo brand panel with an emerald horizon */
.auth__brand {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4.5rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--on-indigo);
  background:
    radial-gradient(120% 85% at 100% 0%, rgba(5, 216, 156, 0.28), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(90, 90, 200, 0.35), transparent 60%),
    var(--brand-panel);
}
.auth__brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(80% 60% at 30% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}
.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
}
/* Logo mark: a light chip behind the two-tone icon so it reads on both the
   dark brand panel and light surfaces without the indigo shapes disappearing
   into an indigo background. */
.brand-icon {
  width: 32px;
  height: 32px;
  padding: 5px;
  border-radius: 9px;
  background: var(--logo-chip);
  box-shadow: 0 1px 2px rgba(21, 21, 107, 0.1), 0 6px 16px -6px rgba(21, 21, 107, 0.25);
  flex: none;
  display: block;
}
.auth__headline {
  position: relative;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  max-width: 15ch;
  color: #fff;
}
.auth__headline em { font-style: normal; color: var(--emerald-hi); }
.auth__note { position: relative; color: rgba(238, 240, 255, 0.72); font-size: 0.92rem; }

/* Right: the form */
.auth__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  background: var(--bg);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.75rem, 4.5vw, 2.75rem);
}
.auth-card h1 { font-size: 1.5rem; margin: 0 0 8px; color: var(--text); }
.auth-card .sub { color: var(--text-dim); margin: 0 0 28px; font-size: 0.92rem; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 7px;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field input::placeholder { color: var(--text-faint); }
.field input:focus {
  border-color: var(--emerald);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}
.field select {
  width: 100%;
  padding: 11px 38px 11px 13px;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6b8f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
[dir="rtl"] .field select { padding: 11px 13px 11px 38px; background-position: left 12px center; }
.field select:hover { border-color: var(--indigo); }
.field select:focus {
  border-color: var(--emerald);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}
.field .hint, p.hint { margin-top: 6px; font-size: 0.76rem; color: var(--text-faint); }

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
}
.check-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--indigo); cursor: pointer; flex: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: var(--indigo);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.06s, box-shadow 0.15s;
  box-shadow: 0 10px 24px -12px rgba(21, 21, 107, 0.5);
}
.btn:hover { background: var(--indigo-hi); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn--sm {
  width: auto;
  padding: 9px 15px;
  font-size: 0.88rem;
  white-space: nowrap;
  box-shadow: 0 8px 18px -12px rgba(21, 21, 107, 0.5);
}

.btn--emerald { background: var(--emerald-press); }
.btn--emerald:hover { background: var(--emerald); }

.btn--ghost {
  background: var(--surface);
  color: var(--indigo);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn--ghost:hover { background: var(--surface-2); border-color: var(--indigo); }
:root[data-theme="dark"] .btn--ghost,
:root:not([data-theme="light"]) .btn--ghost { color: var(--text); }

.auth-switch {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--text-dim);
  text-align: center;
}
.auth-switch button {
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--emerald-press);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-inline-start: 6px;
}
.auth-switch button:hover { text-decoration: underline; }
.auth-switch--quiet { font-size: 0.82rem; color: var(--text-faint); }

.form-error {
  display: none;
  margin-bottom: 16px;
  padding: 10px 13px;
  font-size: 0.86rem;
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
}
.form-error.show { display: block; }

[hidden] { display: none !important; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth__brand { min-height: 200px; }
}

/* ===========================================================================
   App shell — sidebar + content, mirrors automatically in RTL
   =========================================================================== */

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px 1fr;
  grid-template-rows: minmax(100vh, auto);
  background: var(--bg);
  transition: grid-template-columns 0.18s ease;
}

/* --- Collapsed sidebar: icon-only rail --- */
.app.sidebar-collapsed { grid-template-columns: 76px 1fr; }
.app.sidebar-collapsed .sidebar { padding-inline: 16px; }
.app.sidebar-collapsed .sidebar__brand { justify-content: center; }
.app.sidebar-collapsed .sidebar__brand span { display: none; }
.app.sidebar-collapsed .nav-item { justify-content: center; padding-inline: 0; }
.app.sidebar-collapsed .nav-item span:not(.nav-item__icon),
.app.sidebar-collapsed .nav-item__chev { display: none; }
.app.sidebar-collapsed .nav-dropdown { display: none !important; }
.app.sidebar-collapsed #sidebarCollapseBtn span { display: none; }
.app.sidebar-collapsed #sidebarCollapseBtn svg { transform: rotate(180deg); }
[dir="rtl"] .app.sidebar-collapsed #sidebarCollapseBtn svg { transform: rotate(0deg); }
.app.sidebar-collapsed .side-user__id { display: none; }
.app.sidebar-collapsed .side-user__actions { flex-direction: column; }
.app.sidebar-collapsed .side-user__actions .ghost-btn { width: 100%; }

/* --- Sidebar ----------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 20px;
  background: var(--surface);
  border-inline-end: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 4px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.sidebar__brand .brand-icon { width: 28px; height: 28px; padding: 4px; box-shadow: none; flex: none; }
.sidebar__brand span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.side-nav { display: flex; flex-direction: column; gap: 7px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  cursor: pointer;
  text-align: start;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item__icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex: none;
  background: var(--surface-2);
  color: inherit;
  transition: background 0.15s, color 0.15s;
}
/* Each main nav item keeps its own icon colour at all times — including the
   collapsed icon-only rail, where colour is the only thing left to tell them
   apart. The active/hover states below still take over on top of this. */
.nav-item__icon[data-color="blue"]   { background: color-mix(in srgb, #3b82f6 16%, var(--surface-2)); color: #3b82f6; }
.nav-item__icon[data-color="purple"] { background: color-mix(in srgb, #8b5cf6 16%, var(--surface-2)); color: #8b5cf6; }
.nav-item__icon[data-color="emerald"]{ background: color-mix(in srgb, var(--emerald) 18%, var(--surface-2)); color: var(--emerald-press); }
.nav-item__icon[data-color="amber"]  { background: color-mix(in srgb, #f59e0b 18%, var(--surface-2)); color: #f59e0b; }
.nav-item__icon[data-color="pink"]   { background: color-mix(in srgb, #ec4899 16%, var(--surface-2)); color: #ec4899; }
.nav-item__icon[data-color="teal"]   { background: color-mix(in srgb, #14b8a6 18%, var(--surface-2)); color: #14b8a6; }
.nav-item:hover { color: var(--text); }
.nav-item:hover .nav-item__icon { background: var(--bg-tint); }
.nav-item.is-active {
  color: var(--indigo);
  background: var(--bg-tint);
}
.nav-item.is-active .nav-item__icon { background: var(--indigo); color: #fff; }

.nav-item--dropdown .nav-item__chev { margin-inline-start: auto; transition: transform 0.15s; }
.nav-item--dropdown[aria-expanded="true"] .nav-item__chev { transform: rotate(180deg); }
.nav-item--dropdown[aria-expanded="true"] { color: var(--indigo); }

.nav-dropdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 10px 16px;
  margin: 2px 2px 6px;
  border-inline-start: 2px solid var(--line);
  padding-inline-start: 16px;
}
.nav-dropdown__label {
  display: flex;
  align-items: center;
  padding-inline: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 4px;
}
.nav-dropdown__label--row { justify-content: space-between; }
.nav-dropdown .chip-row { padding-inline: 4px; }
.nav-dropdown .cat-list { margin-inline: -2px; gap: 3px; }

.nav-sublink {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.86rem;
  color: var(--text-body);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-sublink:hover { background: var(--bg-tint); color: var(--indigo); }

/* --- Empty / placeholder view (e.g. Leads) --- */
.empty-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 60vh;
  text-align: center;
  color: var(--text-dim);
}
.empty-view svg { width: 46px; height: 46px; color: var(--text-faint); }
.empty-view h2 { margin: 0; color: var(--text); font-size: 1.2rem; }
.empty-view p { margin: 0; max-width: 32ch; font-size: 0.9rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-tint); color: var(--indigo); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn--bordered {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.icon-btn--bordered svg { width: 18px; height: 18px; }

.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 0.9rem;
  color: var(--text-body);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: start;
  font-family: var(--font);
}
.cat-item:hover { background: var(--bg-tint); }
.cat-item.is-active { background: var(--bg-tint); color: var(--indigo); font-weight: 600; }
.cat-item__swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.cat-item__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item__count { font-size: 0.78rem; color: var(--text-faint); }
.cat-item__del {
  opacity: 0;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}
.cat-item:hover .cat-item__del { opacity: 1; }
.cat-item__del:hover { color: var(--p-high); }
.cat-item__del svg { width: 14px; height: 14px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; padding-inline: 6px; }
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--indigo); color: var(--indigo); }
.chip.is-active { background: var(--indigo); border-color: var(--indigo); color: #fff; }

.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }

.ghost-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ghost-btn:hover { background: var(--bg-tint); border-color: var(--indigo); color: var(--indigo); }
.ghost-btn svg { width: 16px; height: 16px; flex: none; }
.ghost-btn--sm { padding: 7px 10px; font-size: 0.8rem; }
.ghost-btn.is-on { color: var(--emerald-press); border-color: var(--emerald); background: rgba(5, 216, 156, 0.08); }
.ghost-btn[disabled] { opacity: 0.6; cursor: default; }

.side-user {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.side-user__id {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: start;
  font-family: var(--font);
}
.side-user__id:hover { background: var(--bg-tint); }
.side-user__id:hover svg { opacity: 1; color: var(--indigo); }
.side-user__id-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.side-user__id strong { font-size: 0.9rem; color: var(--text); font-weight: 600; }
.side-user__id span { font-size: 0.78rem; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user__id > svg { width: 15px; height: 15px; flex: none; color: var(--text-faint); opacity: 0.7; }
.side-user__actions { display: flex; gap: 8px; }
.side-user__actions .ghost-btn { flex: 1; justify-content: center; }
.side-user__actions .ghost-btn--icon { flex: none; width: 38px; padding-inline: 0; justify-content: center; }
.side-user__actions .ghost-btn--icon > span:not(.theme-toggle__sun):not(.theme-toggle__moon) { display: none; }

/* --- Theme picker: pick one of a few ready-made backgrounds ----------- */
.theme-picker { position: relative; flex: none; display: flex; }
.theme-picker__menu {
  position: absolute;
  bottom: calc(100% + 8px);
  inset-inline-start: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 30px);
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.theme-picker__menu--down { bottom: auto; top: calc(100% + 8px); }
.theme-swatch {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  background: var(--sw);
  cursor: pointer;
  padding: 0;
  position: relative;
  flex: none;
}
.theme-swatch:hover { border-color: var(--indigo); }
.theme-swatch.is-active { border-color: var(--indigo); box-shadow: 0 0 0 2px var(--bg-tint); }
.theme-swatch.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--indigo);
}

/* --- Content --------------------------------------------------------- */
.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  padding: 30px clamp(20px, 3.5vw, 40px) 40px;
  gap: 24px;
}

/* The board/leads panes are swapped by JS but must keep the same vertical
   rhythm as .content itself — display:block here would collapse every gap
   between the topbar, filters, stats and board to zero. */
#boardView {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar__title { font-size: 1.6rem; font-weight: 700; color: var(--text); margin: 0; }
.topbar__tools { display: flex; align-items: center; gap: 10px; }

.board-filter {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: -10px;
}
.board-filter__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.board-filter .chip-row { padding-inline: 0; }
.board-filter__sep { width: 1px; height: 18px; background: var(--line-strong); }

/* Priority chips pick up the priority's own colour once selected, tying the
   filter back to the badge colours it controls. */
#priorityFilter .chip[data-priority="high"].is-active { background: var(--p-high); border-color: var(--p-high); }
#priorityFilter .chip[data-priority="medium"].is-active { background: var(--p-med); border-color: var(--p-med); }
#priorityFilter .chip[data-priority="low"].is-active { background: var(--p-low); border-color: var(--p-low); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-faint);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus-within { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-glow); }
.search svg { width: 16px; height: 16px; flex: none; }
.search input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  width: clamp(140px, 22vw, 240px);
}

.reminders { position: relative; }
.reminders__badge {
  position: absolute;
  inset-block-start: -5px;
  inset-inline-end: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--p-high);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.reminders__panel {
  position: absolute;
  inset-block-start: calc(100% + 10px);
  inset-inline-end: 0;
  width: 300px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 30;
}
.reminders__head {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.notify-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.83rem;
  color: var(--text-body);
  cursor: pointer;
  background: var(--surface-2);
}
.notify-row[data-disabled] { color: var(--text-faint); cursor: not-allowed; }

.switch { position: relative; display: inline-block; width: 36px; height: 21px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track {
  position: absolute;
  inset: 0;
  background: var(--line-strong);
  border-radius: 999px;
  transition: background 0.15s;
}
.switch__thumb {
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.switch input:checked + .switch__track { background: var(--emerald-press); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(15px); }
[dir="rtl"] .switch input:checked + .switch__track .switch__thumb { transform: translateX(-15px); }
.switch input:disabled + .switch__track { opacity: 0.5; cursor: not-allowed; }
.reminder-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.reminder-row:hover { background: var(--bg-tint); }
.reminder-row:last-child { border-bottom: none; }
.reminder-row__title { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.reminder-row__time { font-size: 0.76rem; color: var(--text-faint); }
.reminder-row.is-due .reminder-row__time { color: var(--p-high); font-weight: 700; }
.reminders__empty { padding: 18px 14px; font-size: 0.85rem; color: var(--text-faint); text-align: center; }

/* --- Stats ---------------------------------------------------------- */
.stats__head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.stats__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.stats__toggle:hover { border-color: var(--indigo); color: var(--indigo); background: var(--bg-tint); }
.stats.is-collapsed .stats__head { margin-bottom: 0; }
.stats.is-collapsed .stats__grid { display: none; }

.stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.3fr;
  gap: 14px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card__label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }
.stat-card__value { font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-card--warn .stat-card__value { color: var(--p-high); }
.stat-card--ok .stat-card__value { color: var(--emerald-press); }

.stat-card--donut { gap: 10px; }
.donut-wrap { display: flex; align-items: center; gap: 14px; }
.donut { width: 74px; height: 74px; flex: none; transform: rotate(-90deg); }
.donut__hole { fill: var(--surface); }
.donut__ring { fill: transparent; stroke: var(--bg-tint); stroke-width: 4; }
.donut__seg { fill: transparent; stroke-width: 4; stroke-linecap: butt; transition: stroke-dasharray 0.4s ease; }
#segPending { stroke: var(--st-pending); }
#segProgress { stroke: var(--st-progress); }
#segDone { stroke: var(--emerald); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.donut-legend li { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; color: var(--text-dim); }
.donut-legend .k { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.donut-legend b { color: var(--text); margin-inline-start: 2px; }

/* --- Board -------------------------------------------------------- */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
  flex: 1;
}
.column {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 230px);
  overflow: hidden;
}
.column__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 15px 17px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.column[data-status="pending"] .column__head { background: color-mix(in srgb, var(--st-pending) 13%, var(--surface-2)); }
.column[data-status="in_progress"] .column__head { background: color-mix(in srgb, var(--st-progress) 15%, var(--surface-2)); }
.column[data-status="done"] .column__head { background: color-mix(in srgb, var(--emerald) 15%, var(--surface-2)); }
.column__dot { width: 8px; height: 8px; border-radius: 999px; flex: none; }
.column__dot[data-status="pending"] { background: var(--st-pending); }
.column__dot[data-status="in_progress"] { background: var(--st-progress); }
.column__dot[data-status="done"] { background: var(--emerald); }
.column__count {
  margin-inline-start: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-tint);
  color: var(--text-dim);
  font-size: 0.76rem;
  display: grid;
  place-items: center;
}
.column__body {
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  min-height: 90px;
}
.column__body.is-drop-target {
  background: rgba(5, 216, 156, 0.07);
  outline: 2px dashed var(--emerald);
  outline-offset: -6px;
  border-radius: 10px;
}
.column__empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 0.83rem;
  color: var(--text-faint);
}

/* --- Task card -------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--card-accent, var(--line-strong));
  border-radius: 12px;
  padding: 14px 15px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s, transform 0.05s, border-color 0.15s;
}
.card:hover { box-shadow: var(--shadow); border-color: var(--line-strong); }
.card:active { cursor: grabbing; }
.card.is-dragging { opacity: 0.45; }
.card.is-done .card__title { text-decoration: line-through; color: var(--text-faint); }

.card__title { font-size: 0.9rem; font-weight: 600; color: var(--text); line-height: 1.4; }
.card__desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.6;
}
.badge--priority { color: #fff; }
.badge--priority[data-p="low"] { background: var(--p-low); }
.badge--priority[data-p="medium"] { background: var(--p-med); }
.badge--priority[data-p="high"] { background: var(--p-high); }
.badge--cat { background: var(--bg-tint); color: var(--text-body); }
.badge--cat .k { width: 7px; height: 7px; border-radius: 2px; }
.badge--due { background: var(--bg-tint); color: var(--text-dim); }
.badge--due.is-soon { background: #fef3e2; color: #b45309; }
.badge--due.is-over { background: #fef2f2; color: #b91c1c; }
.badge--reminder { background: var(--bg-tint); color: var(--text-dim); }
.badge svg { width: 11px; height: 11px; }

/* --- Dialogs --------------------------------------------------- */
.dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 0;
  background: var(--surface);
  color: var(--text-body);
  box-shadow: 0 30px 70px -20px rgba(21, 21, 107, 0.4);
}
.dialog::backdrop { background: rgba(21, 21, 107, 0.32); backdrop-filter: blur(2px); }
.dialog {
  max-block-size: calc(100vh - 32px);
  overflow: hidden;
}
.dialog form {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 17px;
  max-block-size: calc(100vh - 32px);
  overflow-y: auto;
}
.dialog h2 { margin: 0 0 2px; font-size: 1.15rem; color: var(--text); }
.dialog__error {
  margin: 0;
  padding: 10px 13px;
  border-radius: 9px;
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: #b42318;
  font-size: 0.83rem;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---- Lead detail page ------------------------------------------------- */
.lead-detail__head { align-items: center; }
.lead-detail__heading { display: flex; align-items: center; gap: 14px; }
.lead-detail__heading h1 { margin: 0; }
.lead-detail__sub { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-faint); }
.vendor-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(5,216,156,0.18);
  color: var(--emerald-press);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}
.vendor-badge:hover { border-color: var(--emerald); }
.vendor-badge svg { width: 12px; height: 12px; }
.grid-vendor-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-inline-start: 6px;
  border-radius: 999px;
  background: rgba(5,216,156,0.22);
  color: var(--emerald-press);
  vertical-align: middle;
  cursor: pointer;
}
.grid-vendor-badge svg { width: 10px; height: 10px; }
.lead-detail__actions { display: flex; align-items: center; gap: 14px; }
.lead-detail__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
@media (max-width: 920px) { .lead-detail__grid { grid-template-columns: 1fr; } }
.lead-detail__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.lead-detail__card h3 {
  margin: 0 0 14px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
}
.lead-detail__card .field:last-child { margin-bottom: 0; }
.lead-detail__readonly {
  margin: 0;
  padding: 9px 12px;
  font-size: 0.88rem;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: 8px;
}
.note-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; max-height: 320px; overflow-y: auto; }
.note-item { padding: 10px 12px; background: var(--surface-2); border-radius: 9px; }
.note-item__text { margin: 0 0 6px; font-size: 0.86rem; color: var(--text-body); white-space: pre-wrap; }
.note-item__meta { font-size: 0.74rem; color: var(--text-faint); }
.note-list__empty { font-size: 0.84rem; color: var(--text-faint); }
.lead-detail__add-note { display: flex; flex-direction: column; gap: 10px; }
.lead-detail__add-note textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-body);
  font: inherit;
}
.lead-detail__add-note .btn { align-self: flex-start; }
.dialog .field { margin: 0; }
.dialog label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-body);
  margin-bottom: 7px;
}
.dialog input,
.dialog textarea,
.dialog select {
  width: 100%;
  padding: 10px 13px;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
}
.dialog textarea { resize: vertical; }
.dialog input:focus,
.dialog textarea:focus,
.dialog select:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}
.dialog__actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.dialog__actions .spacer { flex: 1; }
.dialog input:disabled,
.dialog textarea:disabled,
.dialog select:disabled { opacity: 0.6; cursor: not-allowed; }

.dialog__note {
  margin: 0;
  padding: 10px 13px;
  border-radius: 9px;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #1e40af;
  font-size: 0.83rem;
}

/* --- Dialog subsections (steps, assignment) --- */
.subsection {
  border-top: 1px solid var(--line);
  padding-top: 17px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.subsection__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-body);
}
.subsection__hint {
  margin: -4px 0 0;
  font-size: 0.76rem;
  color: var(--text-faint);
}
.subsection__count {
  margin-inline-start: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-faint);
}

.step-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-tint);
  overflow: hidden;
}
.step-progress > span {
  display: block;
  block-size: 100%;
  inline-size: 0%;
  background: var(--emerald);
  border-radius: 999px;
  transition: inline-size 0.3s ease;
}
.step-progress--sm { height: 5px; }

.step-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
}
.step-item:hover { background: var(--surface-2); }
.step-check {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-body);
  cursor: pointer;
}
.step-check input { width: auto; accent-color: var(--emerald-press); }
.step-item.is-done .step-check span { text-decoration: line-through; color: var(--text-faint); }
.step-del {
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 2px;
}
.step-del:hover { color: var(--p-high); }
.step-del svg { width: 14px; height: 14px; }

.step-add { display: flex; gap: 8px; }
.step-add input { flex: 1; }

.assign-current {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--text-body);
}
.assign-current span:nth-child(2) { flex: 1; }
.assign-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--indigo);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex: none;
}
.assign-avatar--xs { width: 18px; height: 18px; font-size: 0.58rem; }

/* --- Card extras (steps, assignee) --- */
.card__steps { display: flex; align-items: center; gap: 8px; }
.card__steps .step-progress { flex: 1; }
.card__steps-count { font-size: 0.72rem; font-weight: 600; color: var(--text-faint); }
.card__assignee {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-dim);
  border-top: 1px dashed var(--line);
  padding-top: 7px;
}

.text-btn {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px 6px;
}
.text-btn:hover { color: var(--text); }
.text-btn--danger { color: var(--p-high); }
.text-btn--danger:hover { color: #b91c1c; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.swatches button.is-selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }

/* --- Toasts -------------------------------------------------- */
.toasts {
  position: fixed;
  inset-block-end: 20px;
  inset-inline-end: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}
.toast {
  padding: 14px 17px;
  border-radius: 11px;
  background: var(--indigo);
  color: #fff;
  font-size: 0.86rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toast-in 0.25s ease;
}
.toast--reminder { background: var(--emerald-press); }
.toast strong { display: block; font-weight: 700; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Admin: activity log ------------------------------------- */
.admin {
  max-width: 1000px;
  margin: 0 auto;
  padding: 34px clamp(20px, 4vw, 44px) 64px;
  min-width: 0;
  width: 100%;
}
.admin__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}
.admin__head .brand-mark { color: var(--text); }
.admin__title { font-size: 1.6rem; color: var(--text); margin: 0 0 4px; }
.admin__sub { color: var(--text-dim); margin: 0 0 22px; font-size: 0.92rem; }

.admin__forbidden {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.admin-tab {
  padding: 10px 4px;
  margin-inline-end: 22px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.is-active { color: var(--indigo); border-bottom-color: var(--emerald); }

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}
.role-pill--admin { background: rgba(21, 21, 107, 0.1); color: var(--indigo); }
.role-pill--user { background: var(--bg-tint); color: var(--text-dim); }
.role-pill .you { color: var(--text-faint); font-weight: 500; }

.admin__filter { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.admin__filter select {
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 0.86rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
}
.admin__filter select:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-glow); }
.admin__total {
  font-size: 0.82rem;
  color: var(--text-faint);
  background: var(--bg-tint);
  padding: 4px 10px;
  border-radius: 999px;
}

.admin-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.admin-table th {
  text-align: start;
  padding: 14px 18px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--indigo);
  background: color-mix(in srgb, var(--indigo) 11%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--indigo) 22%, transparent);
}
.admin-table td { padding: 13px 18px; border-bottom: 1px solid var(--line); color: var(--text-body); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface-2); }
.admin-table__time { color: var(--text-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin-table__details { color: var(--text-dim); }

.admin-actor { display: inline-flex; align-items: center; gap: 8px; }
.admin-action {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg-tint);
  color: var(--text-body);
}
.admin-action[data-a="task"] { background: rgba(96, 165, 250, 0.16); color: #1d4ed8; }
.admin-action[data-a="step"] { background: rgba(5, 216, 156, 0.16); color: var(--emerald-press); }
.admin-action[data-a="category"] { background: rgba(139, 92, 246, 0.16); color: #6d28d9; }
.admin-action[data-a="auth"] { background: rgba(245, 158, 11, 0.16); color: #b45309; }

.admin__empty { padding: 40px 16px; text-align: center; color: var(--text-faint); font-size: 0.9rem; }

/* ===========================================================================
   DataGrid — reusable table (Leads, Partnerships)
   =========================================================================== */
.dg { display: flex; flex-direction: column; gap: 12px; }

.dg__toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dg__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  min-width: 220px;
}
.dg__search svg { width: 15px; height: 15px; color: var(--text-faint); flex: none; }
.dg__search input { border: none; background: none; outline: none; font: inherit; color: var(--text-body); width: 100%; }

.dg__tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-body);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.dg__tool-btn svg { width: 14px; height: 14px; }
.dg__tool-btn:hover { border-color: var(--indigo); color: var(--indigo); }
.dg__tool-btn.is-active { background: var(--indigo); border-color: var(--indigo); color: #fff; }

.dg__cols { position: relative; }
.dg__cols-menu {
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + 6px);
  z-index: 30;
  width: 260px;
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.dg__cols-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
}
.dg__cols-item:hover { background: var(--surface-2); }
.dg__cols-item label { display: flex; align-items: center; gap: 9px; font-size: 0.86rem; color: var(--text-body); cursor: pointer; flex: 1; min-width: 0; }
.dg__cols-item label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg__cols-move { display: inline-flex; gap: 2px; flex: none; }
.dg__cols-move button {
  width: 22px; height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
}
.dg__cols-move button:disabled { opacity: 0.35; cursor: default; }
.dg__cols-reset {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  border: none;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--indigo);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.dg__count { font-size: 0.82rem; color: var(--text-faint); }
.dg__slot { margin-inline-start: auto; display: inline-flex; gap: 8px; }

.dg__scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.dg__table { width: 100%; border-collapse: collapse; font-size: 0.86rem; white-space: nowrap; }
.dg__table thead th {
  text-align: start;
  padding: 12px 16px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--indigo);
  background: color-mix(in srgb, var(--indigo) 11%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--indigo) 22%, transparent);
  user-select: none;
}
.dg__table thead th.is-sortable { cursor: pointer; }
.dg__table thead th.is-sortable:hover { color: var(--indigo); }
.dg__th--drag { opacity: 0.4; }
.dg__th--over { box-shadow: inset 2px 0 0 var(--indigo); }
.dg__table tr[data-role="filter-row"] td { padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dg__table tr[data-role="filter-row"] input,
.dg__table tr[data-role="filter-row"] select {
  width: 100%;
  min-width: 120px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-body);
  font: inherit;
  font-size: 0.82rem;
}
.dg__table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-body);
  vertical-align: middle;
}
.dg__table tbody tr:last-child td { border-bottom: none; }
.dg__table tbody tr.is-clickable { cursor: pointer; }
.dg__table tbody tr:nth-child(even) td { background: var(--surface-2); }
.dg__table tbody tr:hover td { background: var(--bg-tint); }
.dg__empty { padding: 40px 16px !important; text-align: center; color: var(--text-faint); white-space: normal; }

.dg__table .cell-muted { color: var(--text-faint); }
.dg__table .cell-wrap { white-space: normal; min-width: 200px; max-width: 320px; }

/* Long free-text cells (e.g. partner notes): always a single line, however
   long — open the full text in a small popup on click instead of wrapping. */
.dg__table .note-cell-btn {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  text-align: inherit;
  color: inherit;
  cursor: pointer;
}
.dg__table .note-cell-btn:hover { color: var(--indigo); text-decoration: underline; }

.note-dialog { padding: 22px 26px; display: flex; flex-direction: column; gap: 14px; max-block-size: calc(100vh - 32px); overflow-y: auto; }
.note-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-dialog__head h2 { margin: 0; }
.note-dialog__text { margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--text-body); font-size: 0.92rem; line-height: 1.6; }

/* Inline-editable cell: colour-coded pill + a menu of colour-coded options */
.dg-pick { position: relative; display: inline-flex; }
.dg-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-body);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.dg-pill svg { width: 12px; height: 12px; opacity: 0.55; }
.dg-pill:disabled { opacity: 0.5; }
.dg-pick__btn:hover { border-color: var(--indigo); }
.dg-pick__menu {
  position: fixed;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.dg-pick__opt { justify-content: flex-start; width: 100%; }
.dg-pick__opt:hover { box-shadow: inset 0 0 0 2px var(--indigo); }

/* per-value colours (shared by the pill button and its options) */
.dg-pill[data-v] { border-color: transparent; }
.dg-pill[data-v=""] { border-color: var(--line-strong); background: var(--surface); color: var(--text-dim); }

/* shared across the task / VM / partner grids */
.dg-pill[data-v="done"],
.dg-pill[data-v="partner"] { background: rgba(5,216,156,0.2); color: var(--emerald-press); }
.dg-pill[data-v="subcontract"] { background: rgba(96,165,250,0.22); color: #1d4ed8; }
.dg-pill[data-v="in_progress"] { background: rgba(245,158,11,0.24); color: #b45309; }
.dg-pill[data-v="on_hold"] { background: var(--bg-tint); color: var(--text-dim); }

/* lead next action */
.dg-pill[data-v="follow_up"] { background: rgba(5,216,156,0.2); color: var(--emerald-press); }
.dg-pill[data-v="call_back"] { background: rgba(96,165,250,0.22); color: #1d4ed8; }
.dg-pill[data-v="send_message"] { background: rgba(245,158,11,0.24); color: #b45309; }
.dg-pill[data-v="book_meeting"] { background: rgba(139,92,246,0.22); color: #6d28d9; }

/* lead client status */
.dg-pill[data-v="new"] { background: rgba(99,102,241,0.18); color: #4338ca; }
.dg-pill[data-v="contacted"] { background: rgba(96,165,250,0.22); color: #1d4ed8; }
.dg-pill[data-v="no_response"] { background: var(--bg-tint); color: var(--text-dim); }
.dg-pill[data-v="qualified"] { background: rgba(5,216,156,0.2); color: var(--emerald-press); }
.dg-pill[data-v="unqualified"] { background: rgba(148,163,184,0.3); color: #475569; }
.dg-pill[data-v="engaged"] { background: rgba(52,211,153,0.18); color: #047857; }
.dg-pill[data-v="proposal_sent"] { background: rgba(139,92,246,0.22); color: #6d28d9; }
.dg-pill[data-v="negotiation"] { background: rgba(245,158,11,0.24); color: #b45309; }
.dg-pill[data-v="converted"] { background: rgba(21,128,61,0.2); color: #15803d; }
.dg-pill[data-v="lost"] { background: rgba(239,68,68,0.18); color: #b91c1c; }
.dg-pill[data-v="nurturing"] { background: rgba(8,145,178,0.18); color: #0e7490; }
.dg-pill[data-v="churned"] { background: var(--bg-tint); color: #78716c; }
.dg-pill[data-v="blacklisted"] { background: rgba(15,23,42,0.16); color: #1f2937; }

/* field-sized pill picker (lead detail page, not a grid cell) */
.pill-field { display: block; width: 100%; }
.pill-field .dg-pill {
  width: 100%;
  justify-content: space-between;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
}
.pill-field .dg-pill svg { width: 15px; height: 15px; }

.pw-cell {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-body);
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  cursor: pointer;
}
.pw-cell:hover { border-color: var(--indigo); color: var(--indigo); }

/* Status / next-action pills shared by Leads + Partnerships */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg-tint);
  color: var(--text-body);
}
.pill[data-s="interested"], .pill[data-s="done"] { background: rgba(5,216,156,0.16); color: var(--emerald-press); }
.pill[data-s="not_interested"] { background: rgba(239,68,68,0.14); color: #b91c1c; }
.pill[data-s="no_budget"] { background: rgba(245,158,11,0.16); color: #b45309; }
.pill[data-s="has_alternative"] { background: rgba(139,92,246,0.16); color: #6d28d9; }
.pill[data-s="in_progress"] { background: rgba(245,158,11,0.16); color: #b45309; }
.pill[data-s="on_hold"] { background: rgba(148,163,184,0.2); color: var(--text-dim); }
.pill[data-s="other"] { background: var(--bg-tint); color: var(--text-dim); }
.pill[data-s="partner"] { background: rgba(5,216,156,0.16); color: var(--emerald-press); }
.pill[data-s="subcontract"] { background: rgba(96,165,250,0.16); color: #1d4ed8; }
.pill[data-s="vendor_mgmt"] { background: rgba(139,92,246,0.16); color: #6d28d9; }

/* ===========================================================================
   Dashboard
   =========================================================================== */
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.dash-card--span2 { grid-column: span 2; }
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-card--span2 { grid-column: span 2; }
}
@media (max-width: 720px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card--span2 { grid-column: span 1; }
}
.dash-card {
  position: relative;
  background: var(--card-bg, var(--surface));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: opacity 0.15s, outline-color 0.15s;
  outline: 2px dashed transparent;
  outline-offset: -2px;
}
.dash-card:active { cursor: grabbing; }
.dash-card.is-dragging { opacity: 0.45; }
.dash-card.is-dragover { outline-color: var(--indigo); }
.dash-card__drag {
  position: absolute;
  top: 16px;
  inset-inline-end: 14px;
  color: var(--text-faint);
  opacity: 0.55;
  pointer-events: none;
}
.dash-card__drag svg { width: 16px; height: 16px; display: block; }
/* Each card a barely-there different tint — keeps the grid lively without noise. */
.dash-card:nth-child(6n+1) { --card-bg: color-mix(in srgb, #3b82f6 4%, var(--surface)); }
.dash-card:nth-child(6n+2) { --card-bg: color-mix(in srgb, #8b5cf6 4%, var(--surface)); }
.dash-card:nth-child(6n+3) { --card-bg: color-mix(in srgb, var(--emerald) 5%, var(--surface)); }
.dash-card:nth-child(6n+4) { --card-bg: color-mix(in srgb, #f59e0b 4%, var(--surface)); }
.dash-card:nth-child(6n+5) { --card-bg: color-mix(in srgb, #ec4899 4%, var(--surface)); }
.dash-card:nth-child(6n)   { --card-bg: color-mix(in srgb, #14b8a6 4%, var(--surface)); }
.dash-card__title {
  margin: 0 0 14px;
  padding-inline-end: 24px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
}
.dash-card__title--sub {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.dash-card__total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}
.dash-card__total b { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1; }
.dash-card__total span { font-size: 0.82rem; color: var(--text-dim); }

/* Pastel stat tiles (see reference) */
.dash-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.dash-tile {
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--tile-bg, var(--surface-2));
}
.dash-tile b { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1.15; }
.dash-tile span { font-size: 0.76rem; color: var(--text-dim); }
.dash-tile--wide { grid-column: 1 / -1; }
.dash-tile--t1 { --tile-bg: color-mix(in srgb, #3b82f6 14%, var(--surface)); }
.dash-tile--t1 b { color: #2563eb; }
.dash-tile--t2 { --tile-bg: color-mix(in srgb, #8b5cf6 15%, var(--surface)); }
.dash-tile--t2 b { color: #7c3aed; }
.dash-tile--t3 { --tile-bg: color-mix(in srgb, #f59e0b 16%, var(--surface)); }
.dash-tile--t3 b { color: #b45309; }
.dash-tile--t4 { --tile-bg: color-mix(in srgb, #ef4444 13%, var(--surface)); }
.dash-tile--t4 b { color: #b91c1c; }
.dash-tile--t5 { --tile-bg: color-mix(in srgb, var(--emerald) 16%, var(--surface)); }
.dash-tile--t5 b { color: var(--emerald-press); }
:root[data-theme="dark"] .dash-tile b,
:root:not([data-theme="light"]) .dash-tile b { color: var(--text); }

/* "Status distribution" — big value + thick colour bar in a light track */
.dash-dist { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 16px; }
.dash-dist__col { display: flex; flex-direction: column; gap: 6px; }
.dash-dist__head { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-dim); }
.dash-dist__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--seg, var(--indigo)); flex: none; }
.dash-dist__val { font-size: 1.35rem; font-weight: 700; color: var(--text); line-height: 1; }
.dash-dist__bar { height: 8px; border-radius: 999px; background: var(--bg-tint); overflow: hidden; margin-top: 2px; }
.dash-dist__bar i { display: block; height: 100%; border-radius: 999px; background: var(--seg, var(--indigo)); }

.dash-break { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px; }
.dash-break__row { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: center; font-size: 0.82rem; color: var(--text-body); }
.dash-break__row b { font-variant-numeric: tabular-nums; font-weight: 700; }
.dash-break__row span { display: inline-flex; align-items: center; gap: 6px; }
.dash-break__row span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--seg, var(--text-faint)); flex: none; }
.dash-break__bar { grid-column: 1 / -1; height: 7px; border-radius: 999px; background: var(--bg-tint); overflow: hidden; }
.dash-break__bar i { display: block; height: 100%; border-radius: 999px; background: var(--seg, var(--indigo)); }
.dash-break__empty { font-size: 0.83rem; color: var(--text-faint); grid-column: 1 / -1; }

/* Horizontal bar chart */
.dash-bars { display: flex; flex-direction: column; gap: 12px; }
.dash-bar { display: grid; grid-template-columns: minmax(70px, 26%) 1fr auto; align-items: center; gap: 10px; font-size: 0.82rem; }
.dash-bar__label { color: var(--text-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-bar__track { display: block; height: 20px; border-radius: 6px; background: var(--bg-tint); overflow: hidden; }
.dash-bar__fill { display: block; height: 100%; border-radius: 6px; background: var(--seg, var(--indigo)); min-width: 3px; }
.dash-bar__val { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }

/* Pie chart */
.dash-pie-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.dash-pie { width: 128px; height: 128px; flex: none; }
.dash-pie path, .dash-pie circle { stroke: var(--surface); stroke-width: 0.4; }

/* Donut */
.dash-donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.dash-donut { width: 132px; height: 132px; flex: none; }
.dash-donut__seg { fill: none; stroke-width: 5; transition: stroke-dasharray 0.4s; }
.dash-donut__hole { fill: none; stroke: var(--bg-tint); stroke-width: 5; }
.dash-donut__center { fill: var(--text); font-size: 9px; font-weight: 700; text-anchor: middle; }
.dash-donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 0.83rem; color: var(--text-body); }
.dash-donut-legend li { display: flex; align-items: center; gap: 8px; list-style: none; }
.dash-donut-legend .k { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dash-donut-legend b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }

/* ===========================================================================
   Board: filter row extras + view switch + calendar
   =========================================================================== */
.board-filter__spacer { flex: 1; }
.mini-select {
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-body);
  font: inherit;
  font-size: 0.82rem;
}

.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}
.view-switch__btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 28px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
}
.view-switch__btn svg { width: 16px; height: 16px; }
.view-switch__btn:hover { color: var(--indigo); }
.view-switch__btn.is-active { background: var(--indigo); color: #fff; }

/* Calendar */
#tasksCalendar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.cal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.cal-head h2 { margin: 0; font-size: 1.05rem; color: var(--text); min-width: 12ch; text-align: center; }
.cal-head .text-btn { margin-inline-start: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  padding-bottom: 4px;
}
.cal-grid--days { margin-top: 6px; }
.cal-cell {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  background: var(--surface);
}
.cal-cell:hover { border-color: var(--line-strong); }
.cal-cell--muted { background: var(--surface-2); cursor: default; border-style: dashed; opacity: 0.5; }
.cal-cell.is-today { border-color: var(--indigo); box-shadow: inset 0 0 0 1px var(--indigo); }
.cal-cell__num { font-size: 0.78rem; font-weight: 700; color: var(--text-dim); }
.cal-cell.is-today .cal-cell__num { color: var(--indigo); }
.cal-chip {
  text-align: start;
  border: none;
  border-inline-start: 3px solid var(--chip-accent, var(--indigo));
  background: var(--bg-tint);
  color: var(--text-body);
  border-radius: 5px;
  padding: 3px 6px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-chip.is-done { text-decoration: line-through; opacity: 0.6; }

/* Reveal-toggle password input (VM) */
.reveal-input { position: relative; display: flex; }
.reveal-input input { flex: 1; padding-inline-end: 40px; }
.reveal-input__btn {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
}
.reveal-input__btn svg { width: 16px; height: 16px; }
.reveal-input__btn:hover { color: var(--indigo); }

@media (max-width: 620px) {
  .cal-cell { min-height: 64px; }
  .cal-chip { font-size: 0.68rem; }
}

/* View header shared by Leads / Partnerships / Dashboard */
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.view-head h1 { margin: 0; font-size: 1.35rem; color: var(--text); }
.view-head p { margin: 3px 0 0; font-size: 0.85rem; color: var(--text-dim); }

/* --- Responsive ------------------------------------------------ */
@media (max-width: 1080px) {
  .stats__grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card--donut { grid-column: span 2; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto; min-height: 0; }
  /* Sidebar becomes a compact top bar. Brand stays on its own line so it can
     never float into the nav; nav items wrap as chips; dropdowns take a full row. */
  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
    gap: 10px;
    padding: 12px clamp(16px, 4vw, 40px);
    border-inline-end: none;
    border-bottom: 1px solid var(--line);
  }
  .sidebar__brand { margin-bottom: 0; }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    overflow: visible;
  }
  .side-nav > .nav-item { width: auto; padding: 8px 12px; }
  .side-nav > .nav-item .nav-item__chev { margin-inline-start: 4px; }
  .nav-dropdown {
    flex-basis: 100%;
    margin: 2px 0 4px;
    padding: 8px;
    border-inline-start: none;
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .nav-dropdown .cat-item, .nav-sublink { display: inline-flex; width: auto; }
  #adminDropdown { display: flex; flex-flow: row wrap; gap: 6px; }
  .sidebar__foot { margin-top: 0; flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
  #sidebarCollapseBtn { display: none; }
  .side-user { border-top: none; padding-top: 0; margin-inline-start: auto; }
  .side-user__actions { flex-direction: row; }
  .content, .admin { min-height: 0; }
  .board { grid-template-columns: 1fr; }
  .column { max-height: none; }
}
@media (max-width: 620px) {
  .stats__grid { grid-template-columns: 1fr; }
  .stat-card--donut { grid-column: span 1; }
  .field-row { grid-template-columns: 1fr; }
  .topbar__tools { width: 100%; flex-wrap: wrap; }
  .search input { width: 100%; }
  .search { flex: 1; }
  .admin-table__details { display: none; }
}
