/*
 * Leadsensy theme on top of Bootstrap 5.3 (loaded from the CDN in App.razor, no build step).
 * Replaced Tailwind on 2026-09-29 because the dev machine has no Node.js to rebuild Tailwind.
 * Conventions for markup: docs/engineering/ui-styling.md.
 *
 *   1. Bootstrap variable overrides (brand, font, colors, radius)
 *   2. Base + fonts
 *   3. Small utilities Bootstrap lacks (fs-10..fs-15, text/bg palette, sizes, shadows)
 *   4. crm-* components (page, card, table, badge, modal, dropdown, forms, nav)
 *   5. App shell (sidebar, top bar)
 *   6. Carried over from the Tailwind input.css: scrollbars, toasts, DataTables skin
 */

/* ---------- 1. Bootstrap overrides ---------- */
:root {
  --crm-brand: #16a34a;
  --crm-brand-dark: #15803d;
  --crm-brand-soft: #dcfce7;
  --crm-ink: #111827;
  --crm-text: #374151;
  --crm-muted: #6b7280;
  --crm-subtle: #9ca3af;
  --crm-border: #e2e8f0;
  --crm-border-soft: #f1f5f9;
  --crm-surface: #f8fafc;
  --crm-shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
  --crm-shadow-lift: 0 10px 28px -10px rgba(15, 23, 42, 0.2), 0 4px 10px -4px rgba(15, 23, 42, 0.08);
  --crm-shadow-toast: 0 16px 40px rgba(15, 23, 42, 0.12);
  --crm-shadow-auth: 0 12px 32px rgba(15, 23, 42, 0.06);
  --crm-sidebar-width: 240px;

  --bs-primary: #16a34a;
  --bs-primary-rgb: 22, 163, 74;
  --bs-success: #16a34a;
  --bs-success-rgb: 22, 163, 74;
  --bs-link-color: #15803d;
  --bs-link-color-rgb: 21, 128, 61;
  --bs-link-hover-color: #166534;
  --bs-body-font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-font-size: 0.875rem;
  --bs-body-color: #111827;
  --bs-body-bg: #f8fafc;
  --bs-secondary-color: #6b7280;
  --bs-tertiary-color: #9ca3af;
  --bs-border-color: #e2e8f0;
  --bs-border-radius: 0.5rem;
  --bs-border-radius-sm: 0.375rem;
  --bs-border-radius-lg: 0.75rem;
  --bs-focus-ring-color: rgba(22, 163, 74, 0.2);
}

.btn-primary {
  --bs-btn-bg: #16a34a;
  --bs-btn-border-color: #16a34a;
  --bs-btn-hover-bg: #15803d;
  --bs-btn-hover-border-color: #15803d;
  --bs-btn-active-bg: #166534;
  --bs-btn-active-border-color: #166534;
  --bs-btn-disabled-bg: #cbd5e1;
  --bs-btn-disabled-border-color: #cbd5e1;
  --bs-btn-focus-shadow-rgb: 22, 163, 74;
}

.btn-outline-secondary {
  --bs-btn-color: #4b5563;
  --bs-btn-border-color: #e2e8f0;
  --bs-btn-bg: #fff;
  --bs-btn-hover-color: #111827;
  --bs-btn-hover-bg: #f8fafc;
  --bs-btn-hover-border-color: #cbd5e1;
  --bs-btn-active-color: #111827;
  --bs-btn-active-bg: #f1f5f9;
  --bs-btn-active-border-color: #cbd5e1;
}

.btn-outline-danger {
  --bs-btn-color: #dc2626;
  --bs-btn-border-color: #fca5a5;
  --bs-btn-bg: #fff;
  --bs-btn-hover-bg: #fef2f2;
  --bs-btn-hover-color: #b91c1c;
  --bs-btn-hover-border-color: #f87171;
}

.btn {
  --bs-btn-font-weight: 600;
  --bs-btn-font-size: 0.875rem;
  --bs-btn-padding-y: 0.5rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-sm {
  --bs-btn-font-size: 0.75rem;
  --bs-btn-padding-y: 0.25rem;
  --bs-btn-padding-x: 0.625rem;
  --bs-btn-border-radius: 0.375rem;
}

.form-control,
.form-select {
  border-color: var(--crm-border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: var(--crm-ink);
  padding: 0.5rem 0.75rem;
}

.form-control::placeholder { color: var(--crm-subtle); }

.form-control:focus,
.form-select:focus {
  border-color: var(--crm-brand);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.form-control-sm,
.form-select-sm { font-size: 0.75rem; padding: 0.25rem 0.5rem; }

.form-check-input:checked { background-color: var(--crm-brand); border-color: var(--crm-brand); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15); border-color: var(--crm-brand); }

.progress { --bs-progress-bar-bg: var(--crm-brand); --bs-progress-height: 0.5rem; background: var(--crm-border-soft); }

/* ---------- 2. Base ---------- */
@font-face { font-family: "Inter"; src: url("/fonts/inter-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }

html, body { min-height: 100%; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
h1:focus { outline: none; } /* Blazor FocusOnNavigate focuses the page h1 */
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .crm-nav-link:hover, .crm-menu-item:hover { text-decoration: none; }
table { caption-side: bottom; }

/* ---------- 3. Utilities ---------- */
.fs-10 { font-size: 0.625rem !important; }
.fs-11 { font-size: 0.6875rem !important; }
.fs-12 { font-size: 0.75rem !important; }
.fs-13 { font-size: 0.8125rem !important; }
.fs-14 { font-size: 0.875rem !important; }
.fs-15 { font-size: 0.9375rem !important; }
.fs-16 { font-size: 1rem !important; }
.fs-18 { font-size: 1.125rem !important; }
.fs-20 { font-size: 1.25rem !important; }
.fs-24 { font-size: 1.5rem !important; }
.fs-30 { font-size: 1.875rem !important; }

.text-brand { color: var(--crm-brand) !important; }
.text-brand-dark { color: var(--crm-brand-dark) !important; }
.text-ink { color: var(--crm-ink) !important; }
.text-body-2 { color: var(--crm-text) !important; }
.text-slate { color: #4b5563 !important; }
.text-muted-2 { color: var(--crm-muted) !important; }
.text-subtle { color: var(--crm-subtle) !important; }
.text-success-2 { color: #166534 !important; }
.text-warning-2 { color: #92400e !important; }
.text-danger-2 { color: #dc2626 !important; }
.text-info-2 { color: #1d4ed8 !important; }
.text-violet { color: #6d28d9 !important; }

.bg-brand { background-color: var(--crm-brand) !important; color: #fff; }
.bg-brand-soft { background-color: var(--crm-brand-soft) !important; }
.bg-surface { background-color: var(--crm-surface) !important; }
.bg-success-soft { background-color: #ecfdf5 !important; }
.bg-warning-soft { background-color: #fffbeb !important; }
.bg-danger-soft { background-color: #fef2f2 !important; }
.bg-info-soft { background-color: #eff6ff !important; }
.bg-violet-soft { background-color: #f5f3ff !important; }
.bg-slate-soft { background-color: #f3f4f6 !important; }

.border-soft { border-color: var(--crm-border-soft) !important; }
.border-crm { border-color: var(--crm-border) !important; }

.shadow-card { box-shadow: var(--crm-shadow-card) !important; }
.shadow-lift { box-shadow: var(--crm-shadow-lift) !important; }
.shadow-toast { box-shadow: var(--crm-shadow-toast) !important; }
.shadow-auth { box-shadow: var(--crm-shadow-auth) !important; }

.min-w-0 { min-width: 0 !important; }
.flex-1 { flex: 1 1 0% !important; min-width: 0; }
.tabular-nums { font-variant-numeric: tabular-nums; }
.cursor-pointer { cursor: pointer; }
.lh-tight { line-height: 1.25 !important; }
.tracking-wide { letter-spacing: 0.03em; }
.uppercase-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--crm-muted); }

.icon-24, .icon-28, .icon-32, .icon-36, .icon-40 { display: inline-grid; place-items: center; flex-shrink: 0; }
.icon-24 { width: 1.5rem; height: 1.5rem; }
.icon-28 { width: 1.75rem; height: 1.75rem; }
.icon-32 { width: 2rem; height: 2rem; }
.icon-36 { width: 2.25rem; height: 2.25rem; }
.icon-40 { width: 2.5rem; height: 2.5rem; }

.avatar { display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 999px; background: var(--crm-brand); color: #fff; font-weight: 600; }

.dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 999px; flex-shrink: 0; }

.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

/* ---------- 4. Components ---------- */

/* Page scaffold: <main class="crm-page"> ... */
.crm-page { padding: 1.25rem 1rem 2.5rem; }
@media (min-width: 576px) { .crm-page { padding: 1.75rem 2rem 2.5rem; } }

.crm-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; margin: 0; font-size: 0.8125rem; font-weight: 500; color: var(--crm-muted); }
.crm-breadcrumb .sep { color: var(--crm-subtle); }
.crm-breadcrumb .current { color: var(--crm-ink); }

.crm-page-header { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.25rem; }
@media (min-width: 576px) { .crm-page-header { flex-direction: row; align-items: center; justify-content: space-between; } }
.crm-page-title { margin: 0.25rem 0 0; font-size: 1.5rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; color: var(--crm-ink); }
.crm-page-subtitle { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--crm-muted); }

/* Cards / panels */
.crm-card { background: #fff; border: 1px solid var(--crm-border); border-radius: 1rem; box-shadow: var(--crm-shadow-lift); }
.crm-card-flat { background: #fff; border: 1px solid var(--crm-border); border-radius: 0.75rem; }
.crm-card-body { padding: 1.25rem; }
.crm-card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem; border-bottom: 1px solid var(--crm-border); }
.crm-section-title { margin: 0; font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; color: var(--crm-ink); }
.crm-list-row { padding: 0.875rem 1rem; border-bottom: 1px solid var(--crm-border-soft); }
.crm-list-row:last-child { border-bottom: 0; }

/* States */
.crm-empty { padding: 4rem 1.25rem; text-align: center; font-size: 0.875rem; color: var(--crm-muted); }
.crm-loading { margin-top: 2rem; font-size: 0.875rem; color: var(--crm-muted); }
.crm-error { display: flex; align-items: center; gap: 0.75rem; margin-top: 2rem; }
.crm-error p { margin: 0; font-size: 0.875rem; color: #dc2626; }

/* Tables: wrap in <TableScroll>, give the <table> class="crm-table" */
.crm-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: 0.875rem; }
.crm-table thead th { white-space: nowrap; padding: 0.75rem 1rem; background: var(--crm-surface); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--crm-muted); }
.crm-table tbody td { padding: 0.875rem 1rem; border-top: 1px solid var(--crm-border); background: #fff; vertical-align: middle; color: #4b5563; }
.crm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.crm-table .strong { font-weight: 600; color: var(--crm-ink); }

/* Badges / pills */
.crm-badge { display: inline-flex; align-items: center; gap: 0.25rem; border-radius: 999px; padding: 0.125rem 0.5rem; font-size: 0.75rem; font-weight: 500; line-height: 1.4; white-space: nowrap; background: #f3f4f6; color: #374151; }
.crm-badge-success { background: #ecfdf5; color: #166534; }
.crm-badge-warning { background: #fffbeb; color: #92400e; }
.crm-badge-danger { background: #fef2f2; color: #b91c1c; }
.crm-badge-info { background: #eff6ff; color: #1d4ed8; }
.crm-badge-violet { background: #f5f3ff; color: #6d28d9; }
.crm-badge-neutral { background: #f3f4f6; color: #6b7280; }
.crm-badge-brand { background: var(--crm-brand-soft); color: var(--crm-brand-dark); }
.crm-badge-solid { background: var(--crm-brand); color: #fff; font-weight: 700; }

.crm-pill { display: inline-flex; align-items: center; border: 1px solid var(--crm-border); background: #fff; color: #4b5563; border-radius: 999px; padding: 0.375rem 0.875rem; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.crm-pill.active, .crm-pill[aria-selected="true"] { background: var(--crm-ink); border-color: var(--crm-ink); color: #fff; }

/* Tabs (underline style, e.g. lead detail) */
.crm-tabs { display: flex; gap: 1.25rem; overflow-x: auto; border-bottom: 1px solid var(--crm-border); }
.crm-tab { position: relative; padding: 0.75rem 0; border: 0; background: none; font-size: 0.875rem; font-weight: 500; color: var(--crm-muted); white-space: nowrap; cursor: pointer; }
.crm-tab.active { color: var(--crm-brand-dark); font-weight: 600; }
.crm-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--crm-brand); }

/* Forms */
.crm-label { display: block; margin-bottom: 0.375rem; font-size: 0.8125rem; font-weight: 600; color: var(--crm-ink); }
.crm-hint { margin-top: 0.25rem; font-size: 0.75rem; color: var(--crm-muted); }
.crm-field-error { margin-top: 0.25rem; font-size: 0.75rem; color: #dc2626; }
.crm-form { display: flex; flex-direction: column; gap: 1rem; }
.crm-form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 576px) { .crm-form-grid { grid-template-columns: 1fr 1fr; } }

/* Auth-style input group (FormField): border wraps the input and any trailing button */
.crm-input-group { display: flex; align-items: center; height: 42px; overflow: hidden; background: #fff; border: 1px solid var(--crm-border); border-radius: 0.5rem; transition: border-color .15s, box-shadow .15s; }
.crm-input-group:focus-within { border-color: var(--crm-brand); box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1); }
.crm-input-group.is-invalid { border-color: #ef4444; }
.crm-input-group input, .crm-input-group select { flex: 1 1 auto; min-width: 0; height: 100%; border: 0; background: transparent; padding: 0 0.75rem; font-size: 0.8125rem; color: var(--crm-ink); outline: none; }
.crm-input-group input::placeholder { color: var(--crm-subtle); }
.crm-input-group .crm-input-action { margin-right: 0.75rem; border: 0; background: none; font-size: 0.75rem; font-weight: 500; color: #4b5563; }

/* Modal (Components/UI/Modal.razor) */
.crm-modal-backdrop { position: fixed; inset: 0; z-index: 1050; display: grid; place-items: center; padding: 1rem; background: rgba(15, 23, 42, 0.4); }
.crm-modal { display: flex; flex-direction: column; gap: 1.25rem; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 1.5rem; background: #fff; border-radius: 0.75rem; box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15); }
.crm-modal-sm { max-width: 420px; }
.crm-modal-md { max-width: 520px; }
.crm-modal-lg { max-width: 680px; }
.crm-modal-xl { max-width: 880px; }
.crm-modal-title { margin: 0; font-size: 1.125rem; font-weight: 700; color: var(--crm-ink); }
.crm-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.crm-modal-close { border: 0; background: none; color: var(--crm-subtle); padding: 0.25rem; }
.crm-modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; }

/* Dropdown panels (menus anchored to a button) */
.crm-dropdown { position: absolute; z-index: 1030; overflow: hidden; background: #fff; border: 1px solid var(--crm-border); border-radius: 0.75rem; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12); }
.crm-menu-item { display: flex; width: 100%; align-items: center; gap: 0.625rem; padding: 0.5rem 0.625rem; border: 0; border-radius: 0.5rem; background: none; text-align: left; font-size: 0.875rem; color: var(--crm-text); }
.crm-menu-item:hover { background: var(--crm-surface); color: var(--crm-ink); }
.crm-menu-item.danger { color: #dc2626; font-weight: 500; }
.crm-menu-item.danger:hover { background: #fef2f2; }

/* Stat tiles */
.crm-stat-label { margin: 0; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--crm-muted); }
.crm-stat-value { margin: 0.5rem 0 0; font-size: 1.875rem; font-weight: 700; letter-spacing: -0.02em; color: var(--crm-ink); }

/* Icon-only buttons (top bar, sidebar) */
.crm-icon-btn { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 0; border-radius: 0.5rem; background: transparent; color: #64748b; }
.crm-icon-btn:hover, .crm-icon-btn.active { background: var(--crm-surface); color: #334155; }

/* ---------- 5. App shell ---------- */
.crm-shell { display: flex; min-height: 100vh; background: var(--crm-surface); }
.crm-main { flex: 1 1 0%; min-width: 0; }
@media (min-width: 992px) { .crm-main { margin-left: var(--crm-sidebar-width); } }

.crm-sidebar-backdrop { position: fixed; inset: 0; z-index: 1040; border: 0; background: rgba(2, 6, 23, 0.4); opacity: 0; pointer-events: none; transition: opacity .2s; }
.crm-sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
@media (min-width: 992px) { .crm-sidebar-backdrop { display: none; } }

.crm-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1045; display: flex; flex-direction: column; width: var(--crm-sidebar-width); overflow: hidden; background: #fff; border-right: 1px solid var(--crm-border); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); transform: translateX(-100%); transition: transform .2s; }
.crm-sidebar.open { transform: translateX(0); }
@media (min-width: 992px) { .crm-sidebar { z-index: 1020; transform: none; box-shadow: none; } }
.crm-sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 0.5rem; }
.crm-nav-group { margin: 0; padding: 0.75rem 0.5rem 0.25rem; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; }
.crm-nav-link { display: flex; align-items: center; gap: 0.625rem; width: 100%; min-height: 2.25rem; padding: 0.5rem 0.625rem; border: 0; border-radius: 0.5rem; background: none; font-size: 0.8125rem; font-weight: 500; color: #475569; text-align: left; }
.crm-nav-link:hover { background: var(--crm-surface); color: var(--crm-ink); }
.crm-nav-link.active { background: var(--crm-brand-soft); color: var(--crm-brand-dark); font-weight: 600; }
.crm-nav-link svg { flex-shrink: 0; }
.crm-nav-children { margin: 0.125rem 0 0.25rem 1.125rem; padding: 0.25rem 0 0.25rem 0.75rem; border-left: 1px solid var(--crm-border); }
.crm-nav-child { display: block; padding: 0.375rem 0.625rem; border-radius: 0.375rem; font-size: 0.8125rem; color: #64748b; }
.crm-nav-child:hover { background: var(--crm-surface); color: var(--crm-ink); text-decoration: none; }
.crm-nav-child.active { color: var(--crm-brand-dark); font-weight: 600; background: var(--crm-brand-soft); }
.crm-nav-count { margin-left: auto; min-width: 1.5rem; padding: 0.125rem 0.375rem; border-radius: 999px; text-align: center; font-size: 0.75rem; font-weight: 700; color: #fff; background: var(--crm-brand); }

.crm-topbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; height: 4rem; padding: 0 0.75rem; background: #fff; border-bottom: 1px solid var(--crm-border); }
@media (min-width: 576px) { .crm-topbar { gap: 1rem; padding: 0 1rem; } }
@media (min-width: 992px) { .crm-topbar { padding: 0 1.5rem; } }
.crm-search { display: flex; flex: 1 1 auto; align-items: center; gap: 0.5rem; min-width: 0; height: 38px; padding: 0 0.75rem; background: var(--crm-surface); border: 1px solid var(--crm-border); border-radius: 0.5rem; }
@media (min-width: 576px) { .crm-search { max-width: 28rem; } }
.crm-search input { width: 100%; border: 0; outline: none; background: transparent; font-size: 0.875rem; color: #334155; }

/* ---------- 6. Carried over from Tailwind input.css ---------- */
.sidebar-scrollbar { scrollbar-width: thin; scrollbar-color: #e2e8f0 transparent; }
.sidebar-scrollbar::-webkit-scrollbar { width: 6px; }
.sidebar-scrollbar::-webkit-scrollbar-track { background: transparent; }
.sidebar-scrollbar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 999px; }
.sidebar-scrollbar::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

.table-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: #e2e8f0 transparent; }
.table-scroll::-webkit-scrollbar { height: 6px; width: 6px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 999px; }
.table-scroll tbody tr:hover td { background: #f8fafc; }
.table-scroll[data-scrolled-start] [data-pin="start"] { box-shadow: 8px 0 16px -10px rgba(15, 23, 42, 0.18); }
.table-scroll[data-scrolled-end] [data-pin="end"] { box-shadow: -8px 0 16px -10px rgba(15, 23, 42, 0.18); }

.toast-enter { animation: toast-in 480ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.toast-leave { animation: toast-out 260ms cubic-bezier(0.4, 0, 1, 1) both; }
.toast-progress { animation-name: toast-progress; animation-timing-function: linear; animation-fill-mode: forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translate3d(18px, -24px, 0) scale(0.96); filter: blur(4px); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: blur(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); filter: blur(0); }
  to { opacity: 0; transform: translate3d(12px, -14px, 0) scale(0.98); filter: blur(3px); }
}
@keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .toast-enter, .toast-leave, .toast-progress { animation: none; } }

@media (max-width: 991px) {
  html { -ms-overflow-style: none; scrollbar-width: none; }
  html::-webkit-scrollbar { display: none; }
}

#blazor-error-ui { background: #fefce8; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none; left: 0; padding: 0.6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }

div.dt-container { font-family: inherit; color: inherit; }
div.dt-container .dt-layout-row:not(.dt-layout-table) { padding: 12px 16px; }
div.dt-container .dt-search { position: relative; display: inline-block; }
div.dt-container .dt-search input { border: 1px solid #e2e8f0; border-radius: 8px; height: 36px; min-width: 180px; max-width: 100%; padding: 0 12px 0 36px; font-size: 13px; color: #111827; background: #fff; }
div.dt-container .dt-search input:focus { outline: none; border-color: #16a34a; }
div.dt-container .dt-search::before { content: "\f002"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: #94a3b8; pointer-events: none; z-index: 1; }
div.dt-container .dt-length { position: relative; display: inline-flex; align-items: center; }
div.dt-container .dt-length select { -webkit-appearance: none; appearance: none; border: 1px solid #e2e8f0; border-radius: 8px; height: 36px; min-width: 72px; padding: 0 32px 0 12px; font-size: 13px; color: #111827; background: #fff; cursor: pointer; }
div.dt-container .dt-length::after { content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; color: #64748b; pointer-events: none; }
div.dt-container .dt-info { font-size: 13px; color: #6b7280; }
div.dt-container .dt-paging .dt-paging-button { border-radius: 8px !important; border: 1px solid #e2e8f0 !important; background: #fff !important; color: #334155 !important; min-width: 36px; padding: 0.375rem 0.75rem; font-size: 13px; }
div.dt-container .dt-paging .dt-paging-button.current { background: #16a34a !important; border-color: #16a34a !important; color: #fff !important; }
div.dt-container .dt-paging .dt-paging-button.disabled { opacity: 0.4; }
table.dataTable thead > tr > th.dt-orderable-asc .dt-column-order,
table.dataTable thead > tr > th.dt-orderable-desc .dt-column-order,
table.dataTable thead > tr > th.dt-ordering-asc .dt-column-order,
table.dataTable thead > tr > th.dt-ordering-desc .dt-column-order { width: 12px; }
table.dataTable thead > tr > th.dt-orderable-asc .dt-column-order:before,
table.dataTable thead > tr > th.dt-orderable-desc .dt-column-order:before,
table.dataTable thead > tr > th.dt-ordering-asc .dt-column-order:before,
table.dataTable thead > tr > th.dt-ordering-desc .dt-column-order:before,
table.dataTable thead > tr > th.dt-orderable-asc .dt-column-order:after,
table.dataTable thead > tr > th.dt-orderable-desc .dt-column-order:after,
table.dataTable thead > tr > th.dt-ordering-asc .dt-column-order:after,
table.dataTable thead > tr > th.dt-ordering-desc .dt-column-order:after { border: 0 !important; height: auto !important; width: auto !important; left: 0; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 9px; line-height: 1; color: #94a3b8; opacity: 0.7; }
table.dataTable thead > tr > th.dt-orderable-asc .dt-column-order:before,
table.dataTable thead > tr > th.dt-orderable-desc .dt-column-order:before,
table.dataTable thead > tr > th.dt-ordering-asc .dt-column-order:before,
table.dataTable thead > tr > th.dt-ordering-desc .dt-column-order:before { content: "\f0de" !important; bottom: calc(50% - 1px); }
table.dataTable thead > tr > th.dt-orderable-asc .dt-column-order:after,
table.dataTable thead > tr > th.dt-orderable-desc .dt-column-order:after,
table.dataTable thead > tr > th.dt-ordering-asc .dt-column-order:after,
table.dataTable thead > tr > th.dt-ordering-desc .dt-column-order:after { content: "\f0dd" !important; top: calc(50% + 1px); }
table.dataTable thead > tr > th.dt-ordering-asc .dt-column-order:before,
table.dataTable thead > tr > th.dt-ordering-desc .dt-column-order:after { color: #16a34a; opacity: 1; }
@media (max-width: 767px) {
  div.dt-container .dt-layout-row:not(.dt-layout-table) { padding: 12px; flex-wrap: wrap; gap: 10px; }
  div.dt-container .dt-search, div.dt-container .dt-search input { width: 100%; min-width: 0; }
  table.dataTable thead th.sticky, table.dataTable tbody td.sticky, table.dataTable thead th.position-sticky, table.dataTable tbody td.position-sticky { position: static !important; left: auto !important; right: auto !important; min-width: 0 !important; }
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before { border: 0 !important; width: 18px; height: 18px; margin-right: 10px; border-radius: 999px; background: #dcfce7; color: #15803d; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 10px; line-height: 18px; text-align: center; content: "\f067" !important; vertical-align: middle; }
table.dataTable.dtr-inline.collapsed > tbody > tr.dtr-expanded > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.dtr-expanded > th.dtr-control:before { content: "\f068" !important; background: #16a34a; color: #fff; }
table.dataTable > tbody > tr.child ul.dtr-details { display: grid; gap: 0; padding: 8px 12px 12px 48px; margin: 0; }
table.dataTable > tbody > tr.child ul.dtr-details > li { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
table.dataTable > tbody > tr.child ul.dtr-details > li:last-child { border-bottom: 0; }
table.dataTable > tbody > tr.child span.dtr-title { min-width: 110px; color: #6b7280; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
table.dataTable > tbody > tr.child span.dtr-data { color: #111827; font-size: 13px; }

/* ---------- 7. Added during the page migration ---------- */
/* Leads list: sticky toolbar under the top bar (desktop) and its view tabs. */
@media (min-width: 992px) { .crm-leads-toolbar { position: sticky; top: 4rem; z-index: 1020; } }
.crm-lead-tab { display: flex; flex-shrink: 0; align-items: center; gap: 0.375rem; padding: 0 1rem; border: 0; border-bottom: 2px solid transparent; background: none; font-size: 0.875rem; font-weight: 500; color: var(--crm-muted); }
.crm-lead-tab:hover { background: var(--crm-surface); }
.crm-lead-tab.active { border-bottom-color: var(--crm-brand); background: #f0fdf4; color: var(--crm-brand); }

/* Stat tile rows: one column on phones, as many 180px+ columns as fit. */
.crm-stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.text-pre-wrap { white-space: pre-wrap !important; }

/* Lead detail header: sticks under the top bar on desktop only (on a phone it would cover a third of the screen).
   Its "more" menu opens to the right on phones, where the button wraps to the start of a line. */
.crm-lead-header { position: relative; z-index: 20; }
.crm-lead-more-menu { left: 0; }
@media (min-width: 768px) { .crm-lead-more-menu { left: auto; right: 0; } }
@media (min-width: 992px) { .crm-lead-header { position: sticky; top: 4rem; } }

/* Lead WhatsApp tab: like WhatsApp, only the messages scroll (newest at the bottom), not the page.
   column-reverse keeps the list pinned to the newest message as messages arrive. */
.crm-chat-card { display: flex; flex-direction: column; height: 75dvh; min-height: 420px; }
.crm-chat-card > :not(.crm-chat-scroll) { flex-shrink: 0; }
.crm-chat-scroll { flex: 1 1 0%; min-height: 0; overflow-y: auto; display: flex; flex-direction: column-reverse; background: #eee7de; }
@media (min-width: 992px) {
  .crm-lead-chat-mode { display: flex; flex-direction: column; height: calc(100dvh - 4rem); overflow: hidden; }
  /* The page does not scroll here, so the lead header need not stick (its top:4rem would leave a gap over the tabs). */
  .crm-lead-chat-mode > .crm-lead-header { position: relative; top: 0; }
  .crm-lead-chat-mode > .crm-lead-body { flex: 1 1 0%; min-height: 0 !important; }
  .crm-lead-chat-mode .crm-lead-aside { overflow-y: auto; }
  .crm-lead-chat-mode .crm-lead-content { display: flex; flex-direction: column; min-height: 0; padding-bottom: 1rem !important; }
  .crm-lead-chat-mode .crm-lead-tab-body { flex: 1 1 0%; min-height: 0; }
  .crm-lead-chat-mode .crm-chat-card { height: 100%; min-height: 0; }
}
