/* ============================================================
   MAIN STYLESHEET - ShowRunner
   Global reset, custom properties, typography, layout,
   and reusable component classes.
   ============================================================ */

/* ----- CSS Custom Properties ----- */
:root {
    color-scheme: light;

    /* Primary */
    --primary:        #6366f1;
    --primary-dark:   #4F46E5;
    --primary-light:  #EEF2FF;
    --primary-50:     #F5F7FF;

    /* Semantic */
    --success:        #2EA44F;
    --success-light:  #DAFBE1;
    --warning:        #E68A00;
    --warning-light:  #FFF4CC;
    --danger:         #D93025;
    --danger-light:   #FCE8E6;
    --info:           #1A73E8;
    --info-light:     #E8F0FE;

    /* Grays (warm neutral — no blue tint) */
    --gray-50:  #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #D5D5D5;
    --gray-400: #9E9E9E;
    --gray-500: #757575;
    --gray-600: #555555;
    --gray-700: #333333;
    --gray-800: #222222;
    --gray-900: #111111;

    /* Surfaces */
    --bg:       #F8F9FC;
    --bg-card:  #ffffff;

    /* Text */
    --text:         #222222;
    --text-primary: #222222;
    --text-muted:   #64748B;

    /* Semantic backgrounds */
    --warning-bg:   #FFF4CC;
    --danger-bg:    #FCE8E6;

    /* Borders & Radii */
    --border:       #E8ECF1;
    --border-hover: #D5D5D5;
    --radius-xs:  3px;
    --radius-sm:  8px;
    --radius:     10px;
    --radius-md:  10px;
    --radius-lg:  12px;
    --radius-xl:  16px;

    /* Shadows (flatter) */
    --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow:     0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.06), 0 4px 6px rgba(0, 0, 0, 0.03);
    --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.08), 0 8px 10px rgba(0, 0, 0, 0.03);

    /* Typography */
    --font: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-size-xs:  0.6875rem;
    --font-size-sm:  0.75rem;
    --font-size-md:  0.8125rem;
    --font-size-base: 0.875rem;
    --font-size-lg:  1rem;
    --font-size-xl:  1.125rem;
    --font-size-2xl: 1.375rem;
    --font-size-3xl: 1.75rem;

    /* Transitions */
    --transition-fast:   0.1s ease;
    --transition:        0.2s ease;
    --transition-slow:   0.3s ease;

    /* Layout */
    --sidebar-width: 240px;
    --sidebar-width-collapsed: 56px;
    --header-height: 52px;

    /* Header search */
    --header-search-bg: #F1F5F9;
    --header-search-border: #E2E8F0;
}

/* ----- Dark Mode ----- */
@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) {
        color-scheme: dark;

        --primary:        #818cf8;
        --primary-dark:   #6366f1;
        --primary-light:  #1E1B4B;
        --primary-50:     #1a1744;

        --success:        #3FB950;
        --success-light:  #0D3117;
        --warning:        #F0A500;
        --warning-light:  #3D2800;
        --danger:         #F85149;
        --danger-light:   #3D1114;
        --info:           #58A6FF;
        --info-light:     #0D2240;

        --gray-50:  #1A1A1A;
        --gray-100: #252525;
        --gray-200: #333333;
        --gray-300: #444444;
        --gray-400: #666666;
        --gray-500: #999999;
        --gray-600: #BBBBBB;
        --gray-700: #D5D5D5;
        --gray-800: #EEEEEE;
        --gray-900: #F5F5F5;

        --bg:       #111318;
        --bg-card:  #1A1D2B;

        --text:         #E0E0E0;
        --text-primary: #E0E0E0;
        --text-muted:   #94A3B8;

        --warning-bg:   #3D2800;
        --danger-bg:    #3D1114;

        --border:       #1E2235;
        --border-hover: #2D3348;

        --header-search-bg: #1E2235;
        --header-search-border: #2D3348;

        --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow:     0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
        --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.4), 0 4px 6px rgba(0, 0, 0, 0.3);
        --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.5), 0 8px 10px rgba(0, 0, 0, 0.3);
    }
}

/* Manual dark mode toggle — applied to <html> so it overrides :root directly */
.theme-dark {
    color-scheme: dark;

    --primary:        #818cf8;
    --primary-dark:   #6366f1;
    --primary-light:  #1E1B4B;
    --primary-50:     #1a1744;

    --success:        #3FB950;
    --success-light:  #0D3117;
    --warning:        #F0A500;
    --warning-light:  #3D2800;
    --danger:         #F85149;
    --danger-light:   #3D1114;
    --info:           #58A6FF;
    --info-light:     #0D2240;

    --gray-50:  #1A1A1A;
    --gray-100: #252525;
    --gray-200: #333333;
    --gray-300: #444444;
    --gray-400: #666666;
    --gray-500: #999999;
    --gray-600: #BBBBBB;
    --gray-700: #D5D5D5;
    --gray-800: #EEEEEE;
    --gray-900: #F5F5F5;

    --bg:       #111318;
    --bg-card:  #1A1D2B;

    --text:         #E0E0E0;
    --text-primary: #E0E0E0;
    --text-muted:   #94A3B8;

    --warning-bg:   #3D2800;
    --danger-bg:    #3D1114;

    --border:       #1E2235;
    --border-hover: #2D3348;

    --header-search-bg: #1E2235;
    --header-search-border: #2D3348;

    --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow:     0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.4), 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.5), 0 8px 10px rgba(0, 0, 0, 0.3);
}

/* Dark-mode select dropdown arrow */
.theme-dark .form-select,
.theme-dark select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999999' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) .form-select,
    :root:not(.theme-light) select.form-control {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999999' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
    }
}

/* ----- CSS Reset ----- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    display: block;
    max-width: 100%;
}

/* SVG icons inside buttons, links, sidebar, and header should stay inline */
svg {
    max-width: 100%;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ----- Custom Scrollbar (Global) ----- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}
::-webkit-scrollbar-corner {
    background: transparent;
}

/* ----- Custom Range Slider ----- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: transparent;
    cursor: pointer;
    padding: 0;
    margin: 8px 0;
}

/* --- Track --- */
input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: var(--gray-200);
    border: none;
    transition: background 0.15s;
}
input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: var(--gray-200);
    border: none;
}

/* --- Filled portion (Firefox only — Webkit uses JS or gradient) --- */
input[type="range"]::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--primary);
}

/* --- Thumb --- */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
    margin-top: -6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* --- Hover --- */
input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(99,102,241,0.35), 0 0 0 1px rgba(0,0,0,0.04);
}
input[type="range"]:hover::-moz-range-thumb {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(99,102,241,0.35), 0 0 0 1px rgba(0,0,0,0.04);
}

/* --- Active / dragging --- */
input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.25);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent), 0 2px 8px rgba(99,102,241,0.3);
}
input[type="range"]:active::-moz-range-thumb {
    transform: scale(1.25);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent), 0 2px 8px rgba(99,102,241,0.3);
}

/* --- Focus visible --- */
input[type="range"]:focus-visible::-webkit-slider-thumb {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
input[type="range"]:focus-visible::-moz-range-thumb {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- Disabled --- */
input[type="range"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
input[type="range"]:disabled::-webkit-slider-thumb {
    background: var(--gray-400);
    box-shadow: none;
    transform: none;
}
input[type="range"]:disabled::-moz-range-thumb {
    background: var(--gray-400);
    box-shadow: none;
    transform: none;
}

/* Prevent body scrolling when modal is open */
body.modal-open {
    overflow: hidden;
}

/* ----- Focus Accessibility ----- */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ----- Typography ----- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--gray-900);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: 1rem; }
h6 { font-size: var(--font-size-md); }

.text-muted {
    color: var(--text-muted);
}

/* ----- Application Layout ----- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    transition: width var(--transition-slow);
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: none;
    gap: 0.5rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.header-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.header-menu-btn:hover {
    background: var(--gray-100);
}

.header-menu-icon {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    position: relative;
    transition: background var(--transition-fast);
}

.header-menu-icon::before,
.header-menu-icon::after {
    content: '';
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    position: absolute;
    left: 0;
    transition: transform var(--transition);
}

.header-menu-icon::before { top: -6px; }
.header-menu-icon::after  { top: 6px; }

/* --- Breadcrumbs --- */
.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
}
.header-breadcrumb .breadcrumb-icon { display: flex; align-items: center; color: var(--text-muted); }
.header-breadcrumb .breadcrumb-parent { color: var(--text-muted); }
.header-breadcrumb .breadcrumb-sep { color: var(--border); margin: 0 2px; }
.header-breadcrumb .breadcrumb-current { color: var(--text); font-weight: 500; }

/* --- Search Trigger --- */
.header-search-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--header-search-bg);
    border: 1px solid var(--header-search-border);
    border-radius: 8px;
    padding: 6px 12px;
    width: 220px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 12px;
    transition: border-color 0.15s;
}
.header-search-trigger:hover { border-color: var(--primary); }
.header-search-text { flex: 1; }
.header-search-kbd {
    background: var(--border);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    color: var(--text-muted);
}

/* --- Icon Buttons (theme, notification) --- */
.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
}
.header-icon-btn:hover { background: var(--gray-100); }

/* --- Notification Badge --- */
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* --- Profile --- */
.header-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.header-profile:hover { background: var(--gray-100); }
.header-avatar {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}
.header-profile-info { line-height: 1.2; }
.header-profile-name { font-size: 12px; font-weight: 500; color: var(--text); }
.header-profile-role { font-size: 10px; color: var(--text-muted); }
.header-profile-chevron { color: var(--text-muted); display: flex; align-items: center; }

/* --- Profile Dropdown --- */
.header-profile-dropdown {
    position: absolute;
    top: calc(var(--header-height) - 4px);
    right: 16px;
    width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 200;
    padding: 4px;
}
.header-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12.5px;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background 0.15s;
}
.header-dropdown-item:hover { background: var(--gray-100); }
.header-dropdown-item--danger { color: var(--danger); }
.header-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Hide profile info on mobile */
@media (max-width: 768px) {
    .header-profile-info,
    .header-profile-chevron,
    .header-search-trigger { display: none; }
}

/* --- Trial / Subscription Banner --- */
.trial-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 1rem;
    font-size: 12.5px;
    font-weight: 500;
    color: #fff;
    position: relative;
    z-index: 99;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease;
}
.trial-banner--visible {
    opacity: 1;
    max-height: 40px;
}
.trial-banner--hiding {
    opacity: 0;
    max-height: 0;
}
.trial-banner--trial {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}
.trial-banner--urgent {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    animation: trial-banner-pulse 2s ease-in-out infinite;
}
.trial-banner--expired {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}
.trial-banner--cancelled {
    background: linear-gradient(90deg, #6b7280, #4b5563);
}
.trial-banner__content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.trial-banner__message {
    line-height: 1.3;
}
.trial-banner__cta {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.5);
    transition: border-color 0.15s;
}
.trial-banner__cta:hover {
    border-color: #fff;
}
.trial-banner__close {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.75);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}
.trial-banner__close:hover {
    color: #fff;
}

@keyframes trial-banner-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.app-content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    animation: pageFadeIn 0.15s ease-in;
}

@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* When planner workspace is active, remove overflow so sidebar position:sticky
   works against the viewport scroll instead of being trapped in .app-content.
   Uses :has() with JS class fallback for broader browser support. */
.app-content:has(.planner-workspace),
.app-content.planner-active {
    overflow-y: visible;
    padding: 0;
}

/* Restore padding on the page header above the planner workspace */
.app-content:has(.planner-workspace) > .page-header,
.app-content.planner-active > .page-header {
    padding: 16px 24px 0;
    margin-bottom: 0;
}

/* ----- Page Header ----- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h2 {
    margin: 0;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header-right,
.page-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ----- Breadcrumb ----- */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.breadcrumb-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumb-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-muted);
    user-select: none;
}

.breadcrumb-current {
    font-weight: 600;
    color: var(--text);
}

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
    box-shadow: none;
}

.btn-success:hover:not(:disabled) {
    filter: brightness(0.9);
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    box-shadow: none;
}

.btn-danger:hover:not(:disabled) {
    filter: brightness(0.9);
    box-shadow: none;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
    box-shadow: none;
}

.btn-warning:hover:not(:disabled) {
    filter: brightness(0.9);
    box-shadow: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--text);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

/* ----- Badges ----- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--gray-100);
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-muted {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* ----- Card ----- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    margin: 0;
    font-size: 0.875rem;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ----- Form Elements ----- */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.4rem 0.65rem;
    font-size: var(--font-size-md);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-hover);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 12%, transparent);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--gray-400);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.form-error {
    font-size: var(--font-size-xs);
    color: var(--danger);
    margin-top: 0.25rem;
}

/* ----- KPI Card ----- */
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition);
}

.kpi-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.kpi-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.kpi-card-icon {
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--primary-50);
}

.kpi-card-change {
    font-size: var(--font-size-sm);
    font-weight: 700;
}

.kpi-card-change--positive {
    color: var(--success);
}

.kpi-card-change--negative {
    color: var(--danger);
}

.kpi-card-value {
    font-size: var(--font-size-2xl);
    font-weight: 900;
    color: var(--gray-900);
}

.kpi-card-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

/* ----- Detail Table ----- */
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table td {
    padding: 0.4rem 0.5rem;
    font-size: var(--font-size-md);
    vertical-align: top;
}

/* ----- Skeleton Loading ----- */
.skeleton {
    background: linear-gradient(90deg,
        var(--gray-100) 25%,
        var(--gray-200) 50%,
        var(--gray-100) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-xs);
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

.skeleton-table-row {
    height: 48px;
    margin-bottom: 4px;
    border-radius: var(--radius-xs);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ----- Loading Spinner ----- */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: var(--font-size-md);
}

.loading-spinner::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 0.75rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ----- Empty State ----- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-message {
    font-size: var(--font-size-md);
    margin-bottom: 1rem;
}

/* ----- Button Spinner ----- */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

/* ----- Tabs ----- */
.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    gap: 0;
    overflow-x: auto;
}

.tab-btn {
    padding: 0.6rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    transition: color var(--transition);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    font-weight: 700;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

/* ----- form-control alias (JS uses form-control, CSS defines form-input) ----- */
.form-control {
    width: 100%;
    padding: 0.4rem 0.65rem;
    font-size: var(--font-size-md);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:hover {
    border-color: var(--border-hover);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 12%, transparent);
}

.form-control::placeholder {
    color: var(--gray-400);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.form-control--error {
    border-color: var(--danger);
}

.form-control--error:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 15%, transparent);
}

/* ----- Form Grid (two-column layout) ----- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.25rem;
}

.form-group--wide,
.form-grid .form-group--wide {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ----- List Toolbar (search + filters row) ----- */
.list-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.search-wrapper {
    flex: 1;
    min-width: 200px;
}

.search-input {
    width: 100%;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-select {
    min-width: 140px;
}

@media (max-width: 640px) {
    .list-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        flex: 1;
    }
}

/* ----- Table Responsive Wrapper ----- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Clickable table rows */
.table-row-clickable {
    cursor: pointer;
    transition: background var(--transition-fast);
}

.table-row-clickable:hover {
    background: var(--gray-50) !important;
}

/* ----- Pagination ----- */
.pagination-wrapper {
    margin-top: 1rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.pagination-info {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    white-space: nowrap;
}

/* ----- Detail Grid (detail pages) ----- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.detail-card {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.detail-card--wide {
    grid-column: 1 / -1;
}

.detail-card--highlight {
    grid-column: 1 / -1;
    background: var(--primary-50);
    padding: 1rem;
    border-radius: var(--radius);
    border-bottom: none;
}

.detail-card-header {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.detail-card-body {
    font-size: var(--font-size-md);
}

.detail-label {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
}

.detail-value {
    font-size: var(--font-size-md);
    color: var(--text);
    word-break: break-word;
}

/* ----- Notes Section ----- */
.notes-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notes-form {
    margin-bottom: 0.5rem;
}

.note-item {
    margin-bottom: 0.5rem;
}

.note-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    flex-wrap: wrap;
}

.note-meta {
    font-size: var(--font-size-xs);
}

.note-content {
    font-size: var(--font-size-md);
    line-height: 1.6;
    white-space: pre-line;
}

/* ----- Attachments Section ----- */
.attachments-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ----- Tabs (BEM variant used by JS) ----- */
.tabs {
    margin-top: 0;
}

.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    gap: 0;
    overflow-x: auto;
}

.tab-btn--active {
    color: var(--primary);
    font-weight: 700;
}

.tab-btn--active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

.tab-content {
    padding: 0.5rem 0;
}

/* ----- Page Loading ----- */
.page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

/* ----- Page Title (inline with header) ----- */
.page-title {
    margin: 0;
    font-size: var(--font-size-2xl);
    font-weight: 700;
}

/* ----- Extra Utility Classes ----- */
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-primary { color: var(--primary); }

.link-primary {
    color: var(--primary);
    font-weight: 400;
}

.link-primary:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ----- Notification Dropdown ----- */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 500;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: var(--font-size-md);
}

.notif-dropdown-body {
    overflow-y: auto;
    max-height: 380px;
    flex: 1;
}

.notif-item {
    display: flex;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notif-item:hover {
    background: var(--gray-50);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item--unread {
    background: var(--primary-50);
}

.notif-item--unread:hover {
    background: var(--primary-light);
}

.notif-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.notif-item-dot--info    { background: var(--info); }
.notif-item-dot--success { background: var(--success); }
.notif-item-dot--warning { background: var(--warning); }
.notif-item-dot--error   { background: var(--danger); }

.notif-item-content {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.125rem;
}

.notif-item-message {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notif-item-time {
    font-size: 0.6875rem;
}

.notif-mark-all {
    font-size: var(--font-size-xs) !important;
    padding: 0.25rem 0.5rem !important;
}

@media (max-width: 480px) {
    .notification-dropdown {
        width: calc(100vw - 2rem);
        right: -1rem;
    }
}

/* ----- Utility Classes ----- */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-sm      { font-size: var(--font-size-sm); }
.text-xs      { font-size: var(--font-size-xs); }
.font-semibold { font-weight: 700; }
.font-bold    { font-weight: 700; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1   { gap: 0.25rem; }
.gap-2   { gap: 0.5rem; }
.gap-3   { gap: 1rem; }
.gap-4   { gap: 1.5rem; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-nowrap { white-space: nowrap; }

/* Compact table variant (less padding) */
.table--compact th,
.table--compact td {
    padding: 0.4rem 0.6rem;
    font-size: var(--font-size-sm);
}

.table--compact {
    width: 100%;
    border-collapse: collapse;
}

.table--compact thead th {
    background: var(--gray-50);
    font-weight: 700;
    text-align: left;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.6875rem;
}

.table--compact tbody tr {
    border-bottom: 1px solid var(--gray-100);
}

.table--compact tbody tr:hover {
    background: var(--gray-50);
}

/* ----- Mobile Sidebar Backdrop ----- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 199;
    animation: modalFadeIn 0.2s ease-out;
}

.sidebar-backdrop--active {
    display: block;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        z-index: 200;
        left: 0;
        top: 0;
        width: var(--sidebar-width) !important; /* Override inline collapsed width */
        height: 100vh;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
    }

    .app-sidebar.sidebar--open {
        transform: translateX(0);
    }

    .header-menu-btn {
        display: flex;
    }

    .app-content {
        padding: 0.75rem;
    }

    /* Page header stacks on tablet/mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .page-header-right {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .page-header-right .btn {
        flex: 1 1 auto;
    }

    /* Detail grid single column on tablet */
    .detail-grid {
        grid-template-columns: 1fr;
    }

    /* Tab buttons scroll horizontally */
    .tab-nav,
    .tabs-header {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tab-nav::-webkit-scrollbar,
    .tabs-header::-webkit-scrollbar {
        display: none;
    }

    /* Card bodies less padding on mobile */
    .card-body {
        padding: 0.75rem;
    }

    /* Breadcrumb wrap */
    .breadcrumb {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .app-content {
        padding: 0.5rem;
    }

    /* Minimum touch targets */
    .btn {
        min-height: 40px;
    }

    .btn-sm {
        min-height: 34px;
    }

    /* Header compact on small screens */
    .header-right {
        gap: 0.25rem;
    }

    /* Pagination compact */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    .pagination-info {
        font-size: var(--font-size-xs);
    }

    /* Page title smaller on mobile */
    .page-title,
    .page-header h2 {
        font-size: 1.1rem;
    }

    /* Card header responsive */
    .card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Badges slightly larger for readability */
    .badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.5rem;
    }
}

/* ----- Print Styles ----- */
@media print {
    .app-sidebar,
    .app-header,
    .page-header-right,
    .page-header-actions,
    .btn,
    .toast-container,
    .notification-badge,
    #toast-container {
        display: none !important;
    }

    .app-layout {
        display: block;
    }

    .app-main {
        width: 100%;
    }

    .app-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    body {
        background: white;
        color: black;
        font-size: 12pt;
    }
}

/* --- Global Search Overlay --- */
.global-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}
.global-search-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 520px;
    max-height: 60vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
}
.global-search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.global-search-icon { color: var(--text-muted); display: flex; }
.global-search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 14px;
    color: var(--text);
    outline: none;
}
.global-search-input::placeholder { color: var(--text-muted); }
.global-search-results {
    overflow-y: auto;
    max-height: calc(60vh - 50px);
}
.global-search-category {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.global-search-item {
    display: flex;
    flex-direction: column;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.1s;
}
.global-search-item:hover { background: var(--gray-100); }
.global-search-item-title { font-size: 13px; }
.global-search-item-sub { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   REPORTS — Tabs, Cards, Date Picker, Chart Containers
   ============================================================ */

/* Report Tabs */
.report-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.report-tab { padding: 10px 20px; border: none; background: none; color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; border-radius: 6px 6px 0 0; transition: color 0.15s; }
.report-tab:hover { color: var(--text-secondary, var(--text)); }
.report-tab--active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.report-tab--disabled { opacity: 0.4; cursor: not-allowed; }

/* Report Index Cards */
.report-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.report-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; cursor: pointer; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.report-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.report-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.report-card-icon { padding: 8px; border-radius: 8px; display: inline-flex; }
.report-card-badge { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 4px; }
.report-card-badge--new { background: rgba(99,102,241,0.1); color: var(--primary); }
.report-card-badge--upgraded { background: rgba(34,197,94,0.1); color: #22c55e; }
.report-card h3 { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.report-card p { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; line-height: 1.5; }
.report-card-tags { display: flex; gap: 6px; }
.report-card-tag { font-size: 10px; color: var(--text-muted); background: var(--bg); padding: 2px 8px; border-radius: 4px; }
.report-card--disabled { opacity: 0.4; cursor: not-allowed; border-style: dashed; }
.report-card--disabled:hover { border-color: var(--border); transform: none; box-shadow: none; }

/* Date Range Picker */
.date-range-picker { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-range-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-right: 4px; }
.date-range-preset { padding: 5px 12px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--text-secondary, var(--text)); font-size: 11.5px; cursor: pointer; font-weight: 500; transition: all 0.15s; }
.date-range-preset:hover { background: var(--bg-hover, rgba(0,0,0,0.04)); }
.date-range-preset--active { border-color: var(--primary); background: rgba(99,102,241,0.12); color: var(--primary); font-weight: 600; }
.date-range-divider { height: 20px; width: 1px; background: var(--border); margin: 0 4px; }
.date-range-custom { display: flex; align-items: center; gap: 6px; }
.date-range-input { padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 11.5px; }
.date-range-sep { color: var(--text-muted); font-size: 11px; }

/* Report Page Header */
.report-page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.25rem; }
.report-breadcrumbs { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.report-breadcrumb-link { color: var(--primary); text-decoration: none; }
.report-breadcrumb-link:hover { text-decoration: underline; }
.report-breadcrumb-sep { margin: 0 6px; }
.report-breadcrumb-current { color: var(--text); }
.report-page-title { font-size: 18px; font-weight: 700; margin: 0; }
.report-export-bar { display: flex; gap: 8px; }
.report-export-csv { display: flex; align-items: center; gap: 6px; }

/* Report KPI Change Indicators */
.report-kpi-change { font-size: 11px; margin-top: 4px; }
.report-kpi-change--up { color: #22c55e; }
.report-kpi-change--down { color: #ef4444; }

/* Report Chart Container */
.report-chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.report-chart-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.report-chart-card-header h4 { font-size: 13px; font-weight: 600; margin: 0; }
.report-chart-canvas-wrap { position: relative; height: 300px; }
.report-chart-legend { display: flex; gap: 16px; font-size: 11px; color: var(--text-muted); margin-top: 12px; }
.report-chart-legend-item { display: flex; align-items: center; gap: 5px; }
.report-chart-legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
