:root {
    /* Modern Color Palette */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #10b981;
    --info: #3b82f6;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light: #f1f5f9;
    --dark: #1e293b;
    --text: #334155;
    --border: #e2e8f0;
    --white: #ffffff;

    /* Navigation bar (dark theme) */
    --sidebar-bg: #1a1f2e;
    --sidebar-header-bg: #141820;
    --sidebar-text: #a8b8cb;
    --sidebar-text-hover: #e2e8f0;
    --sidebar-active-bg: rgba(37, 99, 235, 0.15);
    --sidebar-active-text: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
    --sidebar-section-text: #64748b;
    --sidebar-border: rgba(255, 255, 255, 0.06);
    
    /* Typography */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border Radius */
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    background-color: var(--light);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================
   APP SHELL
   ============================ */

.app-shell {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--light);
    overflow-x: hidden;
}

.main-content > article {
    padding: 1.5rem 2rem;
    flex: 1;
}

@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
    }
    .main-content > article {
        padding: 1rem;
    }
}

/* ============================
   SIDEBAR
   ============================ */

.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg, #1a1f2e);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 200;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.125rem;
    font-style: italic;
    text-decoration: none;
    letter-spacing: -0.01em;
}
.sidebar-brand:hover { color: #ffffff; text-decoration: none; }

.sidebar-brand-icon {
    font-size: 1rem;
    color: var(--primary, #2563eb);
}

.sidebar-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.125rem;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    line-height: 1;
    transition: color 0.15s;
}
.sidebar-close:hover { color: #ffffff; }

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-section-text, #64748b);
    padding: 0.75rem 0.5rem 0.25rem;
    display: block;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-md, 0.5rem);
    color: var(--sidebar-text, #a8b8cb);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    margin-bottom: 1px;
}
.sidebar-nav-item i {
    width: 1.125rem;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.15s;
}
.sidebar-nav-item:hover {
    background-color: var(--sidebar-hover-bg, rgba(255,255,255,0.06));
    color: var(--sidebar-text-hover, #e2e8f0);
    text-decoration: none;
}
.sidebar-nav-item:hover i { opacity: 1; }
.sidebar-nav-item.active {
    background-color: var(--sidebar-active-bg, rgba(37,99,235,0.18));
    color: #ffffff;
}
.sidebar-nav-item.active i {
    opacity: 1;
    color: var(--primary, #2563eb);
}

.sidebar-footer {
    padding: 0.875rem 0.75rem;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

/* New Scan button */
.sidebar-new-scan {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0.75rem 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--primary);
    color: #fff;
    border-radius: var(--border-radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}

.sidebar-new-scan:hover {
    background: #1d4ed8;
    color: #fff;
    text-decoration: none;
}

/* Domain items in recent list */
.sidebar-nav-item--domain span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Muted/secondary nav items */
.sidebar-nav-item--muted {
    opacity: 0.65;
    font-size: 0.8rem;
}

.sidebar-nav-item--muted:hover { opacity: 1; }

/* Beta badge */
.sidebar-beta-badge {
    margin-left: auto;
    background: rgba(255,255,255,0.12);
    color: #94a3b8;
    font-size: 0.625rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-weight: 700;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.25rem;
    border-radius: var(--border-radius-md);
    transition: background-color 0.15s;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary, #2563eb);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sidebar-text-hover, #e2e8f0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 0.6875rem;
    color: var(--sidebar-section-text, #64748b);
    white-space: nowrap;
}

.sidebar-signout {
    background: none;
    border: none;
    color: var(--sidebar-section-text, #64748b);
    padding: 0.375rem;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    flex-shrink: 0;
    transition: color 0.15s, background-color 0.15s;
    line-height: 1;
}
.sidebar-signout:hover {
    color: #ef4444;
    background-color: rgba(239,68,68,0.1);
}

/* Mobile topbar */
.mobile-topbar {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    height: 56px;
    background-color: var(--sidebar-bg, #1a1f2e);
    position: sticky;
    top: 0;
    z-index: 150;
    flex-shrink: 0;
}

.mobile-menu-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: #ffffff;
    padding: 0.375rem 0.625rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: background-color 0.15s;
}
.mobile-menu-btn:hover { background-color: rgba(255,255,255,0.08); }

.mobile-topbar-brand {
    color: #ffffff;
    font-weight: 700;
    font-style: italic;
    font-size: 1.125rem;
    text-decoration: none;
    flex: 1;
}
.mobile-topbar-brand:hover { color: #ffffff; text-decoration: none; }

.mobile-topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--primary, #2563eb);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 190;
    animation: fadeIn 0.2s ease;
}
.sidebar-overlay--visible { display: block; }

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    }
    .sidebar--open { transform: translateX(0); }
    .mobile-topbar { display: flex; }
}

@media (min-width: 992px) {
    .sidebar-close { display: none !important; }
}

/* ============================
   PAGE HERO
   ============================ */

.page-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-hero-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.page-hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.125rem;
    line-height: 1.3;
}

.page-hero-subtitle {
    font-size: 0.875rem;
    color: var(--secondary);
    margin-bottom: 0;
}

/* Scan type color tokens */
.scan-color-standard    { --scan-bg: #dbeafe; --scan-color: #1d4ed8; }
.scan-color-accessibility { --scan-bg: #dcfce7; --scan-color: #15803d; }
.scan-color-healthcheck { --scan-bg: #fee2e2; --scan-color: #b91c1c; }
.scan-color-cookie      { --scan-bg: #ffedd5; --scan-color: #c2410c; }
.scan-color-script      { --scan-bg: #ede9fe; --scan-color: #6d28d9; }
.scan-color-security    { --scan-bg: #fef3c7; --scan-color: #b45309; }
.scan-color-widget      { --scan-bg: #ccfbf1; --scan-color: #0f766e; }
.scan-color-sitemap     { --scan-bg: #e0f2fe; --scan-color: #0369a1; }

/* ============================
   SKELETON LOADER
   ============================ */

@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

.skeleton-line {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--border-radius-sm);
}

.skeleton-box {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--border-radius-md);
}

/* ============================
   LOADING CARD (results page)
   ============================ */

.loading-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.loading-checklist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--secondary);
}

.loading-checklist-item.is-done {
    color: var(--success);
}

.loading-checklist-item i {
    width: 1.25rem;
    text-align: center;
    font-size: 0.875rem;
}

/* ============================
   EMPTY STATES (improved)
   ============================ */

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.empty-state-icon i {
    font-size: 1.5rem;
    color: var(--secondary);
    opacity: 0.6;
}

/* ============================
   CONTAINER RESET
   ============================ */

.container-fluid {
    padding: 0;
    margin: 0;
}

/* Navigation */
.navbar {
    background-color: var(--white);
    padding: var(--spacing-md) var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.nav-link {
    color: var(--text);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.nav-link:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.nav-link.active {
    color: var(--primary);
    background-color: var(--primary-light);
    font-weight: 500;
}

/* Cards */
.card {
    background-color: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    overflow: hidden;
}

/* Only clickable cards should lift on hover */
.clickable-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

.card-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border);
    padding: var(--spacing-lg);
    font-weight: 600;
    color: var(--dark);
}

.card-body {
    padding: var(--spacing-lg);
}

/* Tables */
.table {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    width: 100%;
}

.table > thead > tr > th,
.table thead th {
    background-color: var(--light) !important;
    color: var(--secondary) !important;
    box-shadow: none !important;
    border-bottom: 2px solid var(--border);
    padding: var(--spacing-md);
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.table tbody td {
    padding: var(--spacing-md);
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
    background-color: var(--primary-light);
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

/* Forms */
.form-control {
    border: 1px solid var(--border);
    border-radius: var(--border-radius-md);
    padding: 0.625rem 1rem;
    transition: all var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

/* Alerts */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.alert-info {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid var(--primary);
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #22c55e;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Badges */
.badge {
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.bg-primary {
    background-color: var(--primary);
    color: var(--white);
}

.badge.bg-success {
    background-color: var(--success);
    color: var(--white);
}

.badge.bg-warning {
    background-color: var(--warning);
    color: var(--white);
}

.badge.bg-danger {
    background-color: var(--danger);
    color: var(--white);
}

/* Responsive Design */
@media (max-width: 767.98px) {
    main {
        max-width: 100%;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-xl);
}

.loading-spinner::after {
    content: "";
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Source Pages */
.source-pages {
    max-width: 300px;
}

.source-page-link {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--spacing-xs);
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.source-page-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Technical Headers */
.technical-headers {
    background-color: var(--light);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    font-family: monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

/* Broken Links Tab */
.broken-links-tab {
    background-color: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-lg);
    margin-top: var(--spacing-md);
}

.broken-links-tab .table {
    margin-bottom: 0;
}

.broken-links-tab .table td {
    vertical-align: middle;
    padding: var(--spacing-md);
}

.broken-links-tab .table td:first-child {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.broken-links-tab .table td a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.broken-links-tab .table td a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.broken-links-tab .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Source Pages in Broken Links */
.broken-links-tab .source-pages {
    max-width: 300px;
    background-color: var(--light);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    margin-top: var(--spacing-xs);
}

.broken-links-tab .source-page-link {
    display: block;
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--primary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-radius: var(--border-radius-sm);
}

.broken-links-tab .source-page-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

/* Table Striped Rows */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--light);
}

.table-striped tbody tr:hover {
    background-color: var(--primary-light);
}

/* Table Danger/Warning States */
.table-danger {
    background-color: #fee2e2 !important;
}

.table-warning {
    background-color: #fef3c7 !important;
}

/* Responsive Table */
.table-responsive {
    margin: 0 calc(-1 * var(--spacing-lg));
    padding: 0 var(--spacing-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .broken-links-tab {
        padding: var(--spacing-md);
    }
    
    .broken-links-tab .table td {
        padding: var(--spacing-sm);
    }
    
    .broken-links-tab .table td:first-child {
        max-width: 200px;
    }
}

/* Image Helper Styles */
.image-preview {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: ew-resize;
}

.comparison-slider img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.comparison-slider .slider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 2;
}

.comparison-slider .slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.comparison-slider .slider::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #000;
}

.image-file-card {
    transition: all 0.3s ease;
}

.image-file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.image-file-card .card-body {
    padding: 1rem;
}

.image-file-card .form-check {
    margin-bottom: 0.5rem;
}

.image-file-card .image-preview {
    margin-bottom: 0.5rem;
}

.image-file-card .file-info {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    .image-file-card {
        margin-bottom: 1rem;
    }
    
    .comparison-slider .slider::before {
        width: 24px;
        height: 24px;
    }
    
    .comparison-slider .slider::after {
        width: 16px;
        height: 16px;
    }
}

/* ============================
   UTILITY CLASSES
   ============================ */

.section-gap {
    margin-bottom: 1.5rem;
}

/* ============================
   UNIFIED TAB HEADER
   ============================ */

.tab-header {
    margin-bottom: 1.75rem;
}

.tab-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.tab-subtitle {
    font-size: 0.875rem;
    color: var(--secondary);
    margin-bottom: 0;
}

.tab-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

/* ============================
   STANDARDIZED STAT CARDS
   ============================ */

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-normal);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--dark);
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
}

/* Compact stat card variant (icon + value inline) */
.stat-card--compact {
    padding: 1rem 1.25rem;
}

.stat-card--compact .stat-value {
    font-size: 1.25rem;
}

.stat-card--compact .stat-label {
    margin-top: 0;
}

/* Stat card accent borders (left-border color coding) */
.stat-card--success { border-left: 4px solid var(--success); }
.stat-card--warning { border-left: 4px solid var(--warning); }
.stat-card--danger  { border-left: 4px solid var(--danger); }
.stat-card--info    { border-left: 4px solid var(--info); }
.stat-card--primary { border-left: 4px solid var(--primary); }

/* Stat icon background variants */
.stat-icon--success { background-color: #dcfce7; color: #059669; border: 1.5px solid #bbf7d0; }
.stat-icon--warning { background-color: #fef3c7; color: #d97706; border: 1.5px solid #fde68a; }
.stat-icon--danger  { background-color: #fee2e2; color: #dc2626; border: 1.5px solid #fecaca; }
.stat-icon--info    { background-color: #dbeafe; color: #2563eb; border: 1.5px solid #bfdbfe; }
.stat-icon--primary { background-color: #dbeafe; color: #1d4ed8; border: 1.5px solid #bfdbfe; }

/* Stat cards grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================
   TABLE ENHANCEMENTS
   ============================ */

.table th[data-sortable] {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.table th[data-sortable]:hover {
    background-color: var(--border);
}

.url-cell {
    max-width: 350px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================
   SCROLLABLE TAB NAVIGATION
   ============================ */

.nav-tabs-scrollable {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border);
    gap: 0;
}

.nav-tabs-scrollable .nav-link {
    white-space: nowrap;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 0.5rem 0.875rem;
    color: var(--secondary);
    font-weight: 500;
    font-size: 0.8125rem;
    transition: color var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
}

.nav-tabs-scrollable .nav-link:hover {
    color: var(--primary);
    background-color: transparent;
    border-bottom-color: rgba(37, 99, 235, 0.3);
}

.nav-tabs-scrollable .nav-link.active {
    color: var(--primary);
    background-color: transparent;
    border-bottom: 3px solid var(--primary);
    font-weight: 600;
}

.nav-tabs-scrollable .nav-link i {
    font-size: 0.8125rem;
    opacity: 0.6;
}

.nav-tabs-scrollable .nav-link:hover i {
    opacity: 0.85;
}

.nav-tabs-scrollable .nav-link.active i {
    opacity: 1;
    color: var(--primary);
}

/* ============================
   TAB CONTENT ANIMATION
   ============================ */

.tab-content-enter {
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================
   EMPTY STATES
   ============================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state h5 {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* ============================
   SCORE RING (Overview dashboard)
   ============================ */

.score-ring {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.score-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        var(--score-color, var(--primary)) calc(var(--score-pct, 0) * 1%),
        var(--border) 0
    );
    mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 10px));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 10px));
}

.score-ring .score-value {
    font-size: 1.75rem;
    font-weight: 700;
    z-index: 1;
}

.score-ring .score-label {
    position: absolute;
    bottom: -1.5rem;
    font-size: 0.75rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Priority section highlight */
.priority-section {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
}

/* ============================
   FILTER BAR
   ============================ */

.filter-bar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 250px;
}

/* ============================
   NAV SECTION LABELS
   ============================ */

.nav-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-section-text);
    padding: 1rem 1rem 0.375rem 1.25rem;
    margin-top: 0.5rem;
}

/* ============================
   DASHBOARD
   ============================ */

.dashboard .quick-action-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem;
    border-radius: var(--border-radius-md);
    text-decoration: none;
    color: var(--text);
    transition: background-color var(--transition-fast);
}

.dashboard .quick-action-item:hover {
    background-color: var(--light);
    text-decoration: none;
    color: var(--text);
}

.dashboard .quick-action-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.scan-feed-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.scan-feed-icon--primary { background-color: #dbeafe; color: #2563eb; }
.scan-feed-icon--success { background-color: #dcfce7; color: #059669; }
.scan-feed-icon--danger  { background-color: #fee2e2; color: #dc2626; }
.scan-feed-icon--info    { background-color: #e0f2fe; color: #0284c7; }

.bg-primary-subtle { background-color: #dbeafe !important; }
.bg-success-subtle { background-color: #dcfce7 !important; }
.bg-danger-subtle  { background-color: #fee2e2 !important; }
.bg-info-subtle    { background-color: #e0f2fe !important; }
.bg-warning-subtle { background-color: #fef3c7 !important; }

.bg-success-subtle.badge { background-color: #dcfce7 !important; }
.bg-warning-subtle.badge { background-color: #fef3c7 !important; }

.list-group-item-action:hover {
    background-color: var(--light);
}

/* ============================
   MORE ACTIONS DROPDOWN
   ============================ */

.btn-more-actions {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--secondary);
    padding: 0.375rem 0.625rem;
    border-radius: var(--border-radius-md);
}

.btn-more-actions:hover {
    background-color: var(--light);
    color: var(--dark);
}

/* ============================
   DATABASE STATUS BANNER
   ============================ */

.db-status-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #dc2626;
    color: #fff;
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.db-status-banner-msg {
    flex: 1;
    min-width: 0;
    margin: 0 0.5rem;
}

.db-status-banner-retry {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    border-radius: var(--border-radius-md);
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.db-status-banner-retry:hover:not(:disabled) {
    background: rgba(255,255,255,0.25);
}

.db-status-banner-retry:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ============================
   DOMAIN DASHBOARD
   ============================ */

/* Full-viewport shell used by DomainLayout (no app sidebar) */
.domain-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--light);
}

.domain-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.domain-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.625rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.domain-header-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.domain-back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}

.domain-back-link:hover {
    background: var(--light);
    color: var(--dark);
}

.domain-back-label {
    font-size: 0.8125rem;
    color: var(--secondary);
    margin-right: 0.25rem;
}

.domain-header-divider {
    display: block;
    width: 1px;
    height: 18px;
    background: var(--border);
    flex-shrink: 0;
}

.domain-header-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.domain-version-select {
    max-width: 160px;
    font-size: 0.8125rem;
}

.domain-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Body: sidenav + main */
.domain-body {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    min-height: 0;
    flex: 1;
}

/* Left sidenav */
.domain-sidenav {
    width: 220px;
    flex-shrink: 0;
    padding: 1rem 0.625rem;
    border-right: 1px solid var(--border);
    background: #fafbfc;
    min-height: calc(100vh - 48px);
    overflow-y: auto;
    position: sticky;
    top: 0;
    align-self: flex-start;
    max-height: 100vh;
}

.sidenav-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--secondary);
    padding: 0 0.625rem 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0.125rem;
}
.sidenav-section-label:first-child {
    margin-top: 0;
}

.sidenav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s, color 0.1s;
    margin-bottom: 1px;
}

.sidenav-item i {
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.sidenav-item:hover {
    background: #eef2f7;
    color: var(--dark);
}

.sidenav-item--active {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}

.sidenav-item--active i { color: var(--primary); }

.sidenav-count {
    font-size: 0.6875rem;
    color: var(--secondary);
    font-weight: 400;
}

.sidenav-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    line-height: 1.5;
    min-width: 18px;
    text-align: center;
    background: #fef3c7;
    color: #d97706;
}

.sidenav-badge--warn { background: #fef3c7; color: #d97706; }
.sidenav-badge--danger { background: #fee2e2; color: #dc2626; }

/* Main content area */
.domain-main {
    flex: 1;
    min-width: 0;
    padding: 1.25rem 1.5rem;
}

/* Summary row: score ring card + history card */
.dash-summary-row {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .dash-summary-row { grid-template-columns: 1fr; }
}

.dash-quick-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.dash-quick-stat {
    display: flex;
    flex-direction: column;
}

.dash-quick-stat-val {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--dark);
}

.dash-quick-stat-lbl {
    font-size: 0.75rem;
    color: var(--secondary);
    margin-top: 0.125rem;
}

/* History list */
.dash-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.dash-history-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--secondary);
    transition: background 0.1s;
}

.dash-history-item:hover { background: var(--light); color: var(--dark); }

.dash-history-item--active {
    background: var(--light);
    color: var(--dark);
    font-weight: 500;
}

.dash-history-date { flex: 1; min-width: 0; }

/* Score cards */
.dash-score-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .dash-score-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
    .dash-score-cards { grid-template-columns: 1fr; }
}

.dash-score-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
}

.dash-score-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dash-score-card-score {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.625rem;
}

.dash-score-card-detail {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dash-score-issue {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--secondary);
}

/* Issue severity + top issues */
.dash-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 700px) {
    .dash-panels { grid-template-columns: 1fr; }
}

.dash-severity-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.5rem;
}

.dash-severity-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    width: 70px;
    flex-shrink: 0;
    color: var(--secondary);
}

.dash-severity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dash-severity-bar-wrap {
    flex: 1;
    background: var(--light);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.dash-severity-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.bg-orange { background-color: #ea580c !important; }

.dash-severity-count {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dark);
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.dash-top-issue {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.8125rem;
}

.dash-top-issue:last-of-type { border-bottom: none; }

.dash-top-issue-label {
    color: var(--secondary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.5rem;
}

/* Run prompt (empty state) */
.dash-run-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--secondary);
}

.dash-run-prompt-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* ── Standard sub-tabs ──────────────────────────────────────────────── */
.dash-subtabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: var(--surface, #fff);
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 16px;
    flex-shrink: 0;
}
.dash-subtabs::-webkit-scrollbar { display: none; }

.dash-subtab {
    padding: 10px 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    background: none;
    color: var(--secondary, #64748b);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: color 0.15s;
    line-height: 1;
}
.dash-subtab:hover { color: var(--text, #334155); }
.dash-subtab--active {
    color: var(--primary, #2563eb);
    border-bottom-color: var(--primary, #2563eb);
    font-weight: 600;
}

.dash-subtab-badge {
    background: #fef3c7;
    color: #d97706;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    line-height: 1.5;
    min-width: 18px;
    text-align: center;
}
.dash-subtab-badge--danger { background: #fee2e2; color: #dc2626; }
.dash-subtab-count { color: var(--secondary, #64748b); font-size: 0.75rem; font-weight: 400; }

/* ── Sub-tab stat strips ────────────────────────────────────────────── */
.dash-subtab-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: #f8fafc;
}

.dash-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 14px;
    background: white;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    min-width: 76px;
    text-align: center;
}

.dash-stat-item--warning { border-left: 3px solid var(--warning, #f59e0b); }
.dash-stat-item--danger  { border-left: 3px solid var(--danger, #ef4444); }
.dash-stat-item--success { border-left: 3px solid var(--success, #10b981); }
.dash-stat-item--info    { border-left: 3px solid var(--info, #3b82f6); }

.dash-stat-item-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text, #334155);
    line-height: 1.2;
}
.dash-stat-item-val--warning { color: #d97706; }
.dash-stat-item-val--danger  { color: #dc2626; }
.dash-stat-item-val--success { color: #16a34a; }
.dash-stat-item-val--info    { color: #2563eb; }

.dash-stat-item-lbl {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--secondary, #64748b);
    margin-top: 2px;
    white-space: nowrap;
}

/* ── Detail search bar ──────────────────────────────────────────────── */
.dash-detail-search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border, #e2e8f0);
    background: #f8fafc;
}

/* ── Data tables ────────────────────────────────────────────────────── */
.dash-data-table { font-size: 0.8125rem; }
.dash-data-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--secondary, #64748b);
    padding: 8px 12px;
    white-space: nowrap;
    background: #f8fafc;
}
.dash-data-table td { padding: 7px 12px; vertical-align: middle; }
.dash-data-table tbody tr:hover { background: rgba(37,99,235,0.03); }

.dash-url-cell {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-url-cell a {
    color: var(--primary, #2563eb);
    text-decoration: none;
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: 0.75rem;
}
.dash-url-cell a:hover { text-decoration: underline; }

/* ── Pagination bar ─────────────────────────────────────────────────── */
.dash-paging {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid var(--border, #e2e8f0);
    background: #f8fafc;
    font-size: 0.8125rem;
}