/* Design Tokens */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --surface: rgba(31, 41, 55, 0.7);
    --surface-hover: rgba(55, 65, 81, 0.8);
    --border: rgba(255, 255, 255, 0.08);
    
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --primary-glow: rgba(139, 92, 246, 0.15);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --sidebar-width: 260px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html {
    height: 100%;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    color: var(--text-main);
    font-family: var(--font);
    height: 100%;
    overflow: hidden;
    line-height: 1.5;
}

button, input, select, textarea {
    font-family: inherit;
    color: inherit;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* Main Container Layout */
#app-root {
    display: flex;
    height: 100%;
    overflow: hidden;
}

#dashboard-layout.flex,
#dashboard-layout {
    width: 100%;
    height: 100%;
    overflow: hidden;
    align-items: stretch;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

/* Login Screen */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
}

.login-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.brand-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    box-shadow: 0 0 15px var(--primary-glow);
}

.brand-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 0 15px var(--primary-glow);
}

.brand-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-card h2 {
    font-size: 20px;
    margin-bottom: 8px;
    font-weight: 500;
}

.login-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.error-message {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    margin-bottom: 20px;
    display: none;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.38);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    flex: 0 0 auto;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: var(--text-main);
    background: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.user-info h4 {
    font-size: 14px;
    font-weight: 500;
}

.user-info p {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}

.btn-logout:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

.btn-logout svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Content Area */
.top-bar {
    height: 72px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background: rgba(11, 15, 25, 0.5);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
}

.content-body {
    padding: 40px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-pane.active {
    display: block;
}

/* Stats Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Section Cards / Containers */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.panel {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

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

.panel-title {
    font-size: 16px;
    font-weight: 600;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.data-table th {
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tr {
    transition: var(--transition);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }

/* Settings / Form Elements */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Modal Popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 16px;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #1f2937;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 550px;
    max-height: calc(100dvh - 48px);
    margin: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(12px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-shrink: 0;
    gap: 12px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body {
    margin-bottom: 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
}

.modal-body form {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    background: #1f2937;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.modal-body .modal-footer {
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
}

/* Document Review Layout */
.doc-preview-container {
    background: #111827;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.doc-preview-img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 4px;
}

.placeholder-doc {
    color: var(--text-dim);
    text-align: center;
}

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

/* Utility classes */
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }
.w-auto { width: auto; }
.mt-20 { margin-top: 20px; }

/* Filter Bar Styling */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    flex: 1;
}

.filter-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

/* Custom switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #374151;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.feature-flags-grid {
    display: grid;
    gap: 20px;
}

.feature-phase-block h4 {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.feature-flag-list {
    display: grid;
    gap: 10px;
}

.feature-flag-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
}

.feature-flag-row strong {
    display: block;
    text-transform: capitalize;
    margin-bottom: 4px;
}

.feature-flag-row p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.feature-flag-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 280px;
    max-width: 420px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    animation: toast-in 0.25s ease;
}

.toast-success { border-color: rgba(16, 185, 129, 0.4); color: #34d399; }
.toast-error { border-color: rgba(239, 68, 68, 0.4); color: #f87171; }
.toast-info { border-color: rgba(139, 92, 246, 0.4); color: #c4b5fd; }

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

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 15, 25, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.loading-overlay.active { display: flex; }

.loading-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Dashboard action cards */
.action-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.action-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.action-card:hover {
    border-color: rgba(139, 92, 246, 0.35);
    background: var(--surface-hover);
}

.action-card h4 {
    font-size: 28px;
    margin-bottom: 4px;
    color: var(--primary);
}

.action-card p {
    font-size: 13px;
    color: var(--text-muted);
}

.action-card.has-pending {
    border-color: rgba(245, 158, 11, 0.35);
}

/* Pagination */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

/* Fleet map */
.traccar-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: #e5e7eb;
    cursor: pointer;
    max-width: 360px;
    user-select: none;
}

.traccar-status-badge .traccar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9ca3af;
    flex-shrink: 0;
}

.traccar-status-badge.online {
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(34, 197, 94, 0.18);
}
.traccar-status-badge.online .traccar-dot {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
}

.traccar-status-badge.offline {
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(239, 68, 68, 0.18);
}
.traccar-status-badge.offline .traccar-dot {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25);
}

.traccar-status-badge.mock {
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.55);
    background: rgba(245, 158, 11, 0.18);
}
.traccar-status-badge.mock .traccar-dot {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
}

.traccar-status-badge.unknown .traccar-dot {
    background: #9ca3af;
    animation: traccar-pulse 1.2s ease-in-out infinite;
}

@keyframes traccar-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

.fleet-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 24px 0 8px;
}

.fleet-map {
    height: 100%;
    min-height: 62vh;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #111827;
    z-index: 1;
}

.fleet-map-shell {
    position: relative;
    min-height: 62vh;
    display: flex;
    flex-direction: column;
}

.fleet-fs-exit {
    display: none;
}

.fleet-filter-bar {
    flex-wrap: wrap;
    margin-top: 16px;
}

.fleet-filter-bar .filter-input {
    min-width: 220px;
    flex: 1;
}

.fleet-filter-summary {
    font-size: 13px;
    color: var(--text-dim);
    margin: 8px 0 4px;
}

.fleet-autorefresh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.fleet-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.85fr);
    gap: 12px;
    align-items: stretch;
    min-height: 62vh;
}

.fleet-workspace.fullscreen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    margin: 0;
    padding: 12px;
    gap: 12px;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #0b0f19;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    border-radius: 0;
    overflow: hidden;
}

.fleet-workspace.fullscreen .fleet-map-shell,
.fleet-workspace.fullscreen .fleet-map {
    min-height: 0;
    height: 100%;
    border-radius: 12px;
}

.fleet-workspace.fullscreen .fleet-side-list {
    max-height: none;
    height: 100%;
}

.fleet-workspace.fullscreen .fleet-fs-exit {
    display: inline-flex;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(11, 15, 25, 0.88);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.fleet-workspace.fullscreen .fleet-fs-exit:hover {
    background: rgba(30, 41, 59, 0.95);
}

body.fleet-fs-active {
    overflow: hidden;
}

.fleet-side-list {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    overflow-y: auto;
    max-height: 62vh;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fleet-side-empty {
    color: var(--text-dim);
    font-size: 13px;
    padding: 20px 12px;
    text-align: center;
}

.fleet-side-item {
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-main);
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.fleet-side-item:hover,
.fleet-side-item.active {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.08);
}

.fleet-side-item.no-gps {
    opacity: 0.72;
}

.fleet-side-item.immobilized {
    border-color: rgba(239, 68, 68, 0.4);
}

.fleet-side-item .muted {
    color: var(--text-dim);
    font-size: 12px;
}

.fleet-side-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.fleet-row-flash {
    outline: 2px solid rgba(59, 130, 246, 0.7);
    background: rgba(59, 130, 246, 0.08);
}

.fleet-marker-wrap {
    background: transparent;
    border: none;
}
.fleet-pin {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.fleet-pin.driver {
    background: #3b82f6;
}
.fleet-pin.vehicle {
    background: #f59e0b;
}
.fleet-pin.separated {
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.35);
}

.fleet-popup {
    font-size: 13px;
    line-height: 1.4;
    min-width: 180px;
}

@media (max-width: 980px) {
    .fleet-workspace {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .fleet-workspace.fullscreen {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr minmax(180px, 32vh);
        padding: 8px;
    }
    .fleet-side-list {
        max-height: 280px;
    }
    .fleet-map,
    .fleet-map-shell {
        min-height: 55vh;
    }
}

.hardware-form {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 8px;
}

/* Document preview tabs */
.doc-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.doc-tab {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    font-size: 13px;
}

.doc-tab.active {
    background: var(--primary-glow);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--primary);
}

.doc-preview-container img,
.doc-preview-container iframe {
    width: 100%;
    max-height: 420px;
    border-radius: 8px;
    border: 1px solid var(--border);
    object-fit: contain;
    background: #0f172a;
}

.brand-logo-img {
    width: 36px;
    height: 36px;
}


/* Mobile sidebar */
.menu-toggle,
.sidebar-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
}

.sidebar-overlay {
    display: none;
}

.top-bar {
    gap: 12px;
}

.top-bar .page-title {
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    .menu-toggle {
        display: inline-flex;
        flex-shrink: 0;
    }

    .sidebar-close-btn {
        display: inline-flex;
        position: absolute;
        top: 16px;
        right: 16px;
        z-index: 2;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 100;
        box-shadow: none;
        overflow: hidden;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 90;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .top-bar {
        padding: 0 16px;
        height: 64px;
    }

    .content-body {
        padding: 20px 16px;
    }

    .page-title {
        font-size: 16px;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}

/* Grouped sidebar */
.nav-group {
    margin-bottom: 10px;
}
.nav-group-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 10px 14px 4px;
}

/* Ops strip + command button */
.ops-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}
.ops-strip .traccar-status-badge {
    padding: 6px 10px;
    max-width: 240px;
    font-size: 11px;
}
.ops-poll-label {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
}
.btn-icon {
    width: auto;
    padding: 8px 12px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
}
.btn-icon kbd {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    margin-left: 6px;
}

/* Today queue */
.stats-grid-compact {
    margin-bottom: 20px;
}
.stats-grid-compact .stat-card {
    padding: 16px;
    gap: 14px;
}
.stats-grid-compact .stat-info h3 {
    font-size: 22px;
}
.today-queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.today-card {
    text-align: left;
    width: 100%;
}
.today-card-danger.has-pending {
    border-color: rgba(239, 68, 68, 0.4);
}
.today-empty {
    color: var(--text-dim);
    font-size: 13px;
    padding: 8px 0;
}
.today-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-main);
    padding: 10px 12px;
    cursor: pointer;
    margin-bottom: 8px;
}
.today-row:hover {
    border-color: rgba(139, 92, 246, 0.35);
    background: rgba(139, 92, 246, 0.08);
}
.today-row-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.today-row-main small {
    color: var(--text-dim);
    font-size: 12px;
}
.today-row-go {
    font-size: 11px;
    color: var(--text-muted);
}
.today-kv {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    padding: 6px 0;
}

/* Command palette */
#command-palette.modal-overlay {
    align-items: flex-start;
    padding-top: 12vh;
    z-index: 140;
}
.palette-card {
    width: min(640px, 100%);
    background: #1f2937;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}
.palette-card .form-input {
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 16px 18px;
    font-size: 16px;
}
.palette-list {
    max-height: 380px;
    overflow-y: auto;
    padding: 8px;
}
.palette-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
}
.palette-item.active,
.palette-item:hover {
    background: rgba(139, 92, 246, 0.16);
}
.palette-item-kind {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    width: 42px;
    flex-shrink: 0;
}
.palette-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.palette-item-text small {
    color: var(--text-dim);
    font-size: 12px;
}
.palette-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

/* Typed confirm */
#confirm-modal .modal-card {
    max-width: 440px;
}
.confirm-ok-danger {
    background: #ef4444;
}
.confirm-ok-danger:hover {
    background: #dc2626;
}

/* Case drawer */
#case-panel-overlay {
    display: none;
}
#case-panel-overlay.active {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 110;
}
.case-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(460px, 100%);
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 120;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
}
.case-panel.open {
    transform: translateX(0);
}
.case-panel-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
.case-panel-header h2 {
    font-size: 18px;
    font-weight: 600;
}
.case-panel-header p {
    font-size: 12px;
    color: var(--text-muted);
}
.case-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.case-panel-actions {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}
.case-section {
    margin-bottom: 22px;
}
.case-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    margin-bottom: 10px;
}
.case-kv {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.case-kv span {
    color: var(--text-muted);
}
.case-kv code {
    font-size: 11px;
    color: var(--primary);
}

@media (max-width: 900px) {
    .ops-poll-label,
    .btn-icon kbd {
        display: none;
    }
    .case-panel {
        width: 100%;
    }
    .today-queue-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

.totp-input {
    letter-spacing: 0.28em;
    font-size: 20px;
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.login-step-copy {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}
.btn-2fa {
    margin-top: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    cursor: pointer;
}
.btn-2fa.enabled {
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.4);
}
.totp-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px;
    padding: 6px 10px;
}
.session-lock {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(11, 15, 25, 0.92);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.session-lock.active {
    display: flex;
}
.qr-box {
    display: flex;
    justify-content: center;
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    margin: 12px 0;
}
.qr-box svg,
.qr-box canvas {
    display: block;
}
.recovery-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    margin: 12px 0;
}
.recovery-codes span {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}
.solo-warn {
    color: #f59e0b;
    font-size: 12px;
}
.dual-wait {
    color: #f59e0b;
    font-size: 12px;
}
