/* =====================================================================
   LeadFlow AI CRM — Design System
   Clean & modern (Linear/Stripe-inspired). Indigo + cyan brand.
   Re-skins Bootstrap 5.3 via CSS variables + component overrides.
   Polished light & dark themes · RTL-safe (logical properties).
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Design tokens
   --------------------------------------------------------------------- */
:root {
    /* Brand */
    --lf-primary: #4f46e5;
    --lf-primary-rgb: 79, 70, 229;
    --lf-primary-dark: #4338ca;
    --lf-primary-light: #6366f1;
    --lf-accent: #06b6d4;
    --lf-accent-rgb: 6, 182, 212;

    /* Radii */
    --lf-radius-sm: .55rem;
    --lf-radius: .85rem;
    --lf-radius-lg: 1.15rem;
    --lf-radius-pill: 999px;

    /* Sidebar */
    --lf-sidebar-width: 264px;

    /* Motion */
    --lf-transition: .18s cubic-bezier(.4, 0, .2, 1);

    /* Fonts */
    --lf-font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    --lf-font-ar: 'Cairo', 'Segoe UI', system-ui, Tahoma, sans-serif;
}

/* ---- Light theme ---- */
[data-bs-theme="light"] {
    --lf-bg: #f6f7fb;
    --lf-bg-soft: #eef1f8;
    --lf-surface: #ffffff;
    --lf-surface-2: #f8fafc;
    --lf-border: #e7e9f1;
    --lf-border-strong: #d8dbe8;
    --lf-text: #0f172a;
    --lf-muted: #64748b;
    --lf-heading: #0b1220;

    --lf-sidebar-bg-1: #0b1220;
    --lf-sidebar-bg-2: #131c33;
    --lf-sidebar-fg: #aeb8cc;
    --lf-sidebar-muted: #5b6781;
    --lf-sidebar-hover: rgba(255, 255, 255, .06);

    --lf-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
    --lf-shadow: 0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
    --lf-shadow-lg: 0 18px 40px rgba(15, 23, 42, .12), 0 6px 14px rgba(15, 23, 42, .06);
    --lf-shadow-brand: 0 8px 22px rgba(var(--lf-primary-rgb), .28);

    /* Bootstrap variable overrides */
    --bs-body-bg: var(--lf-bg);
    --bs-body-color: var(--lf-text);
    --bs-body-color-rgb: 15, 23, 42;
    --bs-secondary-bg: var(--lf-surface-2);
    --bs-tertiary-bg: var(--lf-bg-soft);
    --bs-secondary-color: var(--lf-muted);
    --bs-border-color: var(--lf-border);
    --bs-border-color-translucent: var(--lf-border);
    --bs-heading-color: var(--lf-heading);
    --bs-emphasis-color: var(--lf-heading);
}

/* ---- Dark theme ---- */
[data-bs-theme="dark"] {
    --lf-bg: #070b16;
    --lf-bg-soft: #0c1322;
    --lf-surface: #111a2e;
    --lf-surface-2: #0d1525;
    --lf-border: #1f2a44;
    --lf-border-strong: #2a3858;
    --lf-text: #e6ebf5;
    --lf-muted: #8a98b5;
    --lf-heading: #f4f7fc;

    --lf-sidebar-bg-1: #060a13;
    --lf-sidebar-bg-2: #0c1322;
    --lf-sidebar-fg: #aeb8cc;
    --lf-sidebar-muted: #5b6781;
    --lf-sidebar-hover: rgba(255, 255, 255, .05);

    --lf-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --lf-shadow: 0 6px 16px rgba(0, 0, 0, .45);
    --lf-shadow-lg: 0 22px 48px rgba(0, 0, 0, .6);
    --lf-shadow-brand: 0 8px 24px rgba(var(--lf-primary-rgb), .45);

    --bs-body-bg: var(--lf-bg);
    --bs-body-color: var(--lf-text);
    --bs-body-color-rgb: 230, 235, 245;
    --bs-secondary-bg: var(--lf-surface-2);
    --bs-tertiary-bg: var(--lf-bg-soft);
    --bs-secondary-color: var(--lf-muted);
    --bs-border-color: var(--lf-border);
    --bs-border-color-translucent: var(--lf-border);
    --bs-heading-color: var(--lf-heading);
    --bs-emphasis-color: var(--lf-heading);
}

/* Shared brand-derived Bootstrap overrides (both themes) */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
    --bs-primary: var(--lf-primary);
    --bs-primary-rgb: var(--lf-primary-rgb);
    --bs-link-color: var(--lf-primary);
    --bs-link-color-rgb: var(--lf-primary-rgb);
    --bs-link-hover-color: var(--lf-primary-dark);
    --bs-focus-ring-color: rgba(var(--lf-primary-rgb), .25);
    --bs-border-radius: var(--lf-radius-sm);
    --bs-border-radius-lg: var(--lf-radius);
    --bs-border-radius-sm: .4rem;
}

/* ---------------------------------------------------------------------
   2. Base & typography
   --------------------------------------------------------------------- */
html, body { height: 100%; }

body {
    font-family: var(--lf-font-sans);
    background-color: var(--lf-bg);
    color: var(--lf-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11", "ss01";
    letter-spacing: -0.006em;
}

[dir="rtl"] body { font-family: var(--lf-font-ar); letter-spacing: 0; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--lf-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

a { text-decoration: none; transition: color var(--lf-transition); }
a:hover { text-decoration: none; }

.text-muted { color: var(--lf-muted) !important; }
hr { border-color: var(--lf-border); opacity: 1; }

::selection { background: rgba(var(--lf-primary-rgb), .18); }

/* Custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--lf-border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--lf-border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--lf-muted); background-clip: content-box; }

/* ---------------------------------------------------------------------
   3. App shell
   --------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--lf-sidebar-width);
    background: linear-gradient(185deg, var(--lf-sidebar-bg-1) 0%, var(--lf-sidebar-bg-2) 100%);
    color: var(--lf-sidebar-fg);
    flex-shrink: 0;
    position: fixed;
    top: 0; bottom: 0;
    inset-inline-start: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform var(--lf-transition);
    z-index: 1045;
    border-inline-end: 1px solid rgba(255, 255, 255, .04);
}
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); background-clip: content-box; }

.app-sidebar .brand {
    color: #fff; font-weight: 800; font-size: 1.2rem;
    padding: 1.35rem 1.4rem 1.15rem;
    display: flex; align-items: center; gap: .6rem;
    letter-spacing: -.02em;
}
.app-sidebar .brand .brand-mark {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--lf-primary) 0%, var(--lf-accent) 100%);
    color: #fff; font-size: 1.15rem;
    box-shadow: 0 6px 16px rgba(var(--lf-primary-rgb), .45);
    flex-shrink: 0;
}
.app-sidebar .brand .brand-close {
    margin-inline-start: auto; background: none; border: 0; color: var(--lf-sidebar-muted);
    font-size: 1.4rem; line-height: 1; padding: 0; display: none;
}
.app-sidebar .brand .brand-close:hover { color: #fff; }

.app-sidebar nav { padding: .35rem .75rem 1rem; flex: 1; }

.app-sidebar .nav-link {
    color: var(--lf-sidebar-fg);
    padding: .62rem .85rem;
    margin-bottom: 2px;
    border-radius: 10px;
    display: flex; align-items: center; gap: .8rem;
    font-size: .92rem; font-weight: 500;
    position: relative;
    transition: background var(--lf-transition), color var(--lf-transition);
}
.app-sidebar .nav-link i { font-size: 1.1rem; width: 1.35rem; text-align: center; opacity: .85; flex-shrink: 0; }
.app-sidebar .nav-link:hover { background: var(--lf-sidebar-hover); color: #fff; }
.app-sidebar .nav-link:hover i { opacity: 1; }
.app-sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(var(--lf-primary-rgb), .22), rgba(var(--lf-primary-rgb), .08));
    color: #fff;
}
.app-sidebar .nav-link.active i { opacity: 1; color: var(--lf-accent); }
.app-sidebar .nav-link.active::before {
    content: ""; position: absolute; inset-inline-start: -.75rem; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%; border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--lf-primary-light), var(--lf-accent));
}
[dir="rtl"] .app-sidebar .nav-link.active::before { border-radius: 3px 0 0 3px; }

.app-sidebar .nav-section {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
    color: var(--lf-sidebar-muted);
    padding: 1.1rem .85rem .4rem;
}

.sidebar-footer {
    padding: .75rem; margin: 0 .25rem .25rem;
    border-top: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-footer .su {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .6rem; border-radius: 10px;
    color: var(--lf-sidebar-fg);
}
.sidebar-footer .su:hover { background: var(--lf-sidebar-hover); color: #fff; }
.sidebar-footer .su .avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff;
    background: linear-gradient(135deg, var(--lf-primary), var(--lf-accent));
}
.sidebar-footer .su .meta { min-width: 0; line-height: 1.2; }
.sidebar-footer .su .meta .nm { font-size: .85rem; font-weight: 600; color: #e9edf6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .su .meta .rl { font-size: .72rem; color: var(--lf-sidebar-muted); }

/* Sidebar mobile backdrop */
.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(2, 6, 23, .5);
    backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden; transition: opacity var(--lf-transition); z-index: 1044;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

/* Main + topbar */
.app-main { flex: 1; margin-inline-start: var(--lf-sidebar-width); display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
    height: 64px;
    background: rgba(var(--bs-body-bg-rgb, 246, 247, 251), .8);
    background-color: color-mix(in srgb, var(--lf-bg) 78%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--lf-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem; position: sticky; top: 0; z-index: 1030;
}
.app-topbar .topbar-title { font-weight: 700; font-size: 1.05rem; color: var(--lf-heading); letter-spacing: -.02em; }

.app-content { padding: 1.75rem; flex: 1; animation: lf-fade-in .35s ease; }

@keyframes lf-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------
   4. Cards
   --------------------------------------------------------------------- */
.card {
    --bs-card-bg: var(--lf-surface);
    --bs-card-border-color: var(--lf-border);
    --bs-card-border-radius: var(--lf-radius);
    --bs-card-inner-border-radius: calc(var(--lf-radius) - 1px);
    background: var(--lf-surface);
    border: 1px solid var(--lf-border);
    border-radius: var(--lf-radius);
    box-shadow: var(--lf-shadow-sm);
    transition: box-shadow var(--lf-transition), transform var(--lf-transition), border-color var(--lf-transition);
}
.card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--lf-border);
    font-weight: 600; color: var(--lf-heading);
    padding: 1rem 1.25rem;
}
.card .card-body { padding: 1.25rem; }
.card.shadow-sm { box-shadow: var(--lf-shadow) !important; }

/* KPI cards */
.kpi-card { border-radius: var(--lf-radius); box-shadow: var(--lf-shadow-sm); overflow: hidden; position: relative; }
.kpi-card::after {
    content: ""; position: absolute; inset-block-start: 0; inset-inline-end: 0;
    width: 120px; height: 120px; border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--lf-primary-rgb), .08), transparent 70%);
    transform: translate(35%, -35%); pointer-events: none;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--lf-shadow); }
.kpi-card .kpi-value { font-size: 1.95rem; font-weight: 800; line-height: 1.05; letter-spacing: -.03em; color: var(--lf-heading); }
.kpi-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: grid; place-items: center; font-size: 1.45rem; flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(var(--bs-body-color-rgb), .04);
}

/* ---------------------------------------------------------------------
   5. Tables
   --------------------------------------------------------------------- */
.card > .table-responsive { border-radius: var(--lf-radius); }
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--lf-text);
    --bs-table-border-color: var(--lf-border);
    --bs-table-hover-bg: rgba(var(--lf-primary-rgb), .045);
    --bs-table-hover-color: var(--lf-text);
    margin-bottom: 0;
    color: var(--lf-text);
}
.table > thead, .table > thead.table-light {
    --bs-table-bg: transparent;
}
.table > thead th, .table > thead.table-light th {
    background: var(--lf-surface-2);
    color: var(--lf-muted);
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    border-bottom: 1px solid var(--lf-border);
    padding: .8rem 1rem; white-space: nowrap;
}
.table > tbody td { padding: .85rem 1rem; border-color: var(--lf-border); vertical-align: middle; }
.table > tbody tr:last-child > * { border-bottom: 0; }
.table-hover > tbody > tr { transition: background var(--lf-transition); }

/* ---------------------------------------------------------------------
   6. Buttons
   --------------------------------------------------------------------- */
.btn {
    --bs-btn-border-radius: var(--lf-radius-sm);
    --bs-btn-font-weight: 600;
    font-size: .9rem;
    border-radius: var(--lf-radius-sm);
    transition: transform var(--lf-transition), box-shadow var(--lf-transition), background var(--lf-transition), color var(--lf-transition), border-color var(--lf-transition);
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
}
.btn-sm { --bs-btn-border-radius: .5rem; font-size: .82rem; }
.btn-lg { --bs-btn-border-radius: var(--lf-radius); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: 0 0 0 .22rem rgba(var(--lf-primary-rgb), .3); }

.btn-primary {
    --bs-btn-bg: var(--lf-primary);
    --bs-btn-border-color: var(--lf-primary);
    --bs-btn-hover-bg: var(--lf-primary-dark);
    --bs-btn-hover-border-color: var(--lf-primary-dark);
    --bs-btn-active-bg: var(--lf-primary-dark);
    --bs-btn-active-border-color: var(--lf-primary-dark);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0));
    box-shadow: var(--lf-shadow-brand);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(var(--lf-primary-rgb), .4); transform: translateY(-1px); }

.btn-light {
    --bs-btn-bg: var(--lf-surface);
    --bs-btn-border-color: var(--lf-border-strong);
    --bs-btn-color: var(--lf-text);
    --bs-btn-hover-bg: var(--lf-surface-2);
    --bs-btn-hover-border-color: var(--lf-border-strong);
    --bs-btn-hover-color: var(--lf-text);
    --bs-btn-active-bg: var(--lf-surface-2);
}

.btn-outline-secondary {
    --bs-btn-color: var(--lf-muted);
    --bs-btn-border-color: var(--lf-border-strong);
    --bs-btn-hover-bg: var(--lf-surface-2);
    --bs-btn-hover-border-color: var(--lf-muted);
    --bs-btn-hover-color: var(--lf-heading);
    --bs-btn-active-bg: var(--lf-surface-2);
    --bs-btn-active-border-color: var(--lf-muted);
    --bs-btn-active-color: var(--lf-heading);
}
.btn-outline-primary {
    --bs-btn-color: var(--lf-primary);
    --bs-btn-border-color: rgba(var(--lf-primary-rgb), .45);
    --bs-btn-hover-bg: var(--lf-primary);
    --bs-btn-hover-border-color: var(--lf-primary);
    --bs-btn-active-bg: var(--lf-primary-dark);
}
.btn-link { --bs-btn-color: var(--lf-primary); --bs-btn-hover-color: var(--lf-primary-dark); text-decoration: none; }

/* ---------------------------------------------------------------------
   7. Forms
   --------------------------------------------------------------------- */
.form-label { font-weight: 600; font-size: .85rem; color: var(--lf-heading); margin-bottom: .4rem; }
.form-control, .form-select {
    background-color: var(--lf-surface);
    border: 1px solid var(--lf-border-strong);
    border-radius: var(--lf-radius-sm);
    color: var(--lf-text);
    padding: .55rem .85rem;
    transition: border-color var(--lf-transition), box-shadow var(--lf-transition), background var(--lf-transition);
}
.form-control-sm, .form-select-sm { border-radius: .5rem; }
.form-control::placeholder { color: var(--lf-muted); opacity: .7; }
.form-control:focus, .form-select:focus {
    background-color: var(--lf-surface);
    border-color: var(--lf-primary);
    box-shadow: 0 0 0 .22rem rgba(var(--lf-primary-rgb), .18);
    color: var(--lf-text);
}
.form-control:disabled, .form-control[readonly] { background-color: var(--lf-surface-2); }
textarea.form-control { min-height: 2.6rem; }

.input-group-text {
    background-color: var(--lf-surface-2);
    border: 1px solid var(--lf-border-strong);
    color: var(--lf-muted);
    border-radius: var(--lf-radius-sm);
}
.input-group > .input-group-text { border-inline-end: 0; }
.input-group:focus-within .input-group-text { border-color: var(--lf-primary); color: var(--lf-primary); }
.input-group:focus-within .form-control { border-color: var(--lf-primary); box-shadow: none; }

.form-check-input { border-color: var(--lf-border-strong); }
.form-check-input:checked { background-color: var(--lf-primary); border-color: var(--lf-primary); }
.form-check-input:focus { border-color: var(--lf-primary); box-shadow: 0 0 0 .22rem rgba(var(--lf-primary-rgb), .18); }
.form-switch .form-check-input { width: 2.4em; }

/* ---------------------------------------------------------------------
   8. Badges (soft tinted pills)
   --------------------------------------------------------------------- */
.badge {
    font-weight: 600; font-size: .72rem; letter-spacing: .01em;
    padding: .38em .7em; border-radius: var(--lf-radius-pill);
    display: inline-flex; align-items: center; gap: .3rem;
}
.text-bg-primary { background-color: rgba(var(--lf-primary-rgb), .12) !important; color: var(--lf-primary) !important; }
.text-bg-success { background-color: rgba(22, 163, 74, .14) !important; color: #16a34a !important; }
.text-bg-danger  { background-color: rgba(220, 38, 38, .14) !important; color: #dc2626 !important; }
.text-bg-warning { background-color: rgba(217, 119, 6, .15) !important; color: #d97706 !important; }
.text-bg-info    { background-color: rgba(var(--lf-accent-rgb), .15) !important; color: #0891b2 !important; }
.text-bg-secondary { background-color: rgba(100, 116, 139, .15) !important; color: var(--lf-muted) !important; }
.text-bg-light   { background-color: var(--lf-surface-2) !important; color: var(--lf-muted) !important; border: 1px solid var(--lf-border); }
[data-bs-theme="dark"] .text-bg-success { color: #4ade80 !important; }
[data-bs-theme="dark"] .text-bg-danger  { color: #f87171 !important; }
[data-bs-theme="dark"] .text-bg-warning { color: #fbbf24 !important; }
[data-bs-theme="dark"] .text-bg-info    { color: #22d3ee !important; }
[data-bs-theme="dark"] .text-bg-primary { color: #a5b4fc !important; }

/* ---------------------------------------------------------------------
   9. Dropdowns, alerts, list groups, pagination
   --------------------------------------------------------------------- */
.dropdown-menu {
    --bs-dropdown-bg: var(--lf-surface);
    --bs-dropdown-border-color: var(--lf-border);
    --bs-dropdown-link-color: var(--lf-text);
    --bs-dropdown-link-hover-bg: var(--lf-surface-2);
    --bs-dropdown-link-hover-color: var(--lf-heading);
    border-radius: var(--lf-radius);
    box-shadow: var(--lf-shadow-lg);
    padding: .4rem;
    border: 1px solid var(--lf-border);
}
.dropdown-item { border-radius: var(--lf-radius-sm); padding: .5rem .75rem; font-size: .9rem; }
.dropdown-divider { border-color: var(--lf-border); }

.alert {
    border: 1px solid transparent; border-radius: var(--lf-radius);
    border-inline-start-width: 4px;
}
.alert-success { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .3); color: #15803d; }
.alert-danger  { background: rgba(220, 38, 38, .1); border-color: rgba(220, 38, 38, .3); color: #b91c1c; }
.alert-secondary { background: var(--lf-surface-2); border-color: var(--lf-border); color: var(--lf-muted); }
[data-bs-theme="dark"] .alert-success { color: #86efac; }
[data-bs-theme="dark"] .alert-danger { color: #fca5a5; }

.list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--lf-border); --bs-list-group-color: var(--lf-text); }
.list-group-item { background: transparent; border-color: var(--lf-border); }

.pagination {
    --bs-pagination-bg: var(--lf-surface);
    --bs-pagination-border-color: var(--lf-border);
    --bs-pagination-color: var(--lf-text);
    --bs-pagination-hover-bg: var(--lf-surface-2);
    --bs-pagination-hover-color: var(--lf-primary);
    --bs-pagination-hover-border-color: var(--lf-border);
    --bs-pagination-active-bg: var(--lf-primary);
    --bs-pagination-active-border-color: var(--lf-primary);
    --bs-pagination-focus-box-shadow: 0 0 0 .22rem rgba(var(--lf-primary-rgb), .25);
    gap: .3rem;
}
.pagination .page-link { border-radius: var(--lf-radius-sm) !important; min-width: 2.3rem; text-align: center; }

/* Modals & offcanvas inherit surface */
.modal-content, .offcanvas { background: var(--lf-surface); border: 1px solid var(--lf-border); border-radius: var(--lf-radius); }
.modal-header, .modal-footer { border-color: var(--lf-border); }

/* ---------------------------------------------------------------------
   10. Kanban (pipeline board)
   --------------------------------------------------------------------- */
.kanban-col { transition: background var(--lf-transition); border-radius: var(--lf-radius-sm); }
.kanban-col.bg-light { background: rgba(var(--lf-primary-rgb), .07) !important; outline: 2px dashed rgba(var(--lf-primary-rgb), .35); outline-offset: -2px; }
.kanban-card {
    cursor: grab; border-radius: var(--lf-radius-sm) !important;
    box-shadow: var(--lf-shadow-sm); border: 1px solid var(--lf-border);
    transition: box-shadow var(--lf-transition), transform var(--lf-transition);
}
.kanban-card:hover { box-shadow: var(--lf-shadow); transform: translateY(-2px); }
.kanban-card:active { cursor: grabbing; }
#board { padding-bottom: .5rem; }

/* ---------------------------------------------------------------------
   11. Auth pages (split brand + form)
   --------------------------------------------------------------------- */
.auth-wrapper {
    min-height: 100vh; display: flex; align-items: stretch; justify-content: center;
    background: var(--lf-bg);
}
.auth-shell {
    display: grid; grid-template-columns: 1.05fr .95fr;
    width: 100%; max-width: 1180px; margin: auto; padding: 1.25rem;
    gap: 0; align-items: center;
}
.auth-aside {
    position: relative; overflow: hidden;
    border-radius: var(--lf-radius-lg);
    background: linear-gradient(140deg, #312e81 0%, var(--lf-primary) 45%, var(--lf-accent) 115%);
    color: #fff; padding: 3rem 3rem; min-height: 560px;
    display: flex; flex-direction: column; justify-content: center;
    box-shadow: var(--lf-shadow-lg);
}
.auth-aside::before, .auth-aside::after {
    content: ""; position: absolute; border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, rgba(255, 255, 255, .25), transparent 65%);
}
.auth-aside::before { width: 340px; height: 340px; top: -120px; inset-inline-end: -90px; }
.auth-aside::after { width: 260px; height: 260px; bottom: -110px; inset-inline-start: -70px; opacity: .7; }
.auth-aside .a-brand { display: flex; align-items: center; gap: .65rem; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; position: relative; }
.auth-aside .a-brand .brand-mark { width: 44px; height: 44px; border-radius: 13px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; font-size: 1.35rem; backdrop-filter: blur(4px); }
.auth-aside .a-head { font-size: 2rem; font-weight: 800; line-height: 1.15; margin: 2rem 0 .75rem; letter-spacing: -.03em; position: relative; }
.auth-aside .a-sub { color: rgba(255, 255, 255, .82); font-size: 1.02rem; position: relative; max-width: 34ch; }
.auth-aside .a-feats { list-style: none; padding: 0; margin: 2.25rem 0 0; display: grid; gap: .9rem; position: relative; }
.auth-aside .a-feats li { display: flex; align-items: center; gap: .75rem; font-size: .98rem; color: rgba(255, 255, 255, .92); }
.auth-aside .a-feats i { width: 30px; height: 30px; border-radius: 9px; background: rgba(255, 255, 255, .18); display: grid; place-items: center; flex-shrink: 0; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card {
    width: 100%; max-width: 430px; border: 1px solid var(--lf-border);
    border-radius: var(--lf-radius-lg); background: var(--lf-surface);
    box-shadow: var(--lf-shadow-lg);
}
.auth-brand { font-weight: 800; font-size: 1.4rem; color: var(--lf-heading); display: inline-flex; align-items: center; gap: .5rem; }
.auth-brand .brand-mark { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, var(--lf-primary), var(--lf-accent)); color: #fff; display: grid; place-items: center; font-size: 1.05rem; box-shadow: var(--lf-shadow-brand); }
.auth-mobile-brand { display: none; }

@media (max-width: 991.98px) {
    .auth-shell { grid-template-columns: 1fr; max-width: 480px; }
    .auth-aside { display: none; }
    .auth-mobile-brand { display: block; }
}

/* ---------------------------------------------------------------------
   12. Public quotation document
   --------------------------------------------------------------------- */
body.lf-doc { background: var(--lf-bg); }
.lf-doc .card { box-shadow: var(--lf-shadow-lg); border-radius: var(--lf-radius-lg); }

/* Contract document — professional legal-paper presentation */
.contract-paper {
    max-width: 880px; margin: 0 auto;
    background: var(--lf-surface);
    border: 1px solid var(--lf-border);
    border-radius: var(--lf-radius-lg);
    box-shadow: var(--lf-shadow-lg);
    padding: clamp(1.5rem, 4vw, 3.5rem);
    position: relative; overflow: hidden;
}
.contract-paper::before {
    content: ""; position: absolute; top: 0; inset-inline: 0; height: 5px;
    background: linear-gradient(90deg, var(--lf-primary), var(--lf-accent));
}
.contract-body { color: var(--lf-muted); line-height: 1.85; font-size: .98rem; }
.contract-body h2 { font-size: 1.6rem; font-weight: 800; text-align: center; color: var(--lf-heading); margin: .25rem 0 2rem; letter-spacing: -.02em; }
.contract-body h3 { font-size: 1.02rem; font-weight: 700; color: var(--lf-heading); margin: 1.75rem 0 .6rem; padding-bottom: .4rem; border-bottom: 1px solid var(--lf-border); }
.contract-body p { margin: 0 0 .9rem; }
.contract-body strong { color: var(--lf-text); font-weight: 700; }
.contract-body table { width: 100%; margin-top: 2.5rem; border-top: 1px dashed var(--lf-border-strong); }
.contract-body td { padding-top: 1.75rem; color: var(--lf-text); font-size: .92rem; vertical-align: top; line-height: 2.1; }

/* Clean printing for documents (hides the app shell) */
@media print {
    .app-sidebar, .app-topbar, .sidebar-backdrop, .d-print-none, .alert { display: none !important; }
    .app-main { margin-inline-start: 0 !important; }
    .app-content { padding: 0 !important; animation: none !important; }
    .contract-paper { box-shadow: none; border: none; max-width: 100%; padding: 0; }
    .contract-paper::before { display: none; }
    body { background: #fff !important; }
}

/* ---------------------------------------------------------------------
   13. Utilities
   --------------------------------------------------------------------- */
.shadow-sm { box-shadow: var(--lf-shadow-sm) !important; }
.shadow { box-shadow: var(--lf-shadow) !important; }
.border { border-color: var(--lf-border) !important; }
.bg-light { background-color: var(--lf-surface-2) !important; }
.bg-white { background-color: var(--lf-surface) !important; }
pre { color: var(--lf-text); }

/* ---------------------------------------------------------------------
   14. Responsive shell
   --------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: var(--lf-shadow-lg); }
    [dir="rtl"] .app-sidebar { transform: translateX(100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-sidebar .brand .brand-close { display: block; }
    .app-main { margin-inline-start: 0; }
    .app-topbar { padding: 0 1rem; }
    .app-content { padding: 1.15rem; }
}

/* ---------------------------------------------------------------------
   15. Notification center (bell dropdown + toasts) — Module 18
   --------------------------------------------------------------------- */
.notify-item { color: inherit; transition: background-color .12s ease; }
.notify-item:hover { background: var(--bs-tertiary-bg, rgba(0,0,0,.04)); }
.notify-item.unread { background: rgba(79,70,229,.06); }
.notify-item.unread::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: var(--lf-primary, #4f46e5); align-self: center; flex: 0 0 auto; margin-inline-start: -.15rem;
}
.notify-pulse { animation: notify-pulse .6s ease 2; }
@keyframes notify-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

/* ---------------------------------------------------------------------
   16. Accessibility (WCAG 2.1 AA) — keyboard focus + screen-reader helpers
   --------------------------------------------------------------------- */
/* Always-visible, brand-coloured keyboard focus indicator on every interactive element (WCAG 2.4.7). */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.page-link:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--lf-primary);
    outline-offset: 2px;
    border-radius: 6px;
}
/* Sidebar links sit flush, so pull the ring inside to keep it visible. */
.app-sidebar .nav-link:focus-visible { outline-offset: -3px; }

/* Visually-hidden text that remains available to screen readers (for icon-only context). */
.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;
}

/* ---------------------------------------------------------------------
   17. Reduced motion
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
