/* ========================================
   DESIGN TOKENS - Glass Shell System
   ======================================== */
:root {
    /* Base Surfaces */
    --surface-bg: #f5f7fa;
    --surface-frosted: rgba(255, 255, 255, 0.7);
    --surface-card: rgba(255, 255, 255, 0.85);
    --surface-overlay: rgba(0, 0, 0, 0.4);
    
    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-inverse: #ffffff;
    
    /* Brand Accents */
    --accent-purple: #581c87;
    --accent-purple-light: #7c3aed;
    --accent-purple-dark: #1e3a8a;
    --accent-yellow: #fbbf24;
    --accent-yellow-light: #fcd34d;
    
    /* Semantic Colours */
    --semantic-success: #10b981;
    --semantic-success-light: rgba(16, 185, 129, 0.1);
    --semantic-success-border: #10b981;
    
    --semantic-warning: #f59e0b;
    --semantic-warning-light: rgba(245, 158, 11, 0.1);
    --semantic-warning-border: #f59e0b;
    
    --semantic-danger: #ef4444;
    --semantic-danger-light: rgba(239, 68, 68, 0.1);
    --semantic-danger-border: #ef4444;
    
    --semantic-info: #3b82f6;
    --semantic-info-light: rgba(59, 130, 246, 0.1);
    --semantic-info-border: #3b82f6;
    
    --semantic-neutral: #6b7280;
    --semantic-neutral-light: rgba(107, 114, 128, 0.1);
    --semantic-neutral-border: #6b7280;
    
    /* Borders & Effects */
    --border-radius: 10px;
    --border-radius-sm: 6px;
    --border-radius-lg: 12px;
    --border-color: rgba(0, 0, 0, 0.1);
    --border-color-light: rgba(255, 255, 255, 0.15);
    
    /* Shadows — crisp, low-blur elevation (pro-software feel) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.14);
    
    /* Blur */
    --blur-sm: blur(8px);
    --blur-md: blur(12px);
    --blur-lg: blur(20px);
    
    /* Motion System — tight, snappy, deliberate */
    --transition-fast: 120ms ease;
    --transition-base: 150ms ease;
    --transition-slow: 200ms ease;
    
    /* Button Colours - Muted semantic */
    --btn-primary-bg: #6d28d9;
    --btn-primary-hover: #7c3aed;
    --btn-primary-active: #5b21b6;
    
    --btn-secondary-bg: rgba(255, 255, 255, 0.75);
    --btn-secondary-hover: rgba(255, 255, 255, 0.9);
    --btn-secondary-border: rgba(0, 0, 0, 0.12);
    
    --btn-destructive-bg: #b91c1c;
    --btn-destructive-hover: #dc2626;
    --btn-destructive-active: #991b1b;
    
    --btn-success-bg: #059669;
    --btn-success-hover: #10b981;
    --btn-success-active: #047857;
    
    --btn-warning-bg: #d97706;
    --btn-warning-hover: #f59e0b;
    --btn-warning-active: #b45309;
    
    /* Interactive Lift — restrained, pro-software */
    --lift-sm: translateY(-1px);
    --lift-md: translateY(-2px);
    
    /* Pro-Density Spacing */
    --panel-padding: 18px;
    --panel-gap: 16px;
    --card-padding: 14px 16px;
    --table-cell-padding: 8px 12px;
    
    /* Pro Typography */
    --label-size: 11px;
    --label-weight: 600;
    --label-spacing: 0.6px;
    --data-size: 13px;
    --section-title-size: 15px;
    
    /* Z-Index Layers */
    --z-dropdown: 200;
    --z-sticky: 300;
    --z-nav: 400;
    --z-modal-backdrop: 9000;
    --z-modal: 9500;
    --z-toast: 10000;
    
    /* Nav & Hero */
    --border-radius-xl: 16px;
    --shadow-nav: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
    --nav-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --nav-border: 1px solid rgba(255,255,255,0.12);
    --hero-height: 280px;

    /* Dark Mode Text Variables (for fullscreen-page templates) */
    --dark-text-primary: #ffffff;
    --dark-text-secondary: rgba(255, 255, 255, 0.7);
    --dark-text-muted: rgba(255, 255, 255, 0.5);
    --dark-text-hint: rgba(255, 255, 255, 0.4);
    --dark-surface-bg: rgba(15, 23, 42, 0.98);
    --dark-surface-card: rgba(255, 255, 255, 0.04);
    --dark-border-color: rgba(255, 255, 255, 0.08);
    --dark-border-hover: rgba(255, 255, 255, 0.15);
}

/* ========================================
   DARK MODE UTILITIES (for fullscreen-page)
   Apply these classes on dark-themed pages
   ======================================== */
body.fullscreen-page {
    color: var(--dark-text-primary);
}

body.fullscreen-page .text-primary {
    color: var(--dark-text-primary) !important;
}

body.fullscreen-page .text-secondary {
    color: var(--dark-text-secondary) !important;
}

body.fullscreen-page .text-muted {
    color: var(--dark-text-muted) !important;
}

body.fullscreen-page input,
body.fullscreen-page textarea,
body.fullscreen-page select {
    color: var(--dark-text-primary);
}

body.fullscreen-page input::placeholder,
body.fullscreen-page textarea::placeholder {
    color: var(--dark-text-hint);
}

body.fullscreen-page {
    --text-primary: var(--dark-text-primary);
    --text-secondary: var(--dark-text-secondary);
    --text-muted: var(--dark-text-muted);
    --surface-card: var(--dark-surface-card);
    --border-color: var(--dark-border-color);
    --surface-bg: var(--dark-surface-bg);
    --surface-subtle: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(100, 116, 139, 0.15);
    --badge-neutral-bg: rgba(100, 116, 139, 0.15);
    --accent-purple-light-bg: rgba(139, 92, 246, 0.08);
}

:root {
    --surface-subtle: rgba(0, 0, 0, 0.02);
    --surface-hover: rgba(0, 0, 0, 0.05);
    --badge-neutral-bg: rgba(100, 116, 139, 0.1);
    --accent-purple-light-bg: rgba(139, 92, 246, 0.05);
}

/* ========================================
   GLOBAL RESETS
   ======================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--surface-bg);
}

/* ========================================
   GLOBAL FOCUS RINGS - Accessibility
   ======================================== */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--accent-purple-light);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-purple-light);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.2);
    transition: box-shadow var(--transition-fast);
}

.focus-ring-active {
    animation: focusRingPulse 0.6s ease-out;
    outline: 2px solid var(--accent-purple-light);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.3);
}

@keyframes focusRingPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.6);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(124, 58, 237, 0.3);
    }
    100% {
        box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.2);
    }
}

/* ========================================
   FULLSCREEN PAGE MODE
   Used for pages that should hide the hero banner and fill the viewport
   Usage: Add these blocks to your template:
     {% block body_class %}fullscreen-page nav-hidden{% endblock %}
     {% block hero_section %}{% endblock %}
   
   Standard Template Pattern:
   - Use nav-hidden class to hide the top nav bar
   - Add fullscreen-header inside your main container for Return button
   - Container uses 100vh for full viewport height
   ======================================== */
body.fullscreen-page {
    height: 100%;
    max-height: 100%;
    background: #1e293b !important;
    overflow: hidden;
}

/* Scrollable page mode - enables vertical scrolling for content-heavy fullscreen pages */
body.fullscreen-page.scrollable-page {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
}

/* Nav bar visible mode (default for fullscreen-page without nav-hidden) */
body.fullscreen-page .nav-bar {
    margin-top: 0 !important;
    background: #0f172a !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    position: relative !important;
}

body.fullscreen-page .nav-bar .container {
    max-width: 100%;
    padding: 0 20px;
}

/* Nav bar hidden mode - adds nav-hidden class to hide nav and use full viewport */
body.fullscreen-page.nav-hidden .nav-bar {
    display: none !important;
}

body.fullscreen-page .main-content,
body.fullscreen-page main {
    padding: 0 !important;
    margin: 0 !important;
}

body.fullscreen-page .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
}

/* Default height when nav is visible */
body.fullscreen-page .docqa-container,
body.fullscreen-page .workbench-container {
    height: calc(100vh - 52px);
    margin: 0;
    width: 100%;
    border-radius: 0;
}

/* Full viewport height when nav is hidden */
body.fullscreen-page.nav-hidden .docqa-container,
body.fullscreen-page.nav-hidden .workbench-container {
    height: 100vh !important;
}

/* ========================================
   FULLSCREEN RETURN BUTTON
   Standard return-to-dashboard button for fullscreen pages
   ======================================== */
.return-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.return-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    color: white;
    text-decoration: none;
}

/* Hide bottom-right FAB on all fullscreen pages */
body.fullscreen-page .help-fab {
    display: none !important;
}

/* AI Assistant button for fullscreen page headers (matches Clear button style) */
.ai-assistant-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-assistant-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    color: #c4b5fd;
}

.ai-assistant-btn:active {
    transform: scale(0.97);
}

.ai-assistant-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================
   COMPONENT: GlassPanel
   ======================================== */
.glass-panel {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: var(--panel-padding);
    margin-bottom: var(--panel-gap);
    transition: all var(--transition-base);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    .glass-panel {
        background: rgba(255, 255, 255, 0.80);
    }
}

.glass-panel h2, .glass-panel h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: var(--section-title-size);
    font-weight: 600;
}

/* ========================================
   COMPONENT: SemanticCard (left-bordered)
   ======================================== */
.semantic-card {
    background: var(--surface-card);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--semantic-neutral-border);
    box-shadow: var(--shadow-sm);
    padding: var(--card-padding);
    margin-bottom: 10px;
}

.semantic-card.success {
    border-left-color: var(--semantic-success-border);
    background: linear-gradient(to right, rgba(16, 185, 129, 0.12), var(--surface-card) 50%);
}

.semantic-card.warning {
    border-left-color: var(--semantic-warning-border);
    background: linear-gradient(to right, rgba(245, 158, 11, 0.12), var(--surface-card) 50%);
}

.semantic-card.danger {
    border-left-color: var(--semantic-danger-border);
    background: linear-gradient(to right, rgba(239, 68, 68, 0.12), var(--surface-card) 50%);
}

.semantic-card.info {
    border-left-color: var(--semantic-info-border);
    background: linear-gradient(to right, rgba(59, 130, 246, 0.12), var(--surface-card) 50%);
}

/* ========================================
   COMPONENT: StatusBadge (unified renderer)
   ======================================== */
.status-badge-unified {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-badge-unified.queued {
    background: var(--semantic-neutral);
    color: var(--text-inverse);
}

.status-badge-unified.running {
    background: var(--semantic-info);
    color: var(--text-inverse);
    animation: pulse-subtle 2s ease-in-out infinite;
}

.status-badge-unified.completed {
    background: var(--semantic-success);
    color: var(--text-inverse);
}

.status-badge-unified.failed {
    background: var(--semantic-danger);
    color: var(--text-inverse);
}

@keyframes pulse-subtle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

/* ========================================
   COMPONENT: Unified Button System
   ======================================== */
.btn-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.btn-base:focus {
    outline: 2px solid var(--accent-purple-light);
    outline-offset: 2px;
}

.btn-base:disabled, .btn-base.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* A. Primary Action Button (Purple) */
.btn-primary, .btn-primary-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--btn-primary-bg);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-primary:hover, .btn-primary-new:hover {
    background: var(--btn-primary-hover);
    transform: var(--lift-md);
    box-shadow: 0 6px 20px rgba(109, 40, 217, 0.35);
}

.btn-primary:active, .btn-primary-new:active {
    background: var(--btn-primary-active);
    transform: translateY(0);
}

.btn-primary:focus, .btn-primary-new:focus {
    outline: 2px solid var(--accent-purple-light);
    outline-offset: 2px;
}

.btn-primary:disabled, .btn-primary-new:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* B. Secondary Action Button (Glass) */
.btn-secondary, .btn-secondary-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--btn-secondary-border);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    backdrop-filter: var(--blur-sm);
}

.btn-secondary:hover, .btn-secondary-new:hover {
    background: var(--btn-secondary-hover);
    border-color: rgba(0, 0, 0, 0.18);
    transform: var(--lift-sm);
    box-shadow: var(--shadow-md);
}

.btn-secondary:active, .btn-secondary-new:active {
    background: rgba(255, 255, 255, 0.65);
    transform: translateY(0);
}

.btn-secondary:focus, .btn-secondary-new:focus {
    outline: 2px solid var(--text-secondary);
    outline-offset: 2px;
}

.btn-secondary:disabled, .btn-secondary-new:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* C. Tertiary/Ghost Button */
.btn-tertiary, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-tertiary:hover, .btn-ghost:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.btn-tertiary:active, .btn-ghost:active {
    background: rgba(0, 0, 0, 0.08);
}

.btn-tertiary:focus, .btn-ghost:focus {
    outline: 2px solid var(--text-muted);
    outline-offset: 2px;
}

/* D. Destructive Button (Muted Red) */
.btn-danger, .btn-destructive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--btn-destructive-bg);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-danger:hover, .btn-destructive:hover {
    background: var(--btn-destructive-hover);
    transform: var(--lift-sm);
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.3);
}

.btn-danger:active, .btn-destructive:active {
    background: var(--btn-destructive-active);
    transform: translateY(0);
}

.btn-danger:focus, .btn-destructive:focus {
    outline: 2px solid var(--semantic-danger);
    outline-offset: 2px;
}

/* E. Success/Confirm Button (Muted Green) */
.btn-success, .btn-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--btn-success-bg);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-success:hover, .btn-confirm:hover {
    background: var(--btn-success-hover);
    transform: var(--lift-sm);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.btn-success:active, .btn-confirm:active {
    background: var(--btn-success-active);
    transform: translateY(0);
}

.btn-success:focus, .btn-confirm:focus {
    outline: 2px solid var(--semantic-success);
    outline-offset: 2px;
}

/* F. Warning Button (Muted Yellow) */
.btn-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--btn-warning-bg);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-warning:hover {
    background: var(--btn-warning-hover);
    transform: var(--lift-sm);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.btn-warning:active {
    background: var(--btn-warning-active);
    transform: translateY(0);
}

.btn-warning:focus {
    outline: 2px solid var(--semantic-warning);
    outline-offset: 2px;
}

/* Button Sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    gap: 6px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    gap: 10px;
}

/* Icon-only buttons */
.btn-icon {
    padding: 10px;
    min-width: 40px;
    min-height: 40px;
}

.btn-icon.btn-sm {
    padding: 6px;
    min-width: 32px;
    min-height: 32px;
}

/* ========================================
   COMPONENT: WarningNote
   ======================================== */
.warning-note {
    background: var(--semantic-warning-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 4px solid var(--semantic-warning-border);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    color: #92400e;
    font-size: 14px;
}

/* ========================================
   COMPONENT: Glass Tables
   ======================================== */
.glass-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.glass-table th {
    background: var(--surface-frosted);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.glass-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.glass-table tbody tr:last-child td {
    border-bottom: none;
}

.glass-table tbody tr {
    transition: all var(--transition-base);
}

.glass-table tbody tr:hover {
    background: rgba(109, 40, 217, 0.04);
}

/* ========================================
   COMPONENT: Interactive Card Hover
   ======================================== */
.card-interactive {
    transition: all var(--transition-base);
    cursor: pointer;
}

.card-interactive:hover {
    transform: var(--lift-sm);
    box-shadow: var(--shadow-md);
}

.card-interactive:active {
    transform: translateY(0);
}

/* GlassPanel interactive variant */
.glass-panel.interactive {
    transition: all var(--transition-fast);
    cursor: pointer;
}

.glass-panel.interactive:hover {
    transform: var(--lift-sm);
    box-shadow: var(--shadow-md);
    border-color: rgba(109, 40, 217, 0.2);
}

/* SemanticCard interactive variant */
.semantic-card.interactive {
    transition: all var(--transition-base);
    cursor: pointer;
}

.semantic-card.interactive:hover {
    transform: var(--lift-sm);
    box-shadow: var(--shadow-md);
}

.semantic-card.success.interactive:hover {
    background: linear-gradient(to right, rgba(16, 185, 129, 0.15), var(--surface-card) 40%);
}

.semantic-card.warning.interactive:hover {
    background: linear-gradient(to right, rgba(245, 158, 11, 0.15), var(--surface-card) 40%);
}

.semantic-card.danger.interactive:hover {
    background: linear-gradient(to right, rgba(239, 68, 68, 0.15), var(--surface-card) 40%);
}

.semantic-card.info.interactive:hover {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.15), var(--surface-card) 40%);
}

/* ========================================
   COMPONENT: Tooltip System
   ======================================== */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
}

.tooltip-wrapper .tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--text-primary);
    color: var(--text-inverse);
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

.tooltip-wrapper .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
}

.tooltip-wrapper:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Tooltip positions */
.tooltip-wrapper .tooltip.tooltip-bottom {
    bottom: auto;
    top: calc(100% + 8px);
}

.tooltip-wrapper .tooltip.tooltip-bottom::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--text-primary);
}

.tooltip-wrapper .tooltip.tooltip-left {
    bottom: auto;
    top: 50%;
    left: auto;
    right: calc(100% + 8px);
    transform: translateY(-50%);
}

.tooltip-wrapper .tooltip.tooltip-left::after {
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: var(--text-primary);
}

.tooltip-wrapper .tooltip.tooltip-right {
    bottom: auto;
    top: 50%;
    left: calc(100% + 8px);
    transform: translateY(-50%);
}

.tooltip-wrapper .tooltip.tooltip-right::after {
    top: 50%;
    right: 100%;
    left: auto;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--text-primary);
}

/* ========================================
   COMPONENT: Chips and Badges Interactive
   ======================================== */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--surface-frosted);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-base);
}

.chip.interactive {
    cursor: pointer;
}

.chip.interactive:hover {
    background: var(--surface-card);
    border-color: rgba(0, 0, 0, 0.15);
    transform: var(--lift-sm);
}

.chip.active {
    background: var(--btn-primary-bg);
    color: var(--text-inverse);
    border-color: var(--btn-primary-bg);
}

/* Nav badge hover */
.nav-badge {
    transition: all var(--transition-fast);
}

.nav-badge:hover {
    background: var(--accent-yellow);
}
.container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Shared layout for consistent centering across nav, hero, and main content */
body:not(.fullscreen-page) .nav-bar > .container,
body:not(.fullscreen-page) .hero-banner-section > .container,
body:not(.fullscreen-page) main.container {
    box-sizing: border-box;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: clamp(20px, 6vw, 48px);
}

/* Nav bar needs zero vertical padding to fit within 52px height */
body:not(.fullscreen-page) .nav-bar > .container {
    padding-block: 0;
}

body:not(.fullscreen-page) main.container {
    position: static;
    transform: none;
}
header {
    background: #000b5a;
    color: white;
    padding: 15px 20px;
    margin-bottom: 20px;
}
header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}
header nav {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
header nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all var(--transition-base);
    background: rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}
header nav a:hover {
    background: var(--btn-primary-bg);
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.4);
    transform: var(--lift-sm);
}
header nav a:focus {
    outline: 2px solid var(--accent-purple-light);
    outline-offset: 2px;
}
header nav a.active {
    background: var(--btn-primary-bg);
}
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.card h2 {
    margin-bottom: 15px;
    color: #2c3e50;
}
/* Legacy .btn class - maps to new system */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-base);
}

.btn:focus {
    outline: 2px solid var(--accent-purple-light);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
.form-group textarea {
    min-height: 100px;
}
.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
}

/* Dark-theme dropdown option styling for fullscreen pages */
.fullscreen-page select option,
.nav-hidden select option,
.ops-centre-container select option,
.glass-panel select option {
    background: #1e293b;
    color: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
}
table th, table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}
table th {
    background: #f8f9fa;
    font-weight: 600;
}
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.status-queued { background: #f39c12; color: white; animation: pulse-queued 2s ease-in-out infinite; }
.status-stage_a, .status-stage_b, .status-stage_c, .status-stage_d, .status-stage_e, .status-stage_f { 
    background: #3498db; 
    color: white; 
    animation: pulse-running 1.5s ease-in-out infinite;
}
.status-awaiting_outline_approval, .status-awaiting_blueprint_approval { background: #9b59b6; color: white; animation: pulse-waiting 2s ease-in-out infinite; }
.status-completed { background: #27ae60; color: white; }
.status-regenerating { background: #fef3c7; color: #92400e; animation: pulse-running 1.5s ease-in-out infinite; }
.status-failed { background: #e74c3c; color: white; }
.status-cancelled { background: #6b7280; color: white; }

.status-badge.queued { background: #6b7280; color: white; }
.status-badge.running { background: #3498db; color: white; animation: pulse-running 1.5s ease-in-out infinite; }
.status-badge.completed { background: #27ae60; color: white; }
.status-badge.failed { background: #e74c3c; color: white; }

.nav-badge {
    display: inline-block;
    background: var(--accent-yellow);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
    transition: all var(--transition-fast);
}

.nav-badge:hover {
    background: var(--accent-yellow-light);
}
@keyframes pulse-badge {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes pulse-running {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7); }
    50% { opacity: 0.85; box-shadow: 0 0 0 6px rgba(52, 152, 219, 0); }
}
@keyframes pulse-queued {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
@keyframes pulse-waiting {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(155, 89, 182, 0.7); }
    50% { opacity: 0.85; box-shadow: 0 0 0 6px rgba(155, 89, 182, 0); }
}
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}
.alert-info { background: #d1ecf1; color: #0c5460; }
.alert-success { background: #d4edda; color: #155724; }
.alert-warning { background: #fff3cd; color: #856404; }
.alert-danger { background: #f8d7da; color: #721c24; }
pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 13px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}
.release-notification-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.help-fab {
    position: fixed;
    bottom: 30px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #000b5a;
    color: white;
    border: none;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: all 0.2s;
}
.help-fab:hover {
    background: #1a2d7a;
    transform: scale(1.1);
}
body.fullscreen-page .help-fab,
body.nav-hidden .help-fab {
    display: none !important;
    visibility: hidden !important;
}
.help-modal {
    display: none !important;
    visibility: hidden !important;
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 500px;
    height: 550px;
    max-width: calc(100vw - 60px);
    max-height: calc(100vh - 150px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    z-index: 1001;
    flex-direction: column;
    overflow: hidden;
    pointer-events: none !important;
}
.resize-handle {
    position: absolute;
    top: 14px;
    left: 12px;
    width: 18px;
    height: 14px;
    cursor: nwse-resize;
    z-index: 20;
}
.resize-handle .grip-line {
    display: block;
    height: 2px;
    background: rgba(255,255,255,0.7);
    border-radius: 1px;
    margin-bottom: 3px;
}
.resize-handle .grip-line:last-child {
    margin-bottom: 0;
}
.help-modal.open {
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
}
.help-header {
    background: #0d6e6e;
    color: white;
    padding: 15px 20px 15px 45px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}
.help-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}
.help-close:hover {
    color: #f8d7da;
}
.help-fullscreen-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.help-fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}
.help-modal.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0;
    z-index: 9999;
}
.help-modal.fullscreen .resize-handle {
    display: none;
}
.help-modal.fullscreen .help-content {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.help-modal.fullscreen #chat-messages {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.help-modal.fullscreen .help-header {
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e3a8a 0%, #581c87 100%);
}
.help-modal.fullscreen .help-title-docked {
    display: none !important;
}
.help-modal.fullscreen .help-title-fullscreen {
    display: inline !important;
}
.help-modal.fullscreen .chat-input-area {
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}
.help-modal.fullscreen .chat-input-area input {
    font-size: 16px;
}
@media (max-width: 640px) {
    .help-modal.fullscreen .faq-chips {
        flex-direction: column;
    }
    .help-modal.fullscreen .faq-chip {
        width: 100%;
        text-align: left;
    }
    .help-modal.fullscreen .chat-input-area {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
    }
}
.help-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #000b5a #e5e7eb;
}
.help-content::-webkit-scrollbar {
    width: 8px;
}
.help-content::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 4px;
}
.help-content::-webkit-scrollbar-thumb {
    background: #000b5a;
    border-radius: 4px;
}
.help-content::-webkit-scrollbar-thumb:hover {
    background: #1a2d7a;
}
#faq-section {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
}
.faq-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    font-size: 13px;
}
.divider {
    height: 1px;
    background: #e5e7eb;
    margin: 15px 0;
}
#reference-docs-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ref-doc-btn {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    gap: 10px;
}
.ref-doc-btn:hover {
    background: #dcfce7;
    border-color: #22c55e;
}
.ref-doc-icon {
    font-size: 1.5em;
}
.ref-doc-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.ref-doc-name {
    font-weight: 600;
    font-size: 0.9em;
    color: #166534;
}
.ref-doc-desc {
    font-size: 0.75em;
    color: #4b5563;
}
.ref-doc-size {
    font-size: 0.75em;
    color: #9ca3af;
}
#faq-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.faq-btn {
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.faq-btn:hover {
    background: #000b5a;
    color: white;
    border-color: #000b5a;
}
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    min-height: 150px;
}
.chat-msg {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}
.chat-msg.user {
    background: #000b5a;
    color: white;
    margin-left: 40px;
}
.chat-msg.assistant {
    background: #f3f4f6;
    color: #1f2937;
    margin-right: 40px;
    white-space: pre-wrap;
}
.chat-msg.loading {
    color: #6b7280;
    font-style: italic;
}
.chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    gap: 8px;
    flex-shrink: 0;
    background: white;
}
#help-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
}
#help-input:focus {
    border-color: #000b5a;
}
.chat-send {
    padding: 10px 18px;
    background: #0d6e6e;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}
.chat-send:hover {
    background: #095555;
}

/* FAQ Chips in Chat */
.faq-chips-container {
    padding: 12px 0;
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
}
.faq-label {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.faq-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.faq-chip {
    padding: 6px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    line-height: 1.3;
}
.faq-chip:hover {
    background: #000b5a;
    color: white;
    border-color: #000b5a;
    transform: translateY(-1px);
}

/* ========================================
   TEMPLATE-SPECIFIC BUTTON STYLING
   Maps custom buttons to unified system
   ======================================== */

/* Download buttons - Secondary style */
.download-btn, .download-sources-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--btn-secondary-border);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-base);
}

.download-btn:hover, .download-sources-btn:hover {
    background: var(--btn-secondary-hover);
    border-color: rgba(0, 0, 0, 0.18);
    transform: var(--lift-sm);
    box-shadow: var(--shadow-md);
}

.download-btn:disabled, .download-sources-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Configure/Action buttons - Tertiary style */
.configure-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-base);
}

.configure-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.15);
}

/* Generate/Primary action buttons - Primary style */
.generate-pack-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--btn-primary-bg);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.generate-pack-btn:hover:not(:disabled) {
    background: var(--btn-primary-hover);
    transform: var(--lift-md);
    box-shadow: 0 6px 20px rgba(109, 40, 217, 0.35);
}

.generate-pack-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Operation card buttons */
.operation-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--btn-secondary-border);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-base);
}

.operation-card-btn:hover {
    background: var(--btn-secondary-hover);
    border-color: rgba(0, 0, 0, 0.18);
    transform: var(--lift-sm);
    box-shadow: var(--shadow-md);
}

/* Stream action buttons */
.stream-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.stream-action-btn:hover:not(:disabled) {
    transform: var(--lift-sm);
}

.stream-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.stream-action-btn.btn-ingest {
    background: var(--btn-primary-bg);
    color: var(--text-inverse);
}

.stream-action-btn.btn-ingest:hover:not(:disabled) {
    background: var(--btn-primary-hover);
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
}

.stream-action-btn.btn-heal {
    background: var(--btn-success-bg);
    color: var(--text-inverse);
}

.stream-action-btn.btn-heal:hover:not(:disabled) {
    background: var(--btn-success-hover);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.stream-action-btn.btn-issues {
    background: var(--btn-warning-bg);
    color: var(--text-inverse);
}

.stream-action-btn.btn-issues:hover:not(:disabled) {
    background: var(--btn-warning-hover);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

/* Add unit button */
.add-unit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--btn-secondary-bg);
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.add-unit-btn:hover {
    background: var(--btn-secondary-hover);
    border-color: var(--btn-primary-bg);
    color: var(--btn-primary-bg);
}

/* Context save button */
.context-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--btn-success-bg);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.context-save-btn:hover {
    background: var(--btn-success-hover);
    transform: var(--lift-sm);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

/* System map action buttons */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--btn-secondary-border);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-action:hover {
    background: var(--btn-secondary-hover);
    transform: var(--lift-sm);
    box-shadow: var(--shadow-md);
}

.btn-action.btn-save {
    background: var(--btn-success-bg);
    color: var(--text-inverse);
    border: none;
}

.btn-action.btn-save:hover {
    background: var(--btn-success-hover);
}

.btn-action.btn-export {
    background: var(--btn-primary-bg);
    color: var(--text-inverse);
    border: none;
}

.btn-action.btn-export:hover {
    background: var(--btn-primary-hover);
}

/* FAQ and tab buttons */
.faq-btn {
    transition: all var(--transition-base);
}

.faq-btn:hover {
    background: var(--btn-primary-bg);
    color: var(--text-inverse);
    border-color: var(--btn-primary-bg);
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.02);
}

.tab-btn.active {
    color: var(--btn-primary-bg);
    border-bottom-color: var(--btn-primary-bg);
}

/* Links with hover effects */
a {
    transition: color var(--transition-fast);
}

/* Focus styles for accessibility */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent-purple-light);
    outline-offset: 2px;
}

/* Form input focus enhancement */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--btn-primary-bg);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.1);
}

/* ==========================================================================
   Pack Download Buttons & Preview Modal
   ========================================================================== */

.pack-download-section {
    display: none;
    gap: 10px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid rgba(109, 40, 217, 0.2);
}

.pack-download-section.visible {
    display: flex;
    align-items: center;
}

.pack-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.pack-download-btn.preview-btn {
    background: transparent;
    color: var(--btn-primary-bg);
    border: 1px solid var(--btn-primary-bg);
}

.pack-download-btn.preview-btn:hover {
    background: rgba(109, 40, 217, 0.08);
}

.pack-download-btn.download-btn {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-purple-light) 100%);
    color: var(--text-inverse);
    border: none;
}

.pack-download-btn.download-btn:hover {
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
    transform: translateY(-1px);
}

.stream-download-controls {
    display: none;
    gap: 8px;
    margin-left: auto;
}

.stream-download-controls.visible {
    display: flex;
    align-items: center;
}

.stream-download-controls .pack-download-btn {
    padding: 5px 10px;
    font-size: 12px;
}

/* Pack Preview Modal */
.pack-preview-modal {
    display: none;
}

.pack-preview-modal.active {
    display: flex;
}

.pack-preview-modal .modal-content {
    max-width: 700px;
    max-height: 80vh;
}

.pack-preview-modal .modal-body {
    overflow-y: auto;
    max-height: 55vh;
}

.pack-preview-header {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-purple-light) 100%);
    color: var(--text-inverse);
}

.pack-preview-header h3 {
    color: var(--text-inverse);
}

.pack-preview-header .modal-close {
    color: var(--text-inverse);
}

/* Pack Summary Stats */
.pack-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(109, 40, 217, 0.05);
    border-radius: 8px;
}

.pack-summary-item {
    text-align: center;
}

.pack-summary-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--btn-primary-bg);
}

.pack-summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Pack Tree Structure */
.pack-tree-container {
    font-size: 13px;
}

.pack-tree-node {
    margin-left: 0;
}

.pack-tree-node.level-1 { margin-left: 16px; }
.pack-tree-node.level-2 { margin-left: 16px; }
.pack-tree-node.level-3 { margin-left: 16px; }
.pack-tree-node.level-4 { margin-left: 16px; }

.pack-tree-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background var(--transition-fast);
}

.pack-tree-header:hover {
    background: rgba(0, 0, 0, 0.04);
}

.pack-tree-toggle {
    font-size: 10px;
    width: 14px;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.pack-tree-header.collapsed .pack-tree-toggle {
    transform: rotate(-90deg);
}

.pack-tree-header.collapsed + .pack-tree-children {
    display: none;
}

.pack-tree-icon {
    font-size: 14px;
}

.pack-tree-name {
    flex: 1;
    color: var(--text-primary);
}

.pack-tree-count {
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 8px;
    border-radius: 10px;
}

.pack-tree-children {
    margin-top: 2px;
}

.pack-tree-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 28px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* No files state */
.pack-no-files {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.pack-no-files span {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.pack-no-files p {
    margin: 0;
    font-size: 14px;
}

/* ========================================
   GLASS SHELL NOTIFICATION SYSTEM
   System-wide toasts, alerts, and error cards
   ======================================== */

.gs-notification-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.gs-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.gs-toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.gs-toast-hiding {
    opacity: 0;
    transform: translateX(100%);
}

.gs-toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.gs-toast-success .gs-toast-icon { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.gs-toast-warning .gs-toast-icon { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.gs-toast-error .gs-toast-icon { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.gs-toast-info .gs-toast-icon { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }

.gs-toast-content {
    flex: 1;
    min-width: 0;
}

.gs-toast-title {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 2px;
}

.gs-toast-message {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.4;
}

.gs-toast-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.gs-toast-close:hover {
    color: #f1f5f9;
}

.gs-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-purple) 0%, var(--accent-purple-light) 100%);
    animation: gsToastProgress linear forwards;
}

.gs-toast-success .gs-toast-progress { background: linear-gradient(90deg, #059669 0%, #34d399 100%); }
.gs-toast-warning .gs-toast-progress { background: linear-gradient(90deg, #d97706 0%, #fbbf24 100%); }
.gs-toast-error .gs-toast-progress { background: linear-gradient(90deg, #dc2626 0%, #f87171 100%); }
.gs-toast-info .gs-toast-progress { background: linear-gradient(90deg, #2563eb 0%, #60a5fa 100%); }

@keyframes gsToastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

.gs-alert-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    display: flex;
    flex-direction: column;
}

.gs-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.gs-alert-visible {
    opacity: 1;
    transform: translateY(0);
}

.gs-alert-hiding {
    opacity: 0;
    transform: translateY(-100%);
}

.gs-alert-success { background: linear-gradient(90deg, rgba(16, 185, 129, 0.95) 0%, rgba(16, 185, 129, 0.85) 100%); }
.gs-alert-warning { background: linear-gradient(90deg, rgba(245, 158, 11, 0.95) 0%, rgba(245, 158, 11, 0.85) 100%); }
.gs-alert-error { background: linear-gradient(90deg, rgba(220, 38, 38, 0.95) 0%, rgba(239, 68, 68, 0.85) 100%); }
.gs-alert-info { background: linear-gradient(90deg, rgba(37, 99, 235, 0.95) 0%, rgba(59, 130, 246, 0.85) 100%); }

.gs-alert-icon {
    font-size: 16px;
    color: white;
}

.gs-alert-content {
    flex: 1;
}

.gs-alert-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.gs-alert-message {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.gs-alert-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.gs-alert-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.gs-error-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-top: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.gs-error-card-visible {
    opacity: 1;
    transform: translateY(0);
}

.gs-error-card-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

.gs-error-card-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.gs-error-card-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.gs-error-card-error .gs-error-card-icon { color: #f87171; }
.gs-error-card-warning .gs-error-card-icon { color: #fbbf24; }
.gs-error-card-info .gs-error-card-icon { color: #60a5fa; }

.gs-error-card-message {
    flex: 1;
    font-size: 13px;
    color: #f87171;
    line-height: 1.4;
}

.gs-error-card-warning .gs-error-card-message { color: #fbbf24; }
.gs-error-card-info .gs-error-card-message { color: #60a5fa; }

.gs-error-card-close {
    background: none;
    border: none;
    color: #f87171;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.gs-error-card-close:hover {
    opacity: 1;
}

.gs-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.gs-confirm-visible {
    opacity: 1;
    visibility: visible;
}

.gs-confirm-modal {
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    padding: 24px;
    min-width: 380px;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gs-confirm-visible .gs-confirm-modal {
    transform: scale(1) translateY(0);
}

.gs-confirm-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.gs-confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.gs-confirm-icon-warning { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); }
.gs-confirm-icon-danger { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); }
.gs-confirm-icon-info { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); }

.gs-confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}

.gs-confirm-message {
    font-size: 14px;
    line-height: 1.6;
    color: #94a3b8;
    margin: 0 0 24px 58px;
}

.gs-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.gs-confirm-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.gs-confirm-cancel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.gs-confirm-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.gs-confirm-btn-danger {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.gs-confirm-btn-danger:hover {
    background: rgba(239, 68, 68, 0.35);
    border-color: rgba(239, 68, 68, 0.5);
}

.gs-confirm-btn-warning {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.gs-confirm-btn-warning:hover {
    background: rgba(245, 158, 11, 0.35);
    border-color: rgba(245, 158, 11, 0.5);
}

.gs-confirm-btn-info {
    background: var(--accent-purple);
    border-color: transparent;
    color: white;
}

.gs-confirm-btn-info:hover {
    background: var(--accent-purple-light);
}

/* ========================================
   GLOBAL MODAL OVERLAY - Always on top
   ======================================== */
[class*="modal-overlay"],
[class*="-modal-overlay"],
.modal-overlay,
.popup-overlay,
.overlay-modal {
    z-index: var(--z-modal-backdrop) !important;
}

[class*="modal-overlay"] > [class*="modal"],
[class*="-modal-overlay"] > [class*="modal"],
.modal-overlay > .modal,
.popup-overlay > .popup,
.modal-content,
.popup-content {
    z-index: var(--z-modal) !important;
}

/* ========================================
   HERO BANNER & NAV BAR BASE STYLES
   ======================================== */
.hero-banner-section {
    position: relative;
    height: var(--hero-height);
    overflow: hidden;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

.hero-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: opacity 1s ease-in-out;
}

.hero-backdrop-next {
    opacity: 0;
}

.hero-banner-section > .container {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero-title-container {
    z-index: 101;
    position: relative;
    margin-left: 80px;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 15%, rgba(255,255,255,0.15) 85%, rgba(255,255,255,0) 100%);
    padding: 8px 24px;
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-logo-link {
    display: block;
}

.hero-logo {
    height: 200px;
    width: auto;
    filter: none !important;
    -webkit-filter: none !important;
    box-shadow: none !important;
}

.vet-tagline {
    z-index: 101;
    position: relative;
    background: rgba(0, 0, 0, 0.55);
    padding: var(--panel-padding) 24px;
    border-radius: var(--border-radius-xl);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    text-align: right;
    color: white;
}

.vet-tagline-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
}

.vet-tagline-desc {
    font-size: 0.8rem;
    opacity: 0.9;
    line-height: 1.4;
    max-width: 320px;
    color: white;
}

.nav-bar {
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 100;
    border: none;
    height: 60px;
    display: flex;
    align-items: center;
}

#learner-nav-bar {
    display: none;
}

.nav-bar > .container {
    height: 100%;
    display: flex;
    justify-content: center;
}

.cool-nav,
.learner-nav-bar {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: var(--border-radius-sm);
    padding: 10px 20px;
    align-items: center;
    background: var(--nav-bg);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-nav);
    border: var(--nav-border);
}

.desktop-nav-items {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
}

#user-nav-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

#health-status-dot {
    position: relative;
    display: inline-flex;
    align-items: center;
}

#health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    display: inline-block;
    cursor: pointer;
    transition: background var(--transition-slow);
}

#notification-bell-wrapper {
    position: relative;
    display: none;
}

.notification-bell.nav-btn {
    position: relative;
    padding: 6px 10px;
}

#login-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: white;
}

#org-selector {
    display: none;
}

#superadmin-org-switcher {
    display: none;
}

#user-card {
    display: none;
    background: rgba(30, 58, 138, 0.8);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--border-radius-lg);
    padding: 4px 10px;
    align-items: center;
    gap: 10px;
    height: 46px;
    box-shadow: var(--shadow-md);
}

#user-display {
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap;
}

#learner-user-card {
    display: none;
    background: rgba(30, 58, 138, 0.8);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--border-radius-lg);
    padding: 4px 10px;
    align-items: center;
    gap: 10px;
    height: 46px;
    box-shadow: var(--shadow-md);
}

#learner-user-display {
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

#learner-user-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.nav-btn-admin {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: white;
}

.nav-btn-superadmin {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    font-size: 0.75rem;
    padding: 6px 10px;
}

#org-switcher-menu {
    min-width: 220px;
    max-height: 300px;
    overflow-y: auto;
}

#exit-impersonation-btn {
    color: #dc2626;
    font-weight: 600;
}

/* ========================================
   MOBILE RESPONSIVENESS
   Comprehensive mobile-first responsive styles
   ======================================== */

/* Mobile Menu Toggle Button - Hidden by default */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: rgba(30, 58, 138, 0.85);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    margin-right: 8px;
}

.mobile-menu-toggle .close-icon {
    display: none;
}

.mobile-menu-toggle.active .hamburger-icon {
    display: none;
}

.mobile-menu-toggle.active .close-icon {
    display: block;
}

.mobile-menu-toggle:hover {
    background: #1e3a8a;
}

/* Mobile Logo in Nav - Hidden by default */
.mobile-logo-link {
    display: none;
}

.mobile-nav-logo {
    height: 40px;
    width: auto;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mobile-menu-logo img {
    height: 50px;
    width: auto;
}

.mobile-menu-close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-menu-close:hover {
    background: rgba(255,255,255,0.2);
}

.mobile-menu-items {
    padding: 16px 0;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 20px;
    min-height: 48px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.9);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
}

.mobile-menu-item:hover,
.mobile-menu-item:active {
    background: rgba(124, 58, 237, 0.2);
    color: white;
}

.mobile-arrow {
    font-size: 12px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.mobile-menu-dropdown.open .mobile-arrow {
    transform: rotate(180deg);
}

.mobile-dropdown-content {
    display: none;
    background: rgba(0,0,0,0.2);
    padding: 8px 0;
}

.mobile-menu-dropdown.open .mobile-dropdown-content {
    display: block;
}

.mobile-submenu-item {
    display: block;
    padding: 12px 20px 12px 36px;
    min-height: 44px;
    color: rgba(255,255,255,0.8);
    font-size: 15px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.mobile-submenu-item:hover,
.mobile-submenu-item:active {
    background: rgba(124, 58, 237, 0.25);
    color: white;
}

.mobile-menu-user {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 16px;
    margin-top: auto;
}

.mobile-user-info {
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    background: rgba(30, 58, 138, 0.5);
    border-radius: 8px;
    margin-bottom: 8px;
}

.mobile-logout {
    color: #f87171 !important;
}

.mobile-signin {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%) !important;
    border-radius: 10px;
    margin: 0 16px;
    justify-content: center;
}

.mobile-menu-login {
    padding: 16px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* ========================================
   RESPONSIVE BREAKPOINT: TABLET (768px)
   ======================================== */
@media (max-width: 768px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-logo-link {
        display: flex;
        align-items: center;
        flex: 1;
    }
    
    .mobile-menu-overlay {
        display: block;
    }
    
    /* Hide desktop nav items */
    .desktop-nav-items {
        display: none !important;
    }
    
    #user-nav-section {
        display: none !important;
    }
    
    /* Nav bar adjustments */
    .nav-bar {
        height: 56px !important;
    }
    
    .cool-nav {
        width: 100% !important;
        padding: 8px 12px !important;
        justify-content: flex-start !important;
    }
    
    /* Hero banner adjustments */
    .hero-banner-section {
        height: 180px !important;
    }
    
    .hero-title-container {
        margin-left: 20px !important;
    }
    
    .hero-logo {
        height: 120px !important;
    }
    
    .vet-tagline {
        display: none !important;
    }
    
    /* Container adjustments */
    .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    
    /* Glass panels */
    .glass-panel {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: var(--border-radius-sm);
    }
    
    /* Cards stack vertically */
    .card-grid,
    .dashboard-grid,
    .stats-grid,
    .feature-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }
    
    /* Ensure buttons meet touch target size */
    .btn-base,
    .btn-primary,
    .btn-secondary,
    .btn-tertiary,
    .btn-danger,
    .btn-success,
    .btn-warning,
    .nav-btn,
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Form inputs - prevent iOS zoom with 16px font */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
        min-height: 44px;
        width: 100%;
    }
    
    /* Tables - horizontal scroll wrapper */
    .glass-table,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    /* Modals - near full screen */
    .cmd-palette,
    .modal,
    .popup,
    .gs-confirm-modal {
        width: 95% !important;
        max-width: 95% !important;
        margin: 16px auto !important;
        max-height: 90vh !important;
    }
    
    .cmd-palette-overlay {
        padding-top: 5vh !important;
    }
    
    /* Links need larger tap targets */
    a {
        display: inline-block;
        min-height: 44px;
        line-height: 44px;
    }
    
    /* Dropdown items need larger tap targets */
    .dropdown-item {
        padding: 14px 16px !important;
        min-height: 48px !important;
    }
    
    /* Status badges */
    .status-badge-unified {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    /* Semantic cards */
    .semantic-card {
        padding: 14px 16px;
    }
    
    /* Action button groups stack */
    .action-buttons,
    .button-group,
    .btn-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-buttons > *,
    .button-group > *,
    .btn-group > * {
        width: 100%;
    }
    
    /* Flex layouts stack on mobile */
    .flex-row-mobile-col {
        flex-direction: column !important;
    }
    
    /* Two-column layouts stack */
    .two-column,
    .split-layout {
        flex-direction: column !important;
    }
    
    .two-column > *,
    .split-layout > * {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Hide elements on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    /* Show elements only on mobile */
    .show-mobile {
        display: block !important;
    }
    
    /* Font size adjustments for readability */
    body {
        font-size: 16px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Fullscreen page adjustments */
    body.fullscreen-page .docqa-container,
    body.fullscreen-page .workbench-container {
        height: calc(100vh - 56px);
    }
    
    body.fullscreen-page.nav-hidden .docqa-container,
    body.fullscreen-page.nav-hidden .workbench-container {
        height: 100vh !important;
    }
    
    /* ========================================
       MOBILE OVERFLOW PREVENTION - Global Fixes
       ======================================== */
    
    /* Prevent horizontal overflow on all pages */
    body, html {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .container, .content-wrapper, .main-content, .page-content {
        max-width: 100vw;
        padding-left: 12px;
        padding-right: 12px;
        box-sizing: border-box;
    }
    
    /* Tables scroll horizontally inside container */
    table {
        display: block;
        overflow-x: auto;
        max-width: 100%;
    }
    
    /* Cards fill width */
    .card, .glass-card, .stat-card {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Prevent wide elements from overflowing */
    pre, code, .code-block {
        overflow-x: auto;
        max-width: 100%;
    }
    
    /* Search boxes responsive */
    .search-box {
        min-width: 0 !important;
        width: 100%;
    }
    
    /* Grid layouts single column */
    .progress-summary,
    .groups-container {
        grid-template-columns: 1fr !important;
    }
    
    /* Forms stack vertically */
    .qualification-selector,
    .stream-selector {
        flex-direction: column;
    }
    
    .qualification-selector .form-group,
    .stream-selector .form-group {
        min-width: 100% !important;
        width: 100%;
    }
    
    /* Multi-panel layouts stack */
    .library-main-layout {
        flex-direction: column;
    }
    
    .folder-sidebar {
        width: 100% !important;
        max-height: none !important;
    }
    
    /* Book builder grid */
    .book-card-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Filters row wrap */
    .filters-row {
        flex-wrap: wrap;
    }
    
    /* Title rows stack on mobile */
    .library-title-row,
    .streams-title-row {
        flex-direction: column;
        align-items: flex-start !important;
    }
}

/* ========================================
   RESPONSIVE BREAKPOINT: SMALL PHONE (480px)
   ======================================== */
@media (max-width: 480px) {
    /* Hero banner - smaller */
    .hero-banner-section {
        height: 140px !important;
    }
    
    .hero-title-container {
        margin-left: 10px !important;
        padding: 4px 12px !important;
    }
    
    .hero-logo {
        height: 90px !important;
    }
    
    /* Container tighter padding */
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    /* Glass panels */
    .glass-panel {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    /* Nav bar smaller */
    .nav-bar {
        height: 52px !important;
    }
    
    .cool-nav {
        padding: 6px 10px !important;
    }
    
    .mobile-nav-logo {
        height: 36px;
    }
    
    /* Buttons full width */
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-success,
    .btn-warning {
        width: 100%;
        justify-content: center;
    }
    
    /* Smaller button size text */
    .btn-sm {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* Font sizes slightly larger for readability */
    body {
        font-size: 17px;
        line-height: 1.7;
    }
    
    p {
        font-size: 16px;
    }
    
    /* Modal adjustments */
    .cmd-palette,
    .modal,
    .popup,
    .gs-confirm-modal {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        max-height: 100vh !important;
        height: 100vh !important;
    }
    
    .cmd-palette-overlay {
        padding-top: 0 !important;
    }
    
    /* Table cells smaller padding */
    .glass-table th,
    .glass-table td {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    /* Cards tighter spacing */
    .semantic-card {
        padding: 12px 14px;
        margin-bottom: 10px;
    }
    
    /* Status badges smaller */
    .status-badge-unified {
        padding: 4px 10px;
        font-size: 12px;
    }
    
    /* Help FAB smaller */
    .help-fab {
        width: 50px;
        height: 50px;
        bottom: 16px;
        right: 16px;
    }
    
    /* Dropdown menus full width */
    .nav-dropdown-menu {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 60vh !important;
        border-radius: 0 0 12px 12px !important;
    }
    
    /* Command palette full width */
    .cmd-palette-result {
        padding: 14px 16px;
    }
    
    .cmd-palette-header input {
        font-size: 16px;
    }
}

/* ========================================
   TOUCH-FRIENDLY UTILITIES
   ======================================== */
@media (pointer: coarse) {
    /* All interactive elements minimum 44px */
    button,
    [role="button"],
    a,
    input[type="checkbox"],
    input[type="radio"],
    select,
    .clickable,
    .interactive {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Add padding for touch targets */
    a:not(.nav-btn):not(.mobile-menu-item):not(.mobile-submenu-item) {
        padding: 8px 0;
    }
    
    /* Checkbox and radio larger */
    input[type="checkbox"],
    input[type="radio"] {
        width: 24px;
        height: 24px;
    }
    
    /* Scrollbars hidden on touch devices */
    ::-webkit-scrollbar {
        width: 0;
        height: 0;
    }
}

/* ========================================
   iOS SAFE AREA SUPPORT
   ======================================== */
@supports (padding-top: env(safe-area-inset-top)) {
    .nav-bar {
        padding-top: env(safe-area-inset-top);
    }
    
    .mobile-menu-content {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    body.fullscreen-page {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========================================
   COMPONENT: Panel Header (Pro-Software)
   DaVinci Resolve / Unreal Engine style module headers
   ======================================== */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    padding: 8px 14px;
    margin: -18px -18px 14px -18px;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.panel-header-title {
    font-size: var(--section-title-size);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
    line-height: 1.3;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel-header-actions button,
.panel-header-actions a {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.panel-header-actions button:hover,
.panel-header-actions a:hover {
    background: rgba(109, 40, 217, 0.08);
    border-color: rgba(109, 40, 217, 0.2);
    color: var(--accent-purple);
}

/* ========================================
   PRO TYPOGRAPHY UTILITIES
   Compact labels and data display for dense layouts
   ======================================== */
.pro-label {
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    text-transform: uppercase;
    letter-spacing: var(--label-spacing);
    color: var(--text-muted);
    line-height: 1.2;
}

.pro-value {
    font-size: var(--data-size);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
}

.pro-section-title {
    font-size: var(--section-title-size);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
    line-height: 1.3;
    margin-bottom: 10px;
}

.pro-data-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
}

.pro-data-row .pro-label {
    min-width: 100px;
    flex-shrink: 0;
}

.pro-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

.pro-chip.success {
    background: var(--semantic-success-light);
    color: var(--semantic-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pro-chip.warning {
    background: var(--semantic-warning-light);
    color: var(--semantic-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.pro-chip.danger {
    background: var(--semantic-danger-light);
    color: var(--semantic-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.pro-chip.info {
    background: var(--semantic-info-light);
    color: var(--semantic-info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.pro-chip.neutral {
    background: var(--semantic-neutral-light);
    color: var(--semantic-neutral);
    border: 1px solid rgba(107, 114, 128, 0.2);
}

/* Active panel border accent (DaVinci Resolve selected panel) */
.glass-panel.panel-active,
.semantic-card.panel-active {
    border-color: rgba(109, 40, 217, 0.3);
    box-shadow: var(--shadow-sm), 0 0 0 1px rgba(109, 40, 217, 0.1);
}

/* ========================================
   PRINT STYLES - Hide mobile elements
   ======================================== */
@media print {
    .mobile-menu-toggle,
    .mobile-menu-overlay,
    .mobile-logo-link {
        display: none !important;
    }
}
