/**
 * Abide AI Governance Dashboard - Styles (ACCESSIBILITY HARDENED)
 * 
 * SECURITY FIXES APPLIED:
 * - H-09: Color contrast improved to meet WCAG 2.1 AA (4.5:1 ratio)
 * - Extracted from inline to external file for CSP compliance
 */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    /* Primary colors - adjusted for WCAG AA compliance */
    --midnight: #0B1C2D;
    --navy-900: #0D2137;
    --navy-800: #122a3f;
    --navy-700: #1a3a54;
    --navy-600: #234b6a;
    
    /* Accent colors */
    --teal: #3EBDC4;           /* Brightened for contrast */
    --teal-muted: rgba(62, 189, 196, 0.15);
    --teal-glow: rgba(62, 189, 196, 0.4);
    
    /* Status colors - adjusted for accessibility */
    --red: #F25C4E;            /* Brightened */
    --red-muted: rgba(242, 92, 78, 0.15);
    --amber: #FFB020;          /* Brightened */
    --amber-muted: rgba(255, 176, 32, 0.15);
    --green: #34D399;          /* Success color */
    --green-muted: rgba(52, 211, 153, 0.15);
    --purple: #A78BFA;         /* Brightened */
    --purple-muted: rgba(167, 139, 250, 0.15);
    
    /* Text colors - WCAG AA compliant */
    --text-1: #F8FAFC;         /* Primary text: 15.8:1 contrast */
    --text-2: #CBD5E1;         /* Secondary text: 9.7:1 contrast */
    --text-3: #94A3B8;         /* Tertiary text: 5.4:1 contrast */
    --text-muted: #64748B;     /* Muted text: 4.6:1 contrast (just above 4.5:1) */
    
    /* Borders and surfaces */
    --border: rgba(203, 213, 225, 0.2);
    --surface-1: var(--navy-800);
    --surface-2: var(--navy-700);
    
    /* Focus indicator */
    --focus-ring: 0 0 0 3px rgba(62, 189, 196, 0.5);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: var(--midnight);
    color: var(--text-1);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== SKIP LINK (H-10) ===== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--teal);
    color: var(--midnight);
    padding: 8px 16px;
    font-weight: 600;
    z-index: 1000;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
    outline: none;
}

/* ===== FOCUS STYLES ===== */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

/* ===== HEADER ===== */
.header {
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    padding: 12px 32px;
    position: sticky;
    top: 0;
    z-index: 9000;
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    color: var(--text-1);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--teal), var(--navy-600));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.logo-text {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.logo-text span {
    color: var(--teal);
}

/* ===== NAVIGATION ===== */
.nav {
    display: flex;
    gap: 4px;
}

.nav-item {
    position: relative;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    transition: var(--transition-fast);
}

.nav-button:hover {
    background: var(--surface-2);
    color: var(--text-1);
}

.nav-button[aria-expanded="true"] {
    background: var(--surface-2);
    border-color: var(--teal);
    color: var(--text-1);
}

.nav-button .arrow {
    font-size: 0.625rem;
    transition: transform var(--transition-fast);
}

.nav-button[aria-expanded="true"] .arrow {
    transform: rotate(180deg);
}

/* ===== DROPDOWN MENU ===== */
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    z-index: 9100;
}

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

.dropdown-menu[role="menu"] {
    list-style: none;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-2);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: var(--transition-fast);
}

.dropdown-item:hover,
.dropdown-item:focus-visible {
    background: var(--navy-600);
    color: var(--text-1);
}

.dropdown-item[aria-current="page"] {
    background: var(--teal-muted);
    color: var(--teal);
}

.dropdown-item .icon {
    width: 18px;
    text-align: center;
}

.dropdown-item .badge {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--red);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 10px;
}

.dropdown-separator {
    height: 1px;
    background: var(--border);
    margin: 4px 10px;
}

.dropdown-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.dropdown-item .coming-soon {
    margin-left: auto;
    padding: 2px 6px;
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.625rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== HEADER RIGHT ===== */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Command Center Button */
.command-center-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: 24px;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}
.command-center-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}
.command-center-btn .icon {
    font-size: 1rem;
}
.command-center-btn .pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    animation: commandPulse 2s infinite;
}
@keyframes commandPulse {
    0%, 100% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); 
    }
    50% { 
        opacity: 0.8; 
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); 
    }
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-2);
}

.avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--purple), var(--teal));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

/* ===== STATUS BADGE ===== */
.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--green-muted);
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--green);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-1);
}

/* ===== METRICS GRID ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: var(--transition-fast);
}

.metric-card:hover {
    border-color: var(--teal);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.metric-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.metric-icon.teal {
    background: var(--teal-muted);
    color: var(--teal);
}

.metric-icon.red {
    background: var(--red-muted);
    color: var(--red);
}

.metric-icon.amber {
    background: var(--amber-muted);
    color: var(--amber);
}

.metric-icon.green {
    background: var(--green-muted);
    color: var(--green);
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.2;
}

.metric-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8125rem;
    margin-top: 4px;
}

.metric-trend.positive {
    color: var(--green);
}

.metric-trend.negative {
    color: var(--red);
}

/* ===== CONTENT GRID ===== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
}

@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== CARD ===== */
.card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-1);
}

.card-body {
    padding: 20px;
}

/* ===== TABLE ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-3);
    background: rgba(0, 0, 0, 0.2);
}

.data-table td {
    font-size: 0.875rem;
    color: var(--text-2);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:focus-within {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

/* ===== DECISION BADGES ===== */
.decision-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.decision-badge.allowed {
    background: var(--green-muted);
    color: var(--green);
}

.decision-badge.blocked {
    background: var(--red-muted);
    color: var(--red);
}

.decision-badge.pending {
    background: var(--amber-muted);
    color: var(--amber);
}

.decision-badge.escalated {
    background: var(--purple-muted);
    color: var(--purple);
}

/* ===== RISK SCORE ===== */
.risk-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.risk-bar {
    flex: 1;
    height: 6px;
    background: var(--navy-600);
    border-radius: 3px;
    overflow: hidden;
}

.risk-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-normal);
}

.risk-bar-fill.low {
    background: var(--green);
}

.risk-bar-fill.medium {
    background: var(--amber);
}

.risk-bar-fill.high {
    background: var(--red);
}

.risk-bar-fill.critical {
    background: var(--red);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.risk-value {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 32px;
    text-align: right;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--teal);
    color: var(--midnight);
}

.btn-primary:hover:not(:disabled) {
    background: #4dd4db;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--navy-600);
    color: var(--text-1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
}

/* ===== ACTIVITY LIST ===== */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.activity-icon.allowed {
    background: var(--green-muted);
    color: var(--green);
}

.activity-icon.blocked {
    background: var(--red-muted);
    color: var(--red);
}

.activity-icon.pending {
    background: var(--amber-muted);
    color: var(--amber);
}

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

.activity-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-1);
    margin-bottom: 2px;
}

.activity-meta {
    font-size: 0.8125rem;
    color: var(--text-3);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-3);
    white-space: nowrap;
}

/* ===== MODAL (H-08: Keyboard trap prevention) ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-1);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-3);
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--surface-2);
    color: var(--text-1);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--navy-900);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text-1);
    transition: var(--transition-fast);
}

.form-input:hover {
    border-color: var(--teal);
}

.form-input:focus {
    border-color: var(--teal);
    box-shadow: var(--focus-ring);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.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='%2394A3B8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ===== ERROR ALERT (H-13) ===== */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.alert.visible {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-error {
    background: var(--red-muted);
    border: 1px solid rgba(242, 92, 78, 0.3);
    color: var(--red);
}

.alert-success {
    background: var(--green-muted);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: var(--green);
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.alert-message {
    font-size: 0.875rem;
    opacity: 0.9;
}

.alert-dismiss {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: var(--transition-fast);
}

.alert-dismiss:hover {
    opacity: 1;
}

/* ===== LOADING STATES ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-3);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-3);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 8px;
}

.empty-state-message {
    font-size: 0.875rem;
}

/* ===== VISUALLY HIDDEN (ACCESSIBILITY) ===== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }
    
    .main-content {
        padding: 20px 16px;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .nav {
        display: none;
    }
    
    .data-table {
        font-size: 0.8125rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .header,
    .skip-link {
        display: none;
    }
    
    .card {
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}

/* ===== DEMO MODE BANNER ===== */
.demo-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 10px 20px;
    text-align: center;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.demo-banner strong {
    font-weight: 600;
}

.demo-banner-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.demo-banner-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Adjust body when demo banner is visible */
body:has(.demo-banner) .header {
    top: 40px;
}

body:has(.demo-banner) .main-content {
    margin-top: 40px;
}

/* ===== DASHBOARD CUSTOMIZATION (Drag & Drop) ===== */
.customize-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-2);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.customize-mode-toggle:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.customize-mode-toggle.active {
    background: var(--teal-muted);
    border-color: var(--teal);
    color: var(--teal);
}

.customize-mode-toggle .icon {
    font-size: 1rem;
}

/* Dashboard header with customize button */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-header .page-title {
    margin-bottom: 0;
}

/* Customization bar */
.customization-bar {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(62, 189, 196, 0.1), rgba(167, 139, 250, 0.1));
    border: 1px dashed var(--teal);
    border-radius: 12px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

.customization-bar.active {
    display: flex;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.customization-bar .info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--text-2);
}

.customization-bar .info .icon {
    font-size: 1.25rem;
}

.customization-bar .actions {
    display: flex;
    gap: 8px;
}

.customization-bar .btn-reset {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-3);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.customization-bar .btn-reset:hover {
    border-color: var(--red);
    color: var(--red);
}

.customization-bar .btn-save {
    padding: 8px 16px;
    background: var(--teal);
    border: none;
    border-radius: 6px;
    color: var(--midnight);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.customization-bar .btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--teal-glow);
}

/* Draggable widget styles */
.widget {
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.widget.customize-mode {
    cursor: grab;
}

.widget.customize-mode::before {
    content: '⋮⋮';
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 1rem;
    color: var(--text-3);
    opacity: 0.5;
    z-index: 10;
}

.widget.customize-mode:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.widget.customize-mode:hover::before {
    opacity: 1;
    color: var(--teal);
}

.widget.dragging {
    cursor: grabbing;
    opacity: 0.8;
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.widget.drag-over {
    border: 2px dashed var(--teal);
    background: var(--teal-muted);
}

/* Drop placeholder */
.drop-placeholder {
    border: 2px dashed var(--teal);
    border-radius: 12px;
    background: var(--teal-muted);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal);
    font-size: 0.875rem;
}

/* Widget resize handles */
.widget.customize-mode .resize-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    bottom: 4px;
    right: 4px;
    cursor: se-resize;
    opacity: 0;
    transition: opacity 0.2s;
}

.widget.customize-mode:hover .resize-handle {
    opacity: 0.5;
}

.widget.customize-mode .resize-handle::before {
    content: '⟋';
    font-size: 1rem;
    color: var(--text-3);
}

/* Metrics grid when in customize mode */
.metrics-grid.customize-mode .metric-card {
    cursor: grab;
}

.metrics-grid.customize-mode .metric-card.dragging {
    cursor: grabbing;
}

/* Widget order indicator */
.widget-order-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--teal);
    border-radius: 50%;
    color: var(--midnight);
    font-size: 0.75rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    box-shadow: 0 2px 8px var(--teal-glow);
}

.customize-mode .widget-order-badge {
    display: flex;
}

/* ===== NOTIFICATION SYSTEM ===== */
.notification-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-2);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-toggle:hover {
    border-color: var(--teal);
    background: var(--teal-muted);
}

.notification-toggle.active {
    background: var(--teal-muted);
    border-color: var(--teal);
    color: var(--teal);
}

.notification-toggle:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--red);
    border-radius: 10px;
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgePulse 2s infinite;
}

.notification-badge.hidden {
    display: none;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Notification toast styles */
.notification-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    max-width: 380px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    overflow: hidden;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

.notification-toast-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.notification-toast-icon {
    font-size: 1.5rem;
}

.notification-toast-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-1);
}

.notification-toast-close {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.notification-toast-close:hover {
    background: var(--border);
    color: var(--text-1);
}

.notification-toast-body {
    padding: 16px;
    color: var(--text-2);
    font-size: 0.875rem;
    line-height: 1.5;
}

.notification-toast-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}

.notification-toast.critical {
    border-left: 4px solid var(--red);
}

.notification-toast.warning {
    border-left: 4px solid var(--amber);
}

.notification-toast.success {
    border-left: 4px solid var(--green);
}

/* ===== MOBILE RESPONSIVENESS ===== */

/* Mobile Navigation */
@media (max-width: 1024px) {
    .header-inner {
        padding: 12px 16px;
    }
    
    .nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-right {
        gap: 8px;
    }
    
    .command-center-btn .text,
    .status-badge span:not(.status-dot) {
        display: none;
    }
    
    .command-center-btn {
        padding: 8px 12px;
    }
    
    .user-badge span {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Header adjustments */
    .header {
        padding: 0;
    }
    
    .header-inner {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    /* Main content adjustments */
    .main-content {
        padding: 16px;
        margin-top: 60px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    /* Dashboard header */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .customize-mode-toggle {
        width: 100%;
        justify-content: center;
    }
    
    /* Metrics grid */
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .metric-card {
        padding: 16px;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    /* Content grid */
    .content-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Cards */
    .card {
        border-radius: 12px;
    }
    
    .card-header {
        padding: 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    /* Tables */
    .data-table {
        font-size: 0.8125rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }
    
    /* Hide less important columns on mobile */
    .data-table th:nth-child(4),
    .data-table td:nth-child(4),
    .data-table th:nth-child(5),
    .data-table td:nth-child(5) {
        display: none;
    }
    
    /* Modals */
    .modal {
        margin: 16px;
        max-height: calc(100vh - 32px);
        width: calc(100% - 32px);
        max-width: none;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }
    
    /* Alerts */
    .alert {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 0.875rem;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    /* Notification toggle */
    .notification-toggle {
        width: 36px;
        height: 36px;
    }
    
    /* Activity feed items */
    .activity-item {
        padding: 12px 0;
    }
    
    /* Form inputs */
    .form-input {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Customization bar */
    .customization-bar {
        flex-direction: column;
        text-align: center;
    }
    
    .customization-bar .actions {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        padding: 14px;
    }
    
    .metric-header {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .metric-value {
        font-size: 1.75rem;
    }
    
    /* Header */
    .logo-text span {
        display: none;
    }
    
    .header-right {
        gap: 6px;
    }
    
    /* Hide user badge on very small screens */
    .user-badge {
        display: none;
    }
    
    /* Notification toast */
    .notification-toast {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    /* Page title */
    .page-title {
        font-size: 1.25rem;
    }
    
    /* Table - show only essential columns */
    .data-table th:nth-child(3),
    .data-table td:nth-child(3) {
        display: none;
    }
    
    /* Status badges in table */
    .status-badge-cell {
        padding: 4px 8px;
        font-size: 0.6875rem;
    }
}

/* Mobile menu */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-2);
    font-size: 1.25rem;
    cursor: pointer;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--midnight);
    z-index: 900;
    padding: 20px;
    overflow-y: auto;
}

.mobile-menu.active {
    display: block;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-1);
    text-decoration: none;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.mobile-menu-item:hover,
.mobile-menu-item:focus {
    border-color: var(--teal);
    background: var(--teal-muted);
}

.mobile-menu-item .icon {
    font-size: 1.25rem;
}

/* Touch-friendly targets */
@media (pointer: coarse) {
    .btn,
    .nav-button,
    .dropdown-item,
    .mobile-menu-item {
        min-height: 44px;
    }
    
    .data-table tr {
        min-height: 48px;
    }
    
    input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: rgba(255, 255, 255, 0.5);
        --text-muted: #a0aec0;
    }
    
    .card,
    .metric-card,
    .modal {
        border-width: 2px;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    a {
        text-decoration: underline;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .pulse-dot,
    .status-dot {
        animation: none;
    }
    
    .notification-badge {
        animation: none;
    }
}

/* Focus styles - enhanced visibility */
:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
}

/* Ensure focus is visible on all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px var(--teal-muted);
}

/* Skip link improvements */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--teal);
    color: var(--midnight);
    padding: 12px 24px;
    font-weight: 600;
    z-index: 10000;
    text-decoration: none;
    border-radius: 0 0 8px 8px;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    outline: none;
}

/* Screen reader only content */
.sr-only,
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* But allow it to be focusable */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ARIA live regions */
[aria-live="polite"],
[aria-live="assertive"] {
    position: relative;
}

/* Loading states for screen readers */
[aria-busy="true"] {
    cursor: wait;
}

/* Disabled states */
[aria-disabled="true"],
[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Required field indicator */
.form-label[aria-required="true"]::after,
.required-field::after {
    content: " *";
    color: var(--red);
}

/* Error states */
[aria-invalid="true"] {
    border-color: var(--red) !important;
    box-shadow: 0 0 0 3px var(--red-muted);
}

.error-message {
    color: var(--red);
    font-size: 0.8125rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.error-message::before {
    content: "⚠️";
}

/* Success states */
[aria-invalid="false"]:not(:placeholder-shown) {
    border-color: var(--green);
}

/* Expanded/collapsed states */
[aria-expanded="true"] .arrow,
[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

/* Current page indicator */
[aria-current="page"] {
    font-weight: 600;
    color: var(--teal);
}

/* Selection indicator */
[aria-selected="true"] {
    background: var(--teal-muted);
    border-color: var(--teal);
}

/* Modal accessibility */
.modal-overlay[aria-hidden="false"] {
    display: flex;
}

.modal-overlay[aria-hidden="true"] {
    display: none;
}

/* Table accessibility */
.data-table caption {
    padding: 12px;
    font-weight: 600;
    text-align: left;
    color: var(--text-2);
}

.data-table[aria-describedby] {
    border-collapse: separate;
}

/* Sortable table headers */
.data-table th[aria-sort] {
    cursor: pointer;
    user-select: none;
}

.data-table th[aria-sort]::after {
    content: "";
    margin-left: 8px;
}

.data-table th[aria-sort="ascending"]::after {
    content: "↑";
}

.data-table th[aria-sort="descending"]::after {
    content: "↓";
}

.data-table th[aria-sort="none"]::after {
    content: "↕";
    opacity: 0.5;
}

/* Tooltip accessibility */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--midnight);
    color: var(--text-1);
    font-size: 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}

/* Progress indicators */
[role="progressbar"] {
    height: 8px;
    background: var(--surface-2);
    border-radius: 4px;
    overflow: hidden;
}

[role="progressbar"]::after {
    content: "";
    display: block;
    height: 100%;
    background: var(--teal);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: var(--progress, 0%);
}

/* Tab panels */
[role="tablist"] {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

[role="tab"] {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

[role="tab"]:hover {
    color: var(--text-1);
}

[role="tab"][aria-selected="true"] {
    color: var(--teal);
    border-bottom-color: var(--teal);
}

[role="tabpanel"] {
    padding: 20px 0;
}

[role="tabpanel"][hidden] {
    display: none;
}

/* Alert roles */
[role="alert"] {
    border-left: 4px solid var(--amber);
}

[role="alert"].error,
[role="alert"][data-type="error"] {
    border-left-color: var(--red);
}

[role="alert"].success,
[role="alert"][data-type="success"] {
    border-left-color: var(--green);
}

/* Status role */
[role="status"] {
    font-size: 0.875rem;
}

/* Dialog improvements */
[role="dialog"] {
    max-height: 90vh;
    overflow-y: auto;
}

[role="dialog"] .modal-header {
    position: sticky;
    top: 0;
    background: var(--surface-1);
    z-index: 10;
}

/* Landmark regions */
[role="main"] {
    min-height: calc(100vh - 80px);
}

[role="navigation"] {
    position: relative;
}

[role="banner"] {
    position: sticky;
    top: 0;
    z-index: 9000;
}

/* Print styles for accessibility */
@media print {
    .skip-link,
    .notification-toggle,
    .mobile-menu-toggle,
    [role="navigation"],
    .btn-icon {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 20px;
    }
    
    .card,
    .metric-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* =========================================================================
   NAV COMPONENT STYLES (moved from enhancements.css so all pages get them)
   ========================================================================= */

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
    --midnight: #F8FAFC;
    --navy-900: #F1F5F9;
    --navy-800: #E2E8F0;
    --navy-700: #CBD5E1;
    --navy-600: #94A3B8;
    --teal: #0D9488;
    --teal-muted: rgba(13, 148, 136, 0.12);
    --teal-glow: rgba(13, 148, 136, 0.3);
    --green: #059669;
    --green-muted: rgba(5, 150, 105, 0.12);
    --red: #DC2626;
    --red-muted: rgba(220, 38, 38, 0.12);
    --amber: #D97706;
    --amber-muted: rgba(217, 119, 6, 0.12);
    --purple: #7C3AED;
    --purple-muted: rgba(124, 58, 237, 0.12);
    --text-1: #0F172A;
    --text-2: #334155;
    --text-3: #475569;
    --text-muted: #64748B;
    --surface-1: #FFFFFF;
    --surface-2: #F8FAFC;
    --border: rgba(15, 23, 42, 0.12);
    --border-hover: rgba(13, 148, 136, 0.5);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ===== MODE BADGE ===== */
.mode-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mode-badge.enforcing {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--green);
}

.mode-badge.enforcing:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--green);
}

.mode-badge.shadow {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--amber);
}

.mode-badge.shadow:hover {
    background: rgba(245, 158, 11, 0.18);
    border-color: var(--amber);
}

.mode-badge .mode-icon {
    font-size: 0.875rem;
}

/* ===== USER PROFILE DROPDOWN ===== */
.user-profile-container {
    position: relative;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 100px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    color: inherit;
}

.user-profile-trigger:hover {
    background: var(--navy-700);
    border-color: var(--border-hover, var(--border));
}

.user-profile-trigger .avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--purple), var(--teal));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.user-profile-trigger .user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.user-profile-trigger .user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-1);
}

.user-profile-trigger .user-role {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.user-profile-trigger .dropdown-icon {
    font-size: 0.625rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
    margin-left: 4px;
}

.user-profile-trigger[aria-expanded="true"] .dropdown-icon {
    transform: rotate(180deg);
}

/* Profile Dropdown Menu */
.user-profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.2s ease;
    z-index: 9200;
    overflow: hidden;
}

.user-profile-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-profile-menu .menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.user-profile-menu .menu-header .avatar-lg {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--purple), var(--teal));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
}

.user-profile-menu .menu-header .user-details .name {
    font-weight: 600;
    color: var(--text-1);
    font-size: 0.9375rem;
}

.user-profile-menu .menu-header .user-details .email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-profile-menu .menu-section {
    padding: 8px;
}

.user-profile-menu .menu-section-label {
    padding: 8px 12px 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.user-profile-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    text-decoration: none;
}

.user-profile-menu .menu-item:hover {
    background: var(--navy-700);
    color: var(--text-1);
}

.user-profile-menu .menu-item .icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.user-profile-menu .menu-item .label {
    flex: 1;
}

.user-profile-menu .menu-item .shortcut {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.user-profile-menu .menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
}

.user-profile-menu .menu-item.danger {
    color: var(--red);
}

.user-profile-menu .menu-item.danger:hover {
    background: var(--red-muted);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.theme-toggle-row:hover {
    background: var(--navy-700);
}

.theme-toggle-row .label-group {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-2);
    font-size: 0.875rem;
}

.theme-toggle-row .label-group .icon {
    font-size: 1rem;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--navy-600);
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.toggle-switch.active {
    background: var(--teal);
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

/* ===== SR-ONLY UTILITY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===== DARK THEME GLOBAL FORM OVERRIDES ===== */
/* Ensures all form elements respect the dark theme */
input, textarea, select, button {
    color: inherit;
    font-family: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea {
    background-color: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
textarea:focus {
    border-color: #3EBDC4;
    outline: none;
    box-shadow: 0 0 0 2px rgba(62, 189, 196, 0.2);
}

input::placeholder,
textarea::placeholder {
    color: #64748b;
}

select {
    background-color: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    -webkit-appearance: none;
    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='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

select:focus {
    border-color: #3EBDC4;
    outline: none;
}

select option {
    background-color: #1e293b;
    color: #e2e8f0;
}

/* Policy management tab buttons — force dark styling */
nav.bg-slate-800 button,
.tab-bar button,
[role="tablist"] button {
    background: transparent;
    color: #94a3b8;
    border: none;
    cursor: pointer;
}

nav.bg-slate-800 button.tab-active,
nav.bg-slate-800 button:hover,
.tab-bar button.active,
[role="tablist"] button[aria-selected="true"] {
    color: #22d3ee;
}

/* Condition builder area — force dark */
.condition-row,
.conditions-container,
[class*="condition"] {
    background-color: transparent;
    color: #e2e8f0;
}

/* Fix any stray white backgrounds in dark pages */
body.bg-slate-900 div,
body.bg-slate-900 section,
body.bg-slate-900 article,
body.bg-slate-900 main {
    color: inherit;
}

/* Policy builder specific fixes */
.selectable-card {
    cursor: pointer;
    transition: all 0.2s;
}

.selectable-card:hover {
    border-color: #3EBDC4 !important;
}

.selectable-card.selected {
    border-color: #3EBDC4 !important;
    background-color: rgba(62, 189, 196, 0.05) !important;
}

/* Ensure code/pre blocks are dark */
pre, code, .code-block {
    background-color: #0f172a;
    color: #e2e8f0;
}

/* Modal/dialog dark background */
dialog {
    background-color: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 1rem;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}
