/* MSPL CRM design system: shadcn/ui-style tokens on top of Bootstrap 5.3 (grid, collapse, dropdown JS).
   Light/dark via [data-bs-theme] on <html>. Everything is served locally (CSP: self only). */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../vendor/inter/InterVariable.woff2") format("woff2"); }

/* ------------------------------------------------------------------ tokens */
:root, [data-bs-theme=light] {
  --background: #ffffff; --page: #fafafa; --foreground: #09090b;
  --card: #ffffff; --popover: #ffffff;
  --primary: #18181b; --primary-fg: #fafafa;
  --secondary: #f4f4f5; --secondary-fg: #18181b;
  --muted: #f4f4f5; --muted-fg: #71717a;
  --accent: #f4f4f5; --accent-fg: #18181b;
  --border: #e4e4e7; --input: #e4e4e7; --ring: #a1a1aa;
  --sidebar: #fafafa; --sidebar-border: #e4e4e7; --sidebar-active: #f0f0f2;
  --destructive: #dc2626; --success: #16a34a; --warning: #d97706; --info: #0284c7;
  --chart-1: #2563eb; --chart-2: #60a5fa; --chart-off: #d4d4d8;
  --soft-green-bg: #ecfdf3; --soft-green-fg: #047857; --soft-amber-bg: #fffbeb; --soft-amber-fg: #b45309;
  --soft-red-bg: #fef2f2; --soft-red-fg: #b91c1c; --soft-blue-bg: #eff6ff; --soft-blue-fg: #1d4ed8;
  --soft-sky-bg: #f0f9ff; --soft-sky-fg: #0369a1; --soft-zinc-bg: #f4f4f5; --soft-zinc-fg: #3f3f46;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05); --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
  --radius: .5rem; --radius-lg: .75rem;
  --sb-w: 15.5rem; --sb-w-collapsed: 3.5rem; --hdr-h: 3.5rem; --tab-h: 3.75rem;
  color-scheme: light;
}
[data-bs-theme=dark] {
  --background: #09090b; --page: #09090b; --foreground: #fafafa;
  --card: #0c0c0e; --popover: #111114;
  --primary: #fafafa; --primary-fg: #18181b;
  --secondary: #27272a; --secondary-fg: #fafafa;
  --muted: #1c1c1f; --muted-fg: #a1a1aa;
  --accent: #232326; --accent-fg: #fafafa;
  --border: #27272a; --input: #2e2e32; --ring: #71717a;
  --sidebar: #0c0c0e; --sidebar-border: #232326; --sidebar-active: #1f1f23;
  --destructive: #ef4444; --success: #22c55e; --warning: #f59e0b; --info: #38bdf8;
  --chart-1: #3b82f6; --chart-2: #1e3a8a; --chart-off: #3f3f46;
  --soft-green-bg: rgba(34,197,94,.14); --soft-green-fg: #4ade80; --soft-amber-bg: rgba(245,158,11,.15); --soft-amber-fg: #fbbf24;
  --soft-red-bg: rgba(239,68,68,.15); --soft-red-fg: #f87171; --soft-blue-bg: rgba(59,130,246,.16); --soft-blue-fg: #93c5fd;
  --soft-sky-bg: rgba(56,189,248,.14); --soft-sky-fg: #7dd3fc; --soft-zinc-bg: #27272a; --soft-zinc-fg: #d4d4d8;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 12px rgba(0,0,0,.5); --shadow-lg: 0 16px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}
/* Bootstrap reads its own variables; point them at ours */
:root, [data-bs-theme=light], [data-bs-theme=dark] {
  --bs-body-font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
  --bs-body-font-size: .875rem; --bs-body-line-height: 1.5;
  --bs-body-bg: var(--page); --bs-body-color: var(--foreground); --bs-emphasis-color: var(--foreground);
  --bs-secondary-color: var(--muted-fg); --bs-tertiary-color: var(--muted-fg);
  --bs-secondary-bg: var(--muted); --bs-tertiary-bg: var(--muted);
  --bs-border-color: var(--border); --bs-border-color-translucent: var(--border);
  --bs-border-radius: var(--radius); --bs-border-radius-sm: calc(var(--radius) - 2px); --bs-border-radius-lg: var(--radius-lg);
  --bs-link-color: var(--foreground); --bs-link-hover-color: var(--foreground);
  --bs-link-color-rgb: 9,9,11; --bs-link-hover-color-rgb: 9,9,11;
  --bs-heading-color: var(--foreground); --bs-code-color: var(--foreground);
  --bs-focus-ring-color: color-mix(in srgb, var(--ring) 40%, transparent);
}
[data-bs-theme=dark] { --bs-link-color-rgb: 250,250,250; --bs-link-hover-color-rgb: 250,250,250; }

/* ------------------------------------------------------------------ base */
html { -webkit-text-size-adjust: 100%; }
body { background: var(--page); color: var(--foreground); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--foreground); text-decoration-color: color-mix(in srgb, var(--foreground) 30%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
.table a, .feed-item a, .list-row a, .cust-name { text-decoration: none; font-weight: 500; }
.table a:hover, .feed-item a:hover, .list-row a:hover { text-decoration: underline; }
::selection { background: color-mix(in srgb, var(--chart-1) 25%, transparent); }
.text-muted, .form-text { color: var(--muted-fg) !important; }
.text-danger { color: var(--destructive) !important; } .text-success { color: var(--success) !important; }
.mono, code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .8125rem; }
code { background: var(--muted); padding: .1rem .3rem; border-radius: 4px; }
hr { border-color: var(--border); opacity: 1; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ------------------------------------------------------------------ app shell */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sb { width: var(--sb-w); flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--sidebar-border);
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; transition: width .2s ease; z-index: 40; }
.sb-head { display: flex; align-items: center; gap: .625rem; padding: .75rem .75rem .5rem; min-height: var(--hdr-h); }
.logo { width: 2rem; height: 2rem; border-radius: var(--radius); background: var(--primary); color: var(--primary-fg);
  display: grid; place-items: center; flex-shrink: 0; font-size: 1rem; }
.sb-title { line-height: 1.2; min-width: 0; }
.sb-title b { display: block; font-size: .875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-title small { display: block; font-size: .75rem; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-search { margin: .25rem .75rem .5rem; display: flex; align-items: center; gap: .5rem; height: 2.125rem; padding: 0 .625rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); color: var(--muted-fg);
  font-size: .8125rem; cursor: pointer; width: calc(100% - 1.5rem); text-align: left; box-shadow: var(--shadow-sm); }
.sb-search:hover { background: var(--accent); }
.sb-search kbd, .kbd { margin-left: auto; font: 500 .6875rem/1 "Inter", sans-serif; background: var(--muted); color: var(--muted-fg);
  border: 1px solid var(--border); border-radius: 4px; padding: .15rem .35rem; box-shadow: none; }
.sb-nav { flex: 1; overflow-y: auto; padding: .25rem .5rem 1rem; scrollbar-width: thin; }
.sb-sec { font-size: .75rem; font-weight: 500; color: var(--muted-fg); padding: .875rem .5rem .375rem; white-space: nowrap; }
.nav-l { display: flex; align-items: center; gap: .625rem; height: 2.125rem; padding: 0 .5rem; border-radius: calc(var(--radius) - 2px);
  color: var(--foreground); text-decoration: none; font-size: .875rem; white-space: nowrap; position: relative; }
.nav-l i { font-size: 1rem; width: 1.125rem; text-align: center; color: var(--muted-fg); flex-shrink: 0; }
.nav-l:hover { background: var(--sidebar-active); color: var(--foreground); }
.nav-l.active { background: var(--sidebar-active); font-weight: 600; }
.nav-l.active i { color: var(--foreground); }
.nav-l .count { font-style: normal; margin-left: auto; font-size: .6875rem; font-weight: 600; min-width: 1.25rem; height: 1.25rem; padding: 0 .375rem;
  border-radius: 999px; background: var(--soft-amber-bg); color: var(--soft-amber-fg); display: grid; place-items: center; }
.sb-foot { border-top: 1px solid var(--sidebar-border); padding: .5rem; }
.user-btn { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .375rem .5rem; border: 0; background: none;
  border-radius: var(--radius); color: var(--foreground); text-align: left; }
.user-btn:hover, .user-btn[aria-expanded=true] { background: var(--sidebar-active); }
.avatar { width: 2rem; height: 2rem; border-radius: var(--radius); background: var(--secondary); color: var(--secondary-fg);
  display: grid; place-items: center; font-weight: 600; font-size: .75rem; flex-shrink: 0; }
.user-btn .who { min-width: 0; line-height: 1.2; flex: 1; }
.user-btn .who b { display: block; font-size: .8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-btn .who small { display: block; font-size: .75rem; color: var(--muted-fg); white-space: nowrap; }

/* collapsed (desktop icon rail) */
.sb-collapsed .sb { width: var(--sb-w-collapsed); }
.sb-collapsed .sb .sb-title, .sb-collapsed .sb .sb-sec, .sb-collapsed .sb .nav-l span, .sb-collapsed .sb .nav-l .count,
.sb-collapsed .sb .sb-search span, .sb-collapsed .sb .sb-search kbd, .sb-collapsed .sb .user-btn .who,
.sb-collapsed .sb .user-btn .bi-chevron-expand { display: none; }
.sb-collapsed .sb .sb-sec { display: block; height: .5rem; padding: 0; font-size: 0; border-top: 1px solid var(--sidebar-border); margin: .5rem .25rem; }
.sb-collapsed .sb .nav-l, .sb-collapsed .sb .user-btn { justify-content: center; padding: 0; }
.sb-collapsed .sb .sb-search { width: 2.125rem; margin: .25rem auto .5rem; justify-content: center; padding: 0; }
.sb-collapsed .sb .sb-head { justify-content: center; padding-inline: 0; }
.sb-collapsed .sb .nav-l .count { display: block; position: absolute; top: .125rem; right: .125rem; min-width: .5rem; height: .5rem; padding: 0; font-size: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hdr { height: var(--hdr-h); display: flex; align-items: center; gap: .5rem; padding: 0 1.5rem 0 1rem; position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--page) 85%, transparent); backdrop-filter: saturate(1.8) blur(10px);
  -webkit-backdrop-filter: saturate(1.8) blur(10px); border-bottom: 1px solid var(--border); }
.hdr .sep { width: 1px; height: 1rem; background: var(--border); margin: 0 .25rem; }
.hdr-date { font-size: .8125rem; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hdr-date b { color: var(--foreground); font-weight: 600; }
.hdr-actions { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.icon-btn { width: 2.25rem; height: 2.25rem; display: inline-grid; place-items: center; border: 0; background: transparent;
  border-radius: var(--radius); color: var(--foreground); font-size: 1rem; position: relative; flex-shrink: 0; }
.icon-btn:hover { background: var(--accent); }
.icon-btn .dot-badge { position: absolute; top: .375rem; right: .375rem; width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--destructive); box-shadow: 0 0 0 2px var(--page); }
.theme-dark-only { display: none; } [data-bs-theme=dark] .theme-dark-only { display: inline; } [data-bs-theme=dark] .theme-light-only { display: none; }
.content { padding: 1.5rem; width: 100%; max-width: 1480px; margin: 0 auto; flex: 1; }

/* mobile: sidebar becomes a sheet; bottom tab bar */
.sb-backdrop { display: none; }
.tabbar { display: none; }
@media (max-width: 991.98px) {
  .sb { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-105%); transition: transform .22s ease; width: min(18rem, 85vw) !important;
    box-shadow: var(--shadow-lg); }
  .sb-open .sb { transform: none; }
  .sb-open .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .sb-collapsed .sb .sb-title, .sb-collapsed .sb .nav-l span, .sb-collapsed .sb .user-btn .who { display: block; }
  .hdr { padding: 0 .75rem; }
  .content { padding: 1rem 1rem calc(var(--tab-h) + 1.5rem + env(safe-area-inset-bottom)); }
  .no-tabbar .content { padding-bottom: 1.5rem; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--background) 92%, transparent);
    backdrop-filter: saturate(1.8) blur(10px); -webkit-backdrop-filter: saturate(1.8) blur(10px); border-top: 1px solid var(--border); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .125rem;
    font-size: .6875rem; font-weight: 500; color: var(--muted-fg); text-decoration: none; border: 0; background: none; position: relative; }
  .tabbar i { font-size: 1.25rem; line-height: 1; }
  .tabbar .active { color: var(--foreground); }
  .tabbar .fab i { width: 2.75rem; height: 2.75rem; border-radius: 999px; background: var(--primary); color: var(--primary-fg);
    display: grid; place-items: center; font-size: 1.375rem; margin-top: -1.125rem; box-shadow: var(--shadow-md); }
  .tabbar .tab-count { position: absolute; top: .375rem; left: calc(50% + .375rem); font-size: .625rem; font-weight: 700; min-width: 1rem;
    height: 1rem; padding: 0 .25rem; border-radius: 999px; background: var(--destructive); color: #fff; display: grid; place-items: center; }
  .no-tabbar .tabbar { display: none; }
}

/* ------------------------------------------------------------------ page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; }
h1.page { font-size: 1.5rem; font-weight: 600; letter-spacing: -.025em; margin: 0; line-height: 1.25; }
.page-sub { color: var(--muted-fg); margin: .25rem 0 0; font-size: .875rem; }
h2.section { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; margin: 0; }
@media (max-width: 575.98px) { h1.page { font-size: 1.25rem; } .page-head .actions { margin-left: 0; width: 100%; } }

/* ------------------------------------------------------------------ cards */
.card { --bs-card-bg: var(--card); --bs-card-border-color: var(--border); --bs-card-border-radius: var(--radius-lg);
  --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px); --bs-card-cap-bg: transparent; --bs-card-spacer-x: 1.25rem; --bs-card-spacer-y: 1.25rem;
  --bs-card-cap-padding-y: .875rem; --bs-card-cap-padding-x: 1.25rem; color: var(--foreground); box-shadow: var(--shadow-sm); }
.card-header { font-weight: 600; font-size: .9375rem; letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem; border-bottom-color: var(--border); }
.card-header .sub, .card-desc { font-weight: 400; font-size: .8125rem; color: var(--muted-fg); letter-spacing: 0; }
.card-header a { font-weight: 500; font-size: .8125rem; text-decoration: none; color: var(--muted-fg); }
.card-header a:hover { color: var(--foreground); }
.card > .table-responsive:last-child .table, .card > .table:last-child { margin-bottom: 0; }
.card > .table-responsive:last-child, .card > .table:last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }

/* KPI tiles */
.kpi { padding: 1.125rem 1.25rem; height: 100%; }
.kpi .lbl { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .8125rem; font-weight: 500; color: var(--foreground); }
.kpi .lbl i { color: var(--muted-fg); font-size: 1rem; }
.kpi .val { font-size: 1.625rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; margin-top: .375rem; font-variant-numeric: tabular-nums; }
.kpi .val.sm { font-size: 1.5rem; }
.kpi .sub { font-size: .75rem; color: var(--muted-fg); margin-top: .125rem; }
@media (max-width: 575.98px) { .kpi { padding: .875rem 1rem; } .kpi .val, .kpi .val.sm { font-size: 1.25rem; } }

/* ------------------------------------------------------------------ buttons */
.btn { --bs-btn-font-size: .875rem; --bs-btn-font-weight: 500; --bs-btn-padding-x: 1rem; --bs-btn-padding-y: .5rem; --bs-btn-border-radius: var(--radius);
  --bs-btn-focus-box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.25rem; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn-sm { --bs-btn-font-size: .8125rem; --bs-btn-padding-x: .75rem; --bs-btn-padding-y: .3125rem; --bs-btn-border-radius: calc(var(--radius) - 2px); min-height: 2rem; gap: .375rem; }
.btn-lg { --bs-btn-font-size: .9375rem; --bs-btn-padding-x: 1.5rem; --bs-btn-padding-y: .625rem; min-height: 2.75rem; }
.btn > .bi { font-size: 1em; line-height: 1; }
.btn-brand, .btn-primary, .btn-dark {
  --bs-btn-bg: var(--primary); --bs-btn-color: var(--primary-fg); --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: color-mix(in srgb, var(--primary) 88%, var(--page)); --bs-btn-hover-color: var(--primary-fg); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: color-mix(in srgb, var(--primary) 80%, var(--page)); --bs-btn-active-color: var(--primary-fg); --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-color: var(--primary-fg); --bs-btn-disabled-border-color: var(--primary);
  box-shadow: var(--shadow-sm); }
.btn-light, .btn-outline-secondary, .btn-outline-primary, .btn-outline-dark, .btn-success, .btn-outline-success, .btn-secondary {
  --bs-btn-bg: var(--background); --bs-btn-color: var(--foreground); --bs-btn-border-color: var(--input);
  --bs-btn-hover-bg: var(--accent); --bs-btn-hover-color: var(--accent-fg); --bs-btn-hover-border-color: var(--input);
  --bs-btn-active-bg: var(--accent); --bs-btn-active-color: var(--accent-fg); --bs-btn-active-border-color: var(--input);
  --bs-btn-disabled-bg: var(--background); --bs-btn-disabled-color: var(--muted-fg); --bs-btn-disabled-border-color: var(--input);
  box-shadow: var(--shadow-sm); }
.btn-success > .bi, .btn-outline-success > .bi { color: var(--success); }
.btn-ghost { --bs-btn-bg: transparent; --bs-btn-color: var(--foreground); --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--accent); --bs-btn-hover-color: var(--foreground); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: transparent; }
.btn-outline-danger, .btn-danger {
  --bs-btn-bg: var(--background); --bs-btn-color: var(--destructive); --bs-btn-border-color: color-mix(in srgb, var(--destructive) 35%, var(--input));
  --bs-btn-hover-bg: var(--destructive); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: var(--destructive);
  --bs-btn-active-bg: var(--destructive); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--destructive); }
.btn-danger { --bs-btn-bg: var(--destructive); --bs-btn-color: #fff; --bs-btn-border-color: var(--destructive);
  --bs-btn-hover-bg: color-mix(in srgb, var(--destructive) 88%, #000); }
.btn-link { --bs-btn-color: var(--foreground); --bs-btn-hover-color: var(--foreground); --bs-btn-active-color: var(--foreground);
  min-height: 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--foreground) 30%, transparent); }
.btn-group > .btn { box-shadow: none; }
.btn-group { box-shadow: var(--shadow-sm); border-radius: var(--radius); }
/* segmented control (presets, visit mode) */
.seg { display: inline-flex; flex-wrap: wrap; gap: .125rem; padding: .1875rem; background: var(--muted); border-radius: var(--radius); }
.seg .btn { --bs-btn-bg: transparent; --bs-btn-border-color: transparent; --bs-btn-color: var(--muted-fg); --bs-btn-hover-bg: transparent;
  --bs-btn-hover-color: var(--foreground); --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent;
  min-height: 1.875rem; box-shadow: none; border-radius: calc(var(--radius) - 2px); }
.seg .btn.on, .seg .btn-check:checked + .btn { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); border-color: transparent; }
[data-bs-theme=dark] .seg .btn.on, [data-bs-theme=dark] .seg .btn-check:checked + .btn { background: var(--secondary); }
.seg.w-100 .btn { flex: 1; }
/* toggle chips (topics / brands) */
.chips { display: flex; flex-wrap: wrap; gap: .375rem; }
.chips .btn { --bs-btn-padding-x: .75rem; --bs-btn-padding-y: .25rem; --bs-btn-font-size: .8125rem; border-radius: 999px; min-height: 2rem;
  --bs-btn-bg: var(--background); --bs-btn-color: var(--foreground); --bs-btn-border-color: var(--input);
  --bs-btn-hover-bg: var(--accent); --bs-btn-hover-color: var(--foreground); --bs-btn-hover-border-color: var(--input);
  --bs-btn-active-bg: var(--primary); --bs-btn-active-color: var(--primary-fg); --bs-btn-active-border-color: var(--primary); box-shadow: none; }
.chips .btn-check:checked + .btn { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.chips .btn-check:checked + .btn::before { content: "\F26E"; font-family: "bootstrap-icons"; margin-right: .125rem; font-size: .875rem; line-height: 1; }
.chips .btn-check:focus-visible + .btn { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }

/* ------------------------------------------------------------------ forms */
.form-label { font-weight: 500; font-size: .875rem; color: var(--foreground); margin-bottom: .375rem; }
.form-control, .form-select { background-color: var(--background); color: var(--foreground); border-color: var(--input);
  border-radius: var(--radius); font-size: .875rem; min-height: 2.25rem; padding: .4375rem .75rem; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s; }
.form-select { padding-right: 2.25rem; }
textarea.form-control { min-height: 4.5rem; line-height: 1.5; }
.form-control-sm, .form-select-sm { min-height: 2rem; font-size: .8125rem; padding-top: .25rem; padding-bottom: .25rem; border-radius: calc(var(--radius) - 2px); }
.form-select-sm { padding-right: 2rem; }
.form-control::placeholder { color: var(--muted-fg); opacity: 1; }
.form-control:focus, .form-select:focus { border-color: var(--ring); background-color: var(--background); color: var(--foreground);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 30%, transparent); }
.form-control:disabled, .form-select:disabled { background: var(--muted); opacity: .7; }
.form-control[type=file] { padding: .3125rem .5rem; }
.form-control::file-selector-button { background: var(--muted); color: var(--foreground); border: 0; border-radius: calc(var(--radius) - 2px);
  margin: 0 .625rem 0 0; padding: .25rem .625rem; font-weight: 500; }
.form-control.is-valid { border-color: color-mix(in srgb, var(--success) 60%, var(--input)); background-image: none; padding-right: .75rem; }
.form-control.is-valid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }
.form-text { font-size: .8125rem; margin-top: .375rem; }
.form-check-input { background-color: var(--background); border-color: color-mix(in srgb, var(--foreground) 35%, var(--input)); width: 1rem; height: 1rem; margin-top: .1875rem; }
.form-check-input[type=checkbox] { border-radius: 4px; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
[data-bs-theme=dark] .form-check-input:checked[type=checkbox] { --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2318181b' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e"); }
.form-check-input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 30%, transparent); border-color: var(--ring); }
.form-switch .form-check-input { width: 2.25rem; height: 1.25rem; margin-top: .0625rem; border-radius: 999px; background-color: var(--input); border-color: transparent;
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e"); }
.form-switch .form-check-input:checked { background-color: var(--primary); }
[data-bs-theme=dark] .form-switch .form-check-input:checked { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2318181b'/%3e%3c/svg%3e"); }
.form-switch { padding-left: 2.75rem; min-height: 1.5rem; }
.form-switch .form-check-input { margin-left: -2.75rem; }
.form-check-label { font-size: .875rem; }
label.small { display: inline-flex; align-items: center; gap: .5rem; font-size: .875rem !important; cursor: pointer; }
label.small .form-check-input { margin-top: 0; }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted-fg); pointer-events: none; }
.input-icon > .form-control { padding-left: 2.25rem; }
/* BS date picker rows */
.bs-row { display: grid; grid-template-columns: 4rem minmax(0, 1fr) 5rem; gap: .375rem; }
.bs-row .form-select { padding-left: .625rem; padding-right: 1.75rem; background-position: right .5rem center; min-width: 0; }
.ad-hint { font-size: .75rem; }
/* form sections (visit form) */
.fsec + .fsec { border-top: 1px solid var(--border); margin-top: 1.25rem; padding-top: 1.25rem; }
.fsec-title { font-weight: 600; font-size: .9375rem; margin: 0 0 .125rem; letter-spacing: -.01em; }
.fsec-desc { color: var(--muted-fg); font-size: .8125rem; margin: 0 0 1rem; }

/* filter toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.toolbar .fld { display: flex; flex-direction: column; gap: .25rem; }
.toolbar .fld > label { font-size: .75rem; font-weight: 500; color: var(--muted-fg); margin: 0; }
.toolbar .grow { flex: 1 1 12rem; }
@media (max-width: 575.98px) { .toolbar .fld { flex: 1 1 100%; } .toolbar .fld[style] { width: 100% !important; } }

/* ------------------------------------------------------------------ tables */
.table { --bs-table-bg: transparent; --bs-table-color: var(--foreground); --bs-table-border-color: var(--border);
  --bs-table-hover-bg: color-mix(in srgb, var(--muted) 60%, transparent); --bs-table-hover-color: var(--foreground);
  --bs-table-striped-bg: var(--muted); font-size: .875rem; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .625rem .75rem; border-bottom-color: var(--border); }
.table-sm > :not(caption) > * > * { padding: .5rem .75rem; }
.table > thead th, .table thead th { background: transparent; color: var(--muted-fg); font-weight: 500; font-size: .8125rem; text-transform: none;
  letter-spacing: 0; white-space: nowrap; height: 2.5rem; vertical-align: middle; }
.table > thead { position: sticky; top: 0; z-index: 2; }
.table > thead th { background: var(--card); box-shadow: inset 0 -1px 0 var(--border); border-bottom: 0; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table td { vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 1.25rem; }
.table th:last-child, .table td:last-child { padding-right: 1.25rem; }
.table-responsive { scrollbar-width: thin; }
table.kv th { color: var(--muted-fg); font-weight: 500; width: 38%; }

/* ------------------------------------------------------------------ badges */
.badge { --bs-badge-font-weight: 600; --bs-badge-font-size: .75rem; --bs-badge-padding-x: .5rem; --bs-badge-padding-y: .1875rem;
  --bs-badge-border-radius: calc(var(--radius) - 2px); display: inline-flex; align-items: center; gap: .25rem; line-height: 1.25;
  border: 1px solid transparent; }
.badge.rounded-pill { border-radius: 999px; }
.text-bg-success { background: var(--soft-green-bg) !important; color: var(--soft-green-fg) !important; }
.text-bg-warning { background: var(--soft-amber-bg) !important; color: var(--soft-amber-fg) !important; }
.text-bg-danger { background: var(--soft-red-bg) !important; color: var(--soft-red-fg) !important; }
.text-bg-primary { background: var(--soft-blue-bg) !important; color: var(--soft-blue-fg) !important; }
.text-bg-info { background: var(--soft-sky-bg) !important; color: var(--soft-sky-fg) !important; }
.text-bg-secondary { background: var(--soft-zinc-bg) !important; color: var(--soft-zinc-fg) !important; }
.text-bg-light { background: transparent !important; color: var(--foreground) !important; border-color: var(--border); }
.text-bg-dark { background: var(--primary) !important; color: var(--primary-fg) !important; }
.tagx { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 500; padding: .0625rem .5rem; border-radius: 999px;
  background: var(--secondary); color: var(--secondary-fg); margin: 0 .25rem .25rem 0; line-height: 1.5; }
.tagx.brand { background: transparent; border: 1px solid var(--border); color: var(--muted-fg); }
.pct-pill { display: inline-block; min-width: 2.75rem; text-align: center; font-size: .75rem; font-weight: 600; padding: .0625rem .375rem;
  border-radius: 999px; font-variant-numeric: tabular-nums; }
.pct-good { background: var(--soft-green-bg); color: var(--soft-green-fg); }
.pct-mid { background: var(--soft-amber-bg); color: var(--soft-amber-fg); }
.pct-low { background: var(--soft-red-bg); color: var(--soft-red-fg); }

/* ------------------------------------------------------------------ alerts, toasts */
.alert { --bs-alert-border-radius: var(--radius-lg); --bs-alert-padding-x: 1rem; --bs-alert-padding-y: .75rem; font-size: .875rem;
  background: var(--card); color: var(--foreground); border: 1px solid var(--border); display: flex; gap: .625rem; align-items: flex-start; }
.alert > .bi { font-size: 1rem; margin-top: .0625rem; }
.alert-danger { border-color: color-mix(in srgb, var(--destructive) 40%, var(--border)); color: var(--destructive); }
.alert-danger > div { color: var(--foreground); }
.alert-success > .bi { color: var(--success); } .alert-warning > .bi { color: var(--warning); } .alert-info > .bi { color: var(--info); }
.flash-pre { white-space: pre-wrap; }
.toasts { position: fixed; z-index: 1080; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
@media (max-width: 991.98px) { .toasts { left: 1rem; right: 1rem; width: auto; top: calc(var(--hdr-h) + .5rem); bottom: auto; } }
.toast-item { pointer-events: auto; display: flex; gap: .75rem; align-items: flex-start; padding: .875rem 1rem; background: var(--popover); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); font-size: .875rem;
  animation: toast-in .25s cubic-bezier(.21,1.02,.73,1); }
.toast-item > .bi { font-size: 1.0625rem; margin-top: .0625rem; flex-shrink: 0; }
.toast-item .msg { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }
.toast-item .x { border: 0; background: none; color: var(--muted-fg); padding: 0 .125rem; font-size: 1rem; line-height: 1; margin: -.125rem -.25rem 0 0; }
.toast-item .x:hover { color: var(--foreground); }
.toast-item.t-success > .bi { color: var(--success); } .toast-item.t-danger > .bi { color: var(--destructive); }
.toast-item.t-warning > .bi { color: var(--warning); } .toast-item.t-info > .bi { color: var(--info); }
.toast-item.t-danger { border-color: color-mix(in srgb, var(--destructive) 45%, var(--border)); }
.toast-item.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(.5rem) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(.25rem) scale(.97); } }

/* ------------------------------------------------------------------ dropdown, dialog, command palette */
.dropdown-menu { --bs-dropdown-bg: var(--popover); --bs-dropdown-color: var(--foreground); --bs-dropdown-border-color: var(--border);
  --bs-dropdown-border-radius: var(--radius); --bs-dropdown-link-color: var(--foreground); --bs-dropdown-link-hover-bg: var(--accent);
  --bs-dropdown-link-hover-color: var(--foreground); --bs-dropdown-link-active-bg: var(--accent); --bs-dropdown-link-active-color: var(--foreground);
  --bs-dropdown-font-size: .875rem; --bs-dropdown-padding-y: .25rem; --bs-dropdown-item-padding-y: .375rem; --bs-dropdown-divider-bg: var(--border);
  --bs-dropdown-header-color: var(--muted-fg); box-shadow: var(--shadow-md); padding: .25rem; min-width: 14rem; }
.dropdown-item { border-radius: calc(var(--radius) - 2px); display: flex; align-items: center; gap: .5rem; }
.dropdown-item .bi { color: var(--muted-fg); width: 1rem; }
.dropdown-header { font-size: .75rem; padding: .375rem .5rem; }
dialog.dlg { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--popover); color: var(--foreground); padding: 1.5rem;
  width: min(28rem, calc(100vw - 2rem)); box-shadow: var(--shadow-lg); }
dialog.dlg::backdrop { background: rgba(0,0,0,.5); }
dialog.dlg[open] { animation: dlg-in .18s ease; }
@keyframes dlg-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.dlg h3 { font-size: 1.0625rem; font-weight: 600; margin: 0 0 .5rem; }
.dlg p { color: var(--muted-fg); margin: 0 0 1.25rem; }
.dlg .dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap-reverse; }
dialog.cmdk { padding: 0; width: min(36rem, calc(100vw - 1.5rem)); margin-top: 12vh; overflow: hidden; }
.cmdk-in { display: flex; align-items: center; gap: .625rem; padding: 0 1rem; border-bottom: 1px solid var(--border); }
.cmdk-in .bi { color: var(--muted-fg); }
.cmdk-in input { flex: 1; height: 3rem; border: 0; outline: 0; background: transparent; color: var(--foreground); font-size: .9375rem; }
.cmdk-list { max-height: min(24rem, 60vh); overflow-y: auto; padding: .375rem; }
.cmdk-group { font-size: .75rem; font-weight: 500; color: var(--muted-fg); padding: .5rem .5rem .25rem; }
.cmdk-item { display: flex; align-items: center; gap: .625rem; padding: .5rem; border-radius: calc(var(--radius) - 2px); color: var(--foreground);
  text-decoration: none; font-size: .875rem; cursor: pointer; }
.cmdk-item .bi { color: var(--muted-fg); width: 1rem; text-align: center; }
.cmdk-item small { color: var(--muted-fg); margin-left: auto; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.cmdk-item.sel { background: var(--accent); }
.cmdk-empty { padding: 1.5rem; text-align: center; color: var(--muted-fg); font-size: .875rem; }
.cmdk-foot { border-top: 1px solid var(--border); padding: .5rem .875rem; font-size: .75rem; color: var(--muted-fg); display: flex; gap: 1rem; }

/* ------------------------------------------------------------------ lists, tabs, pagination */
.list-group { --bs-list-group-bg: transparent; --bs-list-group-color: var(--foreground); --bs-list-group-border-color: var(--border);
  --bs-list-group-item-padding-x: 1.25rem; --bs-list-group-item-padding-y: .75rem; }
.list-row { display: flex; gap: .75rem; align-items: center; padding: .75rem 1.25rem; border-top: 1px solid var(--border); font-size: .875rem; }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow > * { overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { color: var(--muted-fg); font-size: .8125rem; }
.empty { padding: 2rem 1.25rem; text-align: center; color: var(--muted-fg); font-size: .875rem; }
.empty .bi { display: block; font-size: 1.5rem; margin-bottom: .5rem; color: var(--muted-fg); opacity: .7; }
.nav-tabs { --bs-nav-tabs-border-width: 0; display: inline-flex; gap: .125rem; padding: .1875rem; background: var(--muted); border-radius: var(--radius); flex-wrap: wrap; }
.nav-tabs .nav-link { border: 0; border-radius: calc(var(--radius) - 2px); color: var(--muted-fg); font-weight: 500; font-size: .875rem; padding: .3125rem .75rem; }
.nav-tabs .nav-link:hover { color: var(--foreground); }
.nav-tabs .nav-link.active { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
[data-bs-theme=dark] .nav-tabs .nav-link.active { background: var(--secondary); }
.pagination { --bs-pagination-bg: var(--background); --bs-pagination-color: var(--foreground); --bs-pagination-border-color: var(--input);
  --bs-pagination-hover-bg: var(--accent); --bs-pagination-hover-color: var(--foreground); --bs-pagination-hover-border-color: var(--input);
  --bs-pagination-disabled-bg: transparent; --bs-pagination-disabled-color: var(--muted-fg); --bs-pagination-disabled-border-color: transparent;
  --bs-pagination-focus-box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); gap: .25rem; }
.pagination .page-link { border-radius: var(--radius) !important; }

/* ------------------------------------------------------------------ CRM widgets */
.cust-picker { position: relative; }
.cust-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + .25rem); max-height: 18rem; overflow-y: auto; background: var(--popover);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: .25rem; }
.cust-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: .5rem .625rem; color: var(--foreground);
  border-radius: calc(var(--radius) - 2px); }
.cust-item:hover, .cust-item:focus { background: var(--accent); outline: 0; }
.cust-item span { display: block; font-weight: 500; font-size: .875rem; } .cust-item small { color: var(--muted-fg); font-size: .75rem; }
.cust-empty { padding: .625rem; color: var(--muted-fg); font-size: .8125rem; }
.photo-prev { max-width: 100%; max-height: 14rem; border-radius: var(--radius); border: 1px solid var(--border); }
.gps { display: inline-flex; align-items: center; gap: .375rem; font-size: .8125rem; color: var(--muted-fg); }
.sticky-actions { display: grid; gap: .5rem; }
@media (max-width: 991.98px) { .sticky-actions { position: sticky; bottom: 0; z-index: 5; margin: 0 -1rem; padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--border); } }

/* activity feed */
.feed { position: relative; }
.feed-item { position: relative; padding: 0 0 1.25rem 1.5rem; }
.feed-item::before { content: ""; position: absolute; left: .3125rem; top: 1.125rem; bottom: 0; width: 1px; background: var(--border); }
.feed-item:last-child { padding-bottom: 0; } .feed-item:last-child::before { display: none; }
.feed-item::after { content: ""; position: absolute; left: 0; top: .375rem; width: .6875rem; height: .6875rem; border-radius: 50%;
  background: var(--card); border: 2px solid var(--chart-1); }
.feed-item .meta { font-size: .8125rem; color: var(--muted-fg); margin-bottom: .25rem; }
.feed-item .meta b { color: var(--foreground); font-weight: 600; }
.feed-item .txt { white-space: pre-wrap; margin: .25rem 0 .375rem; }
.feed-item .foot { display: flex; flex-wrap: wrap; gap: .375rem; align-items: center; font-size: .8125rem; }
.feed-item .foot .open { margin-left: auto; font-weight: 500; text-decoration: none; color: var(--muted-fg); }
.feed-item .foot .open:hover { color: var(--foreground); }
.feed-item.plain { padding-left: 0; } .feed-item.plain::before, .feed-item.plain::after { display: none; }
.comment { background: var(--muted); border-radius: var(--radius); padding: .625rem .875rem; margin-bottom: .5rem; }

/* charts */
.chart-box { position: relative; height: 15rem; }
.hbar { display: grid; grid-template-columns: minmax(6.5rem, 40%) 1fr 2.5rem; align-items: center; gap: .625rem; font-size: .8125rem; margin-bottom: .5rem; outline: none; }
.hbar .lbl { color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { background: var(--muted); border-radius: 999px; height: .5rem; overflow: hidden; }
.hbar .fill { background: var(--chart-1); height: 100%; border-radius: 999px; }
.hbar:hover .fill, .hbar:focus .fill { filter: brightness(1.15); }
.hbar .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.heat td.h { text-align: center; font-size: .75rem; font-weight: 600; min-width: 1.75rem; padding: .375rem .125rem !important; font-variant-numeric: tabular-nums; }
.heat th.d { text-align: center; font-size: .6875rem; padding: .25rem .125rem !important; line-height: 1.2; }
.hm0 { color: var(--muted-fg); opacity: .5; }
.hm1, .table > :not(caption) > * > .hm1 { background: color-mix(in srgb, var(--chart-1) 14%, transparent); }
.hm2, .table > :not(caption) > * > .hm2 { background: color-mix(in srgb, var(--chart-1) 30%, transparent); }
.hm3, .table > :not(caption) > * > .hm3 { background: color-mix(in srgb, var(--chart-1) 50%, transparent); }
.hm4, .table > :not(caption) > * > .hm4 { background: color-mix(in srgb, var(--chart-1) 72%, transparent); color: #fff; }
.hm5, .table > :not(caption) > * > .hm5 { background: var(--chart-1); color: #fff; }
.heat-legend span { display: inline-block; width: 1.5rem; text-align: center; border-radius: 4px; font-size: .6875rem; }
.viz-tip { position: fixed; display: none; pointer-events: none; z-index: 1000; background: var(--popover); color: var(--foreground); font-size: .75rem;
  padding: .5rem .625rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-md); }
.viz-tip strong { font-size: .8125rem; }

/* login */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; background: var(--background); }
.auth-side { background: #18181b; color: #fafafa; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; inset: auto -20% -30% auto; width: 32rem; height: 32rem; border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,.35), transparent 65%); }
.auth-side .logo { background: #fafafa; color: #18181b; }
.auth-side blockquote { font-size: 1.125rem; line-height: 1.6; margin: 0; max-width: 28rem; position: relative; z-index: 1; }
.auth-side figcaption { color: #a1a1aa; font-size: .875rem; margin-top: .75rem; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 22rem; }
.auth-card h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.025em; margin: 0; }
@media (max-width: 991.98px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: var(--page); }
.login-card { width: 100%; max-width: 26rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-md); }

@media print {
  .sb, .hdr, .tabbar, .toasts, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; } .card { box-shadow: none; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.min-w-0 { min-width: 0; }
.table.nowrap td, .table.nowrap th, td.date, .date { white-space: nowrap; }
/* filter bars: date pickers carry an "AD:" hint underneath, so align tops and drop the button to the input row */
.toolbar { align-items: flex-start; }
/* label line (.75rem x 1.5) + gap (.25rem) = 1.375rem: puts buttons and checkboxes level with the inputs */
.toolbar .fld.btn-row { padding-top: 1.375rem; }
.toolbar > label.small { margin-top: 1.375rem; height: 2rem; padding: 0; white-space: nowrap; }

/* ------------------------------------------------------------------ Phase 5: notifications, sync, map */
.notif-menu { width: min(24rem, calc(100vw - 1.5rem)); overflow: hidden; }
.notif-head { display: flex; align-items: center; padding: .625rem .75rem .625rem 1rem; border-bottom: 1px solid var(--border); font-size: .875rem; }
.notif-list { max-height: min(26rem, 60vh); overflow-y: auto; }
.notif-row { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem 1rem; color: var(--foreground); text-decoration: none;
  border-top: 1px solid var(--border); font-size: .875rem; }
.notif-row:first-child { border-top: 0; }
.notif-row:hover { background: var(--accent); }
.notif-row .meta { font-size: .75rem; color: var(--muted-fg); margin-top: .125rem; }
.notif-row.unread { background: color-mix(in srgb, var(--chart-1) 6%, transparent); }
.notif-row.unread .grow > div:first-child { font-weight: 500; }
.notif-ic { width: 2rem; height: 2rem; border-radius: 999px; background: var(--muted); display: grid; place-items: center; flex-shrink: 0; color: var(--muted-fg); }
.unread-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--chart-1); flex-shrink: 0; margin-top: .375rem; }
.notif-foot { display: block; text-align: center; padding: .625rem; font-size: .8125rem; font-weight: 500; border-top: 1px solid var(--border);
  color: var(--muted-fg); text-decoration: none; }
.notif-foot:hover { color: var(--foreground); background: var(--accent); }
.list-row.notif-row { padding: .875rem 1.25rem; }
.sync-btn { color: var(--warning); }
.sync-btn .q-count { position: absolute; top: .125rem; right: .0625rem; font-size: .625rem; font-weight: 700; min-width: 1rem; height: 1rem; padding: 0 .25rem;
  border-radius: 999px; background: var(--warning); color: #fff; display: grid; place-items: center; }
.sync-btn.has-error { color: var(--destructive); } .sync-btn.has-error .q-count { background: var(--destructive); }
.queue-list { display: grid; gap: .5rem; max-height: 50vh; overflow-y: auto; }
.queue-item { display: flex; gap: .75rem; align-items: flex-start; padding: .625rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); }
.queue-item .grow { flex: 1; min-width: 0; }
.live-flash { animation: live-flash 1.6s ease; }
@keyframes live-flash { 0% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--chart-1) 45%, transparent); } 100% { box-shadow: var(--shadow-sm); } }
.visit-map { height: min(70vh, 40rem); border-top-left-radius: inherit; border-top-right-radius: inherit; z-index: 0; }
.leaflet-container { font: inherit; background: var(--muted); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--popover); color: var(--foreground); box-shadow: var(--shadow-md); }
.leaflet-popup-content { margin: .75rem .875rem; font-size: .8125rem; line-height: 1.45; }
.leaflet-popup-content a { color: var(--foreground); }
.leaflet-bar a { background: var(--popover); color: var(--foreground); border-color: var(--border); }
[data-bs-theme=dark] .leaflet-tile-pane { filter: brightness(.75) invert(1) contrast(.9) hue-rotate(200deg) saturate(.35); }
.map-dot { display: inline-block; width: .625rem; height: .625rem; border-radius: 50%; }
.map-num { background: var(--primary); color: var(--primary-fg); border: 2px solid var(--background); border-radius: 50%; font-size: .6875rem;
  font-weight: 700; display: grid !important; place-items: center; box-shadow: var(--shadow-md); }
