/* ==========================================================================
   Mini CRM — Admin theme
   Built on Bootstrap 5.3. All colours are tokens; dark mode re-defines them
   under [data-bs-theme="dark"] (toggled from the top bar, persisted).
   ========================================================================== */

:root {
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --app-bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-hover: #f1f5f9;
    --border: #e6eaf1;
    --border-strong: #d5dbe5;
    --text: #0f172a;
    --text-2: #475569;
    --muted: #8a94a6;

    --primary: #2a78d6;
    --primary-hover: #1c5cab;
    --primary-soft: rgba(42, 120, 214, .10);
    --primary-ring: rgba(42, 120, 214, .25);

    --success: #0f9d58;  --success-soft: rgba(15, 157, 88, .12);
    --danger: #d03b3b;   --danger-soft: rgba(208, 59, 59, .10);
    --warning: #c27c00;  --warning-soft: rgba(237, 161, 0, .14);
    --info: #0e7490;     --info-soft: rgba(14, 116, 144, .10);
    --neutral: #64748b;  --neutral-soft: rgba(100, 116, 139, .12);

    --sidebar-bg: #0b1220;
    --sidebar-bg-2: #111a2e;
    --sidebar-text: #94a3b8;
    --sidebar-text-strong: #e2e8f0;
    --sidebar-active: rgba(57, 135, 229, .16);
    --sidebar-border: rgba(255, 255, 255, .06);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow: 0 10px 30px -12px rgba(15, 23, 42, .14);
    --shadow-lg: 0 24px 48px -16px rgba(15, 23, 42, .25);

    --sidebar-w: 264px;
    --sidebar-mini-w: 78px;
    --topbar-h: 68px;

    /* Chart roles (validated categorical slots 1-2, light surface). */
    --chart-1: #2a78d6;
    --chart-2: #eb6834;
    --chart-grid: #e8ebf1;
    --chart-axis: #8a94a6;

    /* Bootstrap bridge */
    --bs-body-font-family: var(--font-sans);
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--text);
    --bs-secondary-color: var(--text-2);
    --bs-tertiary-color: var(--muted);
    --bs-border-color: var(--border);
    --bs-primary: var(--primary);
    --bs-primary-rgb: 42, 120, 214;
    --bs-link-color: var(--primary);
    --bs-link-color-rgb: 42, 120, 214;
    --bs-link-hover-color: var(--primary-hover);
    --bs-border-radius: var(--radius-sm);
    --bs-focus-ring-color: var(--primary-ring);
}

[data-bs-theme="dark"] {
    --app-bg: #0a0d14;
    --surface: #121722;
    --surface-2: #171d2a;
    --surface-hover: #1b2231;
    --border: #222a3a;
    --border-strong: #2d3649;
    --text: #e7eaf0;
    --text-2: #a5afc0;
    --muted: #6f7a8f;

    --primary: #3987e5;
    --primary-hover: #5598e7;
    --primary-soft: rgba(57, 135, 229, .16);
    --primary-ring: rgba(57, 135, 229, .35);

    --success: #34c27a;  --success-soft: rgba(52, 194, 122, .14);
    --danger: #ef6b6b;   --danger-soft: rgba(239, 107, 107, .14);
    --warning: #f0b232;  --warning-soft: rgba(240, 178, 50, .14);
    --info: #38bdf8;     --info-soft: rgba(56, 189, 248, .12);
    --neutral: #94a3b8;  --neutral-soft: rgba(148, 163, 184, .14);

    --sidebar-bg: #080b12;
    --sidebar-bg-2: #0d121d;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, .7);

    --chart-1: #3987e5;
    --chart-2: #d95926;
    --chart-grid: #1f2636;
    --chart-axis: #6f7a8f;

    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--border);
    --bs-primary-rgb: 57, 135, 229;
    --bs-link-color-rgb: 57, 135, 229;
    --bs-tertiary-bg: var(--surface-2);
    --bs-secondary-bg: var(--surface-2);
    --bs-emphasis-color: #fff;
    color-scheme: dark;
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-sans);
    font-size: .875rem;
    background: var(--app-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -.003em;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--text); font-weight: 650; letter-spacing: -.015em; }
a { text-decoration: none; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.text-2 { color: var(--text-2) !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.tabular { font-variant-numeric: tabular-nums; }
::selection { background: var(--primary-soft); }

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    border-right: 1px solid var(--sidebar-border);
    transition: width .22s ease, transform .25s ease;
}
.sidebar-brand {
    height: var(--topbar-h); flex-shrink: 0;
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.35rem;
    color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-brand:hover { color: #fff; }
.brand-logo {
    width: 36px; height: 36px; flex-shrink: 0;
    display: grid; place-items: center; border-radius: 10px;
    background: linear-gradient(135deg, #3987e5 0%, #6d5dfc 100%);
    box-shadow: 0 8px 20px -6px rgba(57, 135, 229, .6);
    color: #fff; font-size: 1.05rem;
}
.brand-text small { display: block; font-size: .68rem; font-weight: 500; color: var(--sidebar-text); letter-spacing: .02em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem .85rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent; }
.nav-heading {
    padding: 1rem .75rem .45rem; margin: 0;
    font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
    color: #5b6b85;
}
.sidebar-link {
    position: relative;
    display: flex; align-items: center; gap: .8rem;
    padding: .62rem .8rem; margin-bottom: 2px;
    border-radius: 10px;
    color: var(--sidebar-text); font-weight: 500;
    transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { color: var(--sidebar-text-strong); background: rgba(255, 255, 255, .04); }
.sidebar-link.active { color: #fff; background: var(--sidebar-active); }
.sidebar-link.active::before {
    content: ""; position: absolute; left: -.85rem; top: 22%; bottom: 22%;
    width: 3px; border-radius: 0 3px 3px 0; background: #3987e5;
}
.sidebar-link.active i { color: #6aa7f0; }
.sidebar-link .badge-count {
    margin-left: auto; font-size: .68rem; font-weight: 600;
    padding: .15rem .5rem; border-radius: 999px;
    background: rgba(255, 255, 255, .08); color: var(--sidebar-text-strong);
}

.sidebar-footer { padding: .85rem; border-top: 1px solid var(--sidebar-border); }
.sidebar-user {
    display: flex; align-items: center; gap: .7rem; padding: .55rem;
    border-radius: 12px; background: rgba(255, 255, 255, .03);
}
.sidebar-user .name { color: var(--sidebar-text-strong); font-weight: 600; font-size: .82rem; line-height: 1.2; }
.sidebar-user .role { color: var(--sidebar-text); font-size: .72rem; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .22s ease; }

.topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1.75rem;
    background: color-mix(in srgb, var(--app-bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-search { position: relative; max-width: 380px; flex: 1; }
.topbar-search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topbar-search .form-control { padding-left: 2.4rem; background: var(--surface); border-color: var(--border); height: 40px; border-radius: 10px; }
.topbar-search kbd {
    position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
    font-size: .68rem; padding: .1rem .4rem; box-shadow: none;
}

.icon-btn {
    width: 40px; height: 40px; flex-shrink: 0;
    display: inline-grid; place-items: center;
    border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-2);
    transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn i { font-size: 1.05rem; }

.user-menu-btn {
    display: flex; align-items: center; gap: .6rem;
    padding: .25rem .6rem .25rem .25rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
    color: var(--text);
}
.user-menu-btn:hover { background: var(--surface-hover); }

.content { flex: 1; padding: 1.75rem; }
.app-footer {
    padding: 1rem 1.75rem; border-top: 1px solid var(--border);
    color: var(--muted); font-size: .78rem;
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
}

/* Mini (collapsed) sidebar — desktop */
@media (min-width: 992px) {
    html.sidebar-mini .sidebar { width: var(--sidebar-mini-w); }
    html.sidebar-mini .main { margin-left: var(--sidebar-mini-w); }
    html.sidebar-mini .sidebar .brand-text,
    html.sidebar-mini .sidebar .nav-heading,
    html.sidebar-mini .sidebar .link-text,
    html.sidebar-mini .sidebar .badge-count,
    html.sidebar-mini .sidebar .sidebar-user > div:not(.avatar) { display: none; }
    html.sidebar-mini .sidebar-brand { justify-content: center; padding: 0; }
    html.sidebar-mini .sidebar-link { justify-content: center; padding: .7rem; }
    html.sidebar-mini .sidebar-user { justify-content: center; background: none; }
    html.sidebar-mini .nav-divider { display: block; }
}
.nav-divider { display: none; height: 1px; background: var(--sidebar-border); margin: .75rem .5rem; }

/* Off-canvas sidebar — mobile */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .main { margin-left: 0; }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1035;
        background: rgba(2, 6, 23, .55); backdrop-filter: blur(2px);
    }
    .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
    .app-footer { padding: 1rem; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -.025em; }
.page-subtitle { color: var(--muted); margin: .25rem 0 0; }
.breadcrumb { --bs-breadcrumb-divider-color: var(--muted); --bs-breadcrumb-item-active-color: var(--muted); font-size: .78rem; margin-bottom: .35rem; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--primary); }

/* ---------- Cards ---------- */
.card {
    --bs-card-bg: var(--surface);
    --bs-card-border-color: var(--border);
    --bs-card-border-radius: var(--radius-lg);
    --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px);
    --bs-card-cap-bg: transparent;
    --bs-card-spacer-y: 1.25rem;
    --bs-card-spacer-x: 1.35rem;
    box-shadow: var(--shadow-xs);
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.1rem; padding-bottom: 1.1rem; }
.card-title { font-size: .95rem; font-weight: 650; margin: 0; }
.card-subtitle { font-size: .78rem; color: var(--muted); margin-top: .15rem; }

/* KPI tiles */
.kpi {
    position: relative; overflow: hidden;
    padding: 1.25rem 1.35rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
    transition: transform .18s ease, box-shadow .18s ease;
    height: 100%;
    color: inherit;
    display: block;
}
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: inherit; }
.kpi-label { font-size: .78rem; font-weight: 500; color: var(--text-2); }
.kpi-value { font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; margin-top: .4rem; color: var(--text); }
.kpi-meta { font-size: .75rem; color: var(--muted); margin-top: .35rem; }
.kpi-icon {
    position: absolute; top: 1.15rem; right: 1.15rem;
    width: 42px; height: 42px; display: grid; place-items: center;
    border-radius: 12px; font-size: 1.2rem;
}
.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-danger  { background: var(--danger-soft);  color: var(--danger); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-info    { background: var(--info-soft);    color: var(--info); }
.tone-neutral { background: var(--neutral-soft); color: var(--neutral); }

.welcome-card {
    position: relative; overflow: hidden;
    border-radius: var(--radius-lg);
    padding: 1.6rem 1.75rem;
    color: #fff;
    background:
        radial-gradient(1200px 300px at 100% 0%, rgba(109, 93, 252, .55), transparent 60%),
        linear-gradient(120deg, #1c5cab 0%, #2a78d6 55%, #4a3aa7 120%);
    box-shadow: 0 18px 40px -18px rgba(42, 120, 214, .7);
}
.welcome-card::after {
    content: ""; position: absolute; right: -60px; bottom: -80px;
    width: 260px; height: 260px; border-radius: 50%;
    border: 40px solid rgba(255, 255, 255, .07);
}
.welcome-card h2 { color: #fff; font-size: 1.35rem; font-weight: 700; margin: 0 0 .35rem; }
.welcome-card p { color: rgba(255, 255, 255, .82); margin: 0; }
.welcome-card .btn-light { color: #1c5cab; font-weight: 600; }

/* ---------- Tables ---------- */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-hover-bg: var(--surface-hover);
    --bs-table-hover-color: var(--text);
    margin-bottom: 0;
}
.table > thead th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
    padding-top: .8rem; padding-bottom: .8rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table > :not(caption) > * > * { padding: .85rem 1rem; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table th a { color: inherit; display: inline-flex; align-items: center; gap: .25rem; }
.table th a:hover { color: var(--text); }
.table th a .sort-idle { opacity: .35; }
.table-card .table > thead th:first-child, .table-card .table td:first-child { padding-left: 1.35rem; }
.table-card .table > thead th:last-child, .table-card .table td:last-child { padding-right: 1.35rem; }

.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.empty-state .empty-icon {
    width: 64px; height: 64px; margin: 0 auto 1rem;
    display: grid; place-items: center; border-radius: 18px;
    background: var(--surface-2); color: var(--muted); font-size: 1.6rem;
    border: 1px solid var(--border);
}
.empty-state h6 { color: var(--text); margin-bottom: .25rem; }

/* ---------- Avatars ---------- */
.avatar {
    --size: 36px;
    width: var(--size); height: var(--size); flex-shrink: 0;
    display: inline-grid; place-items: center;
    border-radius: 50%;
    font-size: calc(var(--size) * .36); font-weight: 600; letter-spacing: .02em;
    color: #fff;
}
.avatar-sm { --size: 30px; }
.avatar-lg { --size: 56px; }
.avatar-xl { --size: 76px; }
.avatar-c0 { background: linear-gradient(135deg, #2a78d6, #4a3aa7); }
.avatar-c1 { background: linear-gradient(135deg, #eb6834, #d03b3b); }
.avatar-c2 { background: linear-gradient(135deg, #1baf7a, #0e7490); }
.avatar-c3 { background: linear-gradient(135deg, #c98500, #eb6834); }
.avatar-c4 { background: linear-gradient(135deg, #d55181, #4a3aa7); }
.avatar-c5 { background: linear-gradient(135deg, #0f766e, #2a78d6); }
.identity { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.identity .title { font-weight: 600; color: var(--text); line-height: 1.25; }
.identity .sub { font-size: .78rem; color: var(--muted); }
a.identity:hover .title { color: var(--primary); }

/* ---------- Badges / pills ---------- */
.pill {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .28rem .65rem; border-radius: 999px;
    font-size: .74rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-new         { background: var(--neutral-soft); color: var(--neutral); }
.pill-in_progress { background: var(--primary-soft); color: var(--primary); }
.pill-won         { background: var(--success-soft); color: var(--success); }
.pill-lost        { background: var(--danger-soft);  color: var(--danger); }
.pill-active      { background: var(--success-soft); color: var(--success); }
.pill-inactive    { background: var(--neutral-soft); color: var(--neutral); }
.pill-admin       { background: rgba(74, 58, 167, .12); color: #6d5dfc; }
.pill-sales       { background: var(--info-soft); color: var(--info); }
.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .22rem .55rem; border-radius: 6px;
    font-size: .74rem; font-weight: 500;
    background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
a.chip:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Forms ---------- */
.form-label { font-weight: 550; font-size: .8rem; color: var(--text-2); margin-bottom: .4rem; }
.form-control, .form-select {
    background-color: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
    border-radius: 10px;
    min-height: 42px;
    font-size: .875rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: var(--muted); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); background-color: var(--surface); color: var(--text); }
.form-control-sm, .form-select-sm { min-height: 36px; }
.form-text { color: var(--muted); font-size: .75rem; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .form-control { padding-left: 2.4rem; }
.form-section-title { font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 1rem; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-switch .form-check-input { width: 2.5em; height: 1.35em; cursor: pointer; }

/* ---------- Buttons ---------- */
.btn { font-weight: 550; border-radius: 10px; padding: .55rem 1rem; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-sm { padding: .38rem .7rem; font-size: .78rem; border-radius: 8px; }
.btn-primary {
    --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-hover); --bs-btn-active-border-color: var(--primary-hover);
    box-shadow: 0 6px 16px -6px rgba(42, 120, 214, .55);
}
.btn-success { --bs-btn-bg: #0f9d58; --bs-btn-border-color: #0f9d58; --bs-btn-hover-bg: #0b8049; --bs-btn-hover-border-color: #0b8049; box-shadow: 0 6px 16px -6px rgba(15, 157, 88, .5); }
.btn-light-soft { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.btn-light-soft:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 8px; }
.btn-soft-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid transparent; }
.btn-soft-danger:hover { background: var(--danger); color: #fff; }
.btn-soft-primary { background: var(--primary-soft); color: var(--primary); border: 1px solid transparent; }
.btn-soft-primary:hover { background: var(--primary); color: #fff; }
.btn-soft-success { background: var(--success-soft); color: var(--success); border: 1px solid transparent; }
.btn-soft-success:hover { background: var(--success); color: #fff; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: 1rem 1.35rem; border-bottom: 1px solid var(--border); }
.filter-bar .search { flex: 1 1 260px; max-width: 360px; }
.filter-bar .form-select { width: auto; min-width: 140px; }
.active-filters { display: flex; flex-wrap: wrap; gap: .4rem; padding: .7rem 1.35rem 0; }

/* ---------- Pagination ---------- */
.pagination { --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); --bs-pagination-color: var(--text-2);
    --bs-pagination-hover-bg: var(--surface-hover); --bs-pagination-hover-color: var(--text); --bs-pagination-hover-border-color: var(--border);
    --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary);
    --bs-pagination-disabled-bg: var(--surface); --bs-pagination-disabled-color: var(--muted); --bs-pagination-disabled-border-color: var(--border);
    --bs-pagination-font-size: .8rem; --bs-pagination-border-radius: 8px; gap: .25rem; margin: 0; }
.pagination .page-link { border-radius: 8px !important; min-width: 34px; text-align: center; }
.card-footer-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.35rem; border-top: 1px solid var(--border); }

/* ---------- Dropdowns, modals, toasts ---------- */
.dropdown-menu {
    --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--border);
    --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--surface-hover); --bs-dropdown-link-hover-color: var(--text);
    --bs-dropdown-link-active-bg: var(--primary-soft); --bs-dropdown-link-active-color: var(--primary);
    --bs-dropdown-font-size: .85rem;
    border-radius: 12px; box-shadow: var(--shadow-lg); padding: .4rem;
}
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; display: flex; align-items: center; gap: .6rem; }
.dropdown-item i { color: var(--muted); }
.dropdown-header { padding: .6rem .75rem; }

.modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; font-size: 1.4rem; margin-bottom: 1rem; }

.toast-container { z-index: 1090; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); color: var(--text); overflow: hidden; }
.toast .toast-body { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; }
.toast .toast-icon { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; }
.toast-progress { height: 3px; background: currentColor; opacity: .5; animation: toast-progress 5s linear forwards; }
@keyframes toast-progress { from { width: 100%; } to { width: 0; } }

/* ---------- Detail views ---------- */
.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem 2rem; }
.detail-item .label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .3rem; }
.detail-item .value { color: var(--text); font-weight: 500; word-break: break-word; }
.profile-cover { height: 84px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: linear-gradient(120deg, #1c5cab, #2a78d6 55%, #4a3aa7); }
.profile-head { margin-top: -38px; }
.profile-head .avatar { border: 4px solid var(--surface); }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-left: 46px; padding-bottom: 1.15rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .dot { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; border: 3px solid var(--surface); }
.timeline .when { font-size: .74rem; color: var(--muted); }

.progress { --bs-progress-bg: var(--surface-2); --bs-progress-height: 6px; --bs-progress-border-radius: 999px; }
.progress-bar { background: var(--primary); border-radius: 999px; }

.chart-box { position: relative; height: 290px; }
.chart-box-sm { position: relative; height: 220px; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.list-row { display: flex; align-items: center; gap: .85rem; padding: .85rem 1.35rem; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }

/* ---------- Auth ---------- */
.auth-wrap {
    position: relative; min-height: 100vh;
    background:
        radial-gradient(700px 360px at 50% -10%, var(--primary-soft), transparent 70%),
        var(--app-bg);
}
.auth-theme-toggle { position: absolute; top: 1.25rem; right: 1.25rem; z-index: 2; }
.auth-main { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow);
    padding: 1.75rem 1.75rem 1.25rem;
}
.auth-card .form-control { min-height: 44px; }
.demo-creds { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px dashed var(--border-strong); font-size: .78rem; }
.demo-creds button { font-size: .75rem; }
@media (max-width: 575.98px) { .auth-panel { padding: 1.5rem; } }

/* ---------- Utilities ---------- */
.min-w-0 { min-width: 0; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.overdue { color: var(--danger) !important; font-weight: 600; }
.due-today { color: var(--warning) !important; font-weight: 600; }
.border-dashed { border-style: dashed !important; }
.nowrap { white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
