/* ============================================================================
   SimEye DR - app stylesheet (loads AFTER vendor/spark-admin/main.css)

   1. Identity: re-maps the Spark Admin design tokens to this app's navy /
      slate palette and Inter / Playfair Display fonts (project decision:
      adopt Spark Admin chrome, keep current identity).
   2. Chrome overrides for the Spark shell (navbar, sidebar, footer).
   3. Legacy component styles carried over from the previous base.html so
      every page keeps working on the new chrome.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   1. Design tokens (app identity + Spark token re-map)
--------------------------------------------------------------------------- */
:root {
    /* App identity - Shadcn Next.js Modern Typography & Zinc Design Tokens */
    --font-heading: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --primary: #12285f;
    --primary-dark: #0b1a42;
    --primary-light: #24408c;
    --bs-primary: #12285f;
    --bs-primary-rgb: 18, 40, 95;
    --secondary: #71717a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --surface: #ffffff;
    --surface-variant: #fafafa;
    --background: #fafafa;
    --outline: #e4e4e7;
    --border-light: #e4e4e7;
    --border-subtle: #f4f4f5;
    --on-surface: #09090b;
    --on-surface-variant: #71717a;
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 14px;

    /* Theme tokens mapped to modern dark sidebar & zinc canvas */
    --brand-forest-dark: #090e17;            /* dark zinc/navy sidebar canvas */
    --brand-forest-medium: #12285f;          /* brand surfaces = primary */
    --brand-forest-light: #162238;           /* interactive hover on dark */
    --brand-lime: #38bdf8;                   /* accent on dark = crisp sky */
    --brand-lime-hover: #7dd3fc;
    --brand-lime-translucent: rgba(56, 189, 248, 0.15);
    --text-main: #09090b;                    /* on-surface (Zinc-950) */
    --text-muted-green: #71717a;             /* on-surface-variant (Zinc-500) */
    --text-sidebar-muted: #94a3b8;           /* slate-blue for the dark sidebar */
    --card-background: #ffffff;
    --border-dark-green: rgba(255, 255, 255, 0.08);
    --bs-body-bg: #fafafa;                   /* Shadcn clean zinc canvas */
    --bs-body-font-family: var(--font-body);

    /* Radii scaled to Shadcn rounded-xl corners */
    --radius-xxl: 16px;
    --radius-xl: 14px;
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;

    /* Sidebar width */
    --sidebar-width: 300px;

    /* Content scale factor */
    --app-zoom: 0.8;
}

/* ---------------------------------------------------------------------------
   2. Base overrides (Modern Shadcn Typography & Spacing)
--------------------------------------------------------------------------- */
body {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: -0.011em;
    color: var(--on-surface);
    background: var(--background);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    zoom: var(--app-zoom);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Compensate the body zoom for viewport-sized fixed chrome */
.sidebar-wrapper {
    height: calc(100vh / var(--app-zoom));
}

.sidebar-overlay {
    width: calc(100vw / var(--app-zoom));
    height: calc(100vh / var(--app-zoom));
}

.main-wrapper {
    min-height: calc(100vh / var(--app-zoom));
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-heading);
    letter-spacing: -0.025em;
    font-weight: 600;
    color: var(--on-surface);
}

.page-title {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    font-weight: 750;
    letter-spacing: -0.03em;
    color: var(--on-surface);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    font-size: 0.925rem;
    color: #475569;
    font-weight: 500;
    margin-bottom: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--primary-dark);
}

/* ---------------------------------------------------------------------------
   3. Chrome overrides for the Spark shell
--------------------------------------------------------------------------- */

/* Two navbar zones; the global page search lives inside the left zone
   (input/button styling from the Spark theme's own navbar-search classes) */
.navbar-custom {
    grid-template-columns: 1fr auto !important;
    background-color: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid var(--outline) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
}

/* Global page search: results panel under the navbar input. The page
   list is permission-gated server side (apps/core/pages.py) and only
   filtered in the browser. */
.navbar-search-wrapper { z-index: 30; }
.navbar-search-input {
    background: #ffffff !important;
    border: 1px solid var(--outline) !important;
    border-radius: 8px !important;
    font-size: 0.84rem !important;
    color: var(--on-surface) !important;
    transition: all 0.15s ease !important;
}
.navbar-search-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(18, 40, 95, 0.1) !important;
}
.navbar-search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background-color: #FFFFFF;
    border: 1px solid var(--outline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.4rem;
    max-height: 60vh;
    overflow-y: auto;
}
.navbar-search-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--on-surface);
    text-decoration: none;
    transition: background 0.15s ease;
}
.navbar-search-item:hover,
.navbar-search-item.active {
    background-color: #f4f4f5;
    color: var(--on-surface);
}
.navbar-search-item .bi { color: var(--text-muted-green); }
.navbar-search-item-section {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted-green);
    white-space: nowrap;
}
.navbar-search-empty {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted-green);
}

/* ===========================================================================
   TOPBAR REDESIGN: Quick Actions, Notifications, and User Profile
   =========================================================================== */

/* --- 1. Quick-Action Shortcut Button & Dropdown --- */
.btn-quick-action {
    background: linear-gradient(135deg, #1e4635 0%, #2d6a4f 100%) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 50px !important;
    padding: 0.42rem 1rem !important;
    font-size: 0.825rem !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    box-shadow: 0 2px 6px rgba(27, 67, 50, 0.22) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    cursor: pointer;
}
.btn-quick-action:hover {
    background: linear-gradient(135deg, #163628 0%, #245740 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(27, 67, 50, 0.35) !important;
    transform: translateY(-1px);
}
.btn-quick-action:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(27, 67, 50, 0.2) !important;
}
.btn-quick-action i {
    transition: transform 0.25s ease;
}
/* Override theme's generic rotate(90deg) on hover */
.btn-quick-action:hover i {
    transform: none;
}
.btn-quick-action .quick-action-caret {
    font-size: 0.7rem;
    opacity: 0.85;
    transition: transform 0.2s ease;
}
.btn-quick-action[aria-expanded="true"] .quick-action-caret {
    transform: rotate(180deg);
}

/* Quick Actions Dropdown Menu */
.dropdown-menu-quick-action {
    min-width: 295px !important;
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 14px 34px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.05) !important;
    padding: 0.6rem !important;
    margin-top: 0.5rem !important;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.dropdown-menu-quick-action .dropdown-header {
    font-size: 0.72rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding: 0.4rem 0.6rem 0.35rem;
}
.quick-action-item {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem !important;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    background: transparent;
}
.quick-action-item:hover {
    background-color: #f8fafc !important;
    transform: translateX(2px);
}
.quick-action-icon-box {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}
.quick-action-item:hover .quick-action-icon-box {
    transform: scale(1.08);
}
.quick-action-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}
.quick-action-desc {
    font-size: 0.73rem;
    color: #64748b;
    line-height: 1.25;
    margin-top: 1px;
}

/* --- 2. Notification Center (Bell & Dropdown Panel) --- */
.navbar-action-btn.notif-bell-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 10px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}
.navbar-action-btn.notif-bell-btn:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    color: #1b4332;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}
.navbar-action-btn.notif-bell-btn[aria-expanded="true"] {
    background-color: #f1f5f9;
    border-color: #94a3b8;
    color: #1b4332;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 2px solid #ffffff;
    color: #ffffff;
    font-size: 10px;
    font-weight: 750;
    line-height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(220, 38, 38, 0.4);
}

.notif-menu {
    width: 360px !important;
    max-width: calc(100vw - 24px) !important;
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.14), 0 4px 12px -2px rgba(15, 23, 42, 0.06) !important;
    padding: 0 !important;
    overflow: hidden;
    margin-top: 0.5rem !important;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.notif-menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid #e2e8f0 !important;
}
.notif-menu-icon-circle {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    background-color: rgba(45, 106, 79, 0.12);
    color: #2d6a4f;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notif-menu-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}
.notif-mark-all {
    background: none;
    border: none;
    padding: 2px 6px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #2d6a4f;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}
.notif-mark-all:hover {
    background-color: rgba(45, 106, 79, 0.08);
    color: #1b4332;
    text-decoration: none;
}
.notif-list {
    max-height: 370px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}
.notif-item:last-child {
    border-bottom: 0;
}
.notif-item:hover {
    background-color: #f8fafc;
}
.notif-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    margin-top: 5px;
    border-radius: 999px;
}
.notif-dot-primary {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}
.notif-dot-medium {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}
.notif-dot-lowest {
    background: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}
.notif-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.notif-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}
.notif-message {
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.35;
}
.notif-meta {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 500;
}
.notif-empty {
    padding: 2.2rem 1.2rem;
    text-align: center;
}

/* --- 3. User Profile Button & Identity Menu --- */
.navbar-profile-btn {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 50px !important;
    padding: 0.25rem 0.85rem 0.25rem 0.25rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.65rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    cursor: pointer;
}
.navbar-profile-btn:hover {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06) !important;
    transform: translateY(-1px);
}
.navbar-profile-btn[aria-expanded="true"] {
    background-color: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12) !important;
}
.navbar-profile-avatar-initials {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 750;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(27, 67, 50, 0.25);
    flex-shrink: 0;
}
.navbar-profile-name {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    line-height: 1.15;
}
.navbar-profile-role {
    font-size: 0.69rem !important;
    font-weight: 550 !important;
    color: #64748b !important;
    line-height: 1.15;
}
.navbar-profile-caret {
    font-size: 0.7rem;
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.2s ease;
}
.navbar-profile-btn:hover .navbar-profile-caret {
    color: #2d6a4f;
}
.navbar-profile-btn[aria-expanded="true"] .navbar-profile-caret {
    transform: rotate(180deg) !important;
    color: #2d6a4f;
}

/* User Profile Dropdown Menu */
.dropdown-menu-profile {
    width: 290px !important;
    min-width: 290px !important;
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.14), 0 4px 12px -2px rgba(15, 23, 42, 0.06) !important;
    padding: 0.55rem !important;
    margin-top: 0.5rem !important;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.profile-dropdown-user-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 0.35rem;
}
.profile-card-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 750;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(27, 67, 50, 0.25);
    flex-shrink: 0;
}
.profile-card-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}
.profile-dropdown-item {
    display: flex !important;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem !important;
    border-radius: 8px;
    font-size: 0.83rem;
    font-weight: 550;
    color: #334155 !important;
    transition: all 0.15s ease-in-out;
    background: transparent;
    text-decoration: none;
}
.profile-dropdown-item i {
    font-size: 0.95rem;
    width: 20px;
    text-align: center;
}
.profile-dropdown-item:hover {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    transform: translateX(2px);
}
.dropdown-item-logout {
    color: #dc2626 !important;
    font-weight: 600;
}
.dropdown-item-logout:hover {
    background-color: #fef2f2 !important;
    color: #b91c1c !important;
}

/* Pages without a sidebar (login etc.) span the full width */
body.no-sidebar .main-wrapper { margin-left: 0; }

/* Legacy sidebar sub-trees (nav-subgroup / nav-sub) on the dark sidebar */
.sidebar-wrapper .nav-subgroup {
    margin: 0.25rem 0 0.5rem 2.15rem;
    border-left: 2px solid rgba(255, 255, 255, 0.14);
}
.sidebar-wrapper .nav-sub {
    display: block;
    position: relative;
    padding: 0.35rem 0.75rem;
    margin-left: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-sidebar-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.sidebar-wrapper .nav-sub::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    width: 0.75rem;
    height: 2px;
    background: rgba(255, 255, 255, 0.14);
}
.sidebar-wrapper .nav-sub:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}
.sidebar-wrapper .nav-sub.active { color: #ffffff; }
.sidebar-wrapper .nav-sub.active::before { background: var(--brand-lime); }

/* Quick-filter chips on the dark sidebar */
.sidebar-wrapper .filter-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
}
.sidebar-wrapper .filter-chip:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--brand-lime);
    color: #ffffff;
}
.sidebar-wrapper .filter-chip.active {
    background: var(--brand-lime);
    border-color: var(--brand-lime);
    color: var(--brand-forest-dark);
}

/* Hide the legacy trees when the sidebar is minimized (icon rail) */
body.sidebar-minimized .sidebar-wrapper .nav-subgroup,
body.sidebar-minimized .sidebar-wrapper .filter-chips {
    display: none !important;
}

/* Sidebar profile avatar (icon stand-in: no avatar images in this app) */
.sidebar-profile-avatar {
    font-size: 2.4rem;
    line-height: 1;
    color: var(--brand-lime);
}

/* Sidebar: the Spark template's own typeface (self-hosted under
   static/vendor/plus-jakarta-sans/, SIL OFL 1.1) */
.sidebar-wrapper,
.sidebar-overlay {
    font-family: 'Plus Jakarta Sans', var(--font-body);
}

/* Brand row: logo left, collapse toggle inside the sidebar right */
.sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2.5rem;
    min-height: 42px;
}
.sidebar-wrapper .sidebar-brand {
    margin-bottom: 0;
    padding-left: 0.5rem;
    display: flex;
    align-items: center;
}
.sidebar-wrapper .sidebar-brand img { display: block; }

/* Collapse button adapted to the dark sidebar (Spark styles it light) */
.sidebar-wrapper .btn-desktop-toggle {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--text-sidebar-muted);
    box-shadow: none;
    flex: 0 0 auto;
}
.sidebar-wrapper .btn-desktop-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--brand-lime);
    color: #ffffff;
}

/* Icon direction: point left (collapse) when open, right (expand) when minimized */
#desktop-sidebar-toggle .ic-expand { display: none; }
#desktop-sidebar-toggle .ic-collapse { display: flex; }
body.sidebar-minimized #desktop-sidebar-toggle .ic-collapse { display: none; }
body.sidebar-minimized #desktop-sidebar-toggle .ic-expand { display: flex; }

/* Collapsed (icon rail): logo hidden, toggle centered */
body.sidebar-minimized .sidebar-brand { display: none; }
body.sidebar-minimized .sidebar-brand-row {
    justify-content: center;
    margin-bottom: 2rem;
}

/* Collapsed (icon rail): the narrow menu rail keeps scrolling but its
   scrollbar is invisible (wheel/trackpad still scroll it) */
body.sidebar-minimized .sidebar-wrapper .overflow-y-auto {
    scrollbar-width: none;           /* Firefox */
    -ms-overflow-style: none;        /* legacy Edge */
}
body.sidebar-minimized .sidebar-wrapper .overflow-y-auto::-webkit-scrollbar {
    display: none;                   /* Chrome / Edge / Safari */
}

/* Topbar profile avatar (icon stand-in, styled like the navbar image) */
.navbar-profile-avatar {
    font-size: 1.9rem;
    line-height: 1;
    color: var(--primary);
}

/* Page content area: grows, keeps tables from overflowing the flex column */
.main-wrapper .page-content {
    flex: 1 1 auto;
    min-width: 0;
}

/* Footer: app copy + required theme attribution */
.footer-custom .footer-copy { color: var(--on-surface-variant); }

/* ---------------------------------------------------------------------------
   4. Legacy components (carried from the previous base.html)
--------------------------------------------------------------------------- */

/* Quick Filter Chips (light contexts: dashboards, list filters) */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--on-surface);
    transition: all 0.2s;
}

.filter-chip:hover {
    background: var(--surface-variant);
    border-color: var(--primary);
}

.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.filter-chip .material-icons-round { font-size: 1rem; }

/* Cards: Shadcn Modern Aesthetic (crisp 1px border, rounded-xl, subtle micro-shadow) */
.card {
    background: var(--surface);
    padding: 0;
    border: 1px solid var(--outline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    padding: 1rem 1.4rem !important;
    margin-bottom: 0 !important;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.015em;
    color: var(--on-surface);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-start;
}

.card-header .material-icons-round { color: var(--primary); }

.card-body { padding: 1.4rem; }

/* Featured Hero Tile (Total Active DR): Airbus navy to deep forest green */
.card.alert-green-card {
    background: linear-gradient(135deg, #12285f 0%, #1e4635 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 20px rgba(18, 40, 95, 0.16) !important;
}

/* Card headers and modern title styling */
.card-title, .card-title-modern {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--on-surface);
    margin-bottom: 0;
}

/* Stat Cards & KPI Figures */
.stat-card, .card-stat {
    background: var(--surface);
    border: 1px solid var(--outline) !important;
    border-radius: var(--radius-lg) !important;
    padding: 1.25rem 1.4rem !important;
    text-align: left;
    box-shadow: var(--shadow) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card:hover, .card-stat:hover {
    box-shadow: var(--shadow-md) !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-2px);
}

.stat-card .stat-value, .card-stat .stat-value {
    font-family: var(--font-heading);
    font-size: 2.35rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    color: var(--on-surface);
    line-height: 1;
    margin-top: 0.25rem;
    margin-bottom: 0.35rem;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "cv02" 1, "cv03" 1, "cv04" 1, "cv11" 1;
}

.stat-card .stat-label, .card-stat .stat-label {
    font-size: 0.8125rem;
    color: #475569;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
    line-height: 1.25;
}

.stat-card .hero-sub, .card-stat .hero-sub {
    font-size: 0.8125rem;
    color: #64748b;
    font-weight: 500;
    line-height: 1.35;
    margin-top: 0.35rem;
}

/* Global dashboard section headers - Clean, high-contrast typography */
.dash-sep {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 28px 0 16px;
    font-size: 0.825rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #334155;
    white-space: nowrap;
}
.dash-sep:first-child { margin-top: 0; }
.dash-sep span {
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    color: inherit;
}
.dash-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
    background: #f4f4f5;
}

.stat-card .stat-icon .material-icons-round {
    font-size: 1.35rem;
    color: var(--primary);
}

/* Tables - Shadcn Modern Aesthetic */
.table-custom, .table {
    --bs-table-bg: transparent;
    color: var(--on-surface);
    vertical-align: middle;
    margin-bottom: 0;
}

.table-custom thead th, .table thead th {
    background: #fcfcfd !important;
    color: var(--on-surface-variant) !important;
    font-size: 0.725rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-bottom: 1px solid var(--outline) !important;
    border-top: none !important;
    padding: 0.75rem 1rem !important;
    white-space: nowrap;
}

.table-custom tbody tr, .table tbody tr {
    border-bottom: 1px solid var(--border-subtle) !important;
    transition: background-color 0.15s ease !important;
}

.table-custom tbody tr:hover, .table tbody tr:hover {
    background-color: #f8fafc !important;
}

.table-custom tbody td, .table tbody td {
    padding: 0.8rem 1rem !important;
    font-size: 0.85rem !important;
    color: #18181b !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    vertical-align: middle !important;
}

/* Badges - Shadcn Soft Pill Badges */
.badge {
    font-family: var(--font-body);
    font-weight: 550;
    padding: 0.28rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.725rem;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid transparent;
}

.badge.status-OPEN {
    background: #fef2f2;
    color: #dc2626 !important;
    border-color: #fee2e2;
}
.badge.status-InWork {
    background: #eff6ff;
    color: #2563eb !important;
    border-color: #dbeafe;
}
.badge.status-Monitoring {
    background: #fffbeb;
    color: #b45309 !important;
    border-color: #fef3c7;
}
.badge.status-OnOffer {
    background: #faf5ff;
    color: #7e22ce !important;
    border-color: #f3e8ff;
}
.badge.status-OnHold {
    background: #f4f4f5;
    color: #52525b !important;
    border-color: #e4e4e7;
}
.badge.status-Cleared, .badge.status-CLOSED {
    background: #ecfdf5;
    color: #047857 !important;
    border-color: #a7f3d0;
}

.badge.severity-A {
    background: #fef2f2;
    color: #dc2626 !important;
    border-color: #fecaca;
    font-weight: 700;
}
.badge.severity-B {
    background: #fff7ed;
    color: #c2410c !important;
    border-color: #fed7aa;
    font-weight: 700;
}
.badge.severity-C {
    background: #fffbeb;
    color: #b45309 !important;
    border-color: #fde68a;
    font-weight: 700;
}
.badge.severity-D {
    background: #ecfdf5;
    color: #047857 !important;
    border-color: #a7f3d0;
    font-weight: 700;
}

/* Journey log status badges */
.badge.jl-status-completed {
    background: #e2e8f0 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}
.badge.jl-status-progress {
    background-color: #2563eb !important;
    color: #ffffff !important;
    border: 1px solid #1d4ed8 !important;
    font-weight: 600 !important;
}
.badge.jl-status-noshow {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca !important;
}
.badge.jl-status-booked {
    background: #f8fafc !important;
    color: #1e40af !important;
    border: 1px solid #cbd5e1 !important;
}

/* Buttons - Shadcn Modern Button Language */
.btn {
    font-family: var(--font-body);
    font-weight: 550;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.15s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    letter-spacing: -0.01em;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0 1px 3px rgba(18, 40, 95, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    box-shadow: 0 2px 6px rgba(18, 40, 95, 0.28);
}

.btn-outline-primary {
    border: 1px solid var(--outline);
    color: var(--primary);
    background: #ffffff;
}

.btn-outline-primary:hover {
    background: #f8fafc;
    border-color: var(--primary);
    color: var(--primary-dark);
}

.btn-outline-secondary, .btn-light {
    background: #ffffff;
    border: 1px solid var(--outline);
    color: var(--on-surface);
}

.btn-outline-secondary:hover, .btn-light:hover {
    background: #f4f4f5;
    border-color: #d4d4d8;
    color: var(--on-surface);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    border-radius: 10px;
}

/* Forms & Inputs */
.form-control, .form-select {
    font-family: var(--font-body);
    border: 1px solid var(--outline);
    border-radius: 8px;
    padding: 0.52rem 0.85rem;
    font-size: 0.85rem;
    color: var(--on-surface);
    background-color: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18, 40, 95, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--on-surface-variant);
    margin-bottom: 0.35rem;
}

/* Search Box */
.search-box { position: relative; }

.search-box .material-icons-round {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--on-surface-variant);
    pointer-events: none;
    font-size: 1.15rem;
}

.search-box input {
    padding-left: 2.6rem;
    border-radius: 8px;
}

/* Filter Section */
.filter-section {
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.filter-section h6 {
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
}

/* Action FABs & Icon Buttons */
.action-fab {
    width: 36px;
    height: 36px;
    border-radius: 8px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.15s ease;
}
.action-fab:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.action-fab.action-fab-lg {
    width: 40px;
    height: 40px;
    border-radius: 9px !important;
}

/* Action Items */
.action-item {
    border-left: 3px solid var(--primary);
    background: #f8fafc;
    border: 1px solid var(--outline);
    border-left: 3px solid var(--primary);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius-sm);
}

.action-item .action-meta {
    font-size: 0.825rem;
    color: var(--on-surface-variant);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-item .action-description {
    margin-top: 0.5rem;
    color: var(--on-surface);
    font-size: 0.875rem;
}

/* Pagination */
.pagination .page-link {
    color: var(--on-surface);
    border: 1px solid var(--outline);
    margin: 0 0.15rem;
    border-radius: 6px;
    padding: 0.4rem 0.85rem;
    font-size: 0.825rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}
.pagination .page-link:hover {
    background: #f4f4f5;
    border-color: #d4d4d8;
    color: var(--on-surface);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Alerts */
.alert {
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* Detail Rows */
.detail-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--on-surface-variant);
    min-width: 180px;
}

.detail-value {
    color: var(--on-surface);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Material Design FAB */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 1000;
    text-decoration: none;
}

.fab:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.fab .material-icons-round { font-size: 1.5rem; }

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--outline);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--on-surface-variant);
}

.empty-state .material-icons-round {
    font-size: 4rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .stat-card .stat-value { font-size: 2rem; }

    .table-custom { font-size: 0.875rem; }

    .table-custom thead th,
    .table-custom tbody td { padding: 0.75rem; }
}
