/* ============================================================
   AuthKit — Stylesheet
   Customise the :root variables to match your brand.
   ============================================================ */
:root {
  /* ── Brand colours ──────────────────────────────────────── */
  --primary:       #0f2d52;   /* main brand colour — buttons, nav, headings */
  --primary-l:     #1e4d8c;   /* lighter shade for hover states */
  --accent:        #c9973f;   /* accent / call-to-action colour */
  --accent-l:      #f0c96b;

  /* ── Surfaces ───────────────────────────────────────────── */
  --bg:            #f4f6fb;   /* page background */
  --card:          #ffffff;   /* card / panel / modal / input surface */
  --text:          #1a1d2e;
  --muted:         #6b7280;
  --border:        #e2e8f0;
  --row-hover:     #f8fafc;   /* table row hover */

  /* ── Semantic colours ───────────────────────────────────── */
  --danger:        #dc2626;
  --success:       #16a34a;
  --warn:          #d97706;
  --info:          #3b82f6;

  /* ── Tinted badge surfaces ──────────────────────────────── */
  --success-bg:    #dcfce7;
  --success-text:  #15803d;
  --danger-bg:     #fef2f2;
  --danger-text:   #b91c1c;
  --warn-bg:       #fef9c3;
  --warn-text:     #a16207;
  --info-bg:       #dbeafe;
  --info-text:     #1d4ed8;

  /* ── Extended grays ─────────────────────────────────────── */
  --gray-1:        #f3f4f6;   /* subtle background fills */
  --gray-2:        #e5e7eb;   /* light gray dividers */
  --gray-3:        #9ca3af;   /* secondary muted text */

  /* ── Extended palette ───────────────────────────────────── */
  --amber:         #f59e0b;   /* warm highlights */
  --indigo:        #6366f1;   /* secondary actions */

  /* ── Typography scale ───────────────────────────────────── */
  --text-xs:       .72rem;    /* system labels, tiny badges */
  --text-sm:       .8rem;     /* secondary content */
  --text-base:     .875rem;   /* body text, form labels */
  --text-md:       .9rem;     /* form input text */
  --text-lg:       1rem;      /* sub-headings */
  --text-xl:       1.1rem;    /* modal headings */
  --text-2xl:      1.4rem;    /* page titles */

  /* ── Spacing scale ──────────────────────────────────────── */
  --sp-1:   .15rem;
  --sp-2:   .25rem;
  --sp-3:   .4rem;
  --sp-4:   .5rem;
  --sp-5:   .6rem;
  --sp-6:   .75rem;
  --sp-8:   1rem;
  --sp-10:  1.25rem;
  --sp-12:  1.5rem;
  --sp-16:  2rem;
  --sp-20:  2.5rem;
  --sp-24:  3rem;

  /* ── Radius scale ───────────────────────────────────────── */
  --radius-sm:   4px;     /* compact elements */
  --radius-md:   6px;     /* buttons, inputs */
  --radius-lg:   8px;     /* panels, rows */
  --radius:      10px;    /* standard card radius */
  --radius-full: 999px;   /* pills */
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem 0 1rem;
  height: 56px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.nav-left {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.nav-brand {
  color: #fff;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  padding: .4rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.15); }
.nav-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .85rem;
  color: rgba(255,255,255,.9);
  white-space: nowrap;
}
.nav-user-name {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .82rem;
  transition: color .2s;
}
.nav-user-name:hover, .nav-user-name.active { color: #fff; }
.btn-logout {
  background: var(--accent);
  color: var(--primary) !important;
  padding: .32rem .85rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: .82rem;
  transition: background .2s;
}
.btn-logout:hover { background: var(--accent-l); }

/* ── Role badges ───────────────────────────────────────────── */
.role-badge {
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.role-superadmin { background: #064e3b; color: #fff; }
.role-admin      { background: #7c3aed; color: #fff; }
.role-manager    { background: #0284c7; color: #fff; }
.role-user       { background: var(--accent); color: var(--primary); }

/* ── App layout ────────────────────────────────────────────── */
.app-body {
  display: flex;
  flex: 1;
  align-items: flex-start;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: var(--header-h, 56px);
  height: calc(100dvh - var(--header-h, 56px));
  transition: width .22s ease, min-width .22s ease;
  flex-shrink: 0;
}
.sidebar--collapsed {
  width: 52px;
  min-width: 52px;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .65rem .4rem;
}
.sidebar-group { margin-bottom: .5rem; }
.sidebar-group-label {
  font-size: .63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: .45rem .75rem .2rem;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .15s;
}
.sidebar--collapsed .sidebar-group-label { opacity: 0; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .75rem;
  margin-bottom: .35rem;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text);
  font-size: .865rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: var(--bg); color: var(--primary); }
.sidebar-link.active {
  background: rgba(15,45,82,.09);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-icon { flex-shrink: 0; opacity: .65; transition: opacity .15s; }
.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon { opacity: 1; }
.sidebar-label { white-space: nowrap; }

/* Collapsed state */
.sidebar--collapsed .sidebar-group-label,
.sidebar--collapsed .sidebar-label {
  display: none !important;
}
.sidebar--collapsed .sidebar-link,
.sidebar--collapsed .sidebar-brand-btn {
  gap: 0 !important;
  justify-content: center !important;
  padding: .52rem !important;
}
.sidebar--collapsed .sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sidebar--collapsed .sidebar-nav hr {
  width: 100%;
}
.sidebar--collapsed .sidebar-group {
  width: 100%;
}
.sidebar--collapsed .sidebar-icon {
  display: block !important;
  opacity: .7;
}
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

/* ── Main content ──────────────────────────────────────────── */
.main-wrap {
  flex: 1;
  min-width: 0;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: .9rem;
  font-weight: 500;
  border-left: 4px solid transparent;
}
.alert-success { background: #f0fdf4; border-color: var(--success); color: #166534; }
.alert-error   { background: #fef2f2; border-color: var(--danger);  color: #991b1b; }
.alert-info    { background: #eff6ff; border-color: var(--info);    color: #1d4ed8; }
.alert-warning { background: #fffbeb; border-color: var(--warn);    color: #92400e; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1.05rem; font-weight: 700; color: var(--primary); }

/* Flush card — no inner padding; card-header carries its own padding */
.card-flush               { padding: 0; }
.card-flush .card-header  { padding: .85rem 1.5rem .75rem; margin-bottom: 0; }

/* ── Card accent border-top (semantic colour system) ────────── */
.card--success { border-top: 3px solid var(--success); }
.card--info    { border-top: 3px solid var(--info); }
.card--danger  { border-top: 3px solid var(--danger); }
.card--warn    { border-top: 3px solid var(--warn, #f59e0b); }
.card--primary { border-top: 3px solid var(--primary); }
.card--muted   { border-top: 3px solid var(--border); }

/* ── Stat grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card-link { text-decoration: none; display: block; }
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow .15s;
}
.stat-card-link:hover .stat-card { box-shadow: var(--shadow), 0 0 0 2px var(--primary); }
.stat-body { min-width: 0; flex: 1; }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0; line-height: 1;
}
/* Currency symbols need a slightly different size than emoji */
.stat-icon.blue   { background: #dbeafe; font-size: 1.35rem; font-weight: 800; color: #1d4ed8; }
.stat-icon.green  { background: #dcfce7; }
.stat-icon.gold   { background: #fef9c3; }
.stat-icon.purple { background: #f3e8ff; }
.stat-num       { font-size: 1.8rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-value-sub { font-size: var(--text-sm); font-weight: 700; color: var(--text); margin-top: .15rem; }
.stat-label     { font-size: var(--text-base); color: var(--muted); margin-top: .15rem; font-weight: 600; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
thead th {
  background: var(--primary); color: #fff;
  padding: .7rem 1rem; text-align: left;
  font-weight: 600; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .04em;
}
thead th a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  white-space: nowrap;
}
thead th a:hover { opacity: .8; }
tbody td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: none; }
tfoot td { padding: .75rem 1rem; vertical-align: middle; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: 7px; border: none;
  font-family: inherit; font-size: .85rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: filter .2s, opacity .2s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-warning { background: var(--warn);    color: #fff; }
.btn-ghost   { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-accent  { background: var(--accent); color: var(--primary); }
.btn-sm      { padding: .3rem .7rem; font-size: .78rem; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group   { margin-bottom: 1.1rem; }
.form-label   { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .4rem; color: var(--primary); }
.form-label-hint { font-weight: 400; color: var(--muted); font-size: var(--text-xs); }
.form-control {
  width: 100%; padding: .6rem .85rem;
  border: 1.5px solid var(--border); border-radius: 7px;
  font-family: inherit; font-size: .9rem; color: var(--text);
  background: var(--card); transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,45,82,.1);
}
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control   { appearance: none; cursor: pointer; }
.form-control-sm      { padding: .3rem .55rem; font-size: .82rem; }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.form-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Login page ────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-l) 100%);
}
.login-box {
  background: var(--card); border-radius: 16px;
  padding: 2.5rem; width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo h1 { font-size: 1.3rem; color: var(--primary); font-weight: 700; }
.login-logo p  { font-size: .83rem; color: var(--muted); margin-top: .3rem; }

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 1.75rem;
  gap: 1rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.page-header p  { font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.page-header-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ── Status badges ─────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .6rem;
  border-radius: 20px; font-size: .72rem;
  font-weight: 700; text-transform: uppercase;
}
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-suspended { background: #fef2f2; color: #b91c1c; }
.badge-pending   { background: #fef9c3; color: #a16207; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: none; align-items: center;
  justify-content: center; z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border-radius: 14px;
  padding: 2rem; width: min(550px, 95vw);
  box-shadow: 0 25px 60px rgba(0,0,0,.25);
  max-height: 90vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 1.5rem;
}
.modal-header h2 { font-size: 1.1rem; color: var(--primary); }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); }

/* ── Footer (removed — copyright now in sidebar) ───────────── */

/* ── Utilities ─────────────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-center  { text-align: center; }
.w-full       { width: 100%; }
.flex         { display: flex; }
.gap-2        { gap: .5rem; }
.mt-1         { margin-top: .5rem; }
.mt-2         { margin-top: 1rem; }

/* ── Sidebar brand switcher ────────────────────────────────── */
.sidebar-brand-switcher {
  position: relative;
  padding: .6rem .5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-brand-btn {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .5rem .65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  overflow: hidden;
}
.sidebar-brand-btn:hover { background: var(--border); }
.sidebar--collapsed .sidebar-brand-btn { justify-content: center; padding: .5rem; }
.sidebar-brand-menu {
  top: calc(100% - .4rem);
  left: .5rem;
  right: .5rem;
  width: auto;
}

/* ── Brand switcher (navbar — kept for compatibility) ──────── */
.brand-switcher { position: relative; }
.brand-switcher-btn {
  display: flex; align-items: center; gap: .45rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff; padding: .32rem .75rem; border-radius: 7px;
  font-family: inherit; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: background .2s; white-space: nowrap;
}
.brand-switcher-btn:hover { background: rgba(255,255,255,.22); }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.35);
}
.brand-switcher-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--card); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  min-width: 220px; z-index: 300; overflow: hidden;
  border: 1px solid var(--border);
}
.brand-switcher-menu.open { display: block; }
.switcher-group-label {
  padding: .55rem 1rem .2rem;
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.switcher-brand-btn {
  display: flex; align-items: center; gap: .6rem;
  width: 100%; padding: .6rem 1rem;
  background: none; border: none;
  font-family: inherit; font-size: .85rem; color: var(--text);
  cursor: pointer; text-align: left; transition: background .15s;
}
.switcher-brand-btn:hover:not(:disabled) { background: var(--bg); }
.switcher-brand-btn.active { font-weight: 700; color: var(--primary); cursor: default; }
.brand-dot-menu { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.switcher-divider { border: none; border-top: 1px solid var(--border); margin: .3rem 0; }
.switcher-action {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem 1rem; font-size: .82rem; color: var(--primary);
  text-decoration: none; font-weight: 600; transition: background .15s;
}
.switcher-action:hover { background: var(--bg); }

/* ── Onboarding ─────────────────────────────────────────────── */
.onboard-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-l) 100%);
  padding: 2rem;
}
.onboard-box {
  background: var(--card); border-radius: 16px;
  padding: 2.5rem; width: 520px; max-width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.onboard-logo { margin-bottom: 1.75rem; }
.onboard-logo h1 { font-size: 1.5rem; color: var(--primary); font-weight: 800; }
.onboard-logo p  { font-size: .875rem; color: var(--muted); margin-top: .4rem; line-height: 1.5; }
.onboard-step {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent); margin-bottom: .75rem;
}

/* ── Colour presets ─────────────────────────────────────────── */
.onboard-colour-presets { display: flex; gap: .4rem; flex-wrap: wrap; }
.colour-preset {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.1); cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  flex-shrink: 0;
}
.colour-preset:hover { transform: scale(1.2); box-shadow: 0 2px 6px rgba(0,0,0,.2); }

/* ── Brand card grid ────────────────────────────────────────── */
.brand-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.brand-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  border: 2px solid transparent; transition: border-color .2s;
}
.brand-card-active { border-color: var(--primary); }
.brand-card-colour { height: 8px; }
.brand-card-body { padding: 1.1rem 1.25rem; flex: 1; }
.brand-card-name { font-size: 1rem; font-weight: 700; color: var(--primary); }
.brand-card-company { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.brand-card-actions {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; gap: .5rem; background: var(--bg);
}

/* ── Filter bar ─────────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .75rem;
  align-items: center; margin-bottom: 1.5rem;
}

/* ── Detail list (view pages) ───────────────────────────────── */
dl.detail-list { display: grid; grid-template-columns: auto 1fr; gap: .4rem .85rem; font-size: .87rem; }
dl.detail-list dt { color: var(--muted); font-weight: 600; white-space: nowrap; }
dl.detail-list dd { color: var(--text); }
dl.detail-list a  { color: var(--primary); text-decoration: none; }
dl.detail-list a:hover { text-decoration: underline; }

/* ── Record map (Leaflet pin) ───────────────────────────────── */
.record-map { height: 280px; border-radius: var(--radius); margin-top: .75rem; overflow: hidden; }

/* ── Nearby type toggles ────────────────────────────────────── */
.nearby-toggle { display:inline-flex; align-items:center; gap:.35rem; padding:.3rem .65rem; border-radius:var(--radius-sm); color:#fff; font-size:var(--text-sm); font-weight:600; cursor:pointer; user-select:none; transition:opacity .15s; }
.nearby-toggle input { display:none; }

/* ── Person row (in org view) ───────────────────────────────── */
.person-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .75rem; background: var(--bg); border-radius: 8px;
  text-decoration: none; color: var(--text); transition: background .15s;
}
.person-row:hover { background: var(--border); }
.person-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; flex-shrink: 0;
}

/* ── Deal two-column layout ────────────────────────────────── */
.deal-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  grid-template-rows: auto 1fr;
  column-gap: 1.5rem;
  row-gap: .75rem;
  align-items: start;
}
.deal-left-col {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.deal-tab-bar {
  grid-column: 2;
  grid-row: 1;
}
.deal-right-col {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}
@media (max-width: 1100px) {
  .deal-layout { grid-template-columns: 1fr; grid-template-rows: auto; }
  .deal-left-col  { grid-row: auto; grid-column: auto; }
  .deal-tab-bar   { grid-row: auto; grid-column: auto; }
  .deal-right-col { grid-row: auto; grid-column: auto; }
}

/* ── Sidebar backdrop (mobile overlay) ─────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}
.sidebar-backdrop--open { display: block; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Prevent any overflowing element from creating horizontal scroll */
  html, body { overflow-x: hidden; max-width: 100%; }

  .navbar { padding: 0 .75rem; width: 100%; }

  /* Hide nav elements that don't fit on mobile */
  .nav-user-name { display: none !important; }
  .nav-a11y      { gap: .1rem; }

  /* Sidebar: hidden by default on mobile, shown as fixed overlay when open */
  .sidebar {
    display: none;
    position: fixed;
    top: var(--header-h, 56px);
    left: 0;
    height: calc(100dvh - var(--header-h, 56px));
    z-index: 200;
    width: 260px;
    min-width: 260px;
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  .sidebar--open { display: flex !important; }

  .form-row  { grid-template-columns: 1fr; }
  .main-wrap { padding: 1rem; width: 100%; min-width: 0; }
  .login-box { width: 95vw; padding: 1.75rem; }
}

/* Hide scrollbars on overflow-scroll elements while keeping scroll behaviour */
.hide-scrollbar::-webkit-scrollbar { display: none; }

/* ── Status dot ──────────────────────────────────────────── */
/* Circular coloured indicator. Size modifier sets dimensions. */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot-xs { width: 6px;  height: 6px;  }
.status-dot-sm { width: 8px;  height: 8px;  }
.status-dot-md { width: 10px; height: 10px; }
.status-dot-lg { width: 12px; height: 12px; }
.dot-success { background: var(--success); }
.dot-danger  { background: var(--danger);  }
.dot-warn    { background: var(--warn);    }
.dot-info    { background: var(--info);    }
.dot-muted   { background: var(--gray-3);  }
.dot-primary { background: var(--primary); }
.dot-amber   { background: var(--amber);   }

/* ── Badge pill ──────────────────────────────────────────── */
/* Pill-shaped coloured status label. */
.badge-pill {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge-pill-success { background: var(--success-bg); color: var(--success-text); }
.badge-pill-danger  { background: var(--danger-bg);  color: var(--danger-text);  }
.badge-pill-warn    { background: var(--warn-bg);    color: var(--warn-text);    }
.badge-pill-info    { background: var(--info-bg);    color: var(--info-text);    }
.badge-pill-muted   { background: var(--gray-1);     color: var(--muted);        }
.badge-pill-primary { background: var(--primary);    color: #fff;                }
.badge-pill-amber   { background: #fef3c7;           color: #92400e;             }
.badge-pill-indigo  { background: #ede9fe;           color: #4338ca;             }

/* ── Badge subtle ────────────────────────────────────────── */
/* Compact non-pill system label — e.g. RECURRING, ONE-OFF. */
.badge-subtle {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--gray-2);
  color: var(--muted);
}
.badge-subtle-success { background: var(--success-bg); color: var(--success-text); }
.badge-subtle-danger  { background: var(--danger-bg);  color: var(--danger-text);  }
.badge-subtle-info    { background: var(--info-bg);    color: var(--info-text);    }
.badge-subtle-primary { background: rgba(15,45,82,.1); color: var(--primary);      }

/* ── Avatar ──────────────────────────────────────────────── */
/* Circular avatar / icon container. */
.avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
  background: var(--primary); color: #fff;
}
.avatar-xs { width: 24px; height: 24px; font-size: var(--text-xs);  }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-sm);  }
.avatar-md { width: 40px; height: 40px; font-size: var(--text-base);}
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg);  }
.avatar-xl { width: 56px; height: 56px; font-size: var(--text-xl);  }

/* ── Colour swatch ───────────────────────────────────────── */
/* Tiny inline colour circle — used next to brand names, etc. */
.colour-swatch {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ── Activity item ───────────────────────────────────────── */
/* Standard timeline / activity row card. */
.activity-item {
  display: flex; align-items: flex-start; gap: var(--sp-6);
  padding: var(--sp-5) var(--sp-6);
  background: var(--bg); border-radius: var(--radius-lg);
}
.activity-item--done { opacity: .55; }

/* ── Empty state box ─────────────────────────────────────── */
/* Dashed placeholder area when a section has no content. */
.empty-state-box {
  border: 2px dashed var(--gray-2);
  border-radius: var(--radius);
  padding: var(--sp-16) var(--sp-8);
  text-align: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ── Button text ─────────────────────────────────────────── */
/* Bare inline action — looks like a link, feels like a button.
   Use for "Edit", "Remove", "✕ Clear" etc. within content areas. */
.btn-text {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  line-height: inherit;
}
.btn-text:hover { text-decoration: underline; }
.btn-text.danger { color: var(--danger); }
.btn-text.muted  { color: var(--muted);  font-weight: 400; }

/* ── Button pill ─────────────────────────────────────────── */
/* Pill-shaped toggle / tab button. Used for note type selectors,
   audit trail filters, and similar toggle groups.
   Active state is set by JS adding the .active class. */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .65rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--gray-2);
  background: var(--bg);
  color: var(--muted);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
}
.btn-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-pill.active,
.btn-pill[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* ── Audit Trail ─────────────────────────────────────────── */
/* Card header right-side flex container */
.trail-header-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}
/* Entry count badge */
.trail-count {
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 400;
}
/* Dynamic filter pill row */
.trail-filters {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
/* Filter link */
.trail-filter {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: color .15s;
}
.trail-filter:hover  { color: var(--text); }
.trail-filter.active { color: var(--primary); font-weight: 700; }
.trail-filter-count  { font-weight: 400; opacity: .65; font-size: var(--text-xs); }

/* Primary Activity / System tabs */
.trail-filters--primary {
  gap: .25rem;
}
.trail-filters--primary .trail-filter {
  padding: .3rem .75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--muted);
}
.trail-filters--primary .trail-filter:hover {
  border-color: var(--primary);
  color: var(--text);
}
.trail-filters--primary .trail-filter.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.trail-filters--primary .trail-filter-count {
  opacity: .75;
}
/* Empty state */
.trail-empty {
  color: var(--muted);
  font-size: var(--text-base);
}
/* File upload area wrapper */
.trail-file-area {
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised, var(--surface));
}
/* Drop zone */
.trail-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface);
  margin-bottom: .75rem;
}
.trail-drop-zone:hover {
  border-color: var(--primary);
}
.trail-drop-label   { font-size: var(--text-base); color: var(--muted); }
.trail-drop-icon    { font-size: 1.5rem; display: block; margin-bottom: .4rem; }
.trail-drop-browse  { color: var(--primary); font-weight: 600; }
.trail-drop-limit   { font-size: var(--text-sm); margin-top: .3rem; }
.trail-drop-preview { font-size: var(--text-base); color: var(--text); }
.trail-drop-filename { font-weight: 600; }
.trail-drop-filesize { color: var(--muted); margin-left: .5rem; }
.trail-drop-clear   { margin-left: .75rem; }
.trail-file-comment-group { margin-bottom: .75rem; }
.trail-upload-row   { display: flex; align-items: center; gap: .75rem; }
.trail-upload-status { font-size: var(--text-sm); color: var(--muted); }

/* ── Icon picker button ──────────────────────────────────── */
/* Square emoji/icon selector button — used in funnel icon picker. */
.icon-opt {
  width: 34px; height: 34px;
  font-size: 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color .1s, background .1s;
  line-height: 1;
}
.icon-opt:hover  { border-color: var(--gray-3); background: var(--gray-1); }
.icon-opt.active { border-color: var(--primary); background: var(--info-bg); }

/* ── Inline add button ───────────────────────────────────── */
/* Small "+" text button used inline in form panels. */
.btn-inline-add {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-inline-add:hover { color: var(--primary-l); }

/* ── Return button ───────────────────────────────────────── */
/* Superadmin "Return to Super Admin" bar button. */
.btn-return {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius-md);
  padding: .25rem .75rem;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.btn-return:hover { background: rgba(255,255,255,.25); }

/* ── Emoji / Icon picker ─────────────────────────────────── */
.ep-wrap { display: flex; flex-direction: column; gap: var(--sp-4); }

.ep-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}

.ep-opt {
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: border-color .1s, background .1s;
}
.ep-opt:hover  { border-color: var(--primary); background: var(--primary-light, #eff6ff); }
.ep-opt.active { border-color: var(--primary); background: var(--primary-light, #eff6ff); }

.ep-clear {
  font-size: var(--text-xs);
  padding: .2rem .55rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  color: var(--muted);
  height: 36px;
  white-space: nowrap;
  transition: border-color .1s, color .1s;
}
.ep-clear:hover { border-color: var(--danger); color: var(--danger); }

.ep-custom-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.ep-preview {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  width: 1.8rem;
  text-align: center;
}

/* ── Activities module ───────────────────────────────────── */

/* Page-header actions row */
.act-header-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
}

/* Mine / All view toggle */
.act-view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  font-size: var(--text-sm);
}
.act-view-btn {
  padding: .3rem .8rem;
  text-decoration: none;
  color: var(--muted);
}
.act-view-btn--active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* Section wrappers */
.act-section        { margin-bottom: 1.5rem; }
.act-section--recent { margin-top: 2rem; }

/* Section heading row */
.act-section-hd {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .6rem;
}
.act-section-hd-sm {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .35rem;
}

/* Section label variants */
.act-section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text);
}
.act-section-label--muted {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.act-section-label--overdue {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--danger);
}
.act-section-label--active {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #059669;
}
.act-section-sublabel {
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Count badges */
.act-badge {
  font-size: var(--text-xs);
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: .1rem .5rem;
}
.act-badge--overdue {
  font-size: var(--text-xs);
  color: var(--danger);
  background: #fee2e2;
  border-radius: var(--radius-full);
  padding: .1rem .5rem;
  font-weight: 700;
}

/* Overdue left-bar */
.act-overdue-bar {
  border-left: 3px solid var(--danger);
  padding-left: .75rem;
}

/* Faded done list */
.act-done-list { opacity: .75; }

/* Individual activity row */
.act-item {
  border: 1px solid var(--border);
  margin-bottom: .4rem;
  border-radius: var(--radius-lg);
}

/* Activity icon */
.act-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
  padding-top: .1rem;
}

/* Activity body */
.act-body {
  flex: 1;
  min-width: 0;
}

/* Subject line */
.act-subject {
  font-weight: 600;
  font-size: var(--text-base);
}
.act-subject--done {
  font-weight: 600;
  font-size: var(--text-base);
  text-decoration: line-through;
  color: var(--muted);
}

/* Meta row (date / owner) */
.act-meta {
  font-size: var(--text-sm);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .6rem;
  margin-top: .15rem;
}

/* Overdue date within meta */
.act-date--overdue {
  color: var(--danger);
  font-weight: 600;
}

/* Context links row (deal / person / org) */
.act-links {
  font-size: var(--text-sm);
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .75rem;
  margin-top: .2rem;
}
.act-link-deal {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .12s;
}
.act-link-deal:hover { border-bottom-color: var(--primary); }
.act-link-muted {
  color: var(--muted);
  text-decoration: none;
}

/* Inline note */
.act-note {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: .25rem;
  font-style: italic;
}

/* Single-line meta (date/owner) in compact deal card rows — color set dynamically */
.act-meta-sm { font-size: var(--text-sm); }

/* Done-at date under completed items */
.act-done-date {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* Actions column (right side of row) */
.act-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .3rem;
  flex-shrink: 0;
}

/* 2×2 agenda grid — Today/Tomorrow/This Week/Next Week */
.act-agenda-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 640px) {
  .act-agenda-grid { grid-template-columns: 1fr; }
}

/* Done / Undo buttons */
.btn-done {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
  white-space: nowrap;
}
.act-btn-undo { white-space: nowrap; }

/* Empty-state inside today's section */
.act-empty       { padding: 1.25rem; text-align: center; }
.act-empty-link  { color: var(--primary); margin-left: .35rem; }

/* No-activities card text */
.act-no-acts-text {
  color: var(--muted);
  margin-bottom: 1rem;
}

/* Collapsed done-items container (toggled by JS) */
.act-done-items { margin-top: .4rem; }

/* "Show done" toggle button text */
.act-show-done-btn {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* "No activities yet" hint */
.act-empty-hint {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: .5rem;
}

/* Activity completion form (inline, shown on Done click) */
.act-complete-form {
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
}
.act-complete-actions {
  display: flex;
  gap: .5rem;
  margin-top: .4rem;
}

/* Pending list in deal card */
.act-pending-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: .5rem;
}

/* Inline schedule form (deal card) */
.act-inline-form {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.act-form-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .6rem;
}
.act-form-group-sm { margin-bottom: .5rem; }

/* Date+time flex row in inline form */
.act-datetime-row {
  display: flex;
  gap: .5rem;
  margin-bottom: .5rem;
}
.act-datetime-row > * { flex: 1; }

/* Type pill selector */
.act-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .6rem;
}
.act-type-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: border-color .12s, background .12s;
}

/* Breadcrumb line above page title */
.act-breadcrumb {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: .3rem;
}
.act-breadcrumb-link { color: var(--muted); }

/* Max-width wrapper for create form */
.act-form-wrap { max-width: 640px; }

/* Context banner (pre-linked entity) */
.act-context-banner {
  padding: .5rem .75rem;
  background: var(--bg);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  font-size: var(--text-sm);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
}
.act-context-value { color: var(--text); }

/* Card-header actions div in deal card */
.act-card-hd-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.ep-custom { max-width: 260px; }

/* ============================================================
   Calendar view — activities/index.php ?mode=calendar
   ============================================================ */
.cal-wrap {
  margin-top: .5rem;
}

/* Month navigation — lives inside .act-header-actions */
.cal-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cal-nav-title {
  font-weight: 600;
  font-size: var(--text-lg);
  min-width: 10rem;
  text-align: center;
}
.cal-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1;
  background: var(--bg);
  transition: background .15s;
}
.cal-nav-btn:hover { background: var(--hover-bg, #f3f4f6); }
.cal-nav-today {
  font-size: var(--text-sm);
  color: var(--primary);
  text-decoration: none;
  margin-left: .25rem;
}
.cal-nav-today:hover { text-decoration: underline; }

/* 7-column grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto;
  grid-auto-rows: minmax(120px, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Day-of-week header cells */
.cal-dow {
  background: var(--surface, #f9fafb);
  padding: .4rem .5rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
}

/* Day cells */
.cal-day {
  background: var(--bg);
  min-height: 0;
  padding: .4rem .5rem .5rem;
  overflow-y: auto;
}
.cal-day--blank {
  background: var(--surface, #f9fafb);
  opacity: .5;
}
.cal-day--weekend {
  background: var(--surface, #fafafa);
}
.cal-day--today {
  background: color-mix(in srgb, var(--primary) 6%, var(--bg));
}
.cal-day--today .cal-day-num {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Day number */
.cal-day-num {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .3rem;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Activity chips */
.cal-chip {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .45rem;
  background: color-mix(in srgb, var(--primary) 10%, var(--bg));
  border-left: 3px solid var(--primary);
  border-radius: 2px;
  margin-bottom: .25rem;
  font-size: var(--text-sm);
  line-height: 1.3;
  overflow: hidden;
  cursor: default;
}
.cal-chip--done {
  opacity: .5;
  background: var(--surface, #f3f4f6);
  border-left-color: var(--muted);
}
.cal-chip-icon {
  flex-shrink: 0;
  font-size: var(--text-sm);
}
.cal-chip-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.cal-overflow {
  font-size: var(--text-xs);
  color: var(--muted);
  padding: .1rem .35rem;
  cursor: default;
}

/* No-due-date strip below calendar */
.cal-no-date-section {
  margin-top: 1.5rem;
}

/* Calendar chips that are links */
a.cal-chip {
  text-decoration: none;
  cursor: pointer;
}
a.cal-chip:hover {
  background: color-mix(in srgb, var(--primary) 18%, var(--bg));
  border-left-color: var(--primary);
}

.act-btn-delete { color: var(--danger, #ef4444); }
.act-btn-delete:hover { background: color-mix(in srgb, var(--danger, #ef4444) 10%, transparent); }

.cal-chip-label { display: flex; flex-direction: column; min-width: 0; }
.cal-chip-ctx   { font-size: var(--text-xs); opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Funnel filter pills — activities page */
.act-funnel-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .75rem;
}
.act-funnel-pill {
  padding: .25rem .75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  text-decoration: none;
  color: var(--muted);
  background: var(--bg);
  transition: border-color .12s, color .12s, background .12s;
}
.act-funnel-pill:hover {
  border-color: var(--fpill-colour, var(--primary));
  color: var(--fpill-colour, var(--primary));
}
.act-funnel-pill--active {
  background: var(--fpill-colour, var(--primary));
  border-color: var(--fpill-colour, var(--primary));
  color: #fff;
  font-weight: 600;
}

/* ── Navbar accessibility controls (font size + dark mode) ── */
.nav-a11y {
  display: flex;
  align-items: center;
  gap: .2rem;
  margin-right: .5rem;
}
.nav-a11y-btn {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  border-radius: var(--radius-md);
  padding: .2rem .5rem;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.4;
  transition: background .15s;
}
.nav-a11y-btn:hover { background: rgba(255,255,255,.25); }
.nav-theme-icon { font-style: normal; font-size: .9rem; }

/* ── Global print utilities ──────────────────────────────── */
@media print {
  .no-print { display: none !important; }
}

/* ── Kanban board ────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 1.5rem;
  min-height: 200px;
}
.kanban-col {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.kanban-col-header {
  padding: .6rem .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.kanban-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: .75rem;
  min-height: 120px;
  background: var(--card);
  transition: background .15s;
}
.kanban-card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  padding: .7rem .75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: grab;
  transition: box-shadow .12s, transform .12s;
}
.kanban-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
  transform: translateY(-1px);
}

/* Deep-link flash: task rows linked from Gantt bars */
tr[id^="task-"]:target {
  animation: task-flash 1.5s ease;
}
@keyframes task-flash {
  0%   { background: var(--primary-light, #eff6ff); }
  100% { background: transparent; }
}
