/* ══════════════════════════════════════
   CUSTOMS CHECKPOINT DASHBOARD
   Based on parking app design system
   ══════════════════════════════════════ */

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

:root {
    --bg: #0a0a1a;
    --bg2: #1a1a2e;
    --surface: rgba(255,255,255,0.04);
    --border: #1f2937;
    --fg: #e8eaed;
    --fg-dim: #9ca3af;
    --fg-muted: #4b5563;
    --accent: #00d4ff;
    --accent-glow: rgba(0,212,255,0.35);
    --success: #06d6a0;
    --success-dark: #065f46;
    --error: #f43f5e;
    --error-dark: #991b1b;
    --warning: #fbbf24;
    --purple: #7c3aed;
    --radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

#app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 481px) {
    #app {
        box-shadow: -1px 0 0 var(--border), 1px 0 0 var(--border),
                    0 0 40px rgba(0,0,0,0.3);
    }
}

/* ══════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════ */
.login-page {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 100dvh; padding: 30px;
    background: radial-gradient(ellipse at 50% 20%, rgba(0,212,255,0.06) 0%, transparent 60%),
                var(--bg);
}
.login-logo { text-align: center; margin-bottom: 40px; }

/* Animated icon with glow ring */
.login-icon-ring {
    position: relative; width: 100px; height: 100px;
    margin: 0 auto 16px;
}
.login-icon-glow {
    position: absolute; inset: -8px; border-radius: 50%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    animation: iconPulse 2.5s ease-in-out infinite;
}
.login-icon-inner {
    position: relative; width: 100%; height: 100%;
    background: linear-gradient(135deg, #0e7490, #00d4ff);
    border-radius: 50%; display: flex; align-items: center;
    justify-content: center; box-shadow: 0 0 30px var(--accent-glow);
    animation: iconFloat 3s ease-in-out infinite;
}
.login-icon-inner .material-icons-round {
    font-size: 48px; color: white;
}

@keyframes iconPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.15); }
}
@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.login-title {
    font-size: 26px; color: white; margin: 0;
    font-weight: 800; letter-spacing: -0.5px;
}
.login-subtitle {
    font-size: 14px; color: var(--fg-dim); margin-top: 4px;
    letter-spacing: 2px; text-transform: uppercase;
}

.login-form { width: 100%; max-width: 360px; }
.field { margin-bottom: 18px; }
.field label {
    display: block; font-size: 11px; color: var(--fg-dim);
    font-weight: 700; letter-spacing: 1.5px; margin-bottom: 8px;
    text-transform: uppercase;
}
.field-wrapper {
    position: relative; display: flex; align-items: center;
}
.field-icon {
    position: absolute; left: 14px; color: var(--fg-muted);
    display: flex; pointer-events: none; transition: color 0.2s;
}
.field-icon .material-icons-round { font-size: 20px; }
.field-wrapper:focus-within .field-icon { color: var(--accent); }
.field input {
    width: 100%; padding: 14px 14px 14px 44px; background: var(--bg2);
    border: 1px solid var(--border); border-radius: 10px;
    color: white; font-size: 16px; outline: none;
    font-family: inherit; transition: border-color 0.25s, box-shadow 0.25s;
    -webkit-appearance: none; appearance: none;
}
.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,212,255,0.12), 0 0 20px var(--accent-glow);
}
.field input:disabled {
    opacity: 0.5; pointer-events: none;
}
.field input::placeholder { color: var(--fg-muted); }

/* Login button with gradient and loading state */
.login-btn {
    position: relative; width: 100%; padding: 16px; border: none;
    border-radius: 10px; cursor: pointer; font-size: 16px;
    font-weight: 700; font-family: inherit;
    background: linear-gradient(135deg, #0891b2, #00d4ff, #06b6d4);
    background-size: 200% 200%; color: var(--bg);
    box-shadow: 0 4px 20px rgba(0,212,255,0.3);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    margin-top: 4px; overflow: hidden;
}
.login-btn:active:not(:disabled) {
    transform: scale(0.97) translateY(1px);
    box-shadow: 0 2px 10px rgba(0,212,255,0.2);
}
.login-btn:disabled { cursor: not-allowed; }

.login-btn-text { transition: opacity 0.2s; }
.login-btn-spinner {
    position: absolute; top: 50%; left: 50%;
    width: 22px; height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid rgba(10,10,26,0.25);
    border-top-color: var(--bg); border-radius: 50%;
    opacity: 0; transition: opacity 0.2s;
}
.login-btn.loading .login-btn-text { opacity: 0; }
.login-btn.loading .login-btn-spinner {
    opacity: 1; animation: spin 0.7s linear infinite;
}
.login-btn.loading {
    opacity: 0.85; pointer-events: none;
    animation: btnPulse 1.5s ease-in-out infinite;
}
.login-btn.success {
    background: var(--success) !important;
    box-shadow: 0 4px 20px rgba(6,214,160,0.4);
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(0,212,255,0.3); }
    50% { box-shadow: 0 4px 30px rgba(0,212,255,0.5); }
}

/* Error area with shake animation */
.login-error-area {
    color: var(--error); font-size: 13px; text-align: center;
    min-height: 20px; margin: 6px 0;
    transition: opacity 0.2s;
}
.login-error-area:empty { opacity: 0; }
.login-error-area.shake {
    animation: shake 0.45s ease-in-out;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-10px); }
    30% { transform: translateX(8px); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
}

/* Footer badge */
.login-footer {
    margin-top: 40px; font-size: 11px; color: var(--fg-muted);
    display: flex; align-items: center; gap: 6px;
    letter-spacing: 0.5px;
}

/* Login banner (session lost reason) */
.login-banner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(255, 159, 10, 0.12);
    border: 0.5px solid rgba(255, 159, 10, 0.3);
    border-radius: 12px;
    color: #ff9f0a;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    max-width: 100%;
    line-height: 1.4;
    letter-spacing: -0.01em;
}
.login-banner .material-icons-round {
    font-size: 16px;
    flex-shrink: 0;
}

/* ══════════════════════════════════════
   MENU HEADER
   ══════════════════════════════════════ */
.menu-header {
    position: relative; overflow: hidden;
}
.menu-header-bg {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #0a0a1a 0%, #0e2a3d 30%, #1a1a3e 60%, #0d1b2a 100%);
    z-index: 0;
}
.menu-header-bg::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 80%, rgba(0,212,255,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 85% 20%, rgba(124,58,237,0.08) 0%, transparent 50%);
    pointer-events: none;
}
.menu-header-bg::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(0,212,255,0.4) 50%, transparent 100%);
}
.menu-header-content {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 16px 18px;
    padding-top: 16px;
}
.menu-header-left { display: flex; align-items: center; gap: 12px; }
.menu-header-logo {
    width: 42px; height: 42px; border-radius: 10px;
    background: linear-gradient(135deg, #0891b2, #00d4ff, #06b6d4);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 12px rgba(0,212,255,0.3);
    animation: logoShine 3s ease-in-out infinite;
}
@keyframes logoShine {
    0%, 100% { box-shadow: 0 2px 12px rgba(0,212,255,0.3); }
    50% { box-shadow: 0 2px 20px rgba(0,212,255,0.5); }
}
.menu-header-logo-text {
    font-size: 22px; font-weight: 900; color: white;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.menu-header-title {
    font-size: 18px; font-weight: 800; color: white;
    letter-spacing: -0.3px;
    background: linear-gradient(90deg, #ffffff 0%, #00d4ff 40%, #06d6a0 60%, #a78bfa 80%, #00d4ff 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShimmer 4s ease-in-out infinite;
}
@keyframes titleShimmer {
    0% { background-position: 100% 0; }
    50% { background-position: 0% 0; }
    100% { background-position: 100% 0; }
}
.menu-header-accent {
    -webkit-text-fill-color: inherit;
}
.menu-header-subtitle {
    font-size: 11px; color: rgba(255,255,255,0.45);
    letter-spacing: 0.5px; margin-top: 1px;
}

/* ══════════════════════════════════════
   MAIN MENU
   ══════════════════════════════════════ */
.menu-page { min-height: 100dvh; background: var(--bg); padding-bottom: 60px; }
.menu-content { padding: 20px 16px; }
.menu-greeting {
    text-align: center; padding: 24px 0 28px;
}
.menu-greeting-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 64px; height: 64px; border-radius: 16px;
    background: linear-gradient(135deg, #0891b2, #00d4ff);
    box-shadow: 0 4px 20px rgba(0,212,255,0.3);
    margin-bottom: 12px;
}
.menu-greeting-icon .material-icons-round { font-size: 32px; color: white; }
.menu-greeting-text { font-size: 20px; font-weight: 700; color: white; }
.menu-greeting-sub { font-size: 13px; color: var(--fg-dim); margin-top: 4px; }

.menu-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.menu-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 16px; padding: 20px 16px;
    cursor: pointer; position: relative;
    transition: transform 0.15s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.menu-card:active { transform: scale(0.97); border-color: var(--accent); }
.menu-card-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.menu-card-icon .material-icons-round { font-size: 26px; color: white; }
.menu-card-title { font-size: 14px; font-weight: 700; color: white; margin-bottom: 4px; }
.menu-card-desc { font-size: 11px; color: var(--fg-dim); }

.menu-card-soon { opacity: 0.5; cursor: default; }
.menu-card-soon:active { transform: none; border-color: var(--border); }
.menu-card-badge {
    position: absolute; top: 10px; right: 10px;
    background: rgba(124,58,237,0.2); color: #a78bfa;
    font-size: 9px; font-weight: 700; padding: 2px 8px;
    border-radius: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}

/* ══════════════════════════════════════
   HEADER
   ══════════════════════════════════════ */
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; background: var(--bg2);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.header h2 { font-size: 16px; font-weight: 700; }
.btn-icon {
    background: none; border: none; color: var(--fg-dim);
    cursor: pointer; padding: 6px; border-radius: 8px;
    font-size: 24px; display: flex; transition: color 0.2s;
}
.btn-icon:active { color: var(--accent); }
.btn-text {
    background: none; border: 1px solid var(--border); color: var(--fg-dim);
    padding: 6px 12px; border-radius: 6px; font-size: 12px;
    cursor: pointer; font-family: inherit;
}

/* ══════════════════════════════════════
   TOAST (global notification UI)
   ══════════════════════════════════════ */
.app-toast {
    position: fixed;
    left: 50%;
    bottom: calc(32px + env(safe-area-inset-bottom, 0));
    transform: translateX(-50%) translateY(20px);
    background: rgba(28, 28, 30, 0.96);
    color: #fff;
    padding: 11px 18px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.2);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border: 0.5px solid rgba(255, 255, 255, 0.12);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.22s cubic-bezier(0.22,1,0.36,1), transform 0.22s cubic-bezier(0.22,1,0.36,1);
    max-width: 88vw;
    text-align: center;
    pointer-events: none;
}
.app-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
[data-theme="light"] .app-toast {
    background: rgba(255, 255, 255, 0.96);
    color: #1a1a2e;
    border-color: rgba(0, 0, 0, 0.08);
}

/* ══════════════════════════════════════
   STATS BAR
   ══════════════════════════════════════ */
.stats-bar {
    display: flex; justify-content: space-around; padding: 16px;
    background: var(--bg2); border-bottom: 1px solid var(--border);
}
.stat { text-align: center; }
.stat-value { font-size: 28px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--fg-dim); margin-top: 2px; }
.stat-value.total { color: white; }
.stat-value.occupied { color: var(--error); }
.stat-value.free { color: var(--success); }

/* ══════════════════════════════════════
   CARDS & INFO ROWS
   ══════════════════════════════════════ */
.card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
    animation: cardSlideIn 0.35s ease both;
}
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.15s; }
.card:nth-child(5) { animation-delay: 0.2s; }
@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.card-title {
    font-size: 11px; color: var(--accent); font-weight: 700;
    letter-spacing: 1px; margin-bottom: 10px;
}
.info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 12px; color: var(--fg-dim); flex-shrink: 0; }
.info-value { font-size: 14px; color: white; text-align: right; }

/* ══════════════════════════════════════
   LOADING / SPINNER
   ══════════════════════════════════════ */
.loading {
    display: flex; justify-content: center; padding: 40px;
}
.spinner {
    width: 36px; height: 36px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loading */
.skeleton-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; height: 84px;
    margin-bottom: 8px; animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--fg-muted); }
.empty-state .material-icons-round { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* ══════════════════════════════════════
   SETTINGS BOTTOM BAR
   ══════════════════════════════════════ */
.settings-bottom-bar {
    position: fixed; bottom: env(safe-area-inset-bottom, 0px); left: 0; right: 0;
    z-index: 50;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    padding: 0 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.settings-bottom-inner {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 0;
    color: var(--fg-dim); font-size: 14px; font-weight: 500;
    transition: color 0.2s;
}
.settings-bottom-bar:active .settings-bottom-inner { color: var(--accent); }
.settings-bottom-inner .material-icons-round { font-size: 20px; }

/* ══════════════════════════════════════
   SETTINGS PANEL (bottom sheet)
   ══════════════════════════════════════ */
.settings-panel { display: none; }
.settings-panel.open { display: block; }

.settings-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 100; animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.settings-sheet {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg2); border-radius: 20px 20px 0 0;
    z-index: 101; max-height: 85vh; overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.16,1,0.3,1);
    padding-bottom: env(safe-area-inset-bottom, 16px);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideDown { from { transform: translateY(0); } to { transform: translateY(100%); } }

.settings-handle {
    width: 36px; height: 4px; background: var(--fg-muted);
    border-radius: 2px; margin: 10px auto 0;
}

.settings-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 8px;
}
.settings-header h3 { font-size: 18px; font-weight: 700; color: var(--fg); }

.settings-body { padding: 0 20px 20px; }

.settings-section {
    margin-bottom: 20px;
}
.settings-section-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 700; color: var(--accent);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.settings-section-title .material-icons-round { font-size: 16px; }

.settings-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 14px; color: var(--fg); }

/* Theme switcher */
.theme-switcher { display: flex; gap: 4px; }
.theme-btn {
    display: flex; align-items: center; gap: 4px;
    padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
    background: transparent; color: var(--fg-dim); font-size: 11px;
    cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.theme-btn .material-icons-round { font-size: 14px; }
.theme-btn.active {
    background: var(--accent); color: var(--bg);
    border-color: var(--accent);
}

/* Font size control */
.font-size-control { display: flex; align-items: center; gap: 8px; }
.font-btn {
    width: 36px; height: 36px; border-radius: 8px;
    border: 1px solid var(--border); background: transparent;
    color: var(--fg); font-size: 14px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.font-btn:active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
#fontSizeLabel { font-size: 13px; color: var(--fg-dim); min-width: 36px; text-align: center; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0; cursor: pointer;
    background: #374151; border-radius: 24px;
    transition: background 0.2s;
}
.toggle-slider::before {
    content: ''; position: absolute; width: 18px; height: 18px;
    left: 3px; top: 3px; background: white; border-radius: 50%;
    transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Settings toggle button & status */
.settings-toggle-wrap { display: flex; align-items: center; gap: 8px; }
.settings-status { font-size: 12px; }
.settings-toggle-btn {
    padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
    background: transparent; color: var(--fg); font-size: 13px;
    cursor: pointer; font-family: inherit;
    min-height: 44px; min-width: 44px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.settings-toggle-btn:disabled { opacity: 0.5; cursor: default; }
.settings-toggle-btn.btn-danger {
    border-color: rgba(244,63,94,0.3); color: #f43f5e;
}
.settings-toggle-btn.btn-danger:active { background: rgba(244,63,94,0.1); }
.settings-toggle-btn.btn-success {
    border-color: rgba(6,214,160,0.3); color: #06d6a0;
}
.settings-toggle-btn.btn-success:active { background: rgba(6,214,160,0.1); }

/* Select dropdown */
.settings-select {
    padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg); color: var(--fg); font-size: 13px;
    font-family: inherit; cursor: pointer;
    -webkit-appearance: none; appearance: none;
}

.settings-about { font-size: 13px; color: var(--fg-dim); padding: 8px 0; }

/* Logout button */
.btn-logout {
    background: rgba(244,63,94,0.12) !important; border: none !important;
    color: var(--error) !important; font-weight: 600;
}
.btn-logout:active { background: rgba(244,63,94,0.25) !important; }

/* ══════════════════════════════════════
   REFRESH BAR
   ══════════════════════════════════════ */
.refresh-bar {
    position: fixed; top: 0; left: 0; height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    z-index: 200; opacity: 0;
}
.refresh-bar.active { opacity: 1; animation: refreshProgress 30s linear forwards; }
@keyframes refreshProgress { from { width: 0%; } to { width: 100%; } }

/* Footer timestamp */
.footer-timestamp {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: linear-gradient(0deg, var(--bg) 60%, transparent);
    padding: 24px 16px 14px; text-align: center; pointer-events: none;
}
.timestamp-text { font-size: 11px; color: var(--fg-muted); }
.timestamp-dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--success); margin-right: 6px; vertical-align: middle;
    animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Spin once (refresh button) */
.spin-once .material-icons-round {
    animation: spin 0.6s ease;
}

/* Card animation */
@keyframes cardIn { to { opacity: 1; transform: translateY(0); } }

/* Scale in animation */
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* ══════════════════════════════════════
   GLOBAL SEARCH
   ══════════════════════════════════════ */
.global-search { padding: 10px 12px 0; background: var(--bg); position: sticky; top: 49px; z-index: 9; }
.global-search-wrapper {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 10px; padding: 0 12px; transition: border-color 0.2s;
}
.global-search-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.global-search-icon { color: var(--fg-muted); display: flex; flex-shrink: 0; }
.global-search-icon .material-icons-round { font-size: 20px; }
.global-search input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--fg); font-size: 14px; font-family: inherit; padding: 12px 0;
}
.global-search input::placeholder { color: var(--fg-muted); }
.global-search-clear {
    background: none; border: none; color: var(--fg-muted); cursor: pointer;
    display: flex; padding: 4px; border-radius: 50%;
}
.global-search-clear .material-icons-round { font-size: 18px; }
.search-results {
    background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
    margin-top: 8px; max-height: 300px; overflow-y: auto;
}
.search-loading { display: flex; justify-content: center; padding: 20px; }
.search-empty {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 20px; color: var(--fg-muted); font-size: 13px;
}
.search-empty .material-icons-round { font-size: 20px; }
.search-result-item {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:active { background: rgba(255,255,255,0.06); }

/* ══════════════════════════════════════
   CUSTOMS — STATS GRID (dashboard cards)
   ══════════════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px 14px;
}
.stats-grid .stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: cardSlideIn 0.35s ease both;
}
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.15s; }
.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.stat-card-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.stat-card-icon .material-icons-round { font-size: 20px; color: white; }
.stat-card-value {
    font-size: 26px; font-weight: 800; color: white;
    letter-spacing: -0.5px; line-height: 1;
}
.stat-card-label {
    font-size: 11px; color: var(--fg-dim); font-weight: 500;
    letter-spacing: 0.3px;
}
.stat-card-trend {
    font-size: 10px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 2px;
    padding: 2px 6px; border-radius: 6px;
}
.stat-card-trend.up { background: rgba(6,214,160,0.12); color: var(--success); }
.stat-card-trend.down { background: rgba(244,63,94,0.12); color: var(--error); }

/* Full-width stat card */
.stats-grid .stat-card-wide {
    grid-column: 1 / -1;
}

/* ══════════════════════════════════════
   CHARTS GRID
   ══════════════════════════════════════ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 14px 12px;
}
.chart-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    animation: cardSlideIn 0.35s ease both;
}
.chart-card canvas {
    width: 100% !important;
    max-height: 220px;
}
.chart-wrap {
    position: relative;
    height: 220px;
    width: 100%;
}
.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.chart-card-title {
    font-size: 13px; font-weight: 700; color: var(--fg);
}
.chart-card-legend {
    display: flex; gap: 12px;
}
.chart-legend-item {
    display: flex; align-items: center; gap: 4px;
    font-size: 10px; color: var(--fg-dim);
}
.chart-legend-dot {
    width: 8px; height: 8px; border-radius: 50%;
}
.chart-container {
    width: 100%;
    height: 180px;
    position: relative;
}
.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ══════════════════════════════════════
   DATA TABLE
   ══════════════════════════════════════ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 10px;
    font-weight: 700;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--fg);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr {
    transition: background 0.15s;
    cursor: pointer;
}
.data-table tbody tr:active {
    background: rgba(255,255,255,0.04);
}
.data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg2);
}

/* ══════════════════════════════════════
   BADGES — Vehicle types
   ══════════════════════════════════════ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 8px;
    font-size: 11px; font-weight: 600;
    white-space: nowrap; letter-spacing: 0.2px;
}

/* Vehicle type badges */
.badge-truck { background: rgba(124,58,237,0.15); color: #a78bfa; }
.badge-car { background: rgba(0,212,255,0.12); color: var(--accent); }
.badge-bus { background: rgba(251,191,36,0.12); color: var(--warning); }
.badge-special { background: rgba(236,72,153,0.12); color: #ec4899; }

/* Direction badges */
.badge-import { background: rgba(6,214,160,0.12); color: var(--success); }
.badge-export { background: rgba(0,212,255,0.12); color: var(--accent); }
.badge-transit { background: rgba(124,58,237,0.12); color: #a78bfa; }

/* Status badges */
.badge-passed { background: rgba(6,214,160,0.12); color: var(--success); }
.badge-inspection { background: rgba(251,191,36,0.12); color: var(--warning); }
.badge-detained { background: rgba(244,63,94,0.12); color: var(--error); }
.badge-waiting { background: rgba(156,163,175,0.12); color: var(--fg-dim); }

/* Role badges */
.badge-admin { background: rgba(244,63,94,0.12); color: var(--error); }
.badge-viewer { background: rgba(156,163,175,0.12); color: var(--fg-dim); }

/* Account status badges */
.badge-active { background: rgba(6,214,160,0.12); color: var(--success); }
.badge-blocked { background: rgba(244,63,94,0.12); color: var(--error); }

/* 2FA badge */
.badge-2fa {
    background: rgba(124,58,237,0.12); color: #a78bfa;
    font-size: 10px; padding: 2px 8px;
}

/* Badge with dot indicator */
.badge-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor; flex-shrink: 0;
}

/* ══════════════════════════════════════
   REPORT DOC
   ══════════════════════════════════════ */
.report-doc {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
}
.report-doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.report-doc-title {
    font-size: 16px; font-weight: 700; color: white;
}
.report-doc-date {
    font-size: 11px; color: var(--fg-dim);
}
.report-doc-section {
    margin-bottom: 16px;
}
.report-doc-section-title {
    font-size: 11px; color: var(--accent); font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.report-doc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.report-doc-row:last-child { border-bottom: none; }
.report-doc-key { font-size: 12px; color: var(--fg-dim); }
.report-doc-val { font-size: 13px; color: white; font-weight: 500; }
.report-doc-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.report-doc-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
    background: transparent; color: var(--fg); font-size: 13px;
    cursor: pointer; font-family: inherit; transition: all 0.2s;
}
.report-doc-btn .material-icons-round { font-size: 16px; }
.report-doc-btn:active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.report-doc-btn-primary {
    background: linear-gradient(135deg, #0891b2, #00d4ff);
    border-color: transparent; color: var(--bg); font-weight: 600;
}
.report-doc-btn-primary:active { opacity: 0.85; }

/* ══════════════════════════════════════
   MODAL OVERLAY
   ══════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 500;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal-content {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.3s cubic-bezier(0.16,1,0.3,1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    font-size: 17px; font-weight: 700; color: var(--fg);
}
.modal-close {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--fg);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.modal-close:active { background: rgba(255,255,255,0.12); }
.modal-close .material-icons-round { font-size: 18px; }
.modal-body {
    padding: 16px 20px 20px;
}
.modal-footer {
    padding: 12px 20px 18px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════
   CONFIRM DIALOG
   ══════════════════════════════════════ */
.confirm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 600;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}
.confirm-dialog {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    padding: 28px 24px 20px;
    animation: scaleIn 0.3s cubic-bezier(0.16,1,0.3,1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.confirm-icon {
    width: 56px; height: 56px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}
.confirm-icon .material-icons-round { font-size: 28px; color: white; }
.confirm-icon-danger { background: rgba(244,63,94,0.15); }
.confirm-icon-danger .material-icons-round { color: var(--error); }
.confirm-icon-warning { background: rgba(251,191,36,0.15); }
.confirm-icon-warning .material-icons-round { color: var(--warning); }
.confirm-icon-success { background: rgba(6,214,160,0.15); }
.confirm-icon-success .material-icons-round { color: var(--success); }
.confirm-title {
    font-size: 17px; font-weight: 700; color: white;
    margin-bottom: 8px;
}
.confirm-text {
    font-size: 13px; color: var(--fg-dim); line-height: 1.5;
    margin-bottom: 20px;
}
.confirm-actions {
    display: flex; gap: 10px;
}
.confirm-btn {
    flex: 1; padding: 12px; border-radius: 10px;
    font-size: 14px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: transform 0.15s, opacity 0.15s;
    border: none;
}
.confirm-btn:active { transform: scale(0.97); }
.confirm-btn-cancel {
    background: rgba(255,255,255,0.08); color: var(--fg);
    border: 1px solid var(--border);
}
.confirm-btn-danger {
    background: var(--error); color: white;
    box-shadow: 0 4px 16px rgba(244,63,94,0.3);
}
.confirm-btn-confirm {
    background: linear-gradient(135deg, #0891b2, #00d4ff);
    color: var(--bg);
    box-shadow: 0 4px 16px rgba(0,212,255,0.3);
}

/* ══════════════════════════════════════
   ADMIN BLOCKS
   ══════════════════════════════════════ */
.admin-page {
    flex: 1; overflow-y: auto; padding: 16px;
}
.admin-section {
    margin-bottom: 20px;
}
.admin-section-title {
    font-size: 12px; font-weight: 700; color: var(--accent);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}
.admin-section-title .material-icons-round { font-size: 16px; }
.admin-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}
.admin-card:active { border-color: var(--accent); transform: scale(0.98); }
.admin-card-icon {
    width: 42px; height: 42px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.admin-card-icon .material-icons-round { font-size: 22px; color: white; }
.admin-card-info { flex: 1; min-width: 0; }
.admin-card-name {
    font-size: 14px; font-weight: 600; color: white;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-card-detail {
    font-size: 11px; color: var(--fg-dim); margin-top: 2px;
}
.admin-card-arrow {
    color: var(--fg-muted); flex-shrink: 0;
}
.admin-card-arrow .material-icons-round { font-size: 20px; }

/* Admin user list */
.admin-user-list {
    display: flex; flex-direction: column; gap: 8px;
}
.admin-user-item {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.admin-user-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 16px; font-weight: 700; color: white;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name {
    font-size: 14px; font-weight: 600; color: white;
}
.admin-user-email {
    font-size: 11px; color: var(--fg-dim); margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-user-actions {
    display: flex; gap: 4px; flex-shrink: 0;
}

/* Admin form fields */
.admin-form-group {
    margin-bottom: 14px;
}
.admin-form-label {
    display: block; font-size: 11px; color: var(--fg-dim);
    font-weight: 700; letter-spacing: 1px; margin-bottom: 6px;
    text-transform: uppercase;
}
.admin-form-input {
    width: 100%; padding: 12px 14px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 10px;
    color: var(--fg); font-size: 14px; font-family: inherit;
    outline: none; transition: border-color 0.2s;
}
.admin-form-input:focus { border-color: var(--accent); }
.admin-form-select {
    width: 100%; padding: 12px 14px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 10px;
    color: var(--fg); font-size: 14px; font-family: inherit;
    -webkit-appearance: none; appearance: none;
    cursor: pointer;
}

/* ══════════════════════════════════════
   QR MODAL
   ══════════════════════════════════════ */
.qr-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 700;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
}
.qr-modal-content {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 320px;
    padding: 28px 24px;
    text-align: center;
    animation: scaleIn 0.3s cubic-bezier(0.16,1,0.3,1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.qr-modal-title {
    font-size: 17px; font-weight: 700; color: white;
    margin-bottom: 6px;
}
.qr-modal-subtitle {
    font-size: 12px; color: var(--fg-dim); margin-bottom: 20px;
}
.qr-modal-code {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin: 0 auto 20px;
    display: inline-block;
}
.qr-modal-code img,
.qr-modal-code canvas,
.qr-modal-code svg {
    display: block;
    max-width: 200px;
    height: auto;
}
.qr-modal-info {
    font-size: 12px; color: var(--fg-dim); line-height: 1.5;
    margin-bottom: 16px;
}
.qr-modal-close {
    width: 100%; padding: 12px; border-radius: 10px;
    background: rgba(255,255,255,0.08); color: var(--fg);
    border: 1px solid var(--border); font-size: 14px;
    font-weight: 600; font-family: inherit;
    cursor: pointer; transition: transform 0.15s;
}
.qr-modal-close:active { transform: scale(0.97); }

/* ══════════════════════════════════════
   SESSION CARD (settings -> Security)
   ══════════════════════════════════════ */
.session-card {
    background: rgba(255, 255, 255, 0.04);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
}
.session-loading, .session-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-muted);
    font-size: 13px;
    padding: 8px 0;
}
.session-loading .material-icons-round,
.session-empty .material-icons-round { font-size: 18px; }

.session-item.is-current {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.session-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.session-device-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(10, 132, 255, 0.14);
    color: #0A84FF;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.session-device-icon .material-icons-round { font-size: 24px; }
.session-device-info { min-width: 0; flex: 1; }
.session-device-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg);
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.session-current-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 500;
    color: #30D158;
}
.session-current-badge .material-icons-round { font-size: 13px; }

.session-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.22);
    border-radius: 10px;
    border: 0.5px solid rgba(255, 255, 255, 0.05);
}
.session-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--fg-dim);
    font-variant-numeric: tabular-nums;
}
.session-meta-icon {
    display: inline-flex;
    color: var(--fg-muted);
    flex-shrink: 0;
}
.session-meta-icon .material-icons-round { font-size: 14px; }
.session-ip {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    font-size: 11px;
    letter-spacing: 0.02em;
}

.session-info-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(10, 132, 255, 0.08);
    border: 0.5px solid rgba(10, 132, 255, 0.18);
    border-radius: 10px;
    font-size: 11px;
    color: var(--fg-dim);
    line-height: 1.4;
}
.session-info-note .material-icons-round {
    font-size: 15px;
    color: #0A84FF;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ══════════════════════════════════════
   CHECKPOINT STATUS (like road-status)
   ══════════════════════════════════════ */
.checkpoint-status { margin-bottom: 12px; }
.checkpoint-status-inner {
    border-radius: 10px; padding: 10px 12px;
    border: 1px solid transparent;
}
.checkpoint-status-open {
    background: linear-gradient(135deg, rgba(6,214,160,0.12) 0%, rgba(6,214,160,0.04) 100%);
    border-color: rgba(6,214,160,0.3);
}
.checkpoint-status-closed {
    background: linear-gradient(135deg, rgba(244,63,94,0.12) 0%, rgba(244,63,94,0.04) 100%);
    border-color: rgba(244,63,94,0.3);
}
.checkpoint-status-row {
    display: flex; align-items: center; justify-content: space-between;
}
.checkpoint-status-left { display: flex; align-items: center; gap: 10px; }
.checkpoint-status-text { font-size: 13px; font-weight: 700; color: white; }
.checkpoint-status-sub { font-size: 10px; color: var(--fg-dim); }

/* Progress bars */
.progress-track {
    width: 100%; height: 6px; background: #2a2a40;
    border-radius: 3px; overflow: hidden;
}
.progress-fill {
    height: 100%; border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 2px;
}

/* ══════════════════════════════════════
   FILTER TABS
   ══════════════════════════════════════ */
.filter-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--fg-dim);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.filter-tab:active { transform: scale(0.96); }
.filter-tab.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}
.filter-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: rgba(255,255,255,0.15);
    font-size: 10px;
    font-weight: 700;
    margin-left: 4px;
}
.filter-tab.active .filter-tab-count {
    background: rgba(0,0,0,0.15);
}

/* ══════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px;
}
.pagination-btn {
    width: 36px; height: 36px; border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent; color: var(--fg-dim);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-family: inherit; font-size: 13px;
    transition: all 0.2s;
}
.pagination-btn:active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.pagination-btn.active {
    background: var(--accent); color: var(--bg); border-color: var(--accent);
    font-weight: 700;
}
.pagination-btn:disabled { opacity: 0.3; cursor: default; }
.pagination-info {
    font-size: 12px; color: var(--fg-dim); padding: 0 8px;
}

/* ══════════════════════════════════════
   LIGHT THEME
   ══════════════════════════════════════ */
[data-theme="light"] {
    --bg: #f5f5f7;
    --bg2: #ffffff;
    --surface: rgba(0,0,0,0.03);
    --border: #e5e7eb;
    --fg: #1a1a2e;
    --fg-dim: #6b7280;
    --fg-muted: #9ca3af;
    --accent: #0891b2;
    --accent-glow: rgba(8,145,178,0.2);
    --success: #059669;
    --success-dark: #d1fae5;
    --error: #dc2626;
    --error-dark: #fee2e2;
    --warning: #d97706;
}
[data-theme="light"] body { background: var(--bg); color: var(--fg); }
[data-theme="light"] .login-page { background: radial-gradient(ellipse at 50% 20%, rgba(8,145,178,0.06) 0%, transparent 60%), var(--bg); }
[data-theme="light"] .login-title { color: var(--fg); }
[data-theme="light"] .field input { background: var(--bg2); color: var(--fg); border-color: var(--border); }
[data-theme="light"] .header { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .stats-bar { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .stat-value.total { color: var(--fg); }
[data-theme="light"] .card { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .card-title { color: var(--accent); }
[data-theme="light"] .info-value { color: var(--fg); }
[data-theme="light"] .menu-header-bg { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 30%, #f0f4ff 60%, #f5f5f7 100%); }
[data-theme="light"] .menu-header-title { background: linear-gradient(90deg, var(--fg) 0%, var(--accent) 40%, var(--success) 60%, #7c3aed 80%, var(--accent) 100%); background-size: 300% 100%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; animation: titleShimmer 4s ease-in-out infinite; }
[data-theme="light"] .menu-card { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .menu-card-title { color: var(--fg); }
[data-theme="light"] .menu-header-bg::after { background: linear-gradient(90deg, transparent 0%, rgba(8,145,178,0.3) 50%, transparent 100%); }
[data-theme="light"] .settings-sheet { background: var(--bg2); }
[data-theme="light"] .settings-row { border-color: var(--border); }
[data-theme="light"] .settings-select { background: var(--bg); color: var(--fg); border-color: var(--border); }
[data-theme="light"] .theme-btn { border-color: var(--border); color: var(--fg-dim); }
[data-theme="light"] .font-btn { border-color: var(--border); color: var(--fg); }
[data-theme="light"] .toggle-slider { background: #d1d5db; }
[data-theme="light"] .settings-bottom-bar { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .progress-track { background: #e5e7eb; }
[data-theme="light"] .checkpoint-status-text { color: var(--fg); }
[data-theme="light"] .checkpoint-status-open { background: linear-gradient(135deg, rgba(5,150,105,0.08) 0%, rgba(5,150,105,0.02) 100%); border-color: rgba(5,150,105,0.3); }

/* Light theme — custom dashboard elements */
[data-theme="light"] .stats-grid .stat-card { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .stat-card-value { color: var(--fg); }
[data-theme="light"] .chart-card { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .data-table thead th { border-color: var(--border); }
[data-theme="light"] .data-table tbody td { border-color: rgba(0,0,0,0.06); color: var(--fg); }
[data-theme="light"] .data-table-wrap { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .report-doc { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .report-doc-title { color: var(--fg); }
[data-theme="light"] .report-doc-val { color: var(--fg); }
[data-theme="light"] .report-doc-header { border-color: var(--border); }
[data-theme="light"] .report-doc-footer { border-color: var(--border); }
[data-theme="light"] .modal-content { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .modal-header { border-color: var(--border); }
[data-theme="light"] .modal-header h3 { color: var(--fg); }
[data-theme="light"] .modal-close { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); color: var(--fg); }
[data-theme="light"] .modal-footer { border-color: var(--border); }
[data-theme="light"] .confirm-dialog { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .confirm-title { color: var(--fg); }
[data-theme="light"] .confirm-btn-cancel { background: rgba(0,0,0,0.04); color: var(--fg); border-color: var(--border); }
[data-theme="light"] .admin-card { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .admin-card-name { color: var(--fg); }
[data-theme="light"] .admin-user-item { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .admin-user-name { color: var(--fg); }
[data-theme="light"] .admin-form-input { background: var(--bg); color: var(--fg); border-color: var(--border); }
[data-theme="light"] .admin-form-select { background: var(--bg); color: var(--fg); border-color: var(--border); }
[data-theme="light"] .qr-modal-content { background: var(--bg2); border-color: var(--border); }
[data-theme="light"] .qr-modal-title { color: var(--fg); }
[data-theme="light"] .qr-modal-close { background: rgba(0,0,0,0.04); color: var(--fg); border-color: var(--border); }
[data-theme="light"] .session-card { background: rgba(0,0,0,0.025); border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .session-meta { background: rgba(0,0,0,0.035); border-color: rgba(0,0,0,0.05); }
[data-theme="light"] .session-device-name { color: #1d1d1f; }
[data-theme="light"] .filter-tab { border-color: var(--border); color: var(--fg-dim); }

/* ══════════════════════════════════════
   RESPONSIVE — 480px
   ══════════════════════════════════════ */
@media (max-width: 480px) {
    #app {
        max-width: 100%;
        box-shadow: none;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 10px 12px;
    }
    .stats-grid .stat-card {
        padding: 12px 10px;
    }
    .stat-card-value {
        font-size: 22px;
    }
    .charts-grid {
        padding: 0 12px 10px;
    }
    .chart-container {
        height: 150px;
    }
    .menu-grid {
        gap: 10px;
    }
    .menu-card {
        padding: 16px 14px;
    }
    .modal-content {
        max-width: 100%;
        border-radius: 16px;
    }
    .confirm-dialog {
        max-width: 100%;
    }
    .report-doc {
        padding: 16px;
    }
    .data-table thead th,
    .data-table tbody td {
        padding: 8px 10px;
        font-size: 12px;
    }
    .admin-page {
        padding: 12px;
    }
    .filter-tabs {
        padding: 8px 12px;
    }
}

/* ══════════════════════════════════════
   MONITORING — Apple Exit-Card Design
   ══════════════════════════════════════ */

/* exitFadeUp animation */
@keyframes exitFadeUp {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Frosted glass header ── */
.exit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    /* safe-area handled by #app padding-top */
    background: rgba(28, 28, 30, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 20;
}
.exit-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.exit-header-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #fff;
    margin: 0;
}
.exit-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Apple pill badge ── */
.match-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    line-height: 1;
}
.match-badge--live {
    background: rgba(48, 209, 88, 0.14);
    color: #30D158;
    border: 0.5px solid rgba(48, 209, 88, 0.3);
}
.match-badge--demo {
    background: rgba(255, 214, 10, 0.14);
    color: #FFD60A;
    border: 0.5px solid rgba(255, 214, 10, 0.3);
}
.match-badge--status {
    color: var(--badge-color);
    background: var(--badge-bg);
    border: 0.5px solid color-mix(in srgb, var(--badge-color) 25%, transparent);
    padding: 5px 11px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    gap: 5px;
}
.match-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: badgeDotPulse 2s ease-in-out infinite;
}
@keyframes badgeDotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Stats strip — glassmorphism pill ── */
.exit-stats-bar {
    margin: 10px 14px 8px;
    padding: 16px 6px;
    background: rgba(28, 28, 30, 0.88);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08),
                0 12px 40px rgba(0, 0, 0, 0.32);
    display: flex;
    align-items: stretch;
    animation: exitFadeUp 0.5s ease both;
}
.exit-stat {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.exit-stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
}
.exit-stat-label {
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.exit-stat-divider {
    width: 0.5px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
    flex-shrink: 0;
}

/* ── Average wait — purple glassmorphism bar ── */
.exit-avg-wait {
    margin: 0 14px 10px;
    padding: 12px 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(191, 90, 242, 0.08);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    border: 0.5px solid rgba(191, 90, 242, 0.2);
    box-shadow: 0 2px 12px rgba(191, 90, 242, 0.06);
    animation: exitFadeUp 0.5s ease 0.08s both;
}
.exit-avg-wait-icon {
    font-size: 22px;
    color: #BF5AF2;
    flex-shrink: 0;
}
.exit-avg-wait-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.exit-avg-wait-label {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
}
.exit-avg-wait-value {
    font-size: 17px;
    font-weight: 700;
    color: #BF5AF2;
    font-variant-numeric: tabular-nums;
}

/* ── Section header ── */
.exit-section-header {
    padding: 6px 16px 8px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: exitFadeUp 0.5s ease 0.12s both;
}
.exit-section-icon {
    font-size: 15px;
    opacity: 0.5;
}
.exit-section-count {
    font-size: 10px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
    margin-left: 2px;
}

/* ── Card list container ── */
.exit-card-list {
    padding: 4px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Exit card — glassmorphism with shadow ── */
.exit-card {
    position: relative;
    background: rgba(28, 28, 30, 0.75);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 0.5px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06),
                0 8px 32px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    animation: exitFadeUp 0.45s ease both;
}
.exit-card-accent {
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 3px;
    border-radius: 0 3px 3px 0;
}
.exit-card-body {
    padding: 14px 14px 10px 18px;
}

/* Top row — plate + badge */
.exit-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.exit-card-plate-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.exit-card-plate {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.8px;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}
.exit-card-trailer {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.3px;
}
.exit-card-vehicle-info {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
    font-weight: 400;
}

/* ── Meta section ── */
.exit-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.exit-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.exit-meta-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.exit-meta-icon .material-icons-round {
    font-size: 14px;
}
.exit-meta-text {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Card footer — timeline ── */
.exit-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px 9px 18px;
    border-top: 0.5px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.015);
}
.exit-card-timeline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}
.exit-card-time-icon {
    font-size: 14px;
    opacity: 0.5;
}
.exit-card-time {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.5);
}
.exit-card-date-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
}
.exit-card-date-label {
    font-weight: 500;
}
.exit-card-country {
    font-size: 10px;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    border: 0.5px solid rgba(255, 255, 255, 0.08);
}

/* ── Empty state ── */
.exit-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    text-align: center;
    animation: exitFadeUp 0.5s ease both;
}
.exit-empty-icon {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
}
.exit-empty-text {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.25);
    margin: 0;
}

/* ── Footer timestamp ── */
.exit-footer-ts {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px 20px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.3);
}
.exit-footer-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #30D158;
    flex-shrink: 0;
    animation: footerDotPulse 2s ease-in-out infinite;
}
@keyframes footerDotPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.4); }
    50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(48, 209, 88, 0); }
}

/* ══════════════════════════════════════
   ПОИСК Т/С — Hero + Search Field
   ══════════════════════════════════════ */

.vs-search-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 0 20px;
    transition: padding 0.3s ease;
}
.vs-search-hero.compact {
    padding: 12px 0 12px;
}
.vs-search-hero.compact .vs-search-icon-wrap,
.vs-search-hero.compact .vs-search-title,
.vs-search-hero.compact .vs-search-subtitle,
.vs-search-hero.compact .vs-search-hints {
    display: none;
}

.vs-search-icon-wrap {
    margin-bottom: 16px;
    animation: exitFadeUp 0.5s ease both;
}
.vs-search-icon-bg {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(135deg, #e11d48, #fb7185);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 36px;
    box-shadow: 0 8px 32px rgba(225, 29, 72, 0.3);
}
.vs-search-icon-bg .material-icons {
    font-size: 36px;
}

.vs-search-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--fg);
    margin-bottom: 6px;
    text-align: center;
    animation: exitFadeUp 0.5s ease 0.05s both;
}
.vs-search-subtitle {
    font-size: 14px;
    color: var(--fg-muted);
    margin-bottom: 20px;
    text-align: center;
    animation: exitFadeUp 0.5s ease 0.1s both;
}

.vs-search-field {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--card);
    border: 2px solid var(--border);
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
    animation: exitFadeUp 0.5s ease 0.15s both;
}
.vs-search-field.focused {
    border-color: #e11d48;
    box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.15);
    background: rgba(225, 29, 72, 0.03);
}
.vs-search-field.active {
    border-color: #e11d48;
}

.vs-search-field-icon {
    color: var(--fg-muted);
    font-size: 22px;
    transition: color 0.25s;
}
.vs-search-field.focused .vs-search-field-icon,
.vs-search-field.active .vs-search-field-icon {
    color: #e11d48;
}
.vs-search-field-icon .material-icons {
    font-size: 22px;
}

.vs-search-field-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-family: inherit;
}
.vs-search-field-input::placeholder {
    color: var(--fg-muted);
    opacity: 0.5;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: none;
}

.vs-search-field-clear {
    color: var(--fg-muted);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.vs-search-field-clear.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.vs-search-hints {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
    justify-content: center;
    animation: exitFadeUp 0.5s ease 0.2s both;
}
.vs-search-hint {
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    letter-spacing: 0.5px;
}
.vs-search-hint:active {
    background: rgba(225, 29, 72, 0.15);
    color: #fb7185;
    border-color: rgba(225, 29, 72, 0.3);
}

/* ══════════════════════════════════════
   ПОИСК Т/С — Timeline
   ══════════════════════════════════════ */

.vs-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
}

.vs-timeline {
    position: relative;
    padding: 0 0 16px 0;
}

.vs-timeline-item {
    display: grid;
    grid-template-columns: 14px 1fr;
    grid-template-rows: auto 1fr;
    column-gap: 14px;
    animation: exitFadeUp 0.4s ease both;
}

.vs-timeline-dot {
    grid-column: 1;
    grid-row: 1;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-top: 14px;
    z-index: 1;
    transition: box-shadow 0.3s;
}

.vs-timeline-line {
    grid-column: 1;
    grid-row: 2;
    width: 2px;
    justify-self: center;
    min-height: 10px;
    border-radius: 1px;
}

.vs-timeline-content {
    grid-column: 2;
    grid-row: 1 / 3;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: border-color 0.3s;
}

.vs-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: var(--fg-muted);
    white-space: nowrap;
}
.vs-tag .material-icons {
    font-size: 13px;
}

/* Полный цикл ТС — шаги с фото */
.vs-stages {
    position: relative;
    display: flex;
    flex-direction: column;
}
.vs-stage-item {
    position: relative;
    padding-left: 28px;
    padding-bottom: 16px;
    opacity: 0;
    animation: vs-stage-in 0.3s ease forwards;
}
.vs-stage-item:last-child {
    padding-bottom: 0;
}
.vs-stage-dot {
    position: absolute;
    left: 6px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.04);
    z-index: 2;
}
.vs-stage-line {
    position: absolute;
    left: 10px;
    top: 15px;
    bottom: 0;
    width: 2px;
}
.vs-stage-content {
    min-width: 0;
}
@keyframes vs-stage-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.vs-photo-wrap {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
    cursor: zoom-in;
}
.vs-doc-photo {
    display: block;
    width: 100%;
    max-height: 240px;
    object-fit: cover;
}

.vs-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(48,209,88,0.3);
    background: rgba(48,209,88,0.08);
    color: #30D158;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.vs-photo-btn:hover:not(:disabled) {
    background: rgba(48,209,88,0.15);
}
.vs-photo-btn:active:not(:disabled) {
    transform: scale(0.97);
}
.vs-photo-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}
.vs-photo-btn .material-icons {
    font-size: 16px;
}
.vs-photo-btn-error {
    border-color: rgba(255,69,58,0.3);
    background: rgba(255,69,58,0.08);
    color: #FF453A;
    cursor: default;
}

/* Lightbox для просмотра фото */
body.vs-lightbox-open { overflow: hidden; }
.vs-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 8px calc(env(safe-area-inset-bottom, 0px) + 16px) 8px;
    animation: vs-fade-in 0.15s ease;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.vs-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    object-fit: contain;
    transition: transform 0.18s ease, opacity 0.18s ease;
    pointer-events: none;
}
.vs-lightbox.vs-swiping img { transition: none; }
.vs-lightbox-close {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    z-index: 3;
}
.vs-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.vs-lightbox-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.vs-lightbox-prev { left: 12px; }
.vs-lightbox-next { right: 12px; }
.vs-lightbox-counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

/* Блок «Иные Места» — период + метрики */
.places-period-row {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}
.places-period-btn {
    flex-shrink: 0;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--fg-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.places-period-btn:active {
    transform: scale(0.97);
}
.places-period-btn.active {
    background: rgba(10,132,255,0.15);
    border-color: rgba(10,132,255,0.4);
    color: #0A84FF;
}
.places-tm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--fg-muted);
    padding: 3px 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
}
.places-tm .material-icons,
.places-tm .material-icons-round {
    font-size: 12px;
}
.places-tm b {
    color: var(--fg);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Anomalies block */
.anom-wrap {
    border-radius: 14px;
    border: 1px solid rgba(255,69,58,0.25);
    background: linear-gradient(135deg, rgba(255,69,58,0.08), rgba(255,159,10,0.04));
    overflow: hidden;
    animation: anom-in 0.3s ease;
}
@keyframes anom-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.anom-header {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    background: rgba(255,69,58,0.12);
    color: #FF6961;
    font-size: 13px; font-weight: 700;
    border-bottom: 1px solid rgba(255,69,58,0.15);
}
.anom-header .material-icons, .anom-header .material-icons-round { font-size: 18px; }
.anom-list { display: flex; flex-direction: column; }
.anom-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid rgba(255,255,255,0.03);
    cursor: pointer;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.anom-item:first-child { border-top: none; }
.anom-item:active, .anom-item:hover { background: rgba(255,255,255,0.04); }
.anom-chevron {
    margin-left: auto;
    color: var(--fg-muted);
    align-self: center;
    flex-shrink: 0;
}
.anom-chevron .material-icons, .anom-chevron .material-icons-round { font-size: 18px; }

/* Отчёты — табы типов и оформление */
.rep-types-row {
    display: flex; gap: 6px;
    padding: 10px 14px 0 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.rep-types-row::-webkit-scrollbar { display: none; }
.rep-type-btn {
    display: inline-flex; align-items: center; gap: 6px;
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--fg-muted);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.rep-type-btn:active { transform: scale(0.96); }
.rep-type-btn.active {
    background: rgba(10,132,255,0.15);
    border-color: rgba(10,132,255,0.4);
    color: #0A84FF;
}
.rep-type-btn .material-icons, .rep-type-btn .material-icons-round { font-size: 16px; }
.rep-params-card .card-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--fg-muted); font-weight: 600;
    margin-bottom: 8px;
}
.rep-action-btn {
    flex: 1;
    padding: 11px 12px; border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--fg);
    font-size: 14px; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.rep-action-btn:active:not(:disabled) { transform: scale(0.98); }
.rep-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rep-action-primary {
    background: linear-gradient(135deg, #0A84FF, #5E5CE6);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(10,132,255,0.35);
}

/* ──────── Report content (summary, tables, bars) ──────── */
.report-header {
    text-align: center;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.report-header h2 {
    font-size: 17px; font-weight: 700; margin: 0 0 6px 0;
    color: var(--fg);
}
.report-header p {
    margin: 2px 0; font-size: 12px; color: var(--fg-muted);
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.report-summary-card {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    min-width: 0;
    overflow: hidden;
}
.rsc-value {
    font-size: 22px; font-weight: 800;
    color: var(--fg);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rsc-label {
    font-size: 11px; color: var(--fg-muted);
    margin-top: 4px;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: var(--card);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.report-table thead th {
    background: rgba(255,255,255,0.04);
    padding: 8px 10px;
    font-weight: 700;
    font-size: 11px;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.report-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--fg);
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
}
.report-table tbody tr:last-child td { border-bottom: none; }
.report-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.report-bar-chart {
    padding: 12px;
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-top: 10px;
}
.report-bar {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, #0A84FF, #00D4FF);
    box-shadow: 0 1px 3px rgba(10,132,255,0.3);
}

/* Светлая тема корректировки */
[data-theme="light"] .report-table {
    background: var(--bg2);
}
[data-theme="light"] .report-table thead th {
    background: rgba(0,0,0,0.03);
}
[data-theme="light"] .report-summary-card {
    background: var(--bg2);
}

/* ──────── Красивые pickers в Отчётах (машина / инспектор) ──────── */
.rep-picker-block {
    padding: 2px 0;
}
.rep-picker-fade { animation: repFade 0.28s ease; }
@keyframes repFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.rep-picker-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
    color: var(--fg-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.rep-picker-label .material-icons, .rep-picker-label .material-icons-round { font-size: 16px; }
.rep-picker-loading {
    padding: 16px; text-align: center;
    color: var(--fg-muted); font-size: 13px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.rep-picker-empty {
    padding: 20px; text-align: center;
    color: var(--fg-muted); font-size: 13px;
}

/* Plate field — стилизованный номерной знак */
.rep-plate-field {
    position: relative;
    display: flex; align-items: center;
    height: 56px;
    background: linear-gradient(135deg, rgba(0,212,255,0.06), rgba(10,132,255,0.04));
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 0 8px 0 14px;
    transition: all 0.2s ease;
}
.rep-plate-field.rep-plate-focus {
    border-color: #00D4FF;
    box-shadow: 0 0 0 4px rgba(0,212,255,0.12), 0 4px 20px rgba(0,212,255,0.15);
    background: linear-gradient(135deg, rgba(0,212,255,0.1), rgba(10,132,255,0.06));
}
.rep-plate-field.rep-plate-filled {
    border-color: rgba(48,209,88,0.45);
}
.rep-plate-ic {
    display: flex; align-items: center;
    color: var(--fg-muted); margin-right: 10px;
}
.rep-plate-ic .material-icons, .rep-plate-ic .material-icons-round { font-size: 22px; }
.rep-plate-field input {
    flex: 1;
    background: transparent; border: none; outline: none;
    color: var(--fg);
    font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
    font-size: 20px; font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    min-width: 0;
}
.rep-plate-field input::placeholder {
    color: rgba(255,255,255,0.2);
    letter-spacing: 2px;
    font-weight: 700;
}
.rep-plate-clear {
    width: 30px; height: 30px; border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--fg-muted);
    display: none;
    align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.rep-plate-field.rep-plate-filled .rep-plate-clear { display: flex; }

/* Quick hints под plate-полем */
.rep-plate-hints {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px;
}
.rep-plate-hint {
    padding: 5px 11px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.rep-plate-hint:hover {
    border-color: rgba(0,212,255,0.3);
    color: #00D4FF;
}
.rep-plate-hint:active { transform: scale(0.96); }

/* Выпадашка с кандидатами */
.rep-picker-suggests {
    margin-top: 8px;
    display: flex; flex-direction: column; gap: 4px;
    max-height: 320px; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.rep-picker-suggests:empty { display: none; }
.rep-sug-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--fg);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    animation: repSugIn 0.2s ease;
}
@keyframes repSugIn { from { opacity: 0; transform: translateY(-2px); } }
.rep-sug-item:hover {
    border-color: rgba(0,212,255,0.4);
    background: rgba(0,212,255,0.05);
}
.rep-sug-item:active { transform: scale(0.99); }
.rep-sug-plate-wrap { display: flex; align-items: baseline; gap: 6px; min-width: 0; flex: 1; }
.rep-sug-plate {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px; font-weight: 800;
    letter-spacing: 1px;
}
.rep-sug-trailer { color: var(--fg-muted); font-size: 11px; font-weight: 500; }
.rep-sug-meta {
    display: flex; align-items: center; gap: 10px;
    font-size: 11px; color: var(--fg-muted);
    flex-shrink: 0;
}
.rep-sug-meta .material-icons, .rep-sug-meta .material-icons-round { font-size: 12px; }
.rep-sug-count {
    padding: 2px 8px; border-radius: 10px;
    background: rgba(10,132,255,0.15); color: #0A84FF;
    font-weight: 700; font-variant-numeric: tabular-nums;
}

/* Operator picker — search + grid of cards */
.rep-op-search {
    position: relative;
    display: flex; align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 12px;
    height: 44px;
    margin-bottom: 10px;
}
.rep-op-search-ic { display: flex; color: var(--fg-muted); margin-right: 8px; }
.rep-op-search-ic .material-icons, .rep-op-search-ic .material-icons-round { font-size: 18px; }
.rep-op-search input {
    flex: 1; min-width: 0;
    background: transparent; border: none; outline: none;
    color: var(--fg); font-size: 14px;
    font-family: inherit;
}
.rep-op-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
}
@media (min-width: 500px) {
    .rep-op-grid { grid-template-columns: 1fr 1fr; }
}
.rep-op-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--fg);
    cursor: pointer;
    text-align: left;
    transition: all 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    opacity: 0; transform: translateY(3px);
    animation: repOpIn 0.28s ease forwards;
}
@keyframes repOpIn { to { opacity: 1; transform: translateY(0); } }
.rep-op-card:hover {
    border-color: rgba(0,212,255,0.4);
    background: rgba(0,212,255,0.04);
    transform: translateY(-1px);
}
.rep-op-card:active { transform: scale(0.99); }
.rep-op-card.active {
    border-color: #00D4FF;
    background: rgba(0,212,255,0.1);
    box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}
.rep-op-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.15), 0 3px 8px rgba(0,0,0,0.2);
}
.rep-op-info { flex: 1; min-width: 0; }
.rep-op-name {
    font-size: 13px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rep-op-login { font-size: 10px; color: var(--fg-muted); margin-top: 1px; }
.rep-op-count {
    padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Operators table bar-cell */
.rep-bar-cell {
    width: 100%; min-width: 80px; max-width: 120px;
    height: 8px; border-radius: 4px;
    background: rgba(255,255,255,0.06); overflow: hidden;
}
.rep-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0A84FF, #30D158);
    transition: width 0.8s ease;
}
.rep-totals td { background: rgba(255,255,255,0.06) !important; font-weight: 700; }

/* Countries rows */
.rep-country-row { background: var(--card); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); }
.rep-country-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rep-country-name { flex: 1; font-size: 13px; font-weight: 600; }
.rep-country-pct { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 50px; text-align: right; }
.rep-country-val { font-size: 11px; color: var(--fg-muted); font-variant-numeric: tabular-nums; min-width: 50px; text-align: right; }
.rep-country-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.06); overflow: hidden; }
.rep-country-fill { height: 100%; border-radius: 3px; transition: width 1s cubic-bezier(0.2,0.8,0.2,1); }

/* Problems cards */
.rep-prob-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px; padding: 12px 14px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.rep-prob-card:hover { border-color: rgba(255,159,10,0.4); }
.rep-prob-card:active { transform: scale(0.99); }
.rep-prob-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.rep-prob-plate {
    font-size: 16px; font-weight: 800;
    font-variant-numeric: tabular-nums; letter-spacing: 0.5px;
}
.rep-prob-cycle {
    font-size: 12px; font-weight: 700;
    padding: 3px 10px; border-radius: 10px;
    background: rgba(255,69,58,0.15); color: #FF6961;
    white-space: nowrap;
}
.rep-prob-sub { font-size: 12px; color: var(--fg-muted); margin-bottom: 6px; }
.rep-prob-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.rep-prob-times {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px;
    font-size: 11px; color: var(--fg-muted);
    padding-top: 6px; border-top: 1px dashed rgba(255,255,255,0.08);
    overflow-wrap: anywhere;
}
.rep-prob-times > span {
    display: flex; flex-wrap: wrap; gap: 4px;
    min-width: 0;
}
.rep-prob-times b { color: var(--fg); font-weight: 600; overflow-wrap: anywhere; }

/* Peaks chart */
.rep-peak-chart {
    display: grid;
    grid-template-columns: repeat(24, 1fr); gap: 3px;
    align-items: end;
    height: 180px;
    padding: 20px 6px 6px 6px;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: visible;
}
.rep-peak-bar-wrap {
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    height: 100%;
    justify-content: flex-end;
    min-width: 0;
}
.rep-peak-bar {
    width: 100%;
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    transition: height 0.8s cubic-bezier(0.2,0.8,0.2,1);
}
.rep-peak-hour { font-size: 9px; color: var(--fg-muted); margin-top: 4px; line-height: 1; }
.rep-peak-val {
    font-size: 9px; font-weight: 700;
    position: absolute; top: -14px;
    white-space: nowrap;
    line-height: 1;
}

.rep-peak-matrix-wrap {
    overflow-x: auto; padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
}
.rep-peak-matrix {
    display: flex; flex-direction: column; gap: 2px;
    min-width: 620px;
    padding: 10px;
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.rep-pm-head, .rep-pm-row {
    display: grid;
    grid-template-columns: 70px repeat(24, minmax(20px, 1fr));
    gap: 2px;
    align-items: center;
}
.rep-pm-hour { font-size: 9px; color: var(--fg-muted); text-align: center; padding: 2px 0; line-height: 1; }
.rep-pm-daylabel {
    font-size: 10px; color: var(--fg-muted);
    display: flex; align-items: center;
    padding-right: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rep-pm-cell {
    aspect-ratio: 1 / 1; border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    font-size: 8px; font-weight: 700;
    color: rgba(0,0,0,0.75);
    min-width: 0;
}

/* Обёртка для горизонтального скролла таблицы */
.report-doc > div[style*="overflow-x"] {
    -webkit-overflow-scrolling: touch;
}

/* ──────── Блок «Сведения по ИМУ» ──────── */
.imu-hero {
    display: flex;
    gap: 16px;
    align-items: center;
    background: linear-gradient(135deg, rgba(0,212,255,0.06), rgba(10,132,255,0.03));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
    opacity: 0; transform: translateY(4px);
    animation: imuIn 0.5s cubic-bezier(0.2,0.8,0.2,1) forwards;
}
@keyframes imuIn { to { opacity: 1; transform: translateY(0); } }
.imu-hero-left { flex-shrink: 0; }
.imu-donut { display: block; }
.imu-hero-right { flex: 1; min-width: 0; }
.imu-hero-title {
    font-size: 13px; font-weight: 700; color: var(--fg-muted);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.imu-hero-sub {
    font-size: 11px; color: var(--fg-muted); margin-bottom: 8px;
}
.imu-hero-big {
    font-size: 36px; font-weight: 800;
    color: var(--fg);
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    line-height: 1;
    display: flex; align-items: baseline; gap: 8px;
}
.imu-hero-of {
    font-size: 18px; font-weight: 500;
    color: var(--fg-muted);
}
.imu-hero-free {
    margin-top: 6px;
    font-size: 18px; font-weight: 700;
    color: #30D158;
    font-variant-numeric: tabular-nums;
}
.imu-hero-free span { font-size: 11px; font-weight: 500; color: var(--fg-muted); margin-left: 4px; }
.imu-hero-locked {
    margin-top: 4px;
    font-size: 11px; color: #FF9F0A;
    display: flex; align-items: center; gap: 4px;
}
.imu-hero-locked .material-icons, .imu-hero-locked .material-icons-round { font-size: 13px; }

/* KPI-ряд */
.imu-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.imu-kpi {
    position: relative;
    padding: 14px;
    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    overflow: hidden;
    opacity: 0; transform: translateY(4px);
    animation: imuKpiIn 0.5s ease forwards;
    transition: transform 0.2s ease;
}
.imu-kpi:hover { transform: translateY(-2px); }
.imu-kpi::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, var(--c, #0A84FF) 0%, transparent 60%);
    opacity: 0.08;
    pointer-events: none;
}
@keyframes imuKpiIn { to { opacity: 1; transform: translateY(0); } }
.imu-kpi-icon {
    width: 32px; height: 32px; border-radius: 10px;
    background: color-mix(in srgb, var(--c, #0A84FF) 15%, transparent);
    color: var(--c, #0A84FF);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 8px;
}
.imu-kpi-icon .material-icons, .imu-kpi-icon .material-icons-round { font-size: 18px; }
.imu-kpi-val {
    font-size: 28px; font-weight: 800;
    color: var(--c, #0A84FF);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px; line-height: 1;
}
.imu-kpi-label {
    font-size: 12px; color: var(--fg-muted);
    margin-top: 4px;
}

/* Сектора */
.imu-section-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: var(--fg-muted);
    text-transform: uppercase; letter-spacing: 0.3px;
    margin: 4px 0 12px 0;
}
.imu-section-title .material-icons, .imu-section-title .material-icons-round { font-size: 16px; }
.imu-sectors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.imu-sector-card {
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    color: var(--fg);
    transition: all 0.2s ease;
    opacity: 0; transform: translateY(4px);
    animation: imuSecIn 0.4s ease forwards;
    -webkit-tap-highlight-color: transparent;
    border-left: 3px solid var(--c, #0A84FF);
}
@keyframes imuSecIn { to { opacity: 1; transform: translateY(0); } }
.imu-sector-card:hover {
    transform: translateY(-2px);
    border-color: var(--c, #0A84FF);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--c, #0A84FF) 20%, transparent);
}
.imu-sector-card:active { transform: scale(0.98); }
.imu-sec-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 8px;
}
.imu-sec-name {
    font-size: 22px; font-weight: 800;
    color: var(--fg);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1px;
}
.imu-sec-pct {
    font-size: 12px; font-weight: 700;
    color: var(--c, #0A84FF);
    font-variant-numeric: tabular-nums;
}
.imu-sec-bar {
    height: 6px; border-radius: 3px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
    margin-bottom: 6px;
}
.imu-sec-fill {
    height: 100%;
    transition: width 0.9s cubic-bezier(0.2,0.8,0.2,1);
    border-radius: 3px;
}
.imu-sec-meta {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
    flex-wrap: wrap;
}
.imu-sec-free { font-weight: 700; }
.imu-sec-lk {
    display: inline-flex; align-items: center; gap: 2px;
    color: #FF9F0A;
}
.imu-sec-lk .material-icons, .imu-sec-lk .material-icons-round { font-size: 11px; }

/* Модалка деталей сектора — места */
.imu-spots-legend {
    display: flex; gap: 14px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 11px; color: var(--fg-muted);
}
.imu-spots-legend span { display: inline-flex; align-items: center; gap: 4px; }
.imu-dot {
    width: 10px; height: 10px; border-radius: 3px;
    display: inline-block;
}
.imu-dot.free   { background: rgba(48,209,88,0.25); border: 1px solid #30D158; }
.imu-dot.busy   { background: #FF453A; }
.imu-dot.locked { background: #FF9F0A; }

.imu-spots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 4px;
}
.imu-spot {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    transition: transform 0.15s ease;
}
.imu-spot.free   {
    background: rgba(48,209,88,0.1);
    border: 1px solid rgba(48,209,88,0.4);
    color: #30D158;
}
.imu-spot.busy   {
    background: #FF453A; color: #fff;
    box-shadow: 0 2px 4px rgba(255,69,58,0.3);
}
.imu-spot.locked {
    background: #FF9F0A; color: #000;
    box-shadow: 0 2px 4px rgba(255,159,10,0.3);
}
.imu-spot:hover { transform: scale(1.1); z-index: 2; }

/* Модалка со списком ТС по аномалии */
.anom-modal {
    position: fixed; inset: 0;
    z-index: 9999;
    display: flex; align-items: flex-end; justify-content: center;
    animation: anom-modal-in 0.2s ease;
}
@keyframes anom-modal-in { from { opacity: 0; } to { opacity: 1; } }
.anom-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.anom-modal-sheet {
    position: relative;
    width: 100%; max-width: 640px;
    max-height: 88vh;
    background: var(--bg, #0a0a1a);
    border-radius: 18px 18px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    animation: anom-sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
@keyframes anom-sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.anom-modal-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
    background: var(--bg, #0a0a1a);
    z-index: 2;
}
.anom-modal-close {
    width: 36px; height: 36px; border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--fg);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.anom-modal-title {
    font-size: 15px; font-weight: 700; flex: 1;
}
.anom-modal-count {
    font-size: 12px; font-weight: 700;
    padding: 4px 10px; border-radius: 12px;
    background: rgba(255,159,10,0.15); color: #FF9F0A;
    font-variant-numeric: tabular-nums;
}
.anom-modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px;
}

/* Карточка ТС в модалке */
.anom-veh {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
    opacity: 0; transform: translateY(4px);
    animation: anom-veh-in 0.35s ease forwards;
}
@keyframes anom-veh-in {
    to { opacity: 1; transform: translateY(0); }
}
.anom-veh:hover { border-color: rgba(0,212,255,0.35); }
.anom-veh:active { transform: scale(0.99); }
.anom-veh-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-bottom: 4px;
}
.anom-veh-plate {
    font-size: 17px; font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}
.anom-veh-age {
    font-size: 12px; font-weight: 700;
    padding: 3px 10px; border-radius: 10px;
    background: rgba(255,69,58,0.15); color: #FF6961;
    white-space: nowrap;
}
.anom-veh-sub {
    font-size: 12px; color: var(--fg-muted);
    margin-bottom: 6px;
}
.anom-veh-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.anom-veh-since {
    font-size: 11px; color: var(--fg-muted);
    display: flex; align-items: center; gap: 4px;
}
.anom-veh-since .material-icons, .anom-veh-since .material-icons-round { font-size: 12px; }
.anom-dot {
    width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0;
    animation: anom-pulse 1.6s ease-in-out infinite;
}
.anom-danger .anom-dot  { background: #FF453A; box-shadow: 0 0 0 0 rgba(255,69,58,0.6); }
.anom-warning .anom-dot { background: #FF9F0A; box-shadow: 0 0 0 0 rgba(255,159,10,0.6); }
@keyframes anom-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,159,10,0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(255,159,10,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,159,10,0); }
}
.anom-text { min-width: 0; flex: 1; }
.anom-title { font-size: 13px; font-weight: 600; color: var(--fg); }
.anom-desc  { font-size: 11px; color: var(--fg-muted); margin-top: 2px; }

/* KPI-карточки с sparkline и дельтой */
.kpi-card {
    padding: 14px 14px 0 14px !important;
    position: relative;
    overflow: hidden;
    display: flex; flex-direction: column;
    opacity: 0; transform: translateY(6px);
    animation: kpi-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes kpi-in {
    to { opacity: 1; transform: translateY(0); }
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.kpi-icon {
    width: 32px; height: 32px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.kpi-icon .material-icons, .kpi-icon .material-icons-round { font-size: 18px; }
.kpi-delta {
    font-size: 11px; font-weight: 700;
    padding: 3px 8px; border-radius: 10px;
    display: inline-flex; align-items: center; gap: 2px;
}
.kpi-delta-up { background: rgba(48,209,88,0.15); color: #30D158; }
.kpi-delta-dn { background: rgba(255,69,58,0.15); color: #FF453A; }
.kpi-value {
    font-size: 30px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.kpi-label { font-size: 13px; font-weight: 600; color: rgba(235,235,245,0.8); margin-top: 2px; }
.kpi-sub   { font-size: 11px; color: rgba(235,235,245,0.35); margin-top: 2px; }
.kpi-spark { height: 28px; margin: 8px -14px -1px -14px; }

/* Funnel */
.funnel-body { display: flex; flex-direction: column; gap: 6px; }
.funnel-step { display: flex; flex-direction: column; align-items: stretch; }
.funnel-bar {
    position: relative; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px; color: #fff; font-weight: 700; font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    animation: funnel-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes funnel-in {
    from { width: 0 !important; opacity: 0; }
}
.funnel-label { display: inline-flex; align-items: center; gap: 6px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.funnel-label .material-icons, .funnel-label .material-icons-round { font-size: 16px; }
.funnel-val { font-variant-numeric: tabular-nums; font-weight: 800; }
.funnel-arrow {
    text-align: center; font-size: 11px; color: var(--fg-muted); padding: 2px 0;
}
.funnel-pct {
    text-align: right; font-size: 10px; color: var(--fg-muted); margin-top: 2px;
}

/* Heat-map час × ИМУ (original layout) */
.hm-wrap { display: flex; flex-direction: column; gap: 2px; overflow-x: auto; padding-bottom: 4px; }
.hm-hours, .hm-row {
    display: grid;
    grid-template-columns: 60px repeat(24, minmax(18px, 1fr));
    gap: 2px;
}
.hm-hour {
    font-size: 9px; color: var(--fg-muted); text-align: center;
    padding: 2px 0;
}
.hm-corner { }
.hm-label {
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center;
    padding-right: 6px;
    white-space: nowrap;
}
.hm-hint {
    margin-top: 6px; padding: 6px 10px;
    font-size: 11px; color: var(--fg-muted);
    display: flex; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
}
.hm-hint .material-icons, .hm-hint .material-icons-round { font-size: 13px; }
.hm-cell {
    aspect-ratio: 1 / 1;
    min-height: 14px;
    border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; color: rgba(0,0,0,0.8);
    transition: transform 0.15s ease;
    cursor: default;
    overflow: hidden;
}
.hm-cell:hover { transform: scale(1.15); z-index: 2; }

/* Кандидаты поиска ТС */
.vs-cand-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--fg);
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.vs-cand-btn:hover {
    border-color: rgba(0,212,255,0.4);
    background: rgba(0,212,255,0.05);
}
.vs-cand-btn:active {
    transform: scale(0.985);
}
@keyframes vs-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}