/* ============================================================
   Smart Shield Tracker - Design System
   site.css - Core layout, sidebar, navigation, typography
   ============================================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    /* Brand Colors */
    --color-primary: #1e40af;        /* Blue 800 */
    --color-primary-dark: #1e3a8a;   /* Blue 900 */
    --color-primary-light: #3b82f6;  /* Blue 500 */
    --color-primary-50: #eff6ff;
    --color-primary-100: #dbeafe;
    --color-primary-200: #bfdbfe;
    --color-primary-700: #1d4ed8;

    /* Neutral / Gray */
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-400: #9ca3af;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
    --color-gray-800: #1f2937;
    --color-gray-900: #111827;

    /* Status Colors */
    --color-success: #059669;        /* Emerald 600 */
    --color-success-light: #d1fae5;  /* Emerald 100 */
    --color-success-dark: #047857;
    --color-warning: #d97706;        /* Amber 600 */
    --color-warning-light: #fef3c7;  /* Amber 100 */
    --color-danger: #dc2626;         /* Red 600 */
    --color-danger-light: #fee2e2;   /* Red 100 */
    --color-info: #2563eb;           /* Blue 600 */
    --color-info-light: #dbeafe;

    /* Phase Colors */
    --color-phase-prep: #7c3aed;     /* Violet 600 */
    --color-phase-collect: #2563eb;  /* Blue 600 */
    --color-phase-review: #d97706;   /* Amber 600 */
    --color-phase-submit: #059669;   /* Emerald 600 */
    --color-phase-closed: #6b7280;   /* Gray 500 */

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0px;
    --header-height: 0px;
    --content-max-width: 1400px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);

    /* Border Radius */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;

    /* Typography Scale -- Survey Components */
    --font-size-question:    1.0625rem;  /* 17px - question heading */
    --font-size-label:       1rem;       /* 16px - input labels, radio labels */
    --font-size-input:       0.9375rem;  /* 15px - form inputs, selects, textareas */
    --font-size-help:        0.875rem;   /* 14px - help text, meta, suffixes */
    --font-size-table-head:  0.8125rem;  /* 13px - table headers */
    --font-size-table-cell:  0.875rem;   /* 14px - table body cells */
    --font-size-small:       0.75rem;    /* 12px - badges, timestamps */
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
    width: 100%;
}

body {
    font-family: var(--font-sans);
    color: var(--color-gray-800);
    background-color: var(--color-gray-50);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: clip;
    width: 100%;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}
a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

img { max-width: 100%; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-gray-900);
}
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--color-gray-500); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-primary { color: var(--color-primary); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* --- App Layout --- */
.app-layout {
    display: flex;
    min-height: 100vh;
    overflow-x: clip;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--color-primary-dark) 0%, #172554 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

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

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo i {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
}

.sidebar-logo span {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #fff;
}

.sidebar-org {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-org-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-survey-year {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

.sidebar-year-picker {
    margin-top: 8px;
}

.sidebar-year-picker .year-picker {
    display: flex;
    width: 100%;
    gap: 0;
}

.sidebar-year-picker .year-picker__label {
    display: none;
}

.sidebar-year-picker .year-picker__select {
    width: 100%;
    min-width: 0;
    padding: 6px 28px 6px 10px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    background-color: rgba(255,255,255,0.08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.sidebar-year-picker .year-picker__select:hover {
    border-color: rgba(255,255,255,0.4);
    background-color: rgba(255,255,255,0.12);
}

.sidebar-year-picker .year-picker__select:focus {
    outline: none;
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}

.sidebar-year-picker .year-picker__select option {
    background: var(--color-gray-800, #1f2937);
    color: #fff;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-title,
.nav-section-label {
    padding: 8px 16px 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.4);
}

.sidebar-link,
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-link:hover,
.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}

.sidebar-link.active,
.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-left-color: var(--color-primary-light);
}

.sidebar-link i,
.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.875rem;
    opacity: 0.7;
}
.sidebar-link.active i,
.nav-item.active i { opacity: 1; }

.sidebar-link .link-text {
    flex: 1;
}

/* Service line letter badge in sidebar nav */
.nav-sl-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(255,255,255,0.15);
    font-size: 0.6875rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    flex-shrink: 0;
}

.sidebar-link .service-line-badge {
    font-size: 0.6875rem;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
}

/* Logout link in sidebar */
.nav-logout {
    margin-top: 8px;
    color: rgba(255,255,255,0.5) !important;
    font-size: 0.875rem;
}
.nav-logout:hover {
    color: #fff !important;
}

/* Service line nav items - slightly smaller text */
.nav-service-line {
    font-size: 0.875rem;
    padding-left: 12px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.sidebar-user > i {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.6);
    flex-shrink: 0;
}

.sidebar-user > div {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.5);
}

.btn-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    transition: color var(--transition-fast);
}
.btn-logout:hover {
    color: #fff;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
    max-width: calc(100% - var(--sidebar-width));
    overflow-x: clip;
}

/* Sidebar Toggle Button (inside sidebar-header) */
.sidebar-toggle {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    border: none;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* Sidebar collapsed state (class on .app-layout) */
.app-layout.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    width: 0;
    overflow: hidden;
}

.app-layout.sidebar-collapsed .main-content {
    margin-left: 0;
    max-width: 100%;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header__left { flex: 1; }
.page-header__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h1,
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header .page-subtitle {
    color: var(--color-gray-600);
    font-size: 0.875rem;
    margin-top: 4px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

/* Section headers - blue accent underline matching mockup border-b-2 border-blue-500 */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gray-900);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary-light);
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header .section-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

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

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--color-gray-500);
    margin-bottom: 8px;
}

.page-breadcrumb a {
    color: var(--color-gray-500);
}
.page-breadcrumb a:hover {
    color: var(--color-primary);
}

.page-breadcrumb .separator {
    color: var(--color-gray-300);
}

/* --- Cards --- */
.card {
    background: #fff;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

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

.card-header h2,
.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-gray-100);
    background: var(--color-gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: var(--color-gray-700);
    border-color: var(--color-gray-300);
}
.btn-secondary:hover {
    background: var(--color-gray-50);
    border-color: var(--color-gray-400);
}

.btn-success {
    background: var(--color-success);
    color: #fff;
}
.btn-success:hover {
    background: var(--color-success-dark);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}
.btn-danger:hover {
    background: #b91c1c;
}

.btn-ghost {
    background: transparent;
    color: var(--color-gray-600);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--color-gray-100);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 10px 24px;
    font-size: 1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-outline {
    background: #fff;
    border: 1px solid var(--color-gray-300);
    color: var(--color-gray-700);
}

.btn-outline:hover {
    background: var(--color-gray-50);
    border-color: var(--color-gray-400);
}

.btn-outline-primary {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-outline-primary:hover {
    background: var(--color-primary);
    color: #fff;
}

/* Documentation button - matches mockup bg-blue-50 text-blue-700 */
.btn-doc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-primary-700);
    background: var(--color-primary-50);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.btn-doc:hover {
    background: var(--color-primary-100);
}

.btn-xs {
    padding: 3px 8px;
    font-size: 0.75rem;
}

/* --- Form Controls --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-700);
    margin-bottom: 8px;
}

.form-group label .required {
    color: var(--color-danger);
    margin-left: 2px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--color-gray-800);
    background: #fff;
    border: 2px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.form-control:disabled {
    background: var(--color-gray-100);
    cursor: not-allowed;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    font-size: 0.75rem;
    color: var(--color-gray-500);
    margin-top: 4px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

/* --- Badges / Tags --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 9999px;
    white-space: nowrap;
    line-height: 1.5;
}

.badge-primary {
    background: var(--color-primary-100);
    color: var(--color-primary);
}
.badge-success {
    background: var(--color-success-light);
    color: var(--color-success);
}
.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}
.badge-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}
.badge-gray {
    background: var(--color-gray-100);
    color: var(--color-gray-600);
}

/* Phase Badges */
.badge-phase-preparation, .badge--purple {
    background: #ede9fe;
    color: var(--color-phase-prep);
}
.badge-phase-data-collection, .badge--blue {
    background: var(--color-info-light);
    color: var(--color-phase-collect);
}
.badge-phase-review, .badge--amber {
    background: var(--color-warning-light);
    color: var(--color-phase-review);
}
.badge-phase-submission, .badge--green {
    background: var(--color-success-light);
    color: var(--color-phase-submit);
}
.badge-phase-closed, .badge--gray {
    background: var(--color-gray-100);
    color: var(--color-phase-closed);
}

/* NEW question badge - matches mockup gradient */
.badge-new {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(to right, #ec4899, #f97316);
    border-radius: 9999px;
    animation: pulse-subtle 2s ease-in-out infinite;
}

/* Modified question badge */
.badge-modified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 9999px;
}

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

/* --- Tables --- */
.table-container {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

table.data-table thead th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--color-gray-600);
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-200);
    white-space: nowrap;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

table.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-gray-100);
    vertical-align: middle;
}

table.data-table tbody tr:hover {
    background: var(--color-gray-50);
}

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

/* --- Progress Bar --- */
.progress {
    height: 8px;
    background: var(--color-gray-200);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width var(--transition-slow);
    background: var(--color-primary);
}

.progress-bar.success { background: var(--color-success); }
.progress-bar.warning { background: var(--color-warning); }
.progress-bar.danger { background: var(--color-danger); }

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--color-gray-500);
    margin-bottom: 4px;
}

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.alert i { margin-top: 2px; }

.alert-info {
    background: var(--color-info-light);
    color: var(--color-info);
    border: 1px solid #93c5fd;
}

.alert-success {
    background: var(--color-success-light);
    color: var(--color-success);
    border: 1px solid #6ee7b7;
}

.alert-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
    border: 1px solid #fcd34d;
}

.alert-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border: 1px solid #fca5a5;
}

/* --- Stat Cards (Dashboard) --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-gray-900);
    margin-top: 4px;
    line-height: 1.2;
}

.stat-card .stat-meta {
    font-size: 0.75rem;
    color: var(--color-gray-500);
    margin-top: 4px;
}

.stat-card .stat-icon {
    float: right;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-icon.blue {
    background: var(--color-primary-50);
    color: var(--color-primary);
}
.stat-icon.green {
    background: var(--color-success-light);
    color: var(--color-success);
}
.stat-icon.amber {
    background: var(--color-warning-light);
    color: var(--color-warning);
}
.stat-icon.red {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

/* --- Tabs --- */
.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--color-gray-200);
    margin-bottom: 20px;
    gap: 0;
}

.tab-link {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font-sans);
}

.tab-link:hover {
    color: var(--color-gray-700);
    text-decoration: none;
}

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

.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Modals --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modal-in 200ms ease-out;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-gray-400);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 4px;
    line-height: 1;
    transition: color var(--transition-fast);
}
.modal-close:hover { color: var(--color-gray-700); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Shared confirm overlay / dialog (used by admin pages + workflow) */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

/* JS sets display:flex to show; CSS class .active also works */
.confirm-overlay.active {
    display: flex;
}

.confirm-dialog {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modal-in 200ms ease-out;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.confirm-dialog h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-gray-100);
}

.confirm-dialog h3 i {
    color: var(--color-primary-light);
    font-size: 1rem;
}

/* --- Tooltips / Popovers --- */
.tooltip-trigger {
    position: relative;
    cursor: help;
}

.tooltip-trigger .tooltip-text {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--color-gray-800);
    color: #fff;
    font-size: 0.75rem;
    border-radius: var(--radius);
    white-space: nowrap;
    z-index: 50;
}

.tooltip-trigger:hover .tooltip-text {
    display: block;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-gray-500);
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--color-gray-300);
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--color-gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto;
}

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--color-gray-500);
    font-size: 0.875rem;
}

/* --- Utility Classes --- */
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.d-block { display: block; }
.d-inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mr-8 { margin-right: 8px; }
.ml-auto { margin-left: auto; }

.p-0 { padding: 0; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-gray-400); }


/* ============================================================
   Login Page
   ============================================================ */
.login-body {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 50%, #3b82f6 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 32px 32px 24px;
    background: var(--color-gray-50);
    border-bottom: 1px solid var(--color-gray-100);
}

.login-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--color-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

.login-header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--color-gray-900);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--color-gray-500);
}

.login-form {
    padding: 24px 32px 32px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-gray-700);
    margin-bottom: 6px;
}

.login-form label i {
    color: var(--color-gray-400);
    font-size: 0.875rem;
}

.login-form .btn-block {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 32px;
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    color: #991b1b;
    font-size: 0.875rem;
}

.login-error i {
    color: var(--color-danger);
    flex-shrink: 0;
}

.login-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 32px;
    padding: 12px;
    background: #FEF3C7;
    border: 1px solid #F59E0B;
    border-radius: 6px;
    color: #92400E;
    font-size: 0.875rem;
}

/* Subdomain org display (replaces org dropdown) */
.org-name-display {
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-gray-700);
}

.login-footer {
    text-align: center;
    padding: 16px 32px;
    border-top: 1px solid var(--color-gray-100);
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--color-gray-400);
}


/* Login links (forgot password, etc.) */
.login-links {
    text-align: center;
    padding-top: 16px;
}
.login-links a {
    font-size: 0.8125rem;
    color: #3b82f6;
    text-decoration: none;
}
.login-links a:hover {
    text-decoration: underline;
}


/* ============================================================
   Mobile Topbar
   Hidden on desktop, visible below 1024px
   ============================================================ */
.mobile-topbar {
    display: none;
}

.sidebar-close {
    display: none;
}

/* Sidebar backdrop - hidden by default */
.sidebar-backdrop {
    display: none;
}


/* ============================================================
   Scroll Shadow Indicators — shows edge shadows on scrollable tables
   Uses background-attachment: local/scroll trick (CSS-only, no JS)
   ============================================================ */
.table-responsive,
.admin-table-wrapper,
.audit-table-wrap,
.heatmap-container,
.gap-table-wrapper {
    background:
        linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left / 40px 100% no-repeat,
        linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) right / 40px 100% no-repeat,
        linear-gradient(to right, rgba(0,0,0,0.07), rgba(0,0,0,0)) left / 14px 100% no-repeat,
        linear-gradient(to left, rgba(0,0,0,0.07), rgba(0,0,0,0)) right / 14px 100% no-repeat;
    background-attachment: local, local, scroll, scroll;
}


/* ============================================================
   Responsive - Tablet (max-width: 1024px)
   Sidebar becomes off-canvas overlay, topbar appears
   ============================================================ */
@media (max-width: 1024px) {

    /* Prevent ASP.NET form from expanding beyond viewport */
    #form1 {
        max-width: 100vw;
        overflow-x: clip;
    }

    /* --- Mobile Topbar --- */
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: linear-gradient(135deg, var(--color-primary-dark) 0%, #172554 100%);
        color: #fff;
        padding: 0 16px;
        z-index: 90;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    .mobile-topbar__hamburger {
        width: 40px;
        height: 40px;
        border: none;
        background: rgba(255,255,255,0.12);
        color: #fff;
        border-radius: var(--radius-md);
        font-size: 1.125rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background var(--transition-fast);
        flex-shrink: 0;
    }

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

    .mobile-topbar__title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 1rem;
        font-weight: 700;
        letter-spacing: -0.025em;
    }

    .mobile-topbar__title i {
        font-size: 1.125rem;
        opacity: 0.8;
    }

    .mobile-topbar__spacer {
        flex: 1;
    }

    /* --- Sidebar Off-Canvas --- */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 200;
    }

    .sidebar--mobile-open {
        transform: translateX(0);
    }

    /* Show close button on mobile */
    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border: none;
        background: rgba(255,255,255,0.12);
        color: rgba(255,255,255,0.8);
        border-radius: var(--radius);
        font-size: 1rem;
        cursor: pointer;
        transition: all var(--transition-fast);
        flex-shrink: 0;
    }

    .sidebar-close:hover {
        background: rgba(255,255,255,0.2);
        color: #fff;
    }

    /* Hide the old desktop toggle */
    .sidebar-toggle {
        display: none;
    }

    /* --- Sidebar Backdrop --- */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 150;
        opacity: 0;
        transition: opacity var(--transition-slow);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
    }

    /* --- Main Content --- */
    .main-content {
        margin-left: 0;
        max-width: 100%;
        width: 100%;
        padding: 72px 16px 24px;  /* 56px topbar + 16px spacing */
        overflow-x: clip;
    }

    /* Prevent horizontal scroll on mobile */
    html, body {
        overflow-x: clip;
        max-width: 100vw;
    }

    /* Lock body scroll when sidebar open */
    body.sidebar-open {
        overflow: hidden;
    }

    /* --- Page Header --- */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header__right {
        width: 100%;
        justify-content: flex-start;
    }

    .page-header-actions {
        flex-wrap: wrap;
    }

    /* --- Section Header --- */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .section-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    /* --- Tabs --- */
    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        flex-wrap: nowrap;
    }

    .tab-link {
        padding: 10px 14px;
        font-size: 0.8125rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* --- Modals & Dialogs (keep on screen) --- */
    .confirm-overlay {
        padding: 16px;
    }

    .confirm-dialog {
        max-width: 100% !important;
        padding: 20px;
        max-height: calc(100vh - 32px);
    }

    .modal {
        width: 95%;
        max-height: 90vh;
    }

    /* --- Tables (horizontal scroll) --- */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive table {
        min-width: 600px;
    }

    /* Admin tables that don't have wrapper yet */
    table.data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.admin-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* --- Stat Grid --- */
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* --- Buttons --- */
    .btn {
        padding: 10px 16px;
    }

    .btn-sm {
        padding: 7px 12px;
    }
}


/* ============================================================
   Responsive - Phone (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {

    /* --- Typography Scale Responsive --- */
    :root {
        --font-size-question:  0.9375rem;
        --font-size-label:     0.9375rem;
        --font-size-input:     0.9375rem;
        --font-size-help:      0.8125rem;
    }

    /* --- Typography --- */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    .page-header h1,
    .page-title { font-size: 1.25rem; }
    .section-title { font-size: 1.25rem; }

    /* --- Main Content Padding --- */
    .main-content {
        padding: 68px 12px 20px;
    }

    /* --- Stat Grid --- */
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        padding: 12px 14px;
    }

    .stat-card .stat-value {
        font-size: 1.375rem;
    }

    .stat-card .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    /* --- Cards --- */
    .card-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .card-body {
        padding: 16px;
    }

    .card-footer {
        padding: 12px 16px;
    }

    /* --- Form Controls --- */
    .form-control {
        padding: 10px 12px;
        font-size: 1rem; /* prevents iOS zoom on focus */
    }

    select.form-control {
        font-size: 1rem;
    }

    /* --- Login Page --- */
    .login-container {
        padding: 16px;
    }

    .login-header {
        padding: 24px 20px 16px;
    }

    .login-form {
        padding: 20px;
    }

    .login-error {
        margin: 0 20px;
    }

    .login-footer {
        padding: 12px 20px;
    }

    /* --- Empty State --- */
    .empty-state {
        padding: 24px 16px;
    }

    .empty-state i {
        font-size: 2rem;
    }

    /* --- Toast Notifications --- */
    #notification-container {
        right: 12px !important;
        left: 12px !important;
        max-width: 100% !important;
        width: auto !important;
    }
}


/* ============================================================
   Responsive - Small Phone (max-width: 480px)
   ============================================================ */
@media (max-width: 480px) {

    /* --- Typography Scale Responsive --- */
    :root {
        --font-size-question:  0.875rem;
        --font-size-label:     0.875rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    /* Stack button groups vertically */
    .page-header-actions,
    .section-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-actions .btn,
    .section-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Topbar smaller */
    .mobile-topbar {
        height: 48px;
        padding: 0 12px;
    }

    .mobile-topbar__hamburger {
        width: 36px;
        height: 36px;
    }

    .mobile-topbar__title {
        font-size: 0.9375rem;
    }

    .main-content {
        padding: 60px 10px 16px;
    }

    /* Modal full-width */
    .modal {
        width: 100%;
        border-radius: var(--radius-md);
    }

    .confirm-dialog {
        padding: 16px;
    }

    .confirm-dialog h3 {
        font-size: 1rem;
    }

    /* Breadcrumbs wrap */
    .page-breadcrumb {
        flex-wrap: wrap;
    }
}


/* --- Session Timeout Warning Modal --- */
.session-warning-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    backdrop-filter: blur(2px);
}

.session-warning {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
    padding: 32px;
    text-align: center;
}

.session-warning--expired {
    border-top: 4px solid #DC2626;
}

.session-warning__icon {
    margin-bottom: 16px;
}

.session-warning__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-gray-900, #111827);
    margin: 0 0 8px;
}

.session-warning__text {
    font-size: 0.9375rem;
    color: var(--color-gray-600, #4B5563);
    margin: 0 0 4px;
    line-height: 1.5;
}

.session-warning__subtext {
    font-size: 0.8125rem;
    color: var(--color-gray-400, #9CA3AF);
    margin: 0 0 20px;
}

.session-warning__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.session-warning__actions .btn {
    min-width: 120px;
}


/* --- Activity Log (E7) --- */

.audit-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.audit-stat-card {
    background: #fff;
    border: 1px solid var(--color-gray-200);
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
}

.audit-stat-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gray-900);
    line-height: 1.2;
}

.audit-stat-card__label {
    font-size: 0.75rem;
    color: var(--color-gray-500);
    margin-top: 2px;
}

/* Filter bar */
.audit-filters {
    padding: 14px 16px;
}

.audit-filters__row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.audit-filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 130px;
}

.audit-filter-group--actions {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 6px;
    min-width: auto;
}

.audit-filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.audit-filter-select,
.audit-filter-input {
    padding: 6px 10px;
    border: 1px solid var(--color-gray-300);
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--color-gray-800);
    background: #fff;
}

.audit-filter-select:focus,
.audit-filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

/* Table */
.audit-table-wrap {
    overflow-x: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.audit-table th {
    background: var(--color-gray-50);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-gray-500);
    border-bottom: 1px solid var(--color-gray-200);
    white-space: nowrap;
}

.audit-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-gray-100);
    vertical-align: top;
}

.audit-row {
    cursor: pointer;
    transition: background 0.1s;
}

.audit-row:hover {
    background: var(--color-gray-50);
}

.audit-cell--time {
    font-size: 0.75rem;
    color: var(--color-gray-500);
    white-space: nowrap;
}

.audit-cell--event {
    font-weight: 500;
    text-transform: capitalize;
    font-size: 0.78rem;
}

.audit-cell--value {
    font-size: 0.75rem;
    color: var(--color-gray-600);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audit-cell--ip {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    color: var(--color-gray-400);
}

.audit-table__empty {
    text-align: center;
    padding: 32px 10px !important;
    color: var(--color-gray-400);
    font-style: italic;
}

.audit-table__error {
    color: var(--color-danger);
}

/* Category badge */
.audit-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Detail row */
.audit-detail-row td {
    padding: 0 !important;
    border-bottom: 1px solid var(--color-gray-200);
}

.audit-detail {
    padding: 12px 16px;
    background: var(--color-gray-50);
    font-size: 0.8rem;
    line-height: 1.6;
}

.audit-detail code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: var(--color-gray-100);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.78rem;
    word-break: break-all;
}

.audit-detail__meta {
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--color-gray-400);
}

/* Pagination */
.audit-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--color-gray-100);
}

.audit-pagination__info {
    font-size: 0.8rem;
    color: var(--color-gray-500);
}

.audit-pagination__buttons {
    display: flex;
    gap: 4px;
}

/* Log management */
.audit-management {
    padding: 16px;
}

.audit-management__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-gray-800);
    margin: 0 0 12px;
}

.audit-management__title i {
    color: var(--color-gray-400);
    margin-right: 6px;
}

.audit-management__row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--color-gray-600);
}

/* ---- Impersonation Banner ---- */
.impersonation-banner {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
    font-size: 0.875rem;
}

.impersonation-banner__content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.impersonation-banner__content i.fa-user-secret {
    font-size: 1.1rem;
}

.impersonation-banner__exit {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}

.impersonation-banner__exit:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Push main layout down when impersonation banner is visible */
.impersonation-banner ~ .app-layout {
    padding-top: 40px;
}

.impersonation-banner ~ .app-layout .sidebar {
    top: 40px;
    height: calc(100vh - 40px);
}

/* ============================================================
   System Announcements (user-facing banners)
   ============================================================ */
.system-announcement {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    font-size: 0.8125rem;
    line-height: 1.4;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.system-announcement--info {
    background: #EFF6FF;
    color: #1E40AF;
    border-left: 4px solid #3B82F6;
}
.system-announcement--warning {
    background: #FFFBEB;
    color: #92400E;
    border-left: 4px solid #F59E0B;
}
.system-announcement--critical {
    background: #FEF2F2;
    color: #991B1B;
    border-left: 4px solid #DC2626;
}
.system-announcement__content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}
.system-announcement__content i {
    font-size: 1rem;
    flex-shrink: 0;
}
.system-announcement__content strong {
    margin-right: 6px;
}
.system-announcement__dismiss {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 4px 8px;
    flex-shrink: 0;
}
.system-announcement__dismiss:hover {
    opacity: 1;
}
@media (max-width: 768px) {
    .system-announcement {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    .system-announcement__content {
        gap: 6px;
    }
}
