/* 
 * ZareReschedule Portal - Premium Glassmorphism Design System
 * Dark Theme First with glowing details
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #0b0f19;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;

    /* USA Flag Color Palette (No Gradients) */
    --primary: #0A3161;
    /* Old Glory Blue */
    --primary-glow: rgba(10, 49, 97, 0.35);
    --primary-hover: #154580;
    /* Lighter Flag Blue for hover state contrast */

    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.25);

    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.25);

    --error: #C8102E;
    /* Old Glory Red */
    --error-glow: rgba(200, 16, 46, 0.3);

    --info: #0A3161;
    /* Old Glory Blue */

    /* Surface Variables */
    --card-bg: rgba(22, 28, 45, 0.45);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-hover-border: rgba(255, 255, 255, 0.12);
    --input-bg: rgba(15, 23, 42, 0.55);
    --input-border: rgba(255, 255, 255, 0.08);

    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* Reset and Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header & Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--card-border);
    padding: 0.85rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 1.4rem;
    font-weight: 800;
    text-decoration: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
}

.navbar-brand-text {
    font-weight: 800;
    font-size: 1.25rem;
    color: #ffffff;
}

.navbar-nav {
    display: flex;
    gap: 1.25rem;
    list-style: none;
    align-items: center;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #ffffff;
    background: rgba(10, 49, 97, 0.25);
    border: 1px solid rgba(10, 49, 97, 0.4);
    box-shadow: inset 0 0 10px rgba(10, 49, 97, 0.2);
}

/* Page Header */
.page-header {
    margin-bottom: 2.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1.2rem;
}

.page-title {
    font-size: 1.95rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* Card layout (Glassmorphism) */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.25);
    margin-bottom: 1.75rem;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: var(--card-hover-border);
    box-shadow: 0 16px 48px 0 rgba(0, 0, 0, 0.35);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 6px 18px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--error);
    color: white;
    box-shadow: 0 4px 12px var(--error-glow);
}

.btn-danger:hover:not(:disabled) {
    background: #ff4d6d;
    box-shadow: 0 6px 18px rgba(244, 63, 94, 0.4);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.825rem;
    border-radius: 6px;
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

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

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.55rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background-color: var(--input-bg);
    color: var(--text-color);
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-hover);
    box-shadow: 0 0 0 3px rgba(10, 49, 97, 0.2);
    background-color: rgba(15, 23, 42, 0.8);
}

.form-control::placeholder {
    color: #475569;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 800px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

.form-group small {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
    padding-right: 2.5rem;
}

/* Tables styling - Clean and compact to prevent horizontal scroll */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    padding: 0.85rem 1rem;
    background-color: rgba(30, 41, 59, 0.45);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
    vertical-align: middle;
    white-space: nowrap;
}

.table td.email-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.table tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

/* Badges styling */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-target {
    background-color: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}

.badge-earliest {
    background-color: rgba(10, 49, 97, 0.25);
    border-color: rgba(10, 49, 97, 0.45);
    color: #81a3d0;
}

.badge-status {
    background-color: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}

.badge-scanning {
    background-color: rgba(10, 49, 97, 0.25);
    border-color: rgba(10, 49, 97, 0.45);
    color: #81a3d0;
    box-shadow: 0 0 10px rgba(10, 49, 97, 0.2);
}

.badge-logging_in {
    background-color: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.badge-booking {
    background-color: rgba(200, 16, 46, 0.15);
    border-color: rgba(200, 16, 46, 0.3);
    color: #fda4af;
    box-shadow: 0 0 10px rgba(200, 16, 46, 0.15);
}

.badge-rescheduled {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.badge-error {
    background-color: rgba(200, 16, 46, 0.15);
    border-color: rgba(200, 16, 46, 0.3);
    color: #fda4af;
    box-shadow: 0 0 10px rgba(200, 16, 46, 0.15);
}

/* Helpers */
.text-muted {
    color: var(--text-muted) !important;
}

.font-bold {
    font-weight: bold;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.text-center {
    text-align: center;
}

/* ==========================================================================
   Modern SaaS Dashboard Navigation & Compact Components
   ========================================================================== */

/* Top Dashboard Tabs Bar */
.dashboard-tabs-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.dashboard-tab-group {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    backdrop-filter: blur(12px);
}

[data-theme="light"] .dashboard-tab-group {
    background: rgba(241, 245, 249, 0.95);
    border-color: rgba(0, 0, 0, 0.08);
}

.dash-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.95rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.825rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dash-tab-btn:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.dash-tab-btn.active {
    background: rgba(10, 49, 97, 0.45);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(10, 49, 97, 0.6);
}

[data-theme="light"] .dash-tab-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.dash-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem 0.45rem;
    border-radius: 6px;
    font-size: 0.725rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
}

.dash-count-success {
    background: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
}

.dashboard-action-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: auto;
    flex-wrap: wrap;
}

/* Compact Stats Strip */
.stats-strip {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.65rem 1.25rem;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.stats-strip::-webkit-scrollbar {
    display: none;
}

[data-theme="light"] .stats-strip {
    background: rgba(248, 250, 252, 0.85);
    border-color: rgba(0, 0, 0, 0.06);
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.stat-pill-label {
    font-size: 0.775rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-pill-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
}

.stat-pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #34d399;
    box-shadow: 0 0 8px #34d399;
}

.stat-pill-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

[data-theme="light"] .stat-pill-divider {
    background: rgba(0, 0, 0, 0.08);
}

.text-success {
    color: #34d399 !important;
}

.text-warning {
    color: #fbbf24 !important;
}

.text-emerald {
    color: #10b981 !important;
}

/* View Mode Segmented Switcher */
.view-mode-toggle {
    display: inline-flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
}

[data-theme="light"] .view-mode-toggle {
    background: rgba(241, 245, 249, 0.95);
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.775rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.view-toggle-btn:hover {
    color: var(--text-color);
}

.view-toggle-btn.active {
    background: var(--primary);
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(10, 49, 97, 0.35);
}

/* Multi-User Responsive Card Grid */
.applicant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.applicant-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.applicant-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

[data-theme="light"] .applicant-card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .applicant-card:hover {
    border-color: rgba(10, 49, 97, 0.25);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}

/* Card Top Row */
.app-card-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(10, 49, 97, 0.5), rgba(30, 58, 138, 0.25));
    border: 1px solid rgba(10, 49, 97, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.825rem;
    font-weight: 700;
    color: #93c5fd;
    flex-shrink: 0;
}

.app-card-heading {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.app-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-card-title:hover {
    color: var(--primary);
}

.app-card-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card Body (Clean 2-Column Info) */
.app-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.75rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .app-card-body {
    border-top-color: rgba(0, 0, 0, 0.05);
}

.app-meta-row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.meta-lbl {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.meta-lbl svg {
    width: 11px;
    height: 11px;
}

.meta-val {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-target-pill {
    display: inline-block;
    background: rgba(10, 49, 97, 0.25);
    color: #93c5fd;
    border: 1px solid rgba(10, 49, 97, 0.4);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.75rem;
}

.badge-slot-found {
    display: inline-block;
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Card Actions */
.app-card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .app-card-actions {
    border-top-color: rgba(0, 0, 0, 0.05);
}

.app-card-actions button,
.app-card-actions a {
    flex: 1;
    justify-content: center;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    min-height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.app-card-actions button svg,
.app-card-actions a svg {
    width: 12px;
    height: 12px;
}

/* Grid Details Layout */
.details-layout {
    display: grid;
    grid-template-columns: 2.1fr 1.1fr;
    gap: 1.25rem;
}

@media (max-width: 1024px) {
    .details-layout {
        grid-template-columns: 1fr;
    }

    #details-browser-container {
        order: 1 !important;
    }

    #details-console-container {
        order: 2 !important;
    }
}

/* Terminal Window Frame */
.terminal-window {
    background-color: #030712;
    border: 1px solid #1e293b;
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background-color: #0f172a;
    padding: 0.6rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e293b;
}

.terminal-title {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red {
    background-color: #f87171;
}

.dot-yellow {
    background-color: #fbbf24;
}

.dot-green {
    background-color: #34d399;
}

.terminal-body {
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    height: 420px;
    overflow-y: auto;
    scroll-behavior: smooth;
    color: #e2e8f0;
}

/* Terminal Log Rows & colors */
.log-line {
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 0.4rem;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.log-time {
    color: #64748b;
    flex-shrink: 0;
}

.log-msg-text {
    flex-grow: 1;
}

/* Reports KPI Grid */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1rem 1.15rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
}

.stat-card.success::after {
    background: var(--success);
}

.stat-card.error::after {
    background: var(--error);
}

.stat-card.warning::after {
    background: var(--warning);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(10, 49, 97, 0.25);
    border: 1px solid rgba(10, 49, 97, 0.4);
    color: #93c5fd;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-card.success .stat-icon {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.stat-card.error .stat-icon {
    background-color: rgba(244, 63, 94, 0.12);
    color: #f43f5e;
}

.stat-card.warning .stat-icon {
    background-color: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

.stat-info {
    flex-grow: 1;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

/* Pulsing Status Dot */
.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 1.6s infinite;
    vertical-align: middle;
    margin-right: 0.4rem;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Charts Layout Grid */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.chart-wrapper {
    position: relative;
    flex-grow: 1;
    height: 320px;
    margin-top: 1rem;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.chart-header-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    background-color: rgba(30, 41, 59, 0.45);
    padding: 0.4rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.control-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.select-control,
.date-input-control {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    outline: none;
    cursor: pointer;
    font-family: var(--font-sans);
}

.select-control:focus,
.date-input-control:focus {
    border-color: var(--primary-hover);
}

.custom-range-container {
    display: none;
    align-items: center;
    gap: 0.4rem;
}

/* Device bezel frame for live browser view */
.device-monitor {
    background-color: #1e293b;
    border: 8px solid #0f172a;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.device-monitor::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: transparent;
    z-index: 5;
}

/* Keyboard control area */
.keyboard-controls-panel {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
    background: rgba(15, 23, 42, 0.4);
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
}

/* Login layout */
.login-body {
    background-image: none;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 160px);
}

.login-card {
    background: rgba(22, 28, 45, 0.5);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.login-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.login-title {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2.2rem;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.error-alert {
    background-color: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fda4af;
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Log Panel on Reports page */
.log-panel {
    background-color: #030712;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.35);
    overflow: hidden;
    margin-top: 2rem;
}

.log-header {
    background-color: #0f172a;
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.log-title {
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #38bdf8;
}

.log-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.log-btn {
    background-color: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.log-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.log-filter-tabs {
    display: flex;
    background-color: #030712;
    padding: 0.5rem 1.25rem;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.filter-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.filter-tab:hover {
    color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.04);
}

.filter-tab.active {
    color: #ffffff;
    background-color: rgba(79, 70, 229, 0.2);
    border: 1px solid rgba(79, 70, 229, 0.3);
    font-weight: 600;
}

.log-body {
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.825rem;
    line-height: 1.6;
    height: 400px;
    overflow-y: auto;
    scroll-behavior: smooth;
    background-color: #030712;
}

.log-row {
    display: flex;
    margin-bottom: 0.45rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    align-items: flex-start;
}

.log-meta {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.log-time {
    color: #64748b;
    margin-right: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.log-name {
    color: #38bdf8;
    font-weight: 600;
    margin-right: 0.75rem;
    width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.log-badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    margin-right: 0.75rem;
    width: 85px;
    text-align: center;
    flex-shrink: 0;
}

.badge-log-info {
    background-color: rgba(148, 163, 184, 0.1);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.badge-log-date_found {
    background-color: rgba(10, 49, 97, 0.2);
    color: #81a3d0;
    border: 1px solid rgba(10, 49, 97, 0.35);
}

.badge-log-no_dates {
    background-color: rgba(100, 116, 139, 0.08);
    color: #64748b;
}

.badge-log-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-log-error {
    background-color: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.log-message {
    color: #e2e8f0;
    word-break: break-all;
}

.log-row.highlight-success {
    background-color: rgba(16, 185, 129, 0.03);
}

.log-row.highlight-error {
    background-color: rgba(244, 63, 94, 0.03);
}

.connection-status {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #64748b;
    display: inline-block;
}

.status-indicator.connected {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-indicator.disconnected {
    background-color: var(--error);
    box-shadow: 0 0 8px var(--error);
}

.status-indicator.connecting {
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

/* Light Mode Variables Override */
[data-theme="light"] {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --primary: #0A3161;
    --primary-hover: #082852;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #0A3161;
}

[data-theme="light"] .navbar-brand-text {
    color: var(--text-color);
}

/* Light Theme Overrides & Adjustments */
[data-theme="light"] body {
    background-image: none;
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .nav-link:hover {
    background-color: rgba(10, 49, 97, 0.06);
    color: var(--primary);
}

[data-theme="light"] .nav-link.active {
    background-color: rgba(10, 49, 97, 0.08);
    border-color: rgba(10, 49, 97, 0.25);
    color: var(--primary);
}

[data-theme="light"] .theme-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .chart-header-controls {
    background-color: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .keyboard-controls-panel {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .device-monitor {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05), inset 0 0 5px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .device-monitor::before {
    background: transparent;
}

[data-theme="light"] .stat-card {
    background: #ffffff;
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .stat-card::after {
    opacity: 0.15;
}

[data-theme="light"] .stat-icon {
    background-color: rgba(79, 70, 229, 0.06);
}

[data-theme="light"] .login-body {
    background-image: none;
}

[data-theme="light"] .login-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .card {
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .form-control {
    background-color: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 49, 97, 0.12);
}

[data-theme="light"] select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

[data-theme="light"] .btn-secondary {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .btn-secondary:hover {
    background-color: #e2e8f0;
}

[data-theme="light"] .btn-danger {
    background-color: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

[data-theme="light"] .btn-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

[data-theme="light"] .table-responsive {
    border-color: #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .table th {
    background-color: #f1f5f9;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .table td {
    border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .table tr:hover {
    background-color: #f8fafc;
}

[data-theme="light"] .badge-target {
    background-color: rgba(100, 116, 139, 0.08);
    border-color: rgba(100, 116, 139, 0.2);
    color: #475569;
}

[data-theme="light"] .badge-status {
    background-color: rgba(100, 116, 139, 0.08);
    border-color: rgba(100, 116, 139, 0.2);
    color: #475569;
}

[data-theme="light"] .badge-earliest {
    background-color: rgba(10, 49, 97, 0.08);
    border-color: rgba(10, 49, 97, 0.2);
    color: var(--primary);
}

[data-theme="light"] .badge-scanning {
    background-color: rgba(10, 49, 97, 0.08);
    color: var(--primary);
    border-color: rgba(10, 49, 97, 0.2);
}

[data-theme="light"] .badge-logging_in {
    background-color: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.2);
}

[data-theme="light"] .badge-booking {
    background-color: rgba(200, 16, 46, 0.08);
    color: var(--error);
    border-color: rgba(200, 16, 46, 0.2);
}

[data-theme="light"] .badge-rescheduled {
    background-color: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.2);
}

[data-theme="light"] .badge-error {
    background-color: rgba(244, 63, 94, 0.1);
    color: #e11d48;
    border-color: rgba(244, 63, 94, 0.2);
}

/* Reports Page Light Mode Overrides */
[data-theme="light"] .log-panel {
    background-color: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .log-header {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .log-title {
    color: var(--primary);
}

[data-theme="light"] .log-filter-tabs {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .filter-tab:hover {
    color: #0f172a;
    background-color: #f1f5f9;
}

[data-theme="light"] .filter-tab.active {
    color: #ffffff;
    background-color: var(--primary);
    border-color: var(--primary);
}

[data-theme="light"] .log-body {
    background-color: #ffffff;
}

[data-theme="light"] .log-row {
    border-bottom-color: #f1f5f9;
}

[data-theme="light"] .log-message {
    color: #0f172a;
}

[data-theme="light"] .log-row.highlight-success {
    background-color: rgba(16, 185, 129, 0.05);
}

[data-theme="light"] .log-row.highlight-error {
    background-color: rgba(244, 63, 94, 0.05);
}

[data-theme="light"] .log-btn {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .log-btn:hover {
    background-color: #e2e8f0;
}

[data-theme="light"] .badge-log-info {
    background-color: #e2e8f0;
    color: #475569;
    border: 1px solid #cbd5e1;
}

[data-theme="light"] .badge-log-date_found {
    background-color: rgba(10, 49, 97, 0.08);
    color: var(--primary);
    border: 1px solid rgba(10, 49, 97, 0.2);
}

[data-theme="light"] .badge-log-no_dates {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .badge-log-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

[data-theme="light"] .badge-log-error {
    background-color: rgba(244, 63, 94, 0.1);
    color: #e11d48;
    border: 1px solid rgba(244, 63, 94, 0.2);
}

/* Responsive Screen Overrides for Mobile & Small Displays */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem 3rem 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .page-header .btn,
    .page-header form {
        width: 100%;
    }

    .page-header .btn {
        justify-content: center;
    }

    .navbar {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.75rem 1.25rem !important;
    }

    .mobile-theme-btn {
        display: flex !important;
    }

    .navbar-nav {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        gap: 0.5rem 1rem;
    }

    .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .details-layout {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    .details-header-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .details-header-controls form {
        width: 100%;
    }

    .details-header-controls button,
    .details-header-controls a {
        width: 100%;
        justify-content: center;
    }

    .tabs-nav button {
        flex: 1 1 auto;
        justify-content: center;
    }

    /* Charts Layout Responsiveness */
    .charts-container {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
        margin-bottom: 1.5rem !important;
    }

    .chart-card {
        padding: 1rem !important;
        border-radius: 16px !important;
    }

    .chart-card h3 {
        font-size: 1.05rem !important;
        flex-wrap: wrap !important;
        gap: 0.4rem !important;
        line-height: 1.3 !important;
    }

    .chart-wrapper {
        height: 250px !important;
        min-width: 0 !important;
        width: 100% !important;
        overflow: hidden !important;
    }

    /* KPI Grid & Stats Optimization */
    .reports-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        margin-bottom: 1.5rem !important;
    }

    .stat-card {
        padding: 0.95rem 0.85rem !important;
        gap: 0.75rem !important;
        border-radius: 14px !important;
    }

    .stat-icon {
        width: 44px !important;
        height: 44px !important;
        border-radius: 10px !important;
    }

    .stat-icon svg {
        width: 20px !important;
        height: 20px !important;
    }

    .stat-card .stat-value {
        font-size: 1.3rem !important;
    }

    .stat-card .stat-label {
        font-size: 0.725rem !important;
        letter-spacing: 0.02em !important;
    }

    .reports-grid .stat-card-health,
    .reports-grid .stat-card:last-child {
        grid-column: span 2 !important;
    }

    /* Global Filter Toolbar on Mobile */
    .global-filter-toolbar {
        padding: 0.85rem 1rem !important;
        gap: 0.75rem !important;
        margin-bottom: 1.25rem !important;
    }

    .filter-toolbar-header {
        width: 100% !important;
    }

    .global-filter-toolbar .chart-header-controls {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.65rem !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        margin-left: 0 !important;
    }

    .global-filter-toolbar .control-group {
        flex: 1 1 calc(50% - 0.35rem) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.25rem !important;
        min-width: 0 !important;
    }

    .global-filter-toolbar .control-group .control-label {
        font-size: 0.675rem !important;
    }

    .global-filter-toolbar .custom-select-wrapper {
        width: 100% !important;
        display: block !important;
        min-width: 0 !important;
    }

    .global-filter-toolbar .select-control {
        width: 100% !important;
        min-height: 32px !important;
        font-size: 0.8rem !important;
    }

    .custom-multiselect {
        width: 100% !important;
        min-width: 0 !important;
    }

    .custom-dropdown-options {
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    .custom-range-inputs[style*="display: flex"] {
        flex: 1 1 100% !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.4rem !important;
        padding: 0.5rem 0.75rem !important;
        min-height: auto !important;
    }

    .custom-range-inputs .range-to-separator {
        text-align: center !important;
        margin: 0.1rem 0 !important;
    }

    .custom-range-inputs .datetime-icon-wrapper {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .custom-range-inputs .datetime-icon-wrapper input {
        flex-grow: 1 !important;
        text-align: right !important;
        width: auto !important;
    }

    .control-group-refresh {
        flex: 1 1 100% !important;
        margin-top: 0.25rem !important;
    }

    .btn-refresh {
        width: 100% !important;
        justify-content: center !important;
        height: 34px !important;
    }

    /* Clean Responsive Table Styling */
    .table-responsive {
        border: 1px solid var(--card-border) !important;
        box-shadow: none !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border-radius: 12px !important;
    }

    .table-responsive .table {
        width: 100% !important;
        margin-bottom: 0 !important;
    }

    /* Log Panel on Mobile */
    .log-panel {
        margin-top: 1.5rem !important;
        border-radius: 14px !important;
    }

    .log-header {
        padding: 0.65rem 0.85rem !important;
    }

    .log-title {
        font-size: 0.8rem !important;
    }

    .log-filter-tabs {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex-wrap: nowrap !important;
        padding: 0.4rem 0.75rem !important;
        gap: 0.35rem !important;
        scrollbar-width: none !important;
    }

    .log-filter-tabs::-webkit-scrollbar {
        display: none !important;
    }

    .filter-tab {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding: 0.3rem 0.6rem !important;
        font-size: 0.75rem !important;
    }

    .log-body {
        height: 320px !important;
        padding: 0.85rem !important;
        font-size: 0.775rem !important;
    }

    .log-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.35rem !important;
        padding-bottom: 0.55rem !important;
    }

    .log-meta {
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        flex-wrap: wrap !important;
    }

    .log-time,
    .log-name,
    .log-badge {
        margin-right: 0 !important;
    }

    .log-name {
        width: auto !important;
        max-width: 120px !important;
    }

    .log-message {
        padding-left: 0.15rem !important;
        font-size: 0.8rem !important;
        word-break: break-word !important;
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Mobile Display Helpers */
.show-on-mobile {
    display: none !important;
}

.hide-on-mobile {
    display: block !important;
}

/* Console Fullscreen Styles */
#log-console:fullscreen {
    padding: 2rem !important;
    font-size: 1.1rem !important;
    background-color: #030712 !important;
    color: #e2e8f0 !important;
    overflow-y: auto !important;
}

/* Mobile Navigation Bottom Bar */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 800px) {
    .show-on-mobile {
        display: block !important;
    }

    .hide-on-mobile {
        display: none !important;
    }

    .navbar-nav {
        display: none !important;
        /* Hide top header navigation links on mobile */
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 62px;
        background: rgba(15, 23, 42, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding: 0 0.5rem;
    }

    [data-theme="light"] .mobile-bottom-nav {
        background: rgba(255, 255, 255, 0.9);
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    .mobile-nav-link,
    .mobile-nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-muted);
        text-decoration: none;
        background: transparent;
        border: none;
        font-family: var(--font-sans);
        font-size: 0.675rem;
        font-weight: 500;
        gap: 3px;
        flex-grow: 1;
        height: 100%;
        cursor: pointer;
        transition: all 0.2s;
        outline: none;
    }

    .mobile-nav-link svg,
    .mobile-nav-btn svg {
        width: 18px;
        height: 18px;
    }

    .mobile-nav-link:hover,
    .mobile-nav-link.active,
    .mobile-nav-btn:hover {
        color: var(--primary);
    }
}

/* Tablet & Smaller Desktop Actions Compact (Icon-Only) */
@media (max-width: 1024px) {
    .btn-text {
        display: none !important;
    }

    .btn-sm {
        padding: 0.35rem 0.5rem !important;
    }

    .table td,
    .table th {
        padding: 0.8rem 0.5rem !important;
    }
}

/* Details Mobile Buttons Grid & Tabs Layout */
@media (max-width: 640px) {
    .details-header-controls {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }

    .details-header-controls form,
    .details-header-controls div {
        width: 100% !important;
        margin: 0 !important;
    }

    .details-header-controls button {
        width: 100% !important;
        justify-content: center !important;
    }

    .tabs-nav {
        display: flex !important;
        width: 100% !important;
        gap: 0.25rem !important;
    }

    .tabs-nav button {
        flex: 1 !important;
        justify-content: center !important;
        padding: 0.5rem 0.25rem !important;
        font-size: 0.825rem !important;
    }
}

/* Active state for AutoScroll button */
.scroll-btn-active {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #34d399 !important;
    opacity: 1 !important;
}

[data-theme="light"] .scroll-btn-active {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
    color: #059669 !important;
}

/* Additional Mobile Responsive Layout Modifications */
@media (max-width: 768px) {
    /* 1. Ensure the bottom nav doesn't overlap container content */
    .container {
        padding-bottom: 6.5rem !important;
    }

    /* 2. Reduce settings-card padding on narrow screens */
    .settings-card {
        padding: 1.25rem !important;
    }

    /* 3. Fix browser screenshot container aspect ratio and spacing */
    #screenshot-container {
        min-height: auto !important;
        aspect-ratio: 16 / 9;
        padding: 0 !important;
    }

    /* 4. Title and username wrap */
    .page-title {
        flex-wrap: wrap !important;
        font-size: 1.5rem !important;
    }
}

/* Mobile performance & rendering optimizations */
@media (max-width: 860px) {

    .navbar,
    .mobile-bottom-nav,
    .card,
    .stat-card,
    .login-card,
    .settings-card,
    .chart-card {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .navbar {
        background: #0f172a !important;
    }

    .mobile-bottom-nav {
        background: #0f172a !important;
    }

    [data-theme="light"] .navbar,
    [data-theme="light"] .mobile-bottom-nav {
        background: #ffffff !important;
    }

    .card,
    .stat-card,
    .login-card,
    .settings-card,
    .chart-card {
        background: #161c2d !important;
        transform: none !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
    }

    [data-theme="light"] .card,
    [data-theme="light"] .stat-card,
    [data-theme="light"] .login-card,
    [data-theme="light"] .settings-card,
    [data-theme="light"] .chart-card {
        background: #ffffff !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05) !important;
    }
}

/* Custom Multiselect Responsive Widths */
.custom-multiselect {
    min-width: 170px;
    width: 100%;
}

/* Mobile responsiveness and card transformation system */
@media (max-width: 768px) {
    .container {
        padding: 1rem 0.85rem 6.5rem 0.85rem !important;
    }

    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.85rem !important;
        margin-bottom: 1.25rem !important;
    }

    .page-header .page-title {
        font-size: 1.25rem !important;
        justify-content: flex-start !important;
    }

    .page-header .btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
    }

    .card {
        padding: 1rem !important;
        margin-bottom: 1.5rem !important;
        border-radius: 14px !important;
    }

    /* Mobile Table Card Transformation */
    .table-responsive {
        border: none !important;
        background: transparent !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    .table.mobile-card-view {
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }

    .table.mobile-card-view thead {
        display: none !important;
    }

    .table.mobile-card-view,
    .table.mobile-card-view tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.85rem !important;
        width: 100% !important;
    }

    .table.mobile-card-view tr {
        display: flex !important;
        flex-direction: column !important;
        background: rgba(22, 28, 45, 0.75) !important;
        border: 1px solid var(--card-border) !important;
        border-radius: 14px !important;
        padding: 1rem !important;
        gap: 0.5rem !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
        transition: all 0.2s ease !important;
        width: 100% !important;
    }

    [data-theme="light"] .table.mobile-card-view tr {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    }

    .table.mobile-card-view tr:hover {
        border-color: rgba(255, 255, 255, 0.15) !important;
    }

    .table.mobile-card-view td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.35rem 0 !important;
        border: none !important;
        white-space: normal !important;
        font-size: 0.875rem !important;
        width: 100% !important;
    }

    .table.mobile-card-view td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }

    .table.mobile-card-view td.card-header-cell {
        padding-bottom: 0.65rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        margin-bottom: 0.25rem !important;
        font-size: 1.05rem !important;
    }

    [data-theme="light"] .table.mobile-card-view td.card-header-cell {
        border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    }

    .table.mobile-card-view td.card-header-cell::before {
        display: none !important;
    }

    .table.mobile-card-view td.card-actions-cell {
        padding-top: 0.75rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        margin-top: 0.35rem !important;
        width: 100% !important;
    }

    [data-theme="light"] .table.mobile-card-view td.card-actions-cell {
        border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    }

    .table.mobile-card-view td.card-actions-cell::before {
        display: none !important;
    }

    .table.mobile-card-view td.card-actions-cell > div,
    .table.mobile-card-view td.card-actions-cell form {
        width: 100% !important;
        display: flex !important;
        gap: 0.5rem !important;
    }

    .table.mobile-card-view td.card-actions-cell button,
    .table.mobile-card-view td.card-actions-cell a {
        flex: 1 !important;
        justify-content: center !important;
        min-height: 40px !important;
        font-size: 0.875rem !important;
    }

    .table.mobile-card-view td.card-actions-cell .btn-text {
        display: inline !important;
    }

    /* Systems Register Tabs on Mobile */
    .setup-tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 0.4rem !important;
        padding-bottom: 0.6rem !important;
        margin-bottom: 1.25rem !important;
        scrollbar-width: none;
    }

    .setup-tabs::-webkit-scrollbar {
        display: none;
    }

    .setup-tab-btn {
        flex-shrink: 0 !important;
        padding: 0.55rem 0.85rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap !important;
    }
}

/* Hide labels on small viewports to maintain space for icons */
@media (max-width: 440px) {
    .mobile-nav-link span,
    .mobile-nav-btn span {
        display: none !important;
    }
    
    .mobile-nav-link svg,
    .mobile-nav-btn svg {
        width: 22px !important;
        height: 22px !important;
    }
}

/* ==========================================================================
   Comprehensive Responsive Layout System (320px - 1440px+)
   ========================================================================== */

/* 1. Mobile & Small Tablets (< 768px) */
@media (max-width: 767px) {
    .dashboard-tabs-bar {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
    }

    .dashboard-tab-group {
        width: 100% !important;
        display: flex !important;
        padding: 3px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }

    .dashboard-tab-group::-webkit-scrollbar {
        display: none !important;
    }

    .dash-tab-btn {
        flex: 1 !important;
        justify-content: center !important;
        padding: 0.45rem 0.4rem !important;
        font-size: 0.75rem !important;
        gap: 0.35rem !important;
    }

    .dashboard-action-group {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
    }

    .dashboard-action-group .register-btn {
        flex-grow: 1 !important;
        justify-content: center !important;
    }

    /* Stats Strip becomes a clean 2x2 matrix on all screens < 768px */
    .stats-strip {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        padding: 0.65rem 0.85rem !important;
        gap: 0.5rem 0.75rem !important;
        overflow-x: visible !important;
    }

    .stat-pill-divider {
        display: none !important;
    }

    .stat-pill {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }

    .stat-pill-label {
        font-size: 0.725rem !important;
    }

    .stat-pill-value {
        font-size: 0.875rem !important;
    }

    /* Reports Filter Toolbar */
    .global-filter-toolbar {
        padding: 0.75rem 0.85rem !important;
        gap: 0.65rem !important;
    }

    .filter-toolbar-header {
        width: 100% !important;
    }

    .global-filter-toolbar .chart-header-controls {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        margin-left: 0 !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }

    .control-group-applicant {
        grid-column: span 2 !important;
    }

    .control-group-refresh {
        grid-column: span 2 !important;
    }

    .btn-refresh {
        width: 100% !important;
        justify-content: center !important;
    }

    .custom-range-inputs[style*="display: flex"] {
        grid-column: span 2 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.35rem !important;
    }

    /* Charts Container */
    .charts-container {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .chart-wrapper {
        height: 240px !important;
    }
}

/* 2. Compact View (< 680px) */
@media (max-width: 679px) {
    .applicant-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .applicant-card {
        padding: 0.85rem !important;
        gap: 0.65rem !important;
    }

    .app-card-title {
        font-size: 0.9rem !important;
    }

    /* Reports KPI 2x2+1 grid */
    .reports-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .reports-grid .stat-card {
        padding: 0.75rem 0.65rem !important;
        gap: 0.5rem !important;
    }

    .reports-grid .stat-icon {
        width: 36px !important;
        height: 36px !important;
        border-radius: 8px !important;
    }

    .reports-grid .stat-icon svg {
        width: 16px !important;
        height: 16px !important;
    }

    .reports-grid .stat-card .stat-value {
        font-size: 1.15rem !important;
    }

    .reports-grid .stat-card .stat-label {
        font-size: 0.65rem !important;
        letter-spacing: 0 !important;
    }

    .reports-grid .stat-card-health,
    .reports-grid .stat-card:last-child {
        grid-column: span 2 !important;
    }

    .doughnut-layout {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    .doughnut-layout .table-responsive {
        width: 100% !important;
    }
}

/* 3. Tablets & Medium Screens (680px - 1099px) */
@media (min-width: 680px) and (max-width: 1099px) {
    .applicant-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.95rem !important;
    }

    .charts-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.25rem !important;
    }

    .charts-container .chart-card-full {
        grid-column: 1 / -1 !important;
    }

    /* Balanced 6-card grid on tablets (3 cards per row) */
    .reports-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.85rem !important;
    }

    .reports-grid .stat-card {
        grid-column: auto !important;
    }
}

/* 4. Large Screens (>= 1100px) */
@media (min-width: 1100px) {
    .reports-grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 1rem !important;
    }
}