/* --- Google Fonts & Variables --- */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #f43f5e 100%);
    
    --success: #10b981;
    --success-hover: #059669;
    --success-light: #dcfce7;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    
    --bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-muted-dark: #475569;
    --border: rgba(226, 232, 240, 0.8);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
    --shadow-hover: 0 20px 35px -5px rgba(79, 70, 229, 0.12), 0 10px 15px -6px rgba(79, 70, 229, 0.08);
    
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
}

body {
    background-color: #f1f5f9;
    color: var(--text-main);
    line-height: 1.5;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(224, 231, 255, 0.4) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(243, 232, 255, 0.4) 0%, transparent 40%);
    background-attachment: fixed;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* --- App Splash Loader --- */
.app-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 50%, #ede9fe 100%);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.app-loader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.app-loader-logo {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: white;
    box-shadow: 0 20px 40px -8px rgba(79, 70, 229, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: loader-pulse 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.app-loader-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.app-loader-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.loader-dots::after {
    content: '';
    animation: loader-dots 1.5s steps(4, end) infinite;
}

@keyframes loader-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 20px 40px -8px rgba(79, 70, 229, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.8); }
    50% { transform: scale(1.06); box-shadow: 0 25px 50px -6px rgba(79, 70, 229, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.8); }
}

@keyframes loader-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

.app-layout {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Premium Topbar Header --- */
.topbar {
    height: 70px;
    min-height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.25rem;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 4px 30px rgba(15, 23, 42, 0.03);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-shrink: 0;
}

.topbar-left .logo-box {
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-left .app-logo {
    max-height: 2.25rem;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.topbar-left:hover .app-logo {
    transform: scale(1.05);
}

.topbar-left .brand-text h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #1e293b;
    margin: 0;
    white-space: nowrap;
}

.brand-highlight {
    background: linear-gradient(135deg, #dc2626 0%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.topbar-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    margin: 0 0.5rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    flex-shrink: 0;
}

.topbar-right .actions {
    display: flex;
    gap: 0.55rem;
    align-items: center;
}

.topbar-right .btn-outline {
    height: 36px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: white;
    color: #475569;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.topbar-right .btn-outline:hover {
    background: #f8fafc;
    color: #1e293b;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.topbar-right .btn-primary {
    height: 36px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    background: linear-gradient(135deg, #dc2626 0%, #f97316 100%) !important;
    border: none !important;
    color: white !important;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.2) !important;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.topbar-right .btn-primary:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.3) !important;
}

/* --- Main Content Layout --- */
.main-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 2rem;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.logo-box {
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-logo {
    max-height: 3.5rem;
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    transition: transform 0.3s ease;
}

.app-logo:hover {
    transform: scale(1.04);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e1b4b;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.25rem;
}

header .actions {
    display: flex;
    gap: 0.75rem;
}

/* --- Tabs Styling --- */
.tabs {
    display: flex;
    gap: 0.2rem;
    background: rgba(15, 23, 42, 0.04);
    padding: 0.2rem;
    border-radius: 30px;
    border: none;
    align-items: center;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.tab-btn {
    padding: 0.35rem 0.65rem;
    border: none;
    background: none;
    font-weight: 600;
    font-size: 0.78rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.tab-btn i {
    font-size: 1.05rem;
    transition: transform 0.2s ease;
}

.tab-btn:hover {
    color: #1e293b;
}

.tab-btn:hover i {
    transform: translateY(-1px);
}

.tab-btn.active {
    color: #dc2626 !important;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.03);
}

.tab-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.hidden {
    display: none !important;
}

#tab-management,
#tab-reports,
#tab-categories,
#tab-logs {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#tab-management .card,
#tab-reports .card,
#tab-logs .card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    padding: 0.85rem 1.25rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Card Glassmorphism --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* --- Forms & Grid Layout --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vehicle-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    align-items: flex-end;
    min-height: 180px;
}

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

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted-dark);
}

input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background-color: #f9fafb;
    color: var(--text-main);
    cursor: pointer;
}

select {
    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='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 3rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    gap: 0.5rem;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.btn-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-muted-dark);
    box-shadow: var(--shadow-sm);
}

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

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

.btn-danger-light:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-gradient);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
}

.bx-spin-hover:hover i, .btn-primary:hover i {
    animation: spin 1s linear infinite;
}

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

/* --- Card Headers --- */
.card-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-title-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.title-icon {
    font-size: 1.5rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.375rem;
    border-radius: var(--radius-sm);
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.search-box-wrapper {
    position: relative;
    width: 280px;
}

.search-input {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    background: #f8fafc;
}

.search-icon-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.select-wrapper {
    min-width: 140px;
}

.page-size-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    background: #f8fafc;
}

/* --- Backend Live Logs Terminal Styles --- */
.logs-terminal-window {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    border-radius: 10px;
    border: 1px solid #30363d;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.logs-terminal-titlebar {
    background: #161b22;
    padding: 0.45rem 1rem;
    border-bottom: 1px solid #30363d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.logs-terminal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    padding: 0.65rem 0.85rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8rem;
    line-height: 1.55;
    color: #c9d1d9;
    background: #0d1117;
    word-break: break-word;
    scroll-behavior: smooth;
}

.logs-terminal-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.logs-terminal-body::-webkit-scrollbar-track {
    background: #0d1117;
}
.logs-terminal-body::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}
.logs-terminal-body::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

.logs-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.logs-toolbar-left {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
}

.logs-toolbar-right {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: nowrap;
}

/* --- Tables & Lists --- */
.table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: white;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: left;
    padding: 0.65rem 1.25rem;
    background-color: #f8fafc;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 0.55rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.825rem;
    word-break: break-word;
}

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

tr:hover td {
    background-color: #f8fafc;
}

td .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.text-semibold {
    font-weight: 600;
    color: var(--text-main);
}

.text-muted {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.text-muted-dark {
    font-size: 0.9rem;
    color: var(--text-muted-dark);
}

/* --- Vietnamese License Plate Styling --- */
.plate-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #0f172a;
    padding: 0.15rem 0.65rem;
    font-weight: 800;
    font-size: 0.775rem;
    border-radius: 0.25rem;
    letter-spacing: 0.08em;
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
    position: relative;
    overflow: hidden;
    min-width: 100px;
    height: 26px;
}

.plate-badge::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

/* --- Columns Width Definitions --- */
#vehicle-table th:nth-child(1), #vehicle-table td:nth-child(1) { width: 12%; min-width: 110px; }
#vehicle-table th:nth-child(2), #vehicle-table td:nth-child(2) { width: 12%; min-width: 110px; }
#vehicle-table th:nth-child(3), #vehicle-table td:nth-child(3) { width: 20%; min-width: 170px; }
#vehicle-table th:nth-child(4), #vehicle-table td:nth-child(4) { width: 18%; min-width: 150px; }
#vehicle-table th:nth-child(5), #vehicle-table td:nth-child(5) { width: 18%; min-width: 140px; }
#vehicle-table th:nth-child(6), #vehicle-table td:nth-child(6) { width: 20%; min-width: 180px; }

/* --- Pagination Controls --- */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    min-height: 36px;
}

.pagination-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pagination-buttons {
    display: flex;
    gap: 0.25rem;
}

.pagination-buttons .btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

/* --- Badges --- */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-width: 110px;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    flex-shrink: 0;
}

.badge i {
    font-size: 0.9rem;
}

.badge-success {
    background: var(--success-light);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: var(--danger-light);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid rgba(71, 85, 105, 0.15);
}

/* --- Collapsible Accordion Drawer Rows --- */
.details-row {
    transition: all 0.3s ease;
}

.details-row.hidden {
    display: none !important;
}

.collapsible-badge {
    transition: all 0.2s ease;
}

.collapsible-badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.toggle-arrow {
    display: inline-block;
    transition: transform 0.2s ease-in-out;
}

/* --- Progress Card --- */
.progress-card {
    margin-bottom: 1.5rem !important;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(220, 38, 38, 0.1) !important;
    border-left: 4px solid #dc2626 !important;
    border-radius: var(--radius-lg) !important;
    padding: 1.15rem 1.5rem !important;
    box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.05), 0 8px 16px -6px rgba(0, 0, 0, 0.02) !important;
    animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.05), 0 8px 16px -6px rgba(0, 0, 0, 0.02); }
    50% { box-shadow: 0 10px 30px -3px rgba(220, 38, 38, 0.1), 0 8px 20px -4px rgba(220, 38, 38, 0.05); }
    100% { box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.05), 0 8px 16px -6px rgba(0, 0, 0, 0.02); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
}

.progress-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    color: #1e293b;
    font-size: 0.9rem;
}

.progress-status .progress-icon {
    font-size: 1.15rem;
    color: #dc2626;
}

.progress-status .current-plate-highlight {
    color: #dc2626;
    font-weight: 800;
    background: rgba(220, 38, 38, 0.06);
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    border: 1px solid rgba(220, 38, 38, 0.12);
    font-family: monospace;
    letter-spacing: 0.03em;
}

#progress-count {
    font-size: 0.85rem;
    font-weight: 800;
    color: #475569;
    background: rgba(15, 23, 42, 0.05);
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(15, 23, 42, 0.05);
    border-radius: 9999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #dc2626 0%, #f97316 100%) !important;
    border-radius: 9999px;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.2);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Statistics Dashboard Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.stat-card {
    background: white;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.7);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-card-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.15rem;
}

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

.stat-total-card {
    border-left: 4px solid var(--primary);
}
.stat-total-card .stat-card-icon {
    background: var(--primary-light);
    color: var(--primary);
}
.stat-total-card .stat-value {
    color: var(--primary);
}

.stat-danger-card {
    border-left: 4px solid var(--danger);
}
.stat-danger-card .stat-card-icon {
    background: var(--danger-light);
    color: var(--danger);
}
.stat-danger-card .stat-value {
    color: var(--danger);
}

.stat-success-card {
    border-left: 4px solid var(--success);
}
.stat-success-card .stat-card-icon {
    background: var(--success-light);
    color: var(--success);
}
.stat-success-card .stat-value {
    color: var(--success);
}

/* --- Modal Dialog Layout --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 2.25rem;
    border-radius: var(--radius-xl);
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    transform: scale(0.95) translateY(15px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1) translateY(0);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.close-modal:hover {
    background: var(--danger-light);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-header-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.modal-header-brand .plate-badge {
    margin-bottom: 0.25rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e1b4b;
    letter-spacing: -0.02em;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.modal-tab-nav {
    margin-bottom: 1.5rem !important;
}

/* --- Congratulations Box --- */
.congrats-box {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(16, 185, 129, 0.15);
    box-shadow: var(--shadow-sm);
}

.congrats-icon {
    font-size: 3.5rem;
    color: var(--success);
    margin-bottom: 1rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.congrats-box h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #065f46;
    margin-bottom: 0.5rem;
}

.congrats-box p {
    font-size: 0.95rem;
    color: #047857;
}

/* --- Violation Item Card --- */
.violation-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.violation-item {
    border-left: 4px solid var(--danger);
    padding: 0.85rem 1.25rem;
    background: linear-gradient(to right, rgba(254, 226, 226, 0.3), white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.violation-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #991b1b;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.4;
}

.violation-title i {
    font-size: 1.25rem;
    margin-top: 0.1rem;
}

.violation-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

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

.violation-detail {
    font-size: 0.9rem;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.violation-label {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.violation-value {
    font-weight: 600;
    color: var(--text-muted-dark);
    word-break: break-word;
}

.violation-value-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    width: fit-content;
    white-space: nowrap;
}

.violation-badge-unpaid {
    background: var(--danger-light);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.violation-badge-paid {
    background: var(--success-light);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

/* --- JSON/API Code Block Renderer --- */
.json-renderer {
    background: #0f172a;
    color: #38bdf8;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    overflow-x: auto;
    max-height: 400px;
    font-family: 'SF Mono', Consolas, monospace;
    border: 1px solid #1e293b;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* --- Schedule Configuration Tab --- */
.schedule-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.schedule-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.schedule-toggle-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.schedule-toggle-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* iOS-style toggle switch */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 28px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.switch-toggle input:checked + .switch-slider {
    background: var(--primary-gradient);
}

.switch-toggle input:checked + .switch-slider::before {
    transform: translateX(24px);
}

.schedule-section {
    margin-bottom: 1.5rem;
}

.schedule-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted-dark);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.schedule-section-title i {
    font-size: 1.1rem;
    color: var(--primary);
}

.schedule-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.schedule-chip {
    min-width: 52px;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: white;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.schedule-chip:hover {
    border-color: rgba(79, 70, 229, 0.3);
    background: rgba(79, 70, 229, 0.04);
    color: var(--primary);
}

.schedule-chip.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.schedule-hours-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.4rem;
}

.schedule-hours-grid .schedule-chip {
    min-width: 0;
    font-size: 0.8rem;
    height: 36px;
    border-radius: 10px;
}

.schedule-summary {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.04) 0%, rgba(139, 92, 246, 0.06) 100%);
    border-radius: var(--radius-md);
    border: 1px dashed rgba(79, 70, 229, 0.25);
    font-size: 0.85rem;
    color: var(--text-muted-dark);
    line-height: 1.7;
}

.schedule-summary strong {
    color: var(--primary);
}

.schedule-config-disabled {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.5);
    transition: all 0.3s ease;
}

/* --- Floating Check Queue Popup --- */
.check-queue-popup {
    position: fixed;
    right: 12px;
    bottom: 12px;
    width: min(280px, calc(100vw - 16px));
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-main);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    z-index: 1200;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.check-queue-popup.collapsed .check-queue-body {
    display: none;
}

.check-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.10), rgba(139, 92, 246, 0.10));
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.check-queue-header-left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.check-queue-header-left b {
    color: var(--primary);
}

.check-queue-toggle {
    border: none;
    background: rgba(79, 70, 229, 0.08);
    color: var(--text-main);
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.check-queue-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.6rem;
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(79, 70, 229, 0.45) transparent;
}

.check-queue-body::-webkit-scrollbar {
    width: 6px;
}

.check-queue-body::-webkit-scrollbar-track {
    background: transparent;
}

.check-queue-body::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.35);
    border-radius: 999px;
}

.check-queue-body::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 70, 229, 0.55);
}

.check-queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 0.6rem;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.check-queue-item strong {
    display: block;
    font-size: 0.88rem;
    color: var(--text-main);
}

.check-queue-item span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.check-queue-item i {
    color: var(--warning);
    font-size: 1rem;
}

/* --- Global Utility Classes --- */
.hidden {
    display: none !important;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.btn-icon i {
    font-size: 1.15rem !important;
    margin: 0 !important;
}

/* --- Category Management Grid Styles --- */
#tab-categories {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#tab-categories .category-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-top: 0;
}

.category-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    background: var(--card-bg) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-md) !important;
    backdrop-filter: blur(16px) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    margin-bottom: 0;
}

.category-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: var(--shadow-lg) !important;
}

.badge-count {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    background: var(--primary-light);
    border: 1px solid rgba(79, 70, 229, 0.2);
    color: var(--primary);
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.category-quick-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.category-quick-form input {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: text;
}

.category-quick-form input:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.category-search-wrapper {
    position: relative;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.category-search-wrapper input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    color: var(--text-main);
    outline: none;
    font-size: 0.825rem;
    transition: all 0.2s ease;
    cursor: text;
}

.category-search-wrapper input:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.search-icon-mini {
    position: absolute;
    left: 0.8rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    pointer-events: none;
}

.btn-square {
    width: 42px;
    height: 42px;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md) !important;
    flex-shrink: 0;
}

.category-item-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #ffffff;
    scroll-behavior: smooth;
}

.category-item-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease, padding-left 0.2s ease;
}

.category-item-list li:last-child {
    border-bottom: none;
}

.category-item-list li:hover {
    background: rgba(79, 70, 229, 0.05);
    padding-left: 1.2rem;
}

.category-item-list .item-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
}

.btn-delete-item {
    background: none;
    border: none;
    color: #ef4444;
    opacity: 0.5;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-delete-item:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.15);
}

/* --- Report Detail Modal Styles --- */
.report-modal-content {
    max-width: 820px !important;
    padding: 2.25rem !important;
}

.report-modal-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.25rem;
}

.report-header-icon {
    font-size: 2.75rem;
    color: var(--primary);
}

.report-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.report-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #ffffff;
}

.report-stat-item.total {
    border-left: 4px solid var(--primary);
}

.report-stat-item.violations {
    border-left: 4px solid var(--danger);
}

.report-stat-item.safe {
    border-left: 4px solid var(--success);
}

.report-stat-item .val {
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.report-stat-item.total .val { color: var(--primary); }
.report-stat-item.violations .val { color: var(--danger); }
.report-stat-item.safe .val { color: var(--success); }

.report-stat-item .lbl {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.75px;
}

.report-section {
    margin-top: 1.5rem;
}

.report-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-main);
    border-left: 3px solid var(--primary);
    padding-left: 0.75rem;
}

.compact-table table {
    font-size: 0.875rem;
}

.compact-table td, .compact-table th {
    padding: 0.6rem 0.75rem !important;
}

/* --- Read-Only Input Styling --- */
input:disabled, select:disabled, .disabled-input {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    color: var(--text-main) !important;
    -webkit-text-fill-color: var(--text-main) !important; /* Fix for Chrome/Safari on macOS */
    opacity: 0.65 !important;
    cursor: not-allowed !important;
    font-weight: 600;
}

/* --- Resolution and Notes Custom Styling --- */
.badge-info {
    background: rgba(59, 130, 246, 0.08);
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.notes-snippet {
    font-size: 0.725rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.notes-snippet:hover {
    background: #fef3c7;
    border-color: #fde68a;
}

/* --- Responsive Adjustments for Mobile & Tablet --- */
@media (max-width: 1180px) {
    body, .app-layout {
        height: auto !important;
        width: 100vw;
        overflow: auto !important;
    }
    
    .main-content {
        overflow: auto !important;
        height: auto !important;
        flex: none !important;
        padding: 1.25rem !important;
    }
    
    /* Ensure content containers stretch to full height under auto layout */
    .tab-content,
    #tab-management,
    #tab-reports,
    #tab-categories {
        flex: none !important;
        height: auto !important;
        min-height: 0 !important;
    }
    
    #tab-management .card,
    #tab-reports .card {
        height: auto !important;
        flex: none !important;
        padding: 1.25rem !important;
    }
    
    .topbar {
        padding: 0 1.25rem !important;
    }
    
    .topbar-left .brand-text h1 {
        font-size: 1rem !important;
    }
    
    /* Enable clean horizontal table scrolling on tablets instead of squeezing columns */
    .table-container {
        overflow-y: visible !important;
        overflow-x: auto !important;
        max-height: none !important;
    }
    
    .table-container table {
        min-width: 850px;
    }
    
    /* Auto-fit Categories layout for tablets: side-by-side or stacked dynamically */
    #tab-categories .category-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
        gap: 1.5rem !important;
        height: auto !important;
        flex: none !important;
    }
    
    .category-card {
        height: auto !important;
        min-height: 0 !important;
        padding: 1.25rem !important;
    }
    
    .category-item-list {
        max-height: 320px;
    }
    
    /* Responsive stats cards grid auto-fitting */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
        gap: 0.75rem !important;
    }
}

@media (max-width: 768px) {
    /* Premium Mobile Topbar Layout with Flexbox wrapping */
    .topbar {
        height: auto !important;
        min-height: auto !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 !important;
        gap: 0 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
        box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.05) !important;
    }
    
    .topbar-left {
        order: 1 !important;
        width: auto !important;
        height: 56px !important;
        padding-left: 1rem !important;
        justify-content: flex-start !important;
    }
    
    .topbar-left .brand-text {
        display: none !important;
    }
    
    .topbar-right {
        order: 2 !important;
        width: auto !important;
        margin-top: 0 !important;
        height: 56px !important;
        padding-right: 1rem !important;
        justify-content: flex-end !important;
        gap: 0.5rem !important;
    }
    
    .topbar-right .btn {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.75rem !important;
        height: 32px !important;
        width: auto !important;
        border-radius: var(--radius-md) !important;
    }
    
    .topbar-right .btn span {
        display: none !important;
    }
    
    .topbar-right .btn i {
        font-size: 1.15rem !important;
        margin: 0 !important;
    }
    
    .topbar-center {
        order: 3 !important;
        width: 100% !important;
        background: #f8fafc !important;
        padding: 0.45rem 1rem !important;
        border-top: 1px solid rgba(226, 232, 240, 0.8) !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .topbar-center::-webkit-scrollbar {
        display: none !important;
    }
    
    .topbar-center .tabs {
        display: flex !important;
        gap: 0.5rem !important;
        width: auto !important;
        box-shadow: none !important;
        background: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
    
    .topbar-center .tab-btn {
        flex: 0 0 auto !important;
        padding: 0.45rem 1rem !important;
        font-size: 0.8rem !important;
        border-radius: 20px !important;
        box-shadow: none !important;
        background: transparent !important;
        color: var(--text-muted) !important;
        border: 1px solid transparent !important;
    }
    
    .topbar-center .tab-btn.active {
        background: white !important;
        color: var(--primary) !important;
        border: 1px solid rgba(79, 70, 229, 0.15) !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
    }
    
    .main-content {
        padding: 1rem !important;
    }
    
    /* Stack Category Cards vertically using Flexbox on mobile */
    #tab-categories .category-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
        height: auto !important;
        flex: none !important;
    }
    
    /* Responsive stats cards for phone viewports */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.5rem 1rem;
    }
    
    /* Compact actions bar */
    .card-header-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem;
    }
    
    .card-title-box {
        justify-content: center;
    }
    
    .filter-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        align-items: center;
    }
    
    .filter-group .search-box-wrapper {
        grid-column: 1 / -1; /* search spans full width */
        width: 100% !important;
    }
    
    .filter-group .search-box-wrapper .search-input {
        font-size: 0.82rem !important;
        padding: 0.5rem 2.2rem 0.5rem 0.75rem !important;
    }
    
    .filter-group .select-wrapper {
        width: 100% !important;
        min-width: 0 !important; /* allow grid to shrink below 140px */
    }
    
    .filter-group .select-wrapper .page-size-select {
        width: 100% !important;
        font-size: 0.78rem !important;
        padding: 0.45rem 1.8rem 0.45rem 0.65rem !important;
        text-overflow: ellipsis;
    }
    
    .filter-group .btn {
        font-size: 0.78rem !important;
        padding: 0.45rem 0.75rem !important;
        height: 36px !important;
        justify-content: center;
        white-space: nowrap;
    }
    
    /* Transform tables into beautiful vertical mobile cards! */
    .table-container table {
        min-width: 0 !important;
        display: block;
        width: 100%;
        border: none;
    }
    
    .table-container {
        border: none !important;
        background: none !important;
        overflow-x: visible !important;
    }
    
    .table-container::before {
        display: none !important;
    }
    
    table thead {
        display: none !important;
    }
    
    table tbody {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        background: none !important;
    }
    
    table tr {
        display: flex;
        flex-direction: column;
        background: white !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius-lg) !important;
        padding: 1.25rem !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
        gap: 0.85rem;
        position: relative;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    table tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08) !important;
    }
    
    table td {
        display: flex !important;
        padding: 0 !important;
        border: none !important;
        width: 100% !important;
        min-width: 0 !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 0.85rem !important;
        background: none !important;
    }
    
    /* Add labels on mobile using data-label attribute */
    table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
    
    /* Specific overrides for mobile card cells to look ultra-premium! */
    table td[data-label="Biển số"]::before,
    table td[data-label="Mã báo cáo"]::before {
        display: none;
    }
    
    table td[data-label="Biển số"] {
        justify-content: flex-start !important;
        border-bottom: 1px dashed var(--border) !important;
        padding-bottom: 0.75rem !important;
        margin-bottom: 0.25rem;
    }
    
    table td[data-label="Mã báo cáo"] {
        justify-content: flex-start !important;
        border-bottom: 1px dashed var(--border) !important;
        padding-bottom: 0.75rem !important;
        margin-bottom: 0.25rem;
    }
    
    table td[data-label="Hành động"] {
        border-top: 1px solid var(--border) !important;
        padding-top: 0.75rem !important;
        margin-top: 0.25rem;
    }
    
    table td[data-label="Kết quả phạt nguội"] .badge,
    table td[data-label="Có vi phạm"] .badge,
    table td[data-label="An toàn"] .badge {
        margin-left: auto;
    }
    
    /* Optimize the inline details drawer row on mobile! */
    table tr.details-row {
        margin-top: -0.5rem;
        padding: 1rem !important;
        border-top: none !important;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02) !important;
        background: #f8fafc !important;
    }
    
    table tr.details-row td {
        display: block !important;
    }
    
    table tr.details-row td::before {
        display: none !important;
    }
    
    /* Pagination stacked */
    .pagination-container {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
    }
    
    .hide-mobile {
        display: none !important;
    }

    /* Schedule tab mobile adjustments */
    .schedule-hours-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .schedule-chip {
        min-width: 0 !important;
        font-size: 0.8rem !important;
    }
}

/* --- Premium Glassmorphic Login Overlay --- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
                radial-gradient(circle at bottom left, rgba(239, 68, 68, 0.1), transparent 45%),
                rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.02);
}

.login-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 28px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4),
                inset 0 1px 1px rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Shake Animation on Wrong Credentials */
.login-card.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.login-header {
    text-align: center;
    margin-bottom: 2.25rem;
}

.login-logo-wrapper {
    width: 74px;
    height: 74px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem auto;
    box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.1),
                0 0 0 1px rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.login-logo {
    max-height: 48px;
    width: auto;
}

.login-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e1b4b;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.login-header p {
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    line-height: 1.4;
}

/* Form Fields */
.form-group-glow {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-group-glow label {
    font-size: 0.775rem;
    font-weight: 700;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.form-group-glow label i {
    font-size: 0.95rem;
    color: #4f46e5;
}

.form-group-glow input {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #0f172a;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

.form-group-glow input::placeholder {
    color: #94a3b8;
}

.form-group-glow input:focus {
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12),
                inset 0 1px 1px rgba(0, 0, 0, 0.02);
}

/* Password eye switcher */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 2.75rem !important;
}

.btn-toggle-password {
    position: absolute;
    right: 0.85rem;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.btn-toggle-password:hover {
    color: #475569;
    background: rgba(15, 23, 42, 0.03);
}

/* Login Button */
.btn-login {
    margin-top: 1.75rem;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.3),
                0 4px 6px -2px rgba(79, 70, 229, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    height: 46px;
    transition: all 0.25s ease;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px -5px rgba(79, 70, 229, 0.45);
}

.btn-login:active {
    transform: scale(0.98);
}

/* Loading state spinner */
.login-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: login-spin 0.6s linear infinite;
}

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

/* Error message box */
.login-error-box {
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 12px;
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    animation: errorFadeIn 0.25s ease-out;
}

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

.login-error-box i {
    font-size: 1.05rem;
    margin-top: 0.05rem;
    flex-shrink: 0;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
}

.login-footer p {
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.025em;
}

/* --- Premium Account Role Badges --- */
.badge-admin {
    background: rgba(99, 102, 241, 0.08) !important;
    color: #4f46e5 !important;
    border: 1px solid rgba(99, 102, 241, 0.15) !important;
}

.badge-user {
    background: rgba(16, 185, 129, 0.08) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.15) !important;
}

/* --- Premium Accounts Tab Grid Layout & Responsiveness --- */
#tab-accounts .category-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1.25rem;
    margin-top: 0;
}

@media (max-width: 1024px) {
    #tab-accounts .category-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        height: auto !important;
        flex: none !important;
    }
}

@media (max-width: 768px) {
    #tab-accounts .category-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
        height: auto !important;
        flex: none !important;
    }
}


