/* ==========================================================================
   CRM — "Steel Desk" design system
   Inspired by a classic back-office CRM: steel-blue sidebar, white header cards,
   dense uppercase tables, crimson monospace codes, solid status labels.
   Light + dark themes via [data-theme] on <html>. All components use tokens.
   ========================================================================== */

/* -------------------------------------------------------------------------
   1. TOKENS
------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Surfaces & text */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --text-2: #334155;
  --muted: #64748b;
  --id-color: #b4235f;

  /* Brand */
  --accent: #4263eb;
  --accent-hover: #3451d1;
  --accent-soft: #edf1fe;
  --accent-ink: #ffffff;
  --ring: rgba(66, 99, 235, 0.25);

  /* Sidebar (steel blue in both themes) */
  --side-bg: linear-gradient(180deg, #33557d 0%, #28486c 45%, #1f3b5b 100%);
  --side-text: #dde6f1;
  --side-strong: #ffffff;
  --side-muted: #a9bdd4;
  --side-hover: rgba(255, 255, 255, 0.09);
  --side-active: rgba(255, 255, 255, 0.18);
  --side-active-text: #ffffff;
  --side-border: rgba(255, 255, 255, 0.12);
  --side-input-bg: rgba(255, 255, 255, 0.1);
  --side-input-bd: rgba(255, 255, 255, 0.16);
  --side-company: #bfdbfe;
  --side-btn-bd: rgba(255, 255, 255, 0.55);
  --side-logout-hover-bg: rgba(255, 255, 255, 0.12);
  --side-focus: #bfdbfe;

  /* Scrollbars */
  --scroll-thumb: #c9d3e1;
  --scroll-thumb-hover: #a3b1c6;
  --scroll-track: transparent;

  /* Status tones (always paired with text or icon, never colour alone) */
  --ok-bg: #dcfce7;   --ok-fg: #166534;   --ok-bd: #bbf7d0;   --ok-solid: #16a34a;
  --warn-bg: #fef3c7; --warn-fg: #92400e; --warn-bd: #fde68a; --warn-solid: #d97706;
  --bad-bg: #fee2e2;  --bad-fg: #991b1b;  --bad-bd: #fecaca;  --bad-solid: #dc2626;
  --info-bg: #e0f2fe; --info-fg: #075985; --info-bd: #bae6fd; --info-solid: #0284c7;
  --neutral-bg: #eef2f7; --neutral-fg: #44526a; --neutral-bd: #dbe2ec;

  /* Solid status labels (badges): text/background pairs meet 4.5:1 in both themes */
  --lbl-ok-bg: #15803d;      --lbl-ok-fg: #ffffff;
  --lbl-bad-bg: #dc2626;     --lbl-bad-fg: #ffffff;
  --lbl-warn-bg: #fbbf24;    --lbl-warn-fg: #422006;
  --lbl-info-bg: #67d0ec;    --lbl-info-fg: #08303d;
  --lbl-neutral-bg: #64748b; --lbl-neutral-fg: #ffffff;
  --lbl-accent-bg: #4263eb;  --lbl-accent-fg: #ffffff;

  /* Skeleton */
  --sk-1: #e9eef6;
  --sk-2: #f6f8fc;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(30, 41, 59, 0.06);
  --shadow-sm: 0 1px 3px rgba(30, 41, 59, 0.07), 0 1px 2px rgba(30, 41, 59, 0.04);
  --shadow-pop: 0 14px 32px -8px rgba(30, 41, 59, 0.28), 0 2px 6px rgba(30, 41, 59, 0.06);
  --shadow-modal: 0 24px 60px -12px rgba(30, 41, 59, 0.4);
  --scrim: rgba(15, 23, 42, 0.55);

  /* Type */
  --font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 26px;

  /* Shape & spacing */
  --r-sm: 5px;
  --r: 6px;
  --r-lg: 10px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --side-w: 236px;
  --top-h: 60px;
  --row-h: 46px;

  /* Motion */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  /* Layers */
  --z-sticky: 20;
  --z-topbar: 30;
  --z-backdrop: 40;
  --z-sidebar: 45;
  --z-dropdown: 60;
  --z-toast: 90;
  --z-progress: 100;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1724;
  --surface: #172233;
  --surface-2: #1c293d;
  --surface-3: #223148;
  --border: #2a3a52;
  --border-strong: #3d5272;
  --text: #e6edf6;
  --text-2: #c3cfdf;
  --muted: #9aabc2;
  --id-color: #f48fb8;

  --accent: #7590ff;
  --accent-hover: #93a9ff;
  --accent-soft: rgba(117, 144, 255, 0.15);
  --accent-ink: #0b1220;
  --ring: rgba(117, 144, 255, 0.35);

  --side-bg: linear-gradient(180deg, #1d3452 0%, #172b45 45%, #112138 100%);
  --side-border: rgba(255, 255, 255, 0.08);

  --lbl-accent-bg: #4263eb;

  --scroll-thumb: #33465f;
  --scroll-thumb-hover: #4a6080;

  --ok-bg: rgba(34, 197, 94, 0.15);   --ok-fg: #86efac;   --ok-bd: rgba(34, 197, 94, 0.3);   --ok-solid: #22c55e;
  --warn-bg: rgba(245, 158, 11, 0.15); --warn-fg: #fcd34d; --warn-bd: rgba(245, 158, 11, 0.3); --warn-solid: #f59e0b;
  --bad-bg: rgba(239, 68, 68, 0.17);  --bad-fg: #fca5a5;  --bad-bd: rgba(239, 68, 68, 0.32);  --bad-solid: #ef4444;
  --info-bg: rgba(56, 189, 248, 0.15); --info-fg: #7dd3fc; --info-bd: rgba(56, 189, 248, 0.3); --info-solid: #38bdf8;
  --neutral-bg: rgba(148, 163, 184, 0.14); --neutral-fg: #cbd5e1; --neutral-bd: rgba(148, 163, 184, 0.26);

  --sk-1: #1c2c4a;
  --sk-2: #243658;

  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-pop: 0 16px 36px -8px rgba(0, 0, 0, 0.65);
  --shadow-modal: 0 24px 60px -12px rgba(0, 0, 0, 0.75);
  --scrim: rgba(3, 7, 15, 0.7);
}

/* -------------------------------------------------------------------------
   2. BASE
------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img, svg { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
strong { font-weight: 700; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--text); font-weight: 700; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

[hidden] { display: none !important; }

/* Scrollbars: slim rounded thumb that follows the theme.
   Chromium/Safari get the styled pseudo-elements; Firefox falls back to scrollbar-color. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }
::-webkit-scrollbar-corner { background: transparent; }
.sidebar-nav::-webkit-scrollbar, .cs-list::-webkit-scrollbar { width: 8px; }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
}

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: var(--z-progress);
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: var(--r);
  font-weight: 600; transform: translateY(-160%); transition: transform var(--dur-2) var(--ease-out);
}
.skip-link:focus { transform: none; text-decoration: none; }

/* Utilities */
.mono { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.id-code { font-family: var(--mono); font-size: 12px; color: var(--id-color); font-weight: 500; letter-spacing: 0.01em; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.text-muted { color: var(--muted); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-ok { color: var(--ok-fg); }
.text-bad { color: var(--bad-fg); }
.text-warn { color: var(--warn-fg); }
.fw-600 { font-weight: 600; }
.nowrap { white-space: nowrap; }
.dash { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mb-4 { margin-bottom: var(--sp-4); }
.ml-auto { margin-left: auto; }

/* -------------------------------------------------------------------------
   3. APP SHELL
------------------------------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text);
  border-right: 1px solid var(--side-border);
  z-index: var(--z-sidebar);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 16px; flex-shrink: 0;
  border-bottom: 1px solid var(--side-border);
  color: var(--side-strong); font-weight: 800; font-size: 15px; letter-spacing: 0.005em;
}
.sidebar-brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
  background: #ffffff; color: #28486c;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.brand-sub { display: block; font-size: 11px; font-weight: 600; color: var(--side-muted); letter-spacing: 0.02em; }

/* Global search lives at the top of the sidebar */
.side-search { position: relative; display: flex; align-items: center; margin: 14px 12px 0; }
.side-search svg { position: absolute; left: 10px; color: var(--side-muted); pointer-events: none; }
.side-search input {
  width: 100%; height: 36px; padding: 0 50px 0 32px;
  background: var(--side-input-bg); border: 1px solid var(--side-input-bd); border-radius: var(--r);
  font-size: var(--fs-sm); color: var(--side-strong);
  transition: border-color var(--dur-1), background var(--dur-1), box-shadow var(--dur-1);
}
.side-search input::placeholder { color: var(--side-muted); }
.side-search input:focus { outline: none; background: rgba(255, 255, 255, 0.16); border-color: var(--side-focus); box-shadow: 0 0 0 3px rgba(191, 219, 254, 0.25); }
.side-search kbd {
  position: absolute; right: 7px; font: 600 10.5px var(--mono); color: var(--side-muted);
  border: 1px solid var(--side-input-bd); border-radius: 4px; padding: 1px 5px; pointer-events: none;
}

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 4px 10px 16px;
  --scroll-thumb: rgba(255, 255, 255, 0.18); --scroll-thumb-hover: rgba(255, 255, 255, 0.3);
}

.nav-section {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--side-muted); padding: 18px 10px 6px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 12px; margin-bottom: 2px;
  border-radius: var(--r);
  color: var(--side-text); font-size: 14px; font-weight: 600;
  transition: background var(--dur-1), color var(--dur-1);
}
.nav-link:hover { background: var(--side-hover); color: var(--side-strong); text-decoration: none; }
.nav-link[aria-current="page"] {
  background: var(--side-active); color: var(--side-active-text); font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.nav-link svg { opacity: 0.8; }
.nav-link[aria-current="page"] svg { opacity: 1; }
.nav-link .nav-ext { margin-left: auto; opacity: 0.6; }
.nav-link:focus-visible { outline-color: var(--side-focus); }

.sidebar-footer { padding: 14px 14px 16px; border-top: 1px solid var(--side-border); }
.user-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; min-width: 0; }
.user-meta { min-width: 0; line-height: 1.35; }
.user-name { color: var(--side-strong); font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; }
.user-role { color: var(--side-muted); font-size: 11.5px; }
.user-company { color: var(--side-company); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-icon-btn {
  width: 34px; height: 34px; border-radius: var(--r); flex-shrink: 0;
  display: inline-grid; place-items: center; color: var(--side-text);
  border: 1px solid var(--side-input-bd);
  transition: background var(--dur-1), color var(--dur-1);
}
.side-icon-btn:hover { background: var(--side-hover); color: var(--side-strong); }
.side-icon-btn:focus-visible { outline-color: var(--side-focus); }

.btn-logout {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 36px; border-radius: var(--r);
  border: 1px solid var(--side-btn-bd); color: var(--side-strong);
  font-size: 13px; font-weight: 700;
  transition: background var(--dur-1), border-color var(--dur-1);
}
.btn-logout:hover { background: var(--side-logout-hover-bg); border-color: #ffffff; text-decoration: none; }
.btn-logout:focus-visible { outline-color: var(--side-focus); }

.main { display: flex; flex-direction: column; min-width: 0; }

/* Mobile header: only shown below 1024px, where the sidebar becomes a drawer */
.mobile-bar {
  display: none; position: sticky; top: 0; z-index: var(--z-topbar);
  height: 56px; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--side-bg); color: var(--side-strong);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.mobile-brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 800; font-size: 15px; color: var(--side-strong); }
.mobile-brand:hover { text-decoration: none; }
.mobile-bar .side-icon-btn { width: 40px; height: 40px; border-color: transparent; }
.mobile-bar .theme-toggle { margin-left: auto; }

/* Breadcrumbs sit above the page title */
.breadcrumbs { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; min-width: 0; }
/* A single crumb would only repeat the page title */
.breadcrumbs:has(li:only-child) { display: none; }
.breadcrumbs ol { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; list-style: none; min-width: 0; }
.breadcrumbs li { white-space: nowrap; min-width: 0; }
.breadcrumbs li:last-child { overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs li + li::before { content: "/"; color: var(--border-strong); margin-right: 6px; }
.breadcrumbs a {
  color: var(--accent); font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.breadcrumbs a:hover { text-decoration-color: currentColor; }
.breadcrumbs li > span { color: var(--text-2); }
.breadcrumbs [aria-current="page"] { font-weight: 600; }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r);
  display: inline-grid; place-items: center; color: var(--muted);
  transition: background var(--dur-1), color var(--dur-1);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* Theme toggle swaps the visible icon */
.theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }

.content {
  flex: 1;
  width: 100%; max-width: 1480px; margin: 0 auto;
  padding: 28px 28px 48px;
}
.content:focus { outline: none; }

.app-footer { padding: 0 28px 20px; text-align: center; font-size: var(--fs-xs); color: var(--muted); }

.sidebar-backdrop {
  position: fixed; inset: 0; z-index: var(--z-backdrop);
  background: var(--scrim); opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) var(--ease-out);
}

/* -------------------------------------------------------------------------
   4. PAGE HEADER
------------------------------------------------------------------------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  gap: 14px 24px; margin-bottom: 22px;
}
.page-head-main { min-width: 0; }
.page-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; }
.page-sub { margin-top: 4px; font-size: var(--fs-sm); color: var(--muted); max-width: 72ch; }
.page-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-sm); color: var(--muted); }
.page-meta span { display: inline-flex; align-items: center; gap: 6px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* -------------------------------------------------------------------------
   5. BUTTONS
------------------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 16px;
  border-radius: var(--r); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap;
  cursor: pointer; user-select: none; touch-action: manipulation;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1);
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Neutral solid (e.g. "Filtra") */
.btn-secondary { background: var(--lbl-neutral-bg); color: var(--lbl-neutral-fg); border-color: var(--lbl-neutral-bg); }
.btn-secondary:hover:not(:disabled) { filter: brightness(0.9); }

/* Outline primary: secondary actions next to a primary button, row actions ("Apri", "Modifica") */
.btn-outline { background: var(--surface); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 70%, var(--surface)); }
.btn-outline:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }

/* Outline neutral: "Annulla" and low-emphasis actions */
.btn-outline-muted { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn-outline-muted:hover:not(:disabled) { background: var(--surface-2); border-color: var(--muted); color: var(--text); }

/* Outline danger: "Elimina", "Rimuovi" */
.btn-outline-danger { background: var(--surface); color: var(--bad-fg); border-color: color-mix(in srgb, var(--bad-solid) 60%, var(--surface)); }
.btn-outline-danger:hover:not(:disabled) { background: var(--bad-bg); border-color: var(--bad-solid); }

.btn-ghost { color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }

.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 18%, transparent); }

.btn-danger { background: var(--bad-solid); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }

.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); gap: 6px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }

/* Loading state: label stays for width, spinner overlays it */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: rgba(255, 255, 255, 0.45); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn-outline.is-loading::after, .btn-outline-muted.is-loading::after, .btn-outline-danger.is-loading::after,
.btn-ghost.is-loading::after, .btn-soft.is-loading::after { border-color: var(--border-strong); border-top-color: var(--accent); }

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

/* -------------------------------------------------------------------------
   6. CARDS
------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card + .card { margin-top: var(--sp-5); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  min-height: 54px; padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-title .count {
  font: 700 11.5px var(--font); color: var(--lbl-neutral-fg); background: var(--lbl-neutral-bg);
  border-radius: 5px; padding: 1px 7px; font-variant-numeric: tabular-nums;
}
.card-sub { font-size: var(--fs-xs); color: var(--muted); }
.card-body { padding: 16px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-link { font-size: var(--fs-sm); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

/* Key/value list (company details) */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 0; font-size: var(--fs-sm); }
.kv dt, .kv dd { padding: 6px 0; }
.kv dt { color: var(--text); font-weight: 700; padding-right: 12px; }
.kv dd { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.kv dt:nth-last-of-type(1), .kv dd:last-of-type { border-bottom: 0; }

/* -------------------------------------------------------------------------
   7. KPI TILES
------------------------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.kpi-icon {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.kpi-value { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); margin-top: 6px; line-height: 1.15; }
.kpi-foot { font-size: var(--fs-xs); color: var(--muted); }
.kpi.tone-ok .kpi-icon { background: var(--ok-bg); color: var(--ok-fg); }
.kpi.tone-ok .kpi-value { color: var(--ok-fg); }
.kpi.tone-bad .kpi-icon { background: var(--bad-bg); color: var(--bad-fg); }
.kpi.tone-bad .kpi-value { color: var(--bad-fg); }
.kpi.tone-warn .kpi-icon { background: var(--warn-bg); color: var(--warn-fg); }
.kpi-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.kpi-bar span { display: block; height: 100%; border-radius: inherit; background: var(--ok-solid); transform-origin: left; animation: growX 0.8s var(--ease-out) both; }
@keyframes growX { from { transform: scaleX(0); } }

/* -------------------------------------------------------------------------
   8. BADGES
------------------------------------------------------------------------- */
/* Solid, compact status labels; the text always names the status */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px; border-radius: 5px;
  font-size: 11.5px; font-weight: 800; line-height: 1.6; white-space: nowrap; letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.badge-ok { background: var(--lbl-ok-bg); color: var(--lbl-ok-fg); }
.badge-warn { background: var(--lbl-warn-bg); color: var(--lbl-warn-fg); }
.badge-bad { background: var(--lbl-bad-bg); color: var(--lbl-bad-fg); }
.badge-info { background: var(--lbl-info-bg); color: var(--lbl-info-fg); }
.badge-neutral { background: var(--lbl-neutral-bg); color: var(--lbl-neutral-fg); }
.badge-accent { background: var(--lbl-accent-bg); color: var(--lbl-accent-fg); }
/* Light tag: neutral metadata such as a document type, quieter than a status */
.badge-tag { background: var(--surface-3); color: var(--text-2); border-color: var(--border); font-weight: 700; }
.badge-lg { font-size: 12.5px; padding: 3px 10px; }
a.badge:hover { text-decoration: none; filter: brightness(0.95); }

/* File / download chip */
.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px; min-height: 30px; border-radius: var(--r-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 70%, var(--surface)); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--accent);
  transition: border-color var(--dur-1), color var(--dur-1), background var(--dur-1);
}
.file-chip:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.file-chip svg { color: currentColor; }

/* -------------------------------------------------------------------------
   9. TABLES
------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: inherit; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; white-space: nowrap;
  padding: 11px 14px;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2);
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
}
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--r-lg); }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--r-lg); }
.table td {
  padding: 9px 14px; height: var(--row-h);
  border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-1); }
.table tbody tr:hover td { background: var(--surface-2); }
.table th.num, .table td.num { text-align: right; }
.table td.actions { text-align: right; white-space: nowrap; }
/* Row actions stay reachable when a wide table scrolls horizontally */
.table td.actions, .table th.actions-col {
  position: sticky; right: 0;
  background: var(--surface);
  box-shadow: -10px 0 10px -10px rgba(15, 27, 45, 0.18);
}
.table th.actions-col { z-index: 2; background: var(--surface); }
:root[data-theme="dark"] .table td.actions, :root[data-theme="dark"] .table th.actions-col { box-shadow: -10px 0 10px -10px rgba(0, 0, 0, 0.6); }
.table td.actions .btn + .btn { margin-left: 6px; }
.table .cell-main { color: var(--text); font-weight: 700; display: block; }
.table .cell-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.table a.cell-main:hover { color: var(--accent); }
.table .truncate { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .clip { display: block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Wraps to at most two lines so the column can shrink instead of forcing horizontal scroll */
.table .clamp-2 {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; min-width: 150px; max-width: 320px; overflow-wrap: anywhere;
}
.row-link { color: inherit; }
.row-link:hover { color: var(--accent); }

/* Sortable headers (enhanced by JS) */
.th-sort {
  display: inline-flex; align-items: center; gap: 4px;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
  padding: 2px 4px; margin: -2px -4px; border-radius: 4px;
}
.th-sort:hover { color: var(--text); background: var(--surface-3); }
.th-sort .sort-ico { opacity: 0.35; transition: transform var(--dur-1), opacity var(--dur-1); }
th[aria-sort="ascending"] .sort-ico, th[aria-sort="descending"] .sort-ico { opacity: 1; color: var(--accent); }
th[aria-sort="descending"] .sort-ico { transform: rotate(180deg); }
th.num .th-sort { flex-direction: row-reverse; }

/* Empty state */
.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-icon {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 14px;
  display: grid; place-items: center; background: var(--surface-3); color: var(--muted);
}
.empty-title { color: var(--text); font-weight: 600; font-size: var(--fs-md); margin-bottom: 4px; }
.empty-text { font-size: var(--fs-sm); max-width: 44ch; margin: 0 auto; }
.empty-state .btn { margin-top: 14px; }
.table td.empty-cell { height: auto; padding: 0; }
.table tbody tr:hover td.empty-cell { background: transparent; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--muted); }
.pager-links { display: flex; align-items: center; gap: 4px; }
.pager-links a, .pager-links span {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: var(--r-sm);
  display: inline-grid; place-items: center; font-weight: 600; color: var(--text-2);
}
.pager-links a:hover { background: var(--surface-3); text-decoration: none; }
.pager-links [aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.pager-links a { border: 1px solid var(--border); }
.pager-links .disabled { opacity: 0.4; }

/* -------------------------------------------------------------------------
   10. FILTERS & CHIP TABS
------------------------------------------------------------------------- */
.filter-bar {
  position: relative; z-index: 5;
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px;
  padding: 14px 16px; margin-bottom: var(--sp-5);
}
.filter-bar .form-group { margin: 0; flex: 1 1 180px; min-width: 170px; }
.filter-bar .form-group.grow { flex: 2 1 280px; }
.filter-actions { display: flex; gap: 8px; align-items: center; }

.chip-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sp-4); }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 34px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.chip[aria-current="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip .chip-count {
  min-width: 20px; padding: 0 6px; border-radius: 99px; font-size: 11px; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--muted); text-align: center; line-height: 18px;
}
.chip[aria-current="true"] .chip-count { background: rgba(255, 255, 255, 0.18); color: inherit; }
:root[data-theme="dark"] .chip[aria-current="true"] .chip-count { background: rgba(0, 0, 0, 0.2); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.dot-ok { background: var(--ok-solid); }
.dot-warn { background: var(--warn-solid); }
.dot-bad { background: var(--bad-solid); }
.dot-info { background: var(--info-solid); }

/* -------------------------------------------------------------------------
   11. FORMS
------------------------------------------------------------------------- */
.form-group { margin-bottom: var(--sp-4); min-width: 0; }
.form-label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .req { color: var(--bad-fg); margin-left: 2px; }
.form-help { font-size: var(--fs-xs); color: var(--muted); margin-top: 5px; }

.form-control, .form-select {
  width: 100%; min-height: 40px; padding: 8px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  font-size: var(--fs-md); line-height: 1.4;
  transition: border-color var(--dur-1), box-shadow var(--dur-1), background var(--dur-1);
}
.form-control::placeholder { color: var(--muted); opacity: 0.85; }
.form-control:hover, .form-select:hover { border-color: var(--muted); }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
textarea.form-control { min-height: 84px; resize: vertical; }
input[type="date"].form-control { font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.85); }

/* Native select fallback (before JS enhancement) */
.form-select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23566680' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}

/* File input */
input[type="file"].form-control { padding: 6px; cursor: pointer; font-size: var(--fs-sm); color: var(--muted); }
input[type="file"].form-control::file-selector-button {
  margin-right: 12px; padding: 6px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-3); color: var(--text);
  font: 600 12.5px var(--font); cursor: pointer; transition: background var(--dur-1);
}
input[type="file"].form-control:hover::file-selector-button { background: var(--accent-soft); color: var(--accent); }
/* Django ClearableFileInput "Currently / Change" markup */
.form-group a[href*="/media/"] { font-size: var(--fs-sm); }

.form-control.is-invalid, .form-select.is-invalid { border-color: var(--bad-solid); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad-solid) 25%, transparent); }
.invalid-feedback { display: none; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--bad-fg); margin-top: 6px; }
.invalid-feedback:not(:empty) { display: flex; }
.invalid-feedback:not(:empty)::before {
  content: ""; width: 14px; height: 14px; margin-top: 1px; flex-shrink: 0; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-row.cols-3 { grid-template-columns: 2fr 1fr 1fr; }
.form-section-title {
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
  margin: 6px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}

.form-alert {
  display: none; gap: 10px; align-items: flex-start;
  padding: 11px 14px; margin-bottom: var(--sp-4); border-radius: var(--r);
  background: var(--bad-bg); color: var(--bad-fg); border: 1px solid var(--bad-bd);
  font-size: var(--fs-sm); font-weight: 500;
}
.form-alert:not(:empty) { display: flex; }
.form-alert:focus { outline: 2px solid var(--bad-solid); outline-offset: 2px; }

.locked-field {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 40px; padding: 8px 12px; border-radius: var(--r);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  font-weight: 600; color: var(--text);
}

/* -------------------------------------------------------------------------
   12. CUSTOM SELECT (enhances <select class="form-select">)
------------------------------------------------------------------------- */
.cs { position: relative; width: 100%; }
.cs-native { position: absolute !important; inset: 0; opacity: 0; pointer-events: none; width: 100% !important; height: 100% !important; }
.cs-trigger {
  width: 100%; min-height: 40px; padding: 0 10px 0 12px;
  display: flex; align-items: center; gap: 8px; text-align: left;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  font-size: var(--fs-md);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.cs-trigger:hover { border-color: var(--muted); }
.cs-trigger:focus-visible, .cs.is-open .cs-trigger { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.cs-trigger:disabled { opacity: 0.55; cursor: not-allowed; }
.cs-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-value.is-placeholder { color: var(--muted); }
.cs-chevron { color: var(--muted); transition: transform var(--dur-2) var(--ease-out); }
.cs.is-open .cs-chevron { transform: rotate(180deg); color: var(--accent); }
.cs.is-invalid .cs-trigger { border-color: var(--bad-solid); }

.cs-menu {
  position: fixed; z-index: var(--z-dropdown);
  min-width: 200px; max-width: min(480px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  opacity: 0; transform: translateY(-4px) scale(0.98); transform-origin: top center;
  visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-1) var(--ease-in), transform var(--dur-1) var(--ease-in), visibility 0s var(--dur-1);
}
.cs-menu.is-up { transform-origin: bottom center; transform: translateY(4px) scale(0.98); }
.cs-menu.is-open {
  opacity: 1; transform: none; visibility: visible; pointer-events: auto;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.cs-search { position: relative; margin-bottom: 6px; }
.cs-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.cs-search input {
  width: 100%; height: 36px; padding: 0 10px 0 32px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text);
}
.cs-search input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.cs-list { list-style: none; max-height: 264px; overflow-y: auto; }
.cs-list:focus { outline: none; }
.cs-option {
  display: flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 7px 10px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); color: var(--text); cursor: pointer; user-select: none;
}
.cs-option[data-active="true"] { background: var(--surface-3); }
.cs-option[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.cs-option[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.cs-option .cs-check { margin-left: auto; opacity: 0; color: var(--accent); }
.cs-option[aria-selected="true"] .cs-check { opacity: 1; }
.cs-option-text { min-width: 0; overflow-wrap: anywhere; }
.cs-empty { padding: 14px 10px; text-align: center; font-size: var(--fs-sm); color: var(--muted); }

/* -------------------------------------------------------------------------
   13. STATUS PILL DROPDOWN (quote status)
------------------------------------------------------------------------- */
.status-pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 0 8px 0 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
  transition: box-shadow var(--dur-1), filter var(--dur-1);
}
.status-pill-btn::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill-btn:hover { filter: brightness(0.97); box-shadow: 0 0 0 3px var(--ring); }
.status-pill-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--ring); }
.status-pill-btn[aria-expanded="true"] .cs-chevron { transform: rotate(180deg); }
.status-pill-btn.is-busy { opacity: 0.6; pointer-events: none; }
.tone-DRAFT, .tone-COMPLETED { background: var(--neutral-bg); color: var(--neutral-fg); border-color: var(--neutral-bd); }
.tone-SUBMITTED { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }
.tone-IN_NEGOTIATION { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.tone-WON { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.tone-LOST { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
.status-menu-template { display: none; }

/* -------------------------------------------------------------------------
   14. MODALS (native <dialog>)
------------------------------------------------------------------------- */
dialog.crm-modal {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  margin: auto; padding: 0; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-modal);
  overflow: hidden;
}
dialog.crm-modal.modal-sm { width: min(440px, calc(100vw - 32px)); }
dialog.crm-modal.modal-lg { width: min(820px, calc(100vw - 32px)); }
dialog.crm-modal[open] { display: flex; flex-direction: column; animation: modalIn var(--dur-3) var(--ease-out); }
dialog.crm-modal.is-closing { animation: modalOut 160ms var(--ease-in) forwards; }
dialog.crm-modal::backdrop { background: var(--scrim); backdrop-filter: blur(3px); animation: fadeIn var(--dur-2) var(--ease-out); }
dialog.crm-modal.is-closing::backdrop { animation: fadeOut 160ms var(--ease-in) forwards; }
dialog.crm-modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }

@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes modalOut { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 800; }
.modal-desc { font-size: var(--fs-sm); color: var(--muted); margin-top: 3px; }
.modal-close-btn {
  width: 34px; height: 34px; margin: -4px -6px 0 0; border-radius: var(--r);
  display: grid; place-items: center; color: var(--muted); flex-shrink: 0;
}
.modal-close-btn:hover { background: var(--surface-3); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.confirm-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 12px;
}
.confirm-icon.is-danger { background: var(--bad-bg); color: var(--bad-fg); }

/* -------------------------------------------------------------------------
   15. TOASTS
------------------------------------------------------------------------- */
#crm-toast-container {
  position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  width: min(400px, calc(100vw - 40px)); padding: 12px 12px 12px 14px;
  border-radius: var(--r-lg); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm); font-weight: 500;
  animation: toastIn var(--dur-3) var(--ease-out);
}
.toast.is-leaving { animation: toastOut 180ms var(--ease-in) forwards; }
.toast-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast.success .toast-icon { background: var(--ok-bg); color: var(--ok-fg); }
.toast.error .toast-icon { background: var(--bad-bg); color: var(--bad-fg); }
.toast.info .toast-icon { background: var(--info-bg); color: var(--info-fg); }
.toast-msg { flex: 1; padding-top: 1px; }
.toast-close { width: 26px; height: 26px; margin: -3px -3px 0 0; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.toast-close:hover { background: var(--surface-3); color: var(--text); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* -------------------------------------------------------------------------
   16. TABS
------------------------------------------------------------------------- */
.tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border); margin-bottom: var(--sp-5);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px; white-space: nowrap;
  font-size: var(--fs-sm); font-weight: 600; color: var(--muted);
  transition: color var(--dur-1);
}
.tab:hover { color: var(--text); }
.tab::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0;
  background: var(--accent); transform: scaleX(0); transition: transform var(--dur-2) var(--ease-out);
}
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab .count {
  min-width: 20px; padding: 0 6px; border-radius: 99px; line-height: 18px; text-align: center;
  font-size: 11px; background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums;
}
.tab .count.is-alert { background: var(--bad-bg); color: var(--bad-fg); }
.tab-panel[hidden] { display: none; }
.tab-panel.is-entering { animation: panelIn var(--dur-3) var(--ease-out); }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } }

/* -------------------------------------------------------------------------
   17. LOADING: progress bar, skeletons, page transitions
------------------------------------------------------------------------- */
#crm-page-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: var(--z-progress);
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  box-shadow: 0 0 10px var(--ring);
  opacity: 0; transition: width 0.4s var(--ease-out), opacity 0.3s;
}
#crm-page-progress.active { opacity: 1; }

.sk {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--sk-1) 25%, var(--sk-2) 50%, var(--sk-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk-text { height: 12px; }
.sk-title { height: 24px; width: 240px; }
.sk-pill { height: 22px; width: 74px; border-radius: 99px; }
.sk-btn { height: 38px; width: 130px; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }

.sk-row { display: flex; align-items: center; gap: 20px; height: var(--row-h); padding: 0 16px; border-bottom: 1px solid var(--border); }
.sk-row:last-child { border-bottom: 0; }

/* Page skeleton overlays the content area during slow navigations */
.page-skeleton { display: none; }
body.is-navigating .content > :not(.page-skeleton) { display: none; }
body.is-navigating .page-skeleton { display: block; animation: fadeIn var(--dur-2) var(--ease-out); }

/* Page exit / enter transitions */
.content.is-leaving > :not(.page-skeleton) { opacity: 0; transform: translateY(6px); transition: opacity 140ms var(--ease-in), transform 140ms var(--ease-in); }
.page-enter > * { animation: rise var(--dur-3) var(--ease-out) both; }
.page-enter > *:nth-child(1) { animation-delay: 0ms; }
.page-enter > *:nth-child(2) { animation-delay: 40ms; }
.page-enter > *:nth-child(3) { animation-delay: 80ms; }
.page-enter > *:nth-child(4) { animation-delay: 120ms; }
.page-enter > *:nth-child(n+5) { animation-delay: 160ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* -------------------------------------------------------------------------
   18. DASHBOARD
------------------------------------------------------------------------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: var(--sp-5); margin-top: var(--sp-5); align-items: start; }
.dash-grid > .stack > .card + .card { margin-top: 0; }

.bar-chart { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; align-items: end; height: 190px; padding: 8px 4px 0; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-track { position: relative; width: 100%; max-width: 46px; flex: 1; display: flex; align-items: flex-end; }
.bar {
  width: 100%; min-height: 3px; border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 70%, transparent));
  transform-origin: bottom; animation: growY 0.7s var(--ease-out) both;
}
.bar-col:last-child .bar { background: linear-gradient(180deg, #60a5fa, var(--accent)); }
.bar-col:nth-child(2) .bar { animation-delay: 40ms; } .bar-col:nth-child(3) .bar { animation-delay: 80ms; }
.bar-col:nth-child(4) .bar { animation-delay: 120ms; } .bar-col:nth-child(5) .bar { animation-delay: 160ms; }
.bar-col:nth-child(6) .bar { animation-delay: 200ms; }
@keyframes growY { from { transform: scaleY(0); } }
.bar-value { font-size: 11px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-label { font-size: 11.5px; color: var(--muted); }

.stack-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stack-bar span { display: block; height: 100%; transform-origin: left; animation: growX 0.8s var(--ease-out) both; }
.legend { display: grid; gap: 10px; margin-top: 16px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.legend-row a { color: var(--text-2); font-weight: 500; }
.legend-row .num { margin-left: auto; font-weight: 650; color: var(--text); }

.list-rows { list-style: none; }
.list-rows li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-rows li:last-child { border-bottom: 0; }
.list-rows .lr-main { min-width: 0; flex: 1; }
.list-rows .lr-title { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-rows .lr-sub { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-rows .lr-end { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.date-tile {
  width: 42px; flex-shrink: 0; text-align: center; border-radius: 9px; padding: 4px 0;
  background: var(--surface-3); line-height: 1.1;
}
.date-tile b { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.date-tile small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.date-tile.tone-bad { background: var(--bad-bg); } .date-tile.tone-bad b, .date-tile.tone-bad small { color: var(--bad-fg); }
.date-tile.tone-warn { background: var(--warn-bg); } .date-tile.tone-warn b, .date-tile.tone-warn small { color: var(--warn-fg); }

.pipeline { display: grid; gap: 12px; }
.pipe-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; font-size: var(--fs-sm); }
.pipe-row .pipe-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pipe-row .pipe-bar span { display: block; height: 100%; border-radius: inherit; transform-origin: left; animation: growX 0.8s var(--ease-out) both; }

/* -------------------------------------------------------------------------
   19. COMPANY DETAIL
------------------------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); gap: var(--sp-5); align-items: start; }
.detail-grid > .card + .card, .dash-grid > .card + .card { margin-top: 0; }
.fin-strip { margin-bottom: var(--sp-5); }
.fin-strip .kpi-value { font-size: 22px; }

/* -------------------------------------------------------------------------
   20. AUTH (LOGIN)
------------------------------------------------------------------------- */
.auth-page {
  position: relative; min-height: 100dvh; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; padding: clamp(32px, 9vh, 96px) 16px 32px;
}
.auth-card {
  width: 100%; max-width: 380px; padding: 36px 36px 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-mark { width: 38px; height: 38px; background: var(--side-bg); color: #fff; font-size: 11.5px; }
.auth-brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.auth-card .page-sub { margin: 6px 0 24px; }
.auth-foot { margin-top: 20px; font-size: var(--fs-xs); color: var(--muted); text-align: center; }
.auth-theme { position: absolute; top: 16px; right: 16px; }
.input-affix { position: relative; }
.input-affix .form-control { padding-right: 46px; }
.input-affix .icon-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 38px; height: 36px; }
.auth-card .form-control { min-height: 42px; background: var(--surface-2); }
.auth-card .form-control:focus { background: var(--surface); }
.auth-card .btn-primary { min-height: 42px; font-size: var(--fs-md); margin-top: 6px; }
.auth-error {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; margin-bottom: 18px; border-radius: var(--r);
  background: var(--bad-bg); color: var(--bad-fg); border: 1px solid var(--bad-bd); font-size: var(--fs-sm); font-weight: 500;
}
.caps-hint { display: none; font-size: 12px; color: var(--warn-fg); margin-top: 6px; }
.caps-hint.show { display: block; }

/* -------------------------------------------------------------------------
   20b. GOOGLE DRIVE
------------------------------------------------------------------------- */
.drive-kpis { margin-bottom: var(--sp-5); }
.kpi-value-sm { font-size: 19px; }
.kpi-unit { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); letter-spacing: 0; }
.chip-add { cursor: pointer; border-style: dashed; color: var(--accent); background: transparent; font-family: inherit; }
.chip-add:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.sync-notice {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; margin-bottom: var(--sp-5);
  border-radius: var(--r); background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-bd);
  font-size: var(--fs-sm); font-weight: 500; animation: rise var(--dur-3) var(--ease-out) both;
}
.sync-notice[hidden] { display: none; }
.sync-notice > span { flex: 1; min-width: 0; }
.sync-notice.is-bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }

.drive-error {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px;
  background: var(--bad-bg); color: var(--bad-fg); border-bottom: 1px solid var(--bad-bd); font-size: var(--fs-sm);
}
.drive-error > svg { flex-shrink: 0; margin-top: 1px; }
.drive-error > div { flex: 1; min-width: 0; }
.drive-error p + p { margin-top: 3px; color: var(--text-2); }
.drive-error .mono { white-space: normal; overflow-wrap: anywhere; }
.drive-error .btn { flex-shrink: 0; }
.drive-email { white-space: normal; overflow-wrap: anywhere; }
.drive-ext { margin-left: 10px; }

.drive-files-head { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.drive-path { font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.drive-path ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; }
.drive-path li { display: inline-flex; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.drive-path li + li::before { content: "›"; margin: 0 7px; color: var(--muted); }
.drive-path a, .drive-path span[aria-current] { display: inline-flex; align-items: center; gap: 5px; }
.drive-path a { color: var(--text-2); font-weight: 500; }
.drive-path a:hover { color: var(--accent); }
.drive-path [aria-current="page"] { color: var(--text); font-weight: 600; }

.drive-search { position: relative; display: flex; align-items: center; gap: 6px; flex: 0 1 300px; }
.drive-search > svg { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.drive-search .form-control { padding-left: 34px; min-height: 36px; font-size: var(--fs-sm); }

.file-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-ico {
  width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-3); color: var(--muted);
}
.file-ico.is-folder { background: var(--accent-soft); color: var(--accent); }
.file-name { min-width: 0; max-width: 420px; }
.file-name .cell-main { overflow-wrap: anywhere; }

.form-check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.form-check-input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

.modal-footer-split { justify-content: space-between; flex-wrap: wrap; }
.modal-footer-actions { display: flex; gap: 8px; margin-left: auto; }
.btn-danger-ghost { color: var(--bad-fg); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--bad-bg); }

.setup-steps { list-style: none; display: grid; gap: 10px; max-width: 520px; margin: 22px auto 4px; text-align: left; }
.setup-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.55; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700;
}

@media (max-width: 720px) {
  .drive-search { flex-basis: 100%; }
  .form-check-group .form-label { display: none; }
  .drive-error { flex-wrap: wrap; }
}

/* -------------------------------------------------------------------------
   20c. EMAIL (GMAIL)
------------------------------------------------------------------------- */
.nav-badge {
  margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px;
  background: #ffffff; color: #28486c; font-size: 11px; font-weight: 800; line-height: 20px;
  text-align: center; font-variant-numeric: tabular-nums;
}

.flash-stack { display: grid; gap: 8px; margin-bottom: var(--sp-4); }
.flash { padding: 10px 14px; border-radius: var(--r); font-size: var(--fs-sm); font-weight: 600; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-bd); }
.flash-error, .flash-warning { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
.flash-info, .flash-debug { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-bd); }

.thread-row.is-unread td { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.thread-subject { display: block; color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
.thread-row.is-unread .thread-subject { font-weight: 800; }
a.thread-subject:hover { color: var(--accent); }
.thread-snippet { display: block; margin-top: 1px; max-width: 560px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--muted); }
.thread-meta { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.thread-senders { max-width: 240px; overflow-wrap: anywhere; }

.mail-header-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 6px; font-size: var(--fs-sm); color: var(--muted); }
.mail-header-meta span { display: inline-flex; align-items: center; gap: 6px; }

.mail-card { padding: 0; }
.mail-card + .mail-card { margin-top: var(--sp-3); }
.mail-card > summary { list-style: none; cursor: pointer; display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; }
.mail-card > summary::-webkit-details-marker { display: none; }
.mail-card > summary:focus-visible { outline-offset: -2px; }
.mail-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px;
}
.mail-card.is-outgoing .mail-avatar { background: var(--surface-3); color: var(--text-2); }
.mail-who { min-width: 0; flex: 1; }
.mail-from { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 800; }
.mail-addr { font-weight: 500; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.mail-to { margin-top: 1px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.mail-preview { display: none; margin-top: 2px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-card:not([open]) .mail-preview { display: block; }
.mail-date { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mail-content { padding: 0 16px 16px; }
.mail-body { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: #ffffff; }
.mail-frame { display: block; width: 100%; height: 160px; min-height: 40px; border: 0; background: #ffffff; }
.mail-notice {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin-bottom: 10px; padding: 8px 12px; border-radius: var(--r);
  background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-bd); font-size: var(--fs-sm); font-weight: 600;
}
.mail-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mail-sentby { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

.reply-card { margin-top: var(--sp-4); }
.reply-card .card-body { display: block; }
.compose-more { margin-bottom: var(--sp-4); }
.compose-more > summary { cursor: pointer; width: fit-content; margin-bottom: 10px; font-size: var(--fs-sm); font-weight: 700; color: var(--accent); }
.compose-docs { margin: 0 0 var(--sp-4); padding: 8px 14px 10px; border: 1px solid var(--border); border-radius: var(--r); }
.compose-docs legend { padding: 0 6px; font-size: var(--fs-sm); font-weight: 700; }
.compose-docs .form-check { min-height: 30px; font-weight: 500; }

.account-progress { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.account-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.account-notes { display: grid; gap: 4px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }

@media (max-width: 720px) {
  .mail-card > summary { flex-wrap: wrap; }
  .mail-date { order: 3; }
  .thread-snippet { max-width: 260px; }
}

/* -------------------------------------------------------------------------
   21. RESPONSIVE
------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .dash-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1200px) {
  .table th, .table td { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(var(--side-w), 86vw); height: auto;
    transform: translateX(-102%); transition: transform var(--dur-3) var(--ease-out);
    box-shadow: var(--shadow-modal);
  }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
  .mobile-bar { display: flex; }
  .sidebar .side-theme { display: none; }
  .content { padding: 20px 16px 40px; }
}

@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 21px; }
  .page-head { align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .form-row, .form-row.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .filter-bar .form-group, .filter-bar .form-group.grow { flex-basis: 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
  .auth-card { padding: 28px 22px 24px; }
  .bar-chart { gap: 8px; height: 160px; }
  .bar-value { font-size: 10px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
  dialog.crm-modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  @keyframes modalIn { from { transform: translateY(40px); opacity: 0; } }
  #crm-toast-container { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { width: 100%; }
  /* Keep the parent link (a "back" affordance), drop the root crumb */
  .breadcrumbs li:first-child:not(:only-child) { display: none; }
  .breadcrumbs li:nth-child(2)::before { display: none; }
}

/* -------------------------------------------------------------------------
   22. MOTION PREFERENCES & PRINT
------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .sk { animation: none; }
}

@media print {
  .sidebar, .mobile-bar, .page-actions, .filter-bar, .chip-tabs, .pager, #crm-toast-container, #crm-page-progress { display: none !important; }
  .app-shell { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
}
