:root {
    --sidebar-w: 250px;
    --sidebar-bg: #15202e;
    --sidebar-fg: #c7d0db;
    --accent: #2a78d6;
    --series-entry: #2a78d6;
    --series-exit: #eb6834;
    --surface: #f4f6f9;
}

body { background: var(--surface); }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg) !important;
    color: var(--sidebar-fg);
    display: flex;
    flex-direction: column;
}
@media (min-width: 992px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; }
    .main { margin-left: var(--sidebar-w); }
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.1rem 1.25rem; color: #fff; font-weight: 700; font-size: 1.05rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .bi { color: #f5c400; font-size: 1.4rem; }
.sidebar-nav { padding: .75rem .6rem; flex: 1; overflow-y: auto; }
.sidebar-nav a {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem .8rem; margin-bottom: 2px; border-radius: .5rem;
    color: var(--sidebar-fg); text-decoration: none; font-size: .95rem;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--accent); color: #fff; }
.sidebar-nav .bi { font-size: 1.1rem; width: 1.2rem; text-align: center; }
.sidebar-user {
    display: flex; align-items: center; gap: .6rem;
    padding: .9rem 1.1rem; border-top: 1px solid rgba(255,255,255,.08); color: #fff;
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
    display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.main { flex: 1; min-width: 0; }
.topbar {
    display: flex; align-items: center; gap: .75rem;
    background: #fff; padding: .85rem 1.25rem; border-bottom: 1px solid #e3e7ec;
    position: sticky; top: 0; z-index: 10;
}
.content { padding: 1.25rem; }
@media (max-width: 575px) { .content { padding: 1rem; } }

.card { border: 1px solid #e3e7ec; border-radius: .75rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef1f4; font-weight: 600; border-radius: .75rem .75rem 0 0 !important; }
.table > :not(caption) > * > * { vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7785; font-weight: 600; }

/* ---------- stat tiles ---------- */
.stat { display: flex; flex-direction: row; align-items: center; gap: 1rem; padding: 1rem 1.1rem; height: 100%; }
.stat-icon {
    width: 48px; height: 48px; border-radius: .75rem; display: grid; place-items: center;
    font-size: 1.4rem; flex-shrink: 0; background: #eef4fc; color: var(--accent);
}
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: #0b0b0b; }
.stat-label { font-size: .82rem; color: #52514e; }
.capacity-bar { height: 6px; border-radius: 3px; background: #e8ebef; overflow: hidden; margin-top: .4rem; }
.capacity-bar > div { height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- Uzbek number plate ---------- */
.uzplate {
    display: inline-flex; align-items: stretch;
    background: #fff; color: #111; border: 2px solid #111; border-radius: 5px;
    font-family: "DIN Alternate", "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
    font-weight: 700; font-size: .95rem; line-height: 1; white-space: nowrap;
    box-shadow: 0 1px 0 rgba(0,0,0,.15);
}
.uzplate > span { display: flex; align-items: center; padding: .28em .4em; }
.uzp-region { border-right: 2px solid #111; }
.uzp-number { letter-spacing: .06em; }
.uzp-flag { flex-direction: column; justify-content: center; gap: 1px; font-size: .5em; padding: .2em .35em !important; color: #1a5fb4; }
.uzp-flag i {
    display: block; width: 1.9em; height: 1.1em; border: 1px solid #ccc;
    background: linear-gradient(to bottom, #0099b5 0 32%, #ce1126 32% 35%, #fff 35% 65%, #ce1126 65% 68%, #1eb53a 68% 100%);
}
.uzplate-lg { font-size: 2.4rem; border-width: 3px; border-radius: 8px; }
.uzplate-lg .uzp-region { border-right-width: 3px; }
.uzplate-other { background: #fffbe6; }

/* ---------- gate page ---------- */
.camera-wrap { position: relative; background: #000; border-radius: .6rem; overflow: hidden; aspect-ratio: 16 / 9; }
.camera-wrap video, .camera-wrap img.preview { width: 100%; height: 100%; object-fit: contain; display: block; }
.camera-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.camera-banner {
    position: absolute; left: 50%; top: .8rem; transform: translateX(-50%); max-width: 92%;
    display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center;
    padding: .6rem 1rem; border-radius: .6rem; color: #fff; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.camera-banner .banner-msg { font-size: .95rem; }
.banner-ok    { background: rgba(22,163,74,.92); }
.banner-warn  { background: rgba(202,138,4,.94); }
.banner-bad   { background: rgba(220,38,38,.92); }
.banner-muted { background: rgba(55,65,81,.88); }
.camera-auto-badge {
    position: absolute; right: .6rem; top: .6rem; display: none; color: #fff; font-size: .75rem; font-weight: 700;
    background: rgba(220,38,38,.9); padding: .15rem .5rem; border-radius: 1rem; letter-spacing: .05em;
}
.camera-wrap.is-auto .camera-auto-badge { display: block; animation: auto-pulse 2s infinite; }
@keyframes auto-pulse { 50% { opacity: .55; } }
.camera-status {
    position: absolute; left: .6rem; bottom: .6rem; color: #fff; font-size: .8rem;
    background: rgba(0,0,0,.55); padding: .2rem .55rem; border-radius: 1rem;
}
.camera-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa4b0; text-align: center; }
.gate-switch .btn { font-weight: 600; }
.plate-input { font-size: 1.6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.result-box { border-radius: .6rem; padding: 1rem; }
.result-box .big { font-size: 1.6rem; font-weight: 700; }
.ocr-debug { max-width: 100%; height: 48px; image-rendering: pixelated; border: 1px solid #ddd; border-radius: 4px; }

.thumb { width: 72px; height: 44px; object-fit: cover; border-radius: 4px; border: 1px solid #ddd; cursor: zoom-in; }
.badge-soft-success { background: #e6f6ee; color: #11734b; }
.badge-soft-warning { background: #fff4dc; color: #8a5a00; }
.badge-soft-danger  { background: #fde8e8; color: #b42318; }
.badge-soft-info    { background: #e8f1fc; color: #1d5fae; }
.badge-soft-secondary { background: #eef0f3; color: #4b5563; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #15202e, #2a4a73); padding: 1rem; }
.login-card { width: 100%; max-width: 400px; }

.lang-switch { display: inline-flex; border: 1px solid #d5dbe2; border-radius: .45rem; overflow: hidden; }
.lang-switch a { padding: .2rem .55rem; font-size: .78rem; font-weight: 600; color: #52514e; text-decoration: none; }
.lang-switch a + a { border-left: 1px solid #d5dbe2; }
.lang-switch a.active { background: var(--accent); color: #fff; }
.login-page .lang-switch { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); }
.login-page .lang-switch a { color: #fff; }
.login-page .lang-switch a + a { border-color: rgba(255,255,255,.3); }

.chart-box { position: relative; height: 260px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; }

/* trial / demo / support banners above the top bar */
.app-banner { border-radius: 0; margin: 0; border-left: 0; border-right: 0; border-top: 0; padding: .55rem 1.2rem; font-size: .92rem; }
