:root {
    --bg: #d9dde4;
    --shell: #ffffff;
    --shell-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
    --text: #101828;
    --muted: #667085;
    --line: #eaecf0;
    --surface: #f8fafc;
    --surface-2: #f2f4f7;
    --dark: #17191f;
    --dark-2: #22252d;
    --blue: #3b82f6;
    --blue-2: #2563eb;
    --green: #16a34a;
    --amber: #d97706;
    --rose: #e11d48;
    --card-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    --bottom-control-offset: calc(118px + env(safe-area-inset-bottom));
    --bottom-panel-offset: calc(102px + env(safe-area-inset-bottom));
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: "Sukhumvit Set", Thonburi, "Noto Sans Thai", "Leelawadee UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    background:
        radial-gradient(circle at top, #f4f6f9 0%, var(--bg) 55%, #ced4dc 100%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.bi::before,
[class^="bi-"]::before,
[class*=" bi-"]::before {
    font-family: "bootstrap-icons" !important;
}

body.app-mode,
body.login-mode {
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
}

body.app-mode {
    background: #000;
    touch-action: pan-y;
    user-select: none;
}

body.app-ready .app-loading-screen {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: 0 28px;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.app-loading-bar-track {
    width: min(260px, 82vw);
    height: 4px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
}

.app-loading-bar-runner {
    width: 40%;
    height: 100%;
    border-radius: inherit;
    background: #fff;
    transform: translateX(-130%);
    animation: app-loading-runner 1.15s ease-in-out infinite;
}

@keyframes app-loading-runner {
    0% {
        transform: translateX(-130%);
    }
    100% {
        transform: translateX(260%);
    }
}

body.app-offline .app-offline-screen {
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

.app-offline-screen {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: 0;
    right: 0;
    z-index: 9998;
    display: flex;
    justify-content: center;
    padding: 0 14px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.app-offline-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
    width: min(410px, 100%);
    border-radius: 14px;
    border: 1px solid rgba(251, 191, 36, 0.36);
    background: rgba(24, 18, 9, 0.94);
    color: #fff;
    text-align: left;
    padding: 10px 10px 10px 12px;
    box-shadow: 0 16px 34px rgba(2, 6, 23, 0.32);
    pointer-events: auto;
    backdrop-filter: blur(14px);
}

.app-offline-icon {
    font-size: 1.25rem;
    line-height: 1;
    color: #fbbf24;
    grid-row: 1 / span 2;
}

.app-offline-card h2 {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.2;
}

.app-offline-card p {
    margin: 2px 0 0;
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.76rem;
    line-height: 1.25;
}

.app-offline-retry {
    grid-column: 3;
    grid-row: 1 / span 2;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: #fbbf24;
    color: #111827;
    font-weight: 700;
    white-space: nowrap;
}

body.login-mode {
    min-height: 100dvh;
    background: #000;
    overflow: hidden;
    touch-action: manipulation;
}

body.login-mode .login-screen {
    width: 100%;
    max-width: none;
    margin: 0;
    box-shadow: none;
}

body.app-page-home,
body.app-page-alerts,
body.app-page-reports,
body.app-page-licenses,
body.app-page-settings {
    background: #000;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.login-screen {
    position: relative;
    width: min(100%, 430px);
    min-height: 100dvh;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(54, 71, 104, 0.18) 0%, rgba(54, 71, 104, 0) 22%),
        radial-gradient(circle at bottom left, rgba(43, 57, 86, 0.16) 0%, rgba(43, 57, 86, 0) 20%),
        linear-gradient(180deg, #05070b 0%, #0a0d14 100%);
    box-shadow: 0 28px 80px rgba(2, 6, 23, 0.45);
}

.login-screen::before,
.login-screen::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.login-screen::before {
    inset: auto auto 6% -12%;
    width: 46%;
    height: 18%;
    border-radius: 32px;
    opacity: 0.5;
    background:
        linear-gradient(180deg, rgba(49, 63, 92, 0.92) 0%, rgba(31, 43, 67, 0.88) 100%);
    transform: rotate(-24deg);
}

.login-screen::after {
    inset: 0;
    background:
        linear-gradient(112deg, transparent 0 18%, rgba(255, 255, 255, 0.06) 18.2% 18.5%, transparent 18.8% 100%),
        linear-gradient(24deg, transparent 0 64%, rgba(255, 255, 255, 0.05) 64.2% 64.5%, transparent 64.8% 100%),
        linear-gradient(0deg, transparent 0 48%, rgba(255, 255, 255, 0.04) 48.2% 48.35%, transparent 48.6% 100%),
        linear-gradient(90deg, transparent 0 56%, rgba(255, 255, 255, 0.04) 56.2% 56.35%, transparent 56.6% 100%),
        repeating-linear-gradient(90deg, transparent 0 12px, rgba(255, 255, 255, 0.03) 12px 13px, transparent 13px 24px),
        repeating-linear-gradient(0deg, transparent 0 12px, rgba(255, 255, 255, 0.03) 12px 13px, transparent 13px 24px),
        radial-gradient(circle at 24% 30%, rgba(255, 255, 255, 0.08) 0 1.5px, transparent 2px),
        radial-gradient(circle at 72% 42%, rgba(255, 255, 255, 0.08) 0 1.5px, transparent 2px);
    opacity: 0.55;
    transform: scale(1.08) rotate(-14deg);
}

.login-backdrop-card {
    display: none;
}

.login-topbar {
    position: absolute;
    top: calc(22px + env(safe-area-inset-top));
    left: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: #f8fbff;
    z-index: 2;
    padding: 0.95rem 1rem;
    border-radius: 1.35rem;
    background: rgba(18, 24, 37, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.login-topbar-mark {
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.95rem;
    border: 1.5px solid rgba(255, 255, 255, 0.88);
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
}

.login-topbar-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.login-topbar-copy strong,
.login-topbar-copy span {
    display: block;
}

.login-topbar-copy strong {
    font-size: 1.1rem;
    line-height: 1.1;
}

.login-topbar-copy span {
    margin-top: 0.12rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.56);
}

.login-card {
    position: relative;
    z-index: 1;
    width: calc(100% - 1rem);
    min-height: 58dvh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1.15rem;
    margin-top: auto;
    padding: 2.4rem 1.65rem calc(2rem + env(safe-area-inset-bottom));
    border-radius: 3rem 3rem 0 0;
    background: linear-gradient(180deg, #01030a 0%, #030611 100%);
    color: #f8fafc;
    box-shadow: 0 26px 46px rgba(0, 0, 0, 0.42);
}

.login-brand {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-items: center;
}

.login-brand h1 {
    margin: 0;
    font-size: 2.1rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
    font-weight: 700;
}

.brand-badge,
.hero-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.18);
    color: #dbeafe;
    font-size: 0.76rem;
    font-weight: 500;
}

.login-form {
    display: grid;
    gap: 1.35rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
}

.login-support-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 14px;
    margin-top: 2px;
    font-size: 0.82rem;
}

.login-support-links a {
    color: rgba(191, 219, 254, 0.92);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.login-form label {
    display: grid;
    gap: 0.45rem;
    color: rgba(255, 255, 255, 0.64);
    font-size: 0.82rem;
}

.login-form input,
.search-panel input {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 1rem;
    min-height: 3rem;
    padding: 0.95rem 1rem;
    font-size: 16px;
    line-height: 1.25;
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.mobile-password-wrap {
    position: relative;
    width: 100%;
}

.login-form .mobile-password-wrap input,
.mobile-manage-form .mobile-password-wrap input {
    padding-right: 3.2rem;
}

.mobile-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.55rem;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 0.75rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.62);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateY(-50%);
}

.mobile-password-toggle:hover,
.mobile-password-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    outline: none;
}

.primary-btn {
    border: 0;
    border-radius: 0.7rem;
    min-height: 3.5rem;
    padding: 0.9rem 1rem;
    margin-top: 0.5rem;
    background: linear-gradient(180deg, #33415c 0%, #2c3750 100%);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

.access-denied-card,
.access-denied-inline {
    display: grid;
    gap: 10px;
    text-align: center;
    color: #e2e8f0;
}

.access-denied-page {
    min-height: calc(100vh - 126px);
    display: grid !important;
    place-items: center;
    padding: 24px;
    background: #000;
}

.access-denied-card {
    width: min(100%, 390px);
    padding: 24px;
    border-radius: 22px;
    background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
    border: 1px solid rgba(248, 113, 113, 0.22);
}

.access-denied-card i,
.access-denied-inline i {
    font-size: 2.1rem;
    color: #fca5a5;
}

.access-denied-card h2,
.access-denied-inline strong {
    margin: 0;
    color: #f8fafc;
}

.access-denied-card p,
.access-denied-inline p {
    margin: 0;
    color: rgba(203, 213, 225, 0.78);
    line-height: 1.55;
}

.access-denied-card a,
.access-denied-logout {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    border-radius: 14px;
    text-decoration: none;
}

.access-denied-card a {
    background: linear-gradient(180deg, #33415c 0%, #2c3750 100%);
    color: #fff;
    font-weight: 800;
}

.login-password-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
}

.login-password-field {
    margin-top: -0.8rem;
}

.login-forgot-btn {
    border: 0;
    padding: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.82rem;
    font-weight: 600;
}

.login-divider {
    margin-top: 1rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.82rem;
}

.login-socials {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.login-social-btn {
    min-height: 3rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.88);
}

.login-signup-note {
    text-align: center;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.82rem;
}

.login-signup-note strong {
    color: #ffffff;
}

.ghost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px 14px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.ghost-btn.small {
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 0.86rem;
}

.alert-card {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(225, 29, 72, 0.16);
    color: #fecdd3;
}

@media (min-width: 431px) {
    body.login-mode {
        padding: 18px 0;
    }

    .login-screen {
        min-height: calc(100dvh - 36px);
        border-radius: 34px;
    }

    .login-card {
        min-height: 32rem;
        border-radius: 2.6rem;
    }
}

.mobile-app {
    position: relative;
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding: calc(24px + env(safe-area-inset-top)) 18px calc(90px + env(safe-area-inset-bottom));
    background: #ffffff;
    box-shadow: none;
    overflow: hidden;
}

.app-content-host {
    min-height: calc(100dvh - 94px);
}

body.app-page-home .mobile-app,
body.app-page-alerts .mobile-app,
body.app-page-history .mobile-app,
body.app-page-reports .mobile-app,
body.app-page-licenses .mobile-app,
body.app-page-settings .mobile-app {
    background: #000;
    box-shadow: none;
}

.app-glow {
    display: none;
}

.app-page {
    display: none;
}

.app-page.active {
    display: block;
}

.dark-page {
    min-height: calc(100vh - 126px);
    margin: calc(-24px - env(safe-area-inset-top)) -18px calc(-90px - env(safe-area-inset-bottom));
    padding: calc(24px + env(safe-area-inset-top)) 18px calc(112px + env(safe-area-inset-bottom));
    background: #000;
}

.dark-page .section-head h2,
.dark-page .summary-card strong,
.dark-page .action-tile,
.dark-page .settings-item strong,
.dark-page .meta-card strong,
.dark-page .empty-state {
    color: #f8fafc;
}

.dark-page .summary-card span,
.dark-page .settings-item p,
.dark-page .meta-card span,
.dark-page .vehicle-sub,
.dark-page .vehicle-meta,
.dark-page .empty-state {
    color: rgba(191, 219, 254, 0.72);
}

.dark-page .section-kicker {
    color: #93c5fd;
}

.dark-page .action-tile,
.dark-page .summary-card,
.dark-page .panel-card,
.dark-page .settings-item,
.dark-page .meta-card {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.24);
}

.dark-page .summary-card.primary {
    background: linear-gradient(180deg, #4f80ff 0%, #2f57c7 100%);
}

.dark-page .ghost-btn {
    background: rgba(15, 23, 42, 0.78);
    border-color: rgba(148, 163, 184, 0.18);
    color: #f8fafc;
}

.home-dashboard {
    display: grid;
    gap: 16px;
}

.home-switcher-wrap {
    margin-bottom: 2px;
}

.home-switcher {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    background: #111;
    color: #f8fafc;
    padding: 13px 16px;
    font: inherit;
    outline: none;
}

.home-vehicle-card {
    position: relative;
    padding: 4px 2px 0;
}

.home-vehicle-media {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 220px;
    margin-bottom: 10px;
    overflow: hidden;
}

.home-vehicle-ring {
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.75);
    opacity: 0.95;
}

.home-vehicle-image {
    position: relative;
    z-index: 1;
    width: min(100%, 320px);
    max-height: 220px;
    object-fit: contain;
    transform: rotate(-10deg);
    filter: drop-shadow(0 18px 30px rgba(0,0,0,0.35));
}

.home-vehicle-head {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.home-vehicle-head h2 {
    margin: 10px 0 6px;
    font-size: 1.7rem;
    color: #fff;
}

.home-vehicle-head p {
    margin: 0;
    color: rgba(255,255,255,0.66);
    font-size: 0.9rem;
    line-height: 1.45;
}

.home-vehicle-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.home-vehicle-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.home-info-item {
    padding: 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}

.home-info-item.full {
    grid-column: 1 / -1;
}

.home-info-item span {
    display: block;
    margin-bottom: 6px;
    color: rgba(191,219,254,0.7);
    font-size: 0.8rem;
}

.home-info-item strong {
    color: #fff;
    font-size: 1rem;
}

.home-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.home-stat-card {
    padding: 14px 12px;
    border-radius: 22px;
    background: #111;
    border: 1px solid rgba(255,255,255,0.08);
    text-align: left;
}

.home-stat-card span {
    display: block;
    margin-bottom: 8px;
    color: rgba(191,219,254,0.72);
    font-size: 0.78rem;
    line-height: 1.35;
}

.home-stat-card strong {
    color: #fff;
    font-size: 1.05rem;
}

.home-registration-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.home-reg-card {
    padding: 14px 12px;
    border-radius: 22px;
    background: #111;
    border: 1px solid rgba(255,255,255,0.08);
}

.home-reg-card.accent {
    background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
}

.home-reg-card span {
    display: block;
    margin-bottom: 8px;
    color: rgba(191,219,254,0.72);
    font-size: 0.78rem;
    line-height: 1.35;
}

.home-reg-card strong {
    color: #fff;
    font-size: 1rem;
}

.home-shortcuts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.home-shortcut {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 14px 10px;
    border-radius: 22px;
    background: #111;
    border: 1px solid rgba(255,255,255,0.08);
    color: #f8fafc;
    text-align: center;
}

.home-shortcut i {
    font-size: 1.1rem;
    color: #60a5fa;
}

.home-shortcut span {
    font-size: 0.8rem;
}

.home-shortcut {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

.home-shortcut i {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(59, 130, 246, 0.14);
    font-size: 1rem;
}

.home-list-dashboard .section-head p {
    margin: 4px 0 0;
    color: rgba(191, 219, 254, 0.72);
    font-size: 0.84rem;
}

.home-vehicle-list {
    display: grid;
    gap: 10px;
}

.home-page .empty-state,
.home-vehicle-list .empty-state {
    color: rgba(191, 219, 254, 0.82);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(17, 24, 39, 0.96) 100%);
    border: 1px solid rgba(71, 85, 105, 0.48);
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.28);
}

.home-page .empty-state.loading::after,
.home-vehicle-list .empty-state.loading::after {
    border-color: rgba(191, 219, 254, 0.22);
    border-top-color: #60a5fa;
}

.home-car-row {
    width: 100%;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 104px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.9) 0%, rgba(17, 24, 39, 0.92) 100%);
    color: #f8fafc;
    text-align: left;
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.24);
}

.home-car-avatar {
    position: relative;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.home-car-avatar.moving { background: rgba(5, 150, 105, 0.16); border-color: rgba(16, 185, 129, 0.18); }
.home-car-avatar.on { background: rgba(217, 119, 6, 0.16); border-color: rgba(245, 158, 11, 0.18); }
.home-car-avatar.off { background: rgba(220, 38, 38, 0.14); border-color: rgba(248, 113, 113, 0.16); }
.home-car-avatar.offline { background: rgba(71, 85, 105, 0.24); border-color: rgba(148, 163, 184, 0.18); }

.home-car-avatar img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    transform: none;
    filter: none !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
}

.home-car-main {
    min-width: 0;
    display: grid;
    gap: 6px;
    align-items: center;
    justify-content: start;
}

.home-car-head {
    min-width: 0;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.home-car-title,
.home-car-meta,
.home-car-place {
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-car-title {
    flex: 0 1 auto;
    min-width: 0;
    color: #f8fafc;
    font-size: 1rem;
    line-height: 1.1;
    font-weight: 800;
    white-space: nowrap;
}

.home-car-meta {
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.76rem;
    line-height: 1.25;
    white-space: normal;
}

.home-car-place {
    color: rgba(191, 219, 254, 0.62);
    font-size: 0.72rem;
    line-height: 1.18;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.home-car-status {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: min(48%, 170px);
    padding: 5px 9px;
    border-radius: 999px;
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.16);
    font-size: 0.68rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-car-status.moving { color: #4ade80; background: rgba(34, 197, 94, 0.15); }
.home-car-status.on { color: #fbbf24; background: rgba(251, 191, 36, 0.15); }
.home-car-status.off { color: #f87171; background: rgba(248, 113, 113, 0.15); }
.home-car-status.offline { color: #cbd5e1; background: rgba(148, 163, 184, 0.15); }

.driver-card-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(96, 165, 250, 0.22);
    background: rgba(37, 99, 235, 0.12);
    color: #93c5fd;
    font-size: 1rem;
    line-height: 1;
}

.driver-card-icon[hidden] {
    display: none !important;
}

.home-car-top-metrics {
    justify-self: start;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: #f8fafc;
}

.home-car-top-metrics span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 900;
    white-space: nowrap;
}

.home-car-top-metrics span + span {
    padding-left: 9px;
    border-left: 1px solid rgba(148, 163, 184, 0.16);
}

.home-car-top-metrics i {
    color: #10b981;
    font-size: 1.1rem;
}

.home-car-top-metrics em {
    color: rgba(191, 219, 254, 0.62);
    font-size: 0.62rem;
    font-style: normal;
    font-weight: 800;
}

@media (max-width: 520px) {
    .home-car-row {
        grid-template-columns: 58px minmax(0, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .home-car-avatar {
        width: 58px;
        height: 58px;
    }

    .home-car-avatar img {
        width: 50px;
        height: 50px;
    }

    .home-car-title {
        font-size: 0.96rem;
    }

    .home-car-main {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-car-top-metrics {
        justify-self: start;
    }
}

.hero-card,
.summary-card,
.panel-card,
.action-tile,
.vehicle-item,
.history-item,
.settings-item,
.history-header-card {
    box-shadow: var(--card-shadow);
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 14px;
    padding: 18px;
    margin-bottom: 16px;
    border-radius: 28px;
    background: linear-gradient(180deg, #181b20 0%, #22262d 100%);
    color: #f8fafc;
}

.hero-copy h2 {
    margin: 10px 0 6px;
    font-size: 1.55rem;
    line-height: 1.08;
}

.hero-sub {
    margin: 0;
    color: rgba(255, 255, 255, 0.68);
    line-height: 1.45;
    font-size: 0.9rem;
}

.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.hero-pill.muted {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.72);
}

.vehicle-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 112px;
}

.vehicle-ring {
    position: absolute;
    width: 116px;
    height: 116px;
    border-radius: 50%;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.vehicle-ring.second {
    width: 88px;
    height: 88px;
}

.vehicle-core {
    position: relative;
    z-index: 1;
    width: 94px;
    height: 94px;
    padding: 10px;
    border-radius: 26px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
    background: linear-gradient(180deg, #2a2e35 0%, #1f2229 100%);
}

.vehicle-core-label {
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    color: #93c5fd;
}

.vehicle-core strong {
    margin-top: 4px;
    font-size: 0.98rem;
}

.vehicle-core small {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.7);
}

.action-grid,
.summary-grid,
.vehicle-list,
.history-list,
.alerts-list,
.license-list,
.settings-list {
    display: grid;
    gap: 12px;
}

.license-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.licenses-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.settings-shell {
    display: grid;
    gap: 14px;
}

.app-page[data-page-section="licenses"],
.app-page[data-page-section="licenses"].active {
    display: flex !important;
    flex-direction: column;
    height: calc(100vh - env(safe-area-inset-bottom));
    margin: calc(-24px - env(safe-area-inset-top)) -18px calc(-90px - env(safe-area-inset-bottom));
    padding: calc(34px + env(safe-area-inset-top)) 18px calc(112px + env(safe-area-inset-bottom));
    background: #000;
    overflow: hidden;
}

.licenses-sticky-head {
    position: relative;
    z-index: 5;
    padding-top: 4px;
    background: #000;
    flex-shrink: 0;
}

.license-tab {
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.68);
    color: rgba(226, 232, 240, 0.82);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.license-tab.active {
    background: linear-gradient(180deg, #33415c 0%, #2c3750 100%);
    color: #fff;
    border-color: rgba(96, 165, 250, 0.3);
}

.license-subtitle {
    margin-top: 4px;
    font-size: 0.8rem;
    color: rgba(191, 219, 254, 0.72);
}

.license-list {
    align-content: start;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.licenses-page .empty-state,
.license-list .empty-state {
    color: rgba(219, 234, 254, 0.86);
    background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
    border: 1px solid rgba(96, 165, 250, 0.18);
    box-shadow: none;
}

.license-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.license-add-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(96, 165, 250, 0.32);
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    background: rgba(37, 99, 235, 0.2);
    color: #bfdbfe;
}

.license-add-btn[hidden] {
    display: none !important;
}

.poi-manage-form {
    margin: 2px 0 14px;
    padding: 14px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 18px;
    background: linear-gradient(180deg, #121923 0%, #0b111d 100%);
}

.poi-coordinate-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.poi-coordinate-grid > div {
    display: grid;
    gap: 8px;
}

.poi-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.poi-quick-actions button {
    min-height: 42px;
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.78);
    color: #dbeafe;
    font-weight: 800;
}

.poi-list-item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.poi-list-item small {
    display: block;
    margin-top: 4px;
    color: rgba(191, 219, 254, 0.64);
    font-size: 0.72rem;
}

.poi-card-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.map-open-btn.danger {
    background: rgba(244, 63, 94, 0.12);
    border-color: rgba(244, 63, 94, 0.3);
    color: #fda4af;
}

.settings-page {
    min-height: calc(100vh - 126px);
    margin: calc(-24px - env(safe-area-inset-top)) -18px calc(-90px - env(safe-area-inset-bottom));
    padding: calc(28px + env(safe-area-inset-top)) 18px calc(148px + env(safe-area-inset-bottom));
    background: #000;
    overflow-x: clip;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.settings-system-header {
    display: grid;
    justify-items: center;
    gap: 6px;
    margin: -2px 0 16px;
    text-align: center;
}

.settings-system-icon {
    width: min(154px, 58vw);
    max-height: 76px;
    object-fit: contain;
    display: block;
}

.settings-system-name {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #f8fafc;
}

.settings-system-company,
.settings-system-meta {
    color: rgba(191, 219, 254, 0.68);
    font-size: 0.78rem;
    line-height: 1.35;
}

.settings-page .settings-list {
    gap: 10px;
}

.settings-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 2px;
}

.settings-tab {
    min-width: 0;
    min-height: 44px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.72);
    color: rgba(226, 232, 240, 0.78);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
}

.settings-tab span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-tab.active {
    background: linear-gradient(180deg, #33415c 0%, #2c3750 100%);
    color: #fff;
    border-color: rgba(96, 165, 250, 0.34);
}

.settings-page .settings-item {
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, #171c25 0%, #11161d 100%);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: none;
}

.reports-page {
    min-height: calc(100vh - 126px);
    margin: calc(-24px - env(safe-area-inset-top)) -18px calc(-90px - env(safe-area-inset-bottom));
    padding: calc(28px + env(safe-area-inset-top)) 14px calc(128px + env(safe-area-inset-bottom));
    background: #000;
    overflow-x: clip;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.reports-shell {
    display: grid;
    gap: 14px;
}

.reports-page .section-head p {
    margin: 4px 0 0;
    color: rgba(191, 219, 254, 0.72);
    font-size: 0.78rem;
    line-height: 1.35;
}

.report-group {
    display: grid;
    gap: 10px;
}

.report-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px;
}

.report-group-title strong {
    color: #f8fafc;
    font-size: 0.92rem;
}

.report-group-title span {
    color: rgba(191, 219, 254, 0.62);
    font-size: 0.72rem;
}

.report-icon-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.report-icon-tile {
    --report-rgb: 96, 165, 250;
    --report-color: #93c5fd;
    min-width: 0;
    min-height: 118px;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 6px;
    padding: 12px 7px 10px;
    border-radius: 16px;
    border: 1px solid rgba(var(--report-rgb), 0.24);
    background:
        radial-gradient(circle at top, rgba(var(--report-rgb), 0.18), transparent 58%),
        linear-gradient(180deg, #171c25 0%, #11161d 100%);
    color: #f8fafc;
    text-align: center;
}

.report-tone-blue { --report-rgb: 59, 130, 246; --report-color: #93c5fd; }
.report-tone-green { --report-rgb: 34, 197, 94; --report-color: #86efac; }
.report-tone-cyan { --report-rgb: 6, 182, 212; --report-color: #67e8f9; }
.report-tone-indigo { --report-rgb: 99, 102, 241; --report-color: #a5b4fc; }
.report-tone-red { --report-rgb: 239, 68, 68; --report-color: #fca5a5; }
.report-tone-amber { --report-rgb: 245, 158, 11; --report-color: #fcd34d; }
.report-tone-violet { --report-rgb: 139, 92, 246; --report-color: #c4b5fd; }
.report-tone-rose { --report-rgb: 244, 63, 94; --report-color: #fda4af; }
.report-tone-teal { --report-rgb: 20, 184, 166; --report-color: #5eead4; }
.report-tone-orange { --report-rgb: 249, 115, 22; --report-color: #fdba74; }
.report-tone-sky { --report-rgb: 14, 165, 233; --report-color: #7dd3fc; }
.report-tone-lime { --report-rgb: 132, 204, 22; --report-color: #bef264; }
.report-tone-slate { --report-rgb: 148, 163, 184; --report-color: #cbd5e1; }
.report-tone-pink { --report-rgb: 236, 72, 153; --report-color: #f9a8d4; }

.report-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(180deg, rgba(var(--report-rgb), 0.26), rgba(var(--report-rgb), 0.12));
    color: var(--report-color);
    border: 1px solid rgba(var(--report-rgb), 0.38);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 8px 18px rgba(var(--report-rgb), 0.14);
}

.report-icon i {
    font-size: 1.25rem;
    line-height: 1;
}

.report-icon-tile strong {
    width: 100%;
    color: #f8fafc;
    font-size: 0.74rem;
    line-height: 1.22;
    overflow-wrap: anywhere;
}

.report-icon-tile small {
    width: 100%;
    color: rgba(191, 219, 254, 0.64);
    font-size: 0.61rem;
    line-height: 1.24;
    overflow-wrap: anywhere;
}

.mobile-report-detail {
    display: grid;
    gap: 12px;
}

.report-viewer-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.report-back-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 12px 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.24);
    background: rgba(15, 23, 42, 0.78);
    color: #bfdbfe;
    font-size: 0.76rem;
    font-weight: 700;
}

.report-back-btn i {
    font-size: 1rem;
}

.report-viewer-title {
    min-width: 0;
    color: rgba(191, 219, 254, 0.72);
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-report-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(var(--report-rgb), 0.22);
    background:
        radial-gradient(circle at top left, rgba(var(--report-rgb), 0.14), transparent 48%),
        linear-gradient(180deg, #171c25 0%, #11161d 100%);
}

.mobile-report-filter label {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.mobile-report-filter label:first-child {
    grid-column: 1 / -1;
}

.mobile-report-filter span {
    color: rgba(191, 219, 254, 0.7);
    font-size: 0.68rem;
    font-weight: 700;
}

.mobile-report-filter select,
.mobile-report-filter input {
    min-width: 0;
    min-height: 40px;
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.88);
    color: #f8fafc;
    padding: 0 10px;
    font: inherit;
    font-size: 0.78rem;
    color-scheme: dark;
}

.mobile-report-run {
    grid-column: 1 / -1;
    min-height: 42px;
    border: 0;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: linear-gradient(180deg, rgba(var(--report-rgb), 0.94), rgba(var(--report-rgb), 0.72));
    color: #fff;
    font-weight: 800;
    box-shadow: 0 12px 24px rgba(var(--report-rgb), 0.18);
}

.mobile-report-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.mobile-report-summary article {
    min-width: 0;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(var(--report-rgb), 0.18);
    background: rgba(15, 23, 42, 0.72);
}

.mobile-report-summary span {
    display: block;
    color: rgba(191, 219, 254, 0.62);
    font-size: 0.66rem;
    line-height: 1.2;
}

.mobile-report-summary strong {
    display: block;
    margin-top: 4px;
    color: #f8fafc;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-report-results {
    min-height: 180px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: #f8fafc;
    color: #0f172a;
    overflow: hidden;
}

.mobile-report-empty {
    min-height: 180px;
    display: grid;
    place-items: center;
    padding: 24px;
    color: #64748b;
    text-align: center;
    font-size: 0.84rem;
}

.mobile-report-table-wrap {
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-report-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
    font-size: 0.76rem;
}

.mobile-report-table th,
.mobile-report-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}

.mobile-report-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef2ff;
    color: #334155;
    font-weight: 800;
    white-space: nowrap;
}

.mobile-report-table td {
    color: #1e293b;
    max-width: 260px;
    overflow-wrap: anywhere;
}

@media (min-width: 390px) {
    .report-icon-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.settings-panel {
    display: none !important;
}

.settings-panel.active {
    display: block !important;
}

.notification-settings-panel.active {
    display: block !important;
}

.notification-settings-card {
    overflow: hidden;
    border-radius: 18px;
    background: linear-gradient(180deg, #171c25 0%, #11161d 100%);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 16px 34px rgba(2, 6, 23, 0.28);
}

.notification-settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 58px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    font-size: clamp(1rem, 4.4vw, 1.22rem);
    line-height: 1.18;
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.28);
}

.notification-settings-row:last-child {
    border-bottom: 0;
}

.notification-account-row strong {
    font-weight: 800;
    color: #e2e8f0;
}

.notification-account-row span {
    min-width: 9ch;
    text-align: left;
    font-weight: 700;
    color: #93c5fd;
}

.notification-toggle-row {
    position: relative;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.notification-toggle-row span {
    min-width: 0;
    padding-right: 18px;
    overflow-wrap: anywhere;
    font-weight: 700;
    color: #e5edf8;
}

.notification-toggle-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.notification-toggle-row i {
    position: relative;
    width: 58px;
    height: 34px;
    border-radius: 999px;
    background: rgba(71, 85, 105, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.14);
    transition: background 0.18s ease, border-color 0.18s ease;
}

.notification-toggle-row i::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 10px rgba(2, 6, 23, 0.42);
    transition: transform 0.18s ease;
}

.notification-toggle-row input:checked + i {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    border-color: rgba(74, 222, 128, 0.48);
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.18);
}

.notification-toggle-row input:checked + i::after {
    transform: translateX(24px);
}

.notification-toggle-row input:focus-visible + i {
    outline: 3px solid rgba(59, 130, 246, 0.42);
    outline-offset: 3px;
}

.settings-section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.settings-icon-action,
.mobile-manage-card button,
.mobile-inline-input button {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.82);
    color: #e2e8f0;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.mobile-manage-list,
.mobile-manage-form,
.mobile-check-list,
.mobile-check-grid,
.mobile-picker {
    display: grid;
    gap: 10px;
}

.mobile-manage-list {
    margin-bottom: 12px;
}

.mobile-manage-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.36);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.mobile-manage-card strong,
.mobile-manage-card p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.16);
    color: #86efac;
    font-size: 0.72rem;
    font-weight: 800;
}

.mobile-status.off {
    background: rgba(244, 63, 94, 0.16);
    color: #fda4af;
}

.mobile-status.muted {
    background: rgba(148, 163, 184, 0.14);
    color: #94a3b8;
}

.mobile-manage-form {
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.mobile-manage-form[hidden] {
    display: none !important;
}

.mobile-form-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 2px;
}

.mobile-form-title strong {
    color: #f8fafc;
    font-size: 1rem;
}

.mobile-form-title button {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.82);
    color: #e2e8f0;
}

.mobile-manage-form label,
.mobile-form-head label {
    color: rgba(226, 232, 240, 0.88);
    font-size: 0.8rem;
    font-weight: 800;
}

.mobile-manage-form input[type="text"],
.mobile-manage-form input[type="password"],
.mobile-manage-form input[type="search"],
.mobile-manage-form input[type="number"],
.mobile-manage-form select,
.mobile-panel-search,
.mobile-prefix-input,
.mobile-inline-input,
.mobile-fixed-name {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.36);
    color: #f8fafc;
}

.mobile-manage-form select {
    padding: 0 12px;
}

.mobile-manage-form input {
    outline: 0;
    -webkit-text-fill-color: #f8fafc;
    caret-color: #93c5fd;
    padding: 0 12px;
}

.mobile-manage-form > input[type="text"],
.mobile-manage-form > input[type="password"],
.mobile-manage-form > input[type="search"],
.mobile-manage-form > input[type="number"],
.mobile-panel-search {
    padding: 0 12px;
}

.mobile-panel-search {
    margin-bottom: 12px;
    outline: 0;
    -webkit-text-fill-color: #f8fafc;
}

.mobile-device-card {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.mobile-device-card.editing {
    border-color: rgba(96, 165, 250, 0.42);
    background: rgba(59, 130, 246, 0.08);
}

.mobile-danger-action {
    background: rgba(220, 38, 38, 0.16) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
    color: #fca5a5 !important;
}

.mobile-security-panel {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
    min-width: 0;
    padding: 12px;
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.36);
    border: 1px solid rgba(96, 165, 250, 0.16);
}

.mobile-security-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.mobile-security-head strong {
    display: block;
    color: #f8fafc;
}

.mobile-security-head p {
    margin: 4px 0 0;
    color: rgba(203, 213, 225, 0.76);
    font-size: 0.78rem;
}

.mobile-totp-setup {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.mobile-totp-setup label {
    color: rgba(226, 232, 240, 0.88);
    font-size: 0.8rem;
    font-weight: 800;
}

.mobile-totp-setup input {
    width: 100%;
    min-height: 44px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.36);
    color: #f8fafc;
    -webkit-text-fill-color: #f8fafc;
    caret-color: #93c5fd;
    padding: 0 12px;
    outline: 0;
}

.mobile-totp-setup[hidden] {
    display: none !important;
}

.mobile-totp-qr {
    width: 100%;
    min-width: 0;
    min-height: auto;
    padding: 12px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.mobile-totp-qr img,
.mobile-totp-qr svg {
    width: min(210px, calc(100vw - 108px), 100%);
    max-width: 100%;
    height: auto;
    display: block;
}

.mobile-totp-setup .mobile-fixed-name {
    display: block;
    min-width: 0;
    height: auto;
    min-height: 44px;
    padding: 10px 12px;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.35;
}

.mobile-totp-setup .mobile-form-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mobile-prefix-input,
.mobile-inline-input {
    display: grid;
    align-items: center;
    grid-template-columns: auto minmax(0, 1fr);
    overflow: hidden;
}

.mobile-prefix-input span {
    align-self: stretch;
    min-width: 58px;
    max-width: 42vw;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    background: rgba(59, 130, 246, 0.16);
    color: #bfdbfe;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-prefix-input input,
.mobile-inline-input input {
    min-width: 0;
    flex: 1;
    border: 0;
    padding: 0 12px;
    background: transparent;
    color: #f8fafc;
}

.mobile-manage-form input:-webkit-autofill,
.mobile-manage-form input:-webkit-autofill:hover,
.mobile-manage-form input:-webkit-autofill:focus {
    border-color: rgba(148, 163, 184, 0.16);
    -webkit-text-fill-color: #f8fafc;
    box-shadow: 0 0 0 1000px #080d18 inset;
    transition: background-color 9999s ease-out;
}

.mobile-fixed-name {
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: #cbd5e1;
    font-weight: 800;
}

.mobile-check-row {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.28);
}

.mobile-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mobile-form-head button {
    border: 0;
    background: transparent;
    color: #93c5fd;
    font-weight: 800;
}

.mobile-check-list {
    max-height: 230px;
    overflow: auto;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 14px;
}

.mobile-check-item,
.mobile-event-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #e2e8f0;
}

.mobile-check-item + .mobile-check-item {
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.mobile-check-item input,
.mobile-event-item input,
.mobile-check-row input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.mobile-check-item span {
    min-width: 0;
}

.mobile-check-item strong,
.mobile-check-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-check-item small {
    margin-top: 2px;
    color: rgba(203, 213, 225, 0.68);
    font-size: 0.74rem;
}

.mobile-check-grid {
    grid-template-columns: 1fr;
}

.mobile-event-item {
    min-height: 40px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.3);
}

.mobile-picker button {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(2, 6, 23, 0.36);
    color: #e2e8f0;
    text-align: left;
}

.mobile-picker strong,
.mobile-picker small {
    display: block;
}

.mobile-picker small,
.mobile-manage-form small {
    color: rgba(203, 213, 225, 0.66);
}

.mobile-form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mobile-primary-btn,
.mobile-secondary-btn {
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    font-weight: 800;
}

.mobile-primary-btn {
    background: linear-gradient(180deg, #33415c 0%, #2c3750 100%);
    color: #fff;
}

.mobile-secondary-btn {
    background: rgba(15, 23, 42, 0.78);
    color: #e2e8f0;
}

.mobile-empty {
    padding: 18px 10px;
    text-align: center;
    color: rgba(203, 213, 225, 0.68);
}

.settings-page .settings-item strong {
    color: #f8fafc;
}

.settings-page .settings-item p {
    color: rgba(203, 213, 225, 0.76);
}

.settings-contact-links {
    display: grid;
    gap: 6px;
    margin-top: 2px;
}

.settings-contact-links a {
    color: #93c5fd;
}

.settings-contact-links span {
    color: rgba(226, 232, 240, 0.82);
    line-height: 1.45;
}

.settings-contact-address {
    display: block;
    margin-top: 4px;
    color: rgba(248, 250, 252, 0.96);
    line-height: 1.6;
}

.settings-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    color: #f8fafc;
    border-radius: 14px;
    background: linear-gradient(180deg, #33415c 0%, #2c3750 100%);
}

.action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.action-tile {
    display: grid;
    justify-items: start;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 22px;
    background: #fff;
}

.action-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #4d8aff 0%, #2f69eb 100%);
    color: #fff;
    font-size: 1rem;
}

.summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.summary-card {
    padding: 16px;
    border-radius: 24px;
    background: #fff;
}

.summary-card.primary {
    background: linear-gradient(180deg, #4f80ff 0%, #2f57c7 100%);
    color: #fff;
}

.summary-card span {
    display: block;
    margin-bottom: 6px;
    font-size: 0.84rem;
    color: var(--muted);
}

.summary-card strong {
    font-size: 1.58rem;
}

.summary-card.primary span,
.summary-card.primary strong {
    color: #fff;
}

.panel-card {
    padding: 16px;
    border-radius: 24px;
    background: #fff;
}

.alert-page {
    min-height: calc(100vh - 126px);
    margin: calc(-24px - env(safe-area-inset-top)) -18px calc(-90px - env(safe-area-inset-bottom));
    padding: calc(28px + env(safe-area-inset-top)) 18px calc(112px + env(safe-area-inset-bottom));
    background: #000;
}

.alert-panel {
    min-height: calc(100vh - 146px - env(safe-area-inset-bottom));
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.alert-panel .section-head h2 {
    color: #f8fafc;
}

.alert-panel .section-kicker {
    color: #93c5fd;
}

.alert-read-all-btn {
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 999px;
    padding: 7px 11px;
    background: rgba(37, 99, 235, 0.16);
    color: #93c5fd;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
}

.alert-panel .empty-state {
    color: rgba(226, 232, 240, 0.82);
}

.alert-page .empty-state {
    min-height: 96px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(17, 24, 39, 0.94) 100%);
    color: rgba(203, 213, 225, 0.8);
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.24);
}

.alert-page .empty-state.loading::after {
    border-color: rgba(191, 219, 254, 0.22);
    border-top-color: #60a5fa;
}

.alert-summary-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.alert-summary-row article {
    min-height: 74px;
    display: grid;
    align-content: center;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(96, 165, 250, 0.14);
    background: rgba(15, 23, 42, 0.9);
}

.alert-summary-row span,
.alert-group h3 {
    color: rgba(203, 213, 225, 0.78);
    font-size: 0.76rem;
    font-weight: 800;
}

.alert-summary-row strong {
    color: #f8fafc;
    font-size: 1.35rem;
    line-height: 1;
}

.alert-group {
    display: grid;
    gap: 10px;
}

.alert-group h3 {
    margin: 4px 2px 0;
}

.alert-page .empty-state.compact {
    min-height: 72px;
    font-size: 0.84rem;
}

.alert-page .settings-item.alert-item {
    position: relative;
    padding: 16px;
    border-radius: 22px;
    background: linear-gradient(180deg, #20252f 0%, #181c24 100%);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: none;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.alert-page .settings-item.alert-item.unread::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 999px;
    background: #60a5fa;
}

.alert-page .settings-item.alert-item.read {
    opacity: 0.72;
}

.alert-page .settings-item.alert-item > .alert-item-copy {
    min-width: 0;
    flex: 1;
}

.alert-item-copy small {
    display: block;
    margin-top: 5px;
    color: rgba(148, 163, 184, 0.86);
    font-size: 0.68rem;
    line-height: 1.25;
}

.telegram-send-status {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.12);
    color: rgba(148, 163, 184, 0.82);
    font-size: 0.92rem;
}

.telegram-send-status.sent {
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
}

.telegram-send-status.muted {
    background: rgba(148, 163, 184, 0.1);
    color: #64748b;
}

.alert-item-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
}

.alert-item-icon.danger {
    background: rgba(225, 29, 72, 0.16);
    color: #fb7185;
}

.alert-item-icon.warning {
    background: rgba(217, 119, 6, 0.16);
    color: #fbbf24;
}

.alert-item-icon.ok {
    background: rgba(22, 163, 74, 0.16);
    color: #4ade80;
}

.alert-item-icon.offline {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
}

.alert-page .settings-item.alert-item strong {
    color: #f8fafc;
}

.alert-page .settings-item.alert-item p {
    margin-top: 4px;
    color: rgba(203, 213, 225, 0.82);
}

.alert-read-btn {
    flex: 0 0 auto;
    border: 1px solid rgba(96, 165, 250, 0.26);
    border-radius: 12px;
    min-height: 34px;
    padding: 0 10px;
    background: rgba(37, 99, 235, 0.16);
    color: #93c5fd;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
}

.alert-read-state {
    flex: 0 0 auto;
    color: rgba(148, 163, 184, 0.76);
    font-size: 0.68rem;
    font-weight: 700;
}

.alert-page .alerts-list {
    gap: 12px;
}

.alert-page .empty-state {
    padding: 18px 0;
}

.compact-panel {
    margin-bottom: 8px;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-head h2 {
    margin: 0;
    font-size: 1.04rem;
}

.section-kicker {
    color: var(--blue);
    font-size: 0.76rem;
    font-weight: 600;
}

.search-panel.inline {
    margin: 0;
}

.search-panel input {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-2);
    color: var(--text);
}

.vehicle-item,
.history-item,
.settings-item {
    padding: 16px;
    border-radius: 22px;
    background: #fff;
}

.vehicle-top,
.vehicle-bottom,
.history-item,
.settings-item {
    display: flex;
    gap: 10px;
}

.vehicle-top {
    justify-content: space-between;
    align-items: flex-start;
}

.vehicle-bottom {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.vehicle-name {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
}

.vehicle-sub,
.vehicle-meta,
.history-meta,
.settings-item p,
.history-header-card span {
    color: var(--muted);
    font-size: 0.84rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.tag.moving {
    background: #d1fae5;
    color: #0f766e;
}

.tag.on {
    background: #fef3c7;
    color: var(--amber);
}

.tag.off {
    background: #ffe4e6;
    color: var(--rose);
}

.tag.offline {
    background: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}

.tag.danger {
    background: rgba(225, 29, 72, 0.16);
    color: #fb7185;
}

.tag.warning {
    background: rgba(217, 119, 6, 0.16);
    color: #fbbf24;
}

.tag.info {
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
}

.tag.ok {
    background: rgba(22, 163, 74, 0.16);
    color: #4ade80;
}

.alert-popup {
    position: fixed;
    z-index: 10050;
    left: 14px;
    right: 14px;
    top: calc(16px + env(safe-area-inset-top));
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 36px;
    gap: 12px;
    align-items: center;
    max-width: 440px;
    margin: 0 auto;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(20, 24, 31, 0.96);
    color: #f8fafc;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transform: translateY(-18px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.alert-popup.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.alert-popup-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
    font-size: 1.2rem;
}

.alert-popup--danger .alert-popup-icon {
    background: rgba(225, 29, 72, 0.18);
    color: #fb7185;
}

.alert-popup--warning .alert-popup-icon {
    background: rgba(217, 119, 6, 0.18);
    color: #fbbf24;
}

.alert-popup--ok .alert-popup-icon {
    background: rgba(22, 163, 74, 0.18);
    color: #4ade80;
}

.alert-popup-copy {
    min-width: 0;
}

.alert-popup-copy strong {
    display: block;
    font-size: 0.96rem;
    line-height: 1.25;
}

.alert-popup-copy p {
    margin: 4px 0 2px;
    color: rgba(226, 232, 240, 0.86);
    font-size: 0.84rem;
    line-height: 1.35;
}

.alert-popup-copy span {
    display: block;
    color: rgba(148, 163, 184, 0.9);
    font-size: 0.73rem;
    line-height: 1.25;
}

.alert-popup-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(248, 250, 252, 0.88);
}

.map-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 7px 10px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.16);
    border: 1px solid rgba(59, 130, 246, 0.38);
    color: #93c5fd;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
}

.map-open-btn i {
    font-size: 0.86rem;
}

.map-open-btn--icon {
    width: 34px;
    min-width: 34px;
    height: 34px;
    margin-top: 0;
    padding: 0;
    border-radius: 999px;
    justify-content: center;
}

.realtime-shell {
    position: relative;
}

/* Map layer — fixed behind everything, same width as app shell */
.realtime-stage {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(100%, 430px);
    height: 100%;
    z-index: 1;
    background: #0b1120;
    overflow: hidden;
}

.map-box {
    position: relative;
    width: 100%;
    height: 100%;
    border: 0;
    overflow: hidden;
    background: #05070b;
}

.map-box .leaflet-container {
    background: #05070b;
}

body.app-page-realtime .map-box,
body.app-page-history .map-box {
    background: #eef2f7;
}

body.app-page-realtime .map-box .leaflet-container,
body.app-page-history .map-box .leaflet-container {
    background: #eef2f7;
}

.map-box .leaflet-control-attribution {
    display: block;
    max-width: 68%;
    padding: 2px 6px;
    border-radius: 8px 0 0 0;
    background: rgba(15, 23, 42, 0.62);
    color: rgba(226, 232, 240, 0.78);
    font-size: 10px;
    line-height: 1.2;
}

.map-box .leaflet-control-attribution a {
    color: #93c5fd;
}

.map-empty-overlay {
    position: absolute;
    left: 50%;
    top: 46%;
    z-index: 650;
    display: grid;
    justify-items: center;
    gap: 7px;
    width: min(82%, 270px);
    padding: 18px 16px;
    border-radius: 16px;
    color: #0f172a;
    text-align: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.map-empty-overlay i {
    font-size: 26px;
    color: #64748b;
}

.map-empty-overlay strong {
    font-size: 15px;
    line-height: 1.25;
}

.map-empty-overlay span {
    font-size: 13px;
    color: #64748b;
}

/* ── Vehicle map marker ── */
.map-vehicle-icon {
    display: block !important;
    background: transparent;
    border: 0;
    overflow: visible !important;
}

.mobile-poi-map-icon {
    display: grid !important;
    place-items: center;
    background: transparent;
    border: 0;
}

.mobile-poi-map-icon span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px 999px 999px 5px;
    color: #fff;
    background: #0ea5e9;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.34);
    transform: rotate(-45deg);
}

.mobile-poi-map-icon i {
    transform: rotate(45deg);
    font-size: 0.92rem;
}

.mobile-poi-map-label {
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(14, 165, 233, 0.94) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22) !important;
    font-size: 0.76rem !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
    max-width: min(190px, 58vw);
    overflow: hidden;
    padding: 4px 8px !important;
    text-overflow: ellipsis;
    text-shadow: 0 1px 1px rgba(15, 23, 42, 0.35);
    white-space: nowrap;
}

.mobile-poi-map-label::before {
    display: none;
}

.mobile-poi-map-label--area {
    background: rgba(124, 58, 237, 0.92) !important;
}

.map-vehicle-wrap {
    position: relative;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    overflow: visible !important;
    --vehicle-effect-rgb: 37, 99, 235;
}

.map-vehicle-wrap--moving { --vehicle-effect-rgb: 5, 150, 105; }
.map-vehicle-wrap--on { --vehicle-effect-rgb: 217, 119, 6; }
.map-vehicle-wrap--off { --vehicle-effect-rgb: 220, 38, 38; }
.map-vehicle-wrap--offline { --vehicle-effect-rgb: 71, 85, 105; }

.map-vehicle-core {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: transparent;
    border: 0;
    overflow: visible;
    filter: none !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
}

.map-vehicle-core img {
    display: block !important;
    object-fit: contain !important;
    object-position: center center !important;
    flex: 0 0 auto;
    transform-origin: center center;
    filter: none !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
}

.map-vehicle-pulse-dot,
.map-vehicle-pulse-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    mix-blend-mode: normal;
}

.map-vehicle-pulse-dot {
    background: rgba(var(--vehicle-effect-rgb), 0.92);
    border: 1px solid rgba(255, 255, 255, 0.34);
    box-shadow:
        0 0 0 3px rgba(var(--vehicle-effect-rgb), 0.18),
        0 0 14px rgba(var(--vehicle-effect-rgb), 0.58);
}

.map-vehicle-pulse-ring {
    background: transparent;
    border: 3px solid rgba(var(--vehicle-effect-rgb), 0.78);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.18),
        0 0 16px rgba(var(--vehicle-effect-rgb), 0.42);
    opacity: 0;
    animation: mobileVehiclePulse 1.55s ease-out infinite;
}

.map-vehicle-pulse-ring--delay {
    animation-delay: 0.48s;
}

@keyframes mobileVehiclePulse {
    0% {
        transform: translate(-50%, -50%) scale(0.18);
        opacity: 0.78;
    }
    70% {
        opacity: 0.28;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.2);
        opacity: 0;
    }
}

/* ── Compact popup ── */
.map-popup-wrap .leaflet-popup-content-wrapper {
    background: rgba(8, 11, 18, 0.98);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(51, 65, 85, 0.62);
    border-radius: 16px;
    box-shadow: 0 14px 34px rgba(0,0,0,0.42);
    padding: 0;
}

.map-popup-wrap .leaflet-popup-tip-container { display: none; }
.map-popup-wrap .leaflet-popup-close-button { color: rgba(226, 232, 240, 0.72); top: 8px; right: 8px; font-size: 1rem; }
.map-popup-wrap .leaflet-popup-content { margin: 0; }

.map-popup,
.map-popup-card {
    padding: 12px 14px 12px;
    min-width: 176px;
    max-width: 250px;
}

.map-popup-plate,
.map-popup-card strong {
    display: block;
    font-size: 0.94rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 8px;
}

.map-popup-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.map-popup-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 100%;
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-popup-badge--moving { background: rgba(34,197,94,0.16); color: #4ade80; }
.map-popup-badge--on     { background: rgba(251,191,36,0.16); color: #fbbf24; }
.map-popup-badge--off    { background: rgba(248,113,113,0.16); color: #f87171; }
.map-popup-badge--offline { background: rgba(148,163,184,0.18); color: #cbd5e1; }

.map-popup-speed {
    font-size: 0.72rem;
    color: rgba(226, 232, 240, 0.9);
    font-weight: 500;
    line-height: 1.45;
    text-shadow: none;
}

.map-popup-time {
    font-size: 0.68rem;
    color: rgba(148,163,184,0.55);
}

/* FAB — fixed above map */
.map-fab-group {
    position: fixed;
    top: 18px;
    right: max(18px, calc(50vw - 215px + 18px));
    z-index: 30;
    display: grid;
    gap: 10px;
}

.history-map-actions {
    position: absolute;
    top: 76px;
    right: 12px;
}

.map-fab {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.18);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.28);
}

[data-map-draw-area],
[data-map-draw-panel] {
    display: none !important;
}

.map-draw-panel {
    position: fixed;
    left: 50%;
    top: calc(18px + env(safe-area-inset-top));
    z-index: 40;
    width: min(92%, 390px);
    transform: translateX(-50%);
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 16px;
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(96, 165, 250, 0.26);
    box-shadow: 0 16px 32px rgba(2, 6, 23, 0.34);
}

.history-stage .map-draw-panel {
    position: absolute;
    top: 12px;
}

.map-draw-panel span {
    font-size: 0.78rem;
    color: #cbd5e1;
}

.map-draw-panel div {
    display: flex;
    gap: 8px;
}

.map-draw-panel button {
    flex: 1;
    border: 0;
    border-radius: 10px;
    padding: 9px 10px;
    color: #f8fafc;
    background: #2563eb;
    font: inherit;
    font-size: 0.82rem;
}

.map-draw-panel button:last-child {
    background: rgba(71, 85, 105, 0.84);
}

.map-draw-point-label {
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: transparent;
    box-shadow: none;
    font-size: 0.68rem;
    font-weight: 800;
}

.mobile-manage-form textarea {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.82);
    color: #f8fafc;
    font: inherit;
    font-size: 0.86rem;
    padding: 10px 12px;
    resize: vertical;
}

.poi-polygon-fields small {
    display: block;
    margin-top: 6px;
    color: rgba(203, 213, 225, 0.74);
    font-size: 0.74rem;
}

/* Vehicle list sheet — fixed above map, below nav */
.realtime-sheet {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: calc(min(100%, 430px) - 20px);
    bottom: var(--bottom-panel-offset);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 190px;
    max-height: min(40vh, 360px);
    padding: 10px 10px 8px;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(11, 17, 32, 0.96) 0%, rgba(5, 7, 11, 0.98) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(71, 85, 105, 0.42);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.46);
    overflow: hidden;
    pointer-events: auto;
}

body.single-vehicle-mode .realtime-sheet {
    min-height: 124px;
    max-height: 164px;
}

.realtime-sheet.has-list-scroll {
    max-height: min(40vh, 360px);
}

.sheet-handle {
    width: 36px;
    height: 4px;
    margin: 0 auto 2px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.34);
}

.realtime-head {
    margin: 0;
    padding: 0 6px;
}

.realtime-head h2 {
    font-size: 1rem;
    color: #f1f5f9;
    margin: 0;
}

.realtime-subtitle {
    margin: 2px 0 0;
    color: rgba(191, 219, 254, 0.62);
    font-size: 0.78rem;
    line-height: 1.4;
}

body.app-page-realtime .section-kicker {
    color: #60a5fa;
}

/* Search input — dark theme */
.realtime-sheet .search-panel input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #f1f5f9;
    padding: 8px 12px;
    font-size: 0.82rem;
}

.realtime-sheet .search-panel input::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

.realtime-vehicle-list {
    flex: 1;
    min-height: 0;
    overflow-y: visible;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 165, 250, 0.32) transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    pointer-events: auto;
}

.realtime-sheet.has-list-scroll .realtime-vehicle-list,
.realtime-vehicle-list.list-scroll-enabled {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    height: min(calc((62px * 4) + 18px), calc(40vh - 94px));
    max-height: min(calc((62px * 4) + 18px), calc(40vh - 94px));
    padding-right: 5px;
    touch-action: pan-y;
}

.realtime-vehicle-list::-webkit-scrollbar {
    width: 4px;
}

.realtime-vehicle-list::-webkit-scrollbar-thumb {
    background: rgba(96, 165, 250, 0.3);
    border-radius: 999px;
}

body.single-vehicle-mode .realtime-vehicle-list {
    flex: 0 0 auto;
    overflow: hidden;
}

/* Dark compact vehicle card */
.realtime-vehicle-list .vehicle-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 14px;
    min-height: 62px;
    border: 1px solid rgba(71, 85, 105, 0.5);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(17, 24, 39, 0.94) 100%);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.22);
    cursor: pointer;
    overflow: clip;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.realtime-vehicle-list .vehicle-item .vehicle-top,
.realtime-vehicle-list .vehicle-item .vehicle-bottom {
    display: none;
}

/* Vehicle icon square */
.rt-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.96rem;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    color: inherit;
}

.rt-icon img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: none !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
}

.rt-icon.moving { background: rgba(5, 150, 105, 0.16); border-color: rgba(16, 185, 129, 0.18); color: inherit; }
.rt-icon.on { background: rgba(217, 119, 6, 0.16); border-color: rgba(245, 158, 11, 0.18); color: inherit; }
.rt-icon.off { background: rgba(220, 38, 38, 0.14); border-color: rgba(248, 113, 113, 0.16); color: inherit; }
.rt-icon.offline { background: rgba(71, 85, 105, 0.24); border-color: rgba(148, 163, 184, 0.18); color: inherit; }

/* Vehicle info */
.rt-info {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 2px;
}

.rt-plate {
    font-size: 0.92rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.rt-sub {
    font-size: 0.7rem;
    color: rgba(191, 219, 254, 0.56);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
    min-width: 0;
}

.rt-loc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: 0.65rem;
    color: rgba(226, 232, 240, 0.72);
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
    max-width: 100%;
    min-width: 0;
    word-break: break-word;
    font-weight: 500;
}

.rt-loc .bi {
    font-size: 0.62rem;
    color: rgba(148, 163, 184, 0.86);
}

/* Status badge */
.rt-badge {
    flex-shrink: 0;
    font-size: 0.64rem;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: 999px;
    letter-spacing: 0.01em;
    align-self: center;
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rt-badge.moving { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.rt-badge.on     { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.rt-badge.off    { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.rt-badge.offline { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

/* Active card */
.realtime-vehicle-list .vehicle-item.active {
    background: linear-gradient(180deg, rgba(23, 37, 84, 0.96) 0%, rgba(15, 23, 42, 0.98) 100%);
    border-color: rgba(96, 165, 250, 0.48);
    box-shadow: 0 16px 30px rgba(30, 64, 175, 0.2);
    transform: translateY(-1px);
}

.realtime-vehicle-list .vehicle-item.active .rt-plate {
    color: #fff;
}

.realtime-vehicle-list .vehicle-item.active .rt-icon {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 0 0 1px rgba(96, 165, 250, 0.16);
}

.realtime-vehicle-list .vehicle-item.active .rt-badge {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

body.app-page-realtime .empty-state {
    padding: 22px 18px;
    border-radius: 18px;
    color: rgba(191, 219, 254, 0.8);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(17, 24, 39, 0.94) 100%);
    border: 1px solid rgba(71, 85, 105, 0.45);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.2);
}

body.app-page-realtime .empty-state.loading::after {
    border-color: rgba(191, 219, 254, 0.22);
    border-top-color: #60a5fa;
}

.vehicle-meta {
    display: grid;
    gap: 8px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.meta-card {
    padding: 12px;
    border-radius: 18px;
    background: var(--surface);
}

.meta-card span {
    display: block;
    margin-bottom: 4px;
    font-size: 0.78rem;
    color: var(--muted);
}

.meta-card strong {
    font-size: 0.96rem;
}

.history-header-card {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
    padding: 16px;
    border-radius: 22px;
    background: #fff;
}

.history-header-card strong {
    font-size: 1rem;
}

/* ── History split layout ── */
.app-page[data-page-section="history"],
.app-page[data-page-section="history"].active {
    margin: -18px -18px calc(-90px - env(safe-area-inset-bottom));
    display: flex !important;
    flex-direction: column;
    height: calc(100vh - env(safe-area-inset-bottom));
    overflow: hidden;
    background: #0e1014;
}

.history-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #0e1014;
    overflow: hidden;
    z-index: 1;
}

.history-stage .map-box {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.history-playback-control {
    position: absolute;
    top: calc(72px + env(safe-area-inset-top));
    left: 20px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    max-width: calc(100% - 40px);
    padding: 4px;
    background: rgba(3, 7, 18, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.24);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: none;
}

.history-playback-btn,
.history-playback-reset,
.history-playback-speed {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 0;
    pointer-events: auto;
}

.history-playback-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #ffffff;
    background:
        radial-gradient(circle at 50% 42%, rgba(96, 165, 250, 0.34), transparent 48%),
        linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 8px 16px rgba(29, 78, 216, 0.26);
    font-size: 1.34rem;
}

.history-playback-reset,
.history-playback-speed {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-size: 0.92rem;
}

.history-playback-speed {
    border-radius: 999px;
    min-width: 38px;
    width: auto;
    padding: 0 9px;
    color: #dbeafe;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0;
}

body.history-playback-running .history-playback-btn {
    background:
        radial-gradient(circle at 50% 42%, rgba(16, 185, 129, 0.3), transparent 50%),
        linear-gradient(180deg, #059669 0%, #047857 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 10px 22px rgba(5, 150, 105, 0.34);
}

.history-playback-btn .bi-play-fill {
    transform: translateX(1px);
}

.history-playback-btn:disabled,
.history-playback-reset:disabled,
.history-playback-speed:disabled {
    opacity: 0.45;
}

.history-playback-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.history-playback-status strong {
    font-size: 0.9rem;
    color: #f1f5f9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-playback-status span {
    font-size: 0.74rem;
    color: rgba(148, 163, 184, 0.7);
}

.history-log-panel {
    flex: 0 0 50vh;
    min-height: 300px;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    background: transparent;
    border: 0;
    border-radius: 0;
    margin: -10px 0 0;
    overflow: hidden;
    box-shadow: 0 -10px 28px rgba(0,0,0,0.28);
    position: relative;
    z-index: 20;
    isolation: isolate;
    pointer-events: auto;
}

.history-log-panel::before {
    content: "";
    position: absolute;
    inset: -2px -2px 0 -2px;
    z-index: -1;
    background: linear-gradient(180deg, #0b1120 0%, #05070b 100%);
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-bottom: 0;
    border-radius: 0;
}

.history-log-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 4px;
    font-size: 0.86rem;
    font-weight: 600;
    color: #f8fafc;
    flex-shrink: 0;
    background: transparent;
}

/* Date picker bar */
.history-date-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px 7px;
    flex-shrink: 0;
    background: transparent;
}

.history-vehicle-bar {
    padding: 0 12px 7px;
    flex-shrink: 0;
    background: transparent;
}

.history-vehicle-select,
.history-date-input {
    flex: 1;
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.88);
    font: inherit;
    font-size: 0.82rem;
    color: #f8fafc;
    padding: 7px 10px;
    outline: none;
    -webkit-appearance: none;
}

.history-vehicle-select {
    width: 100%;
}


.history-log-panel .history-list {
    flex: 1;
    position: relative;
    overflow-y: auto;
    padding: 0 12px calc(8px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 7px;
    background: transparent;
    scrollbar-width: thin;
    scrollbar-color: rgba(96, 165, 250, 0.32) transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.history-log-panel .history-list::before {
    display: none;
    content: none;
}

.history-log-panel .history-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 62px;
    padding: 7px 10px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(17, 24, 39, 0.94) 100%);
    border: 1px solid rgba(71, 85, 105, 0.5);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.22);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.history-log-panel .history-item.active {
    background: linear-gradient(180deg, rgba(30, 58, 138, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
    border-color: rgba(96, 165, 250, 0.95);
    box-shadow:
        0 0 0 2px rgba(96, 165, 250, 0.42),
        0 0 22px rgba(37, 99, 235, 0.34),
        0 16px 30px rgba(30, 64, 175, 0.22);
    transform: translateY(-1px);
}

body.history-playback-running .history-log-panel .history-item.active {
    border-color: rgba(125, 211, 252, 1);
    box-shadow:
        0 0 0 2px rgba(125, 211, 252, 0.55),
        0 0 28px rgba(14, 165, 233, 0.42),
        0 18px 34px rgba(8, 47, 73, 0.3);
}

.history-item-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
}

.history-item-icon.moving { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.history-item-icon.on     { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.history-item-icon.off    { background: rgba(248, 113, 113, 0.15); color: #f87171; }

.history-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.history-item-info {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 2px;
}

.history-item-time {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: #f8fafc;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-log-panel .history-item.active .history-item-time {
    color: #ffffff;
}

.history-item-meta {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    font-size: 0.65rem;
    color: rgba(226, 232, 240, 0.72);
    line-height: 1.15;
    max-width: 100%;
    min-width: 0;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.history-item-meta .bi {
    font-size: 0.62rem;
    color: rgba(148, 163, 184, 0.86);
    margin-right: 4px;
}

.history-item-speed {
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(191, 219, 254, 0.56);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-badge {
    flex-shrink: 0;
    max-width: 31%;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 999px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.history-item-badge.moving { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.history-item-badge.on     { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.history-item-badge.off    { background: rgba(248, 113, 113, 0.15); color: #f87171; }

.history-item,
.settings-item {
    justify-content: space-between;
    align-items: center;
}

.history-item .tag {
    flex-shrink: 0;
}

.settings-item strong {
    display: block;
    margin-bottom: 4px;
}

.settings-item p {
    margin: 0;
}

.empty-state {
    padding: 18px;
    border-radius: 18px;
    text-align: center;
    color: var(--muted);
    background: var(--surface-2);
}

.history-log-panel .empty-state {
    padding: 28px 18px;
    border-radius: 18px;
    color: rgba(191, 219, 254, 0.8);
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
    border: 1px solid rgba(71, 85, 105, 0.48);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.24);
}

.empty-state.loading::after {
    content: '';
    display: block;
    width: 34px;
    height: 34px;
    margin: 12px auto 0;
    border-radius: 50%;
    border: 3px solid #dbe4ff;
    border-top-color: var(--blue);
    animation: spin 0.9s linear infinite;
}

.history-log-panel .empty-state.loading::after {
    border-color: rgba(191, 219, 254, 0.22);
    border-top-color: #60a5fa;
}

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

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 40;
    width: min(100vw, 430px);
    display: grid;
    grid-template-columns: repeat(var(--bottom-nav-count, 7), minmax(0, 1fr));
    gap: 0;
    padding: 10px 0 calc(18px + env(safe-area-inset-bottom));
    border-radius: 0;
    background: rgba(14, 16, 22, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.06);
    border: 0;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 52px;
    padding: 4px 2px;
    border-radius: 0;
    color: rgba(148, 163, 184, 0.55);
}

.bottom-nav-item.active {
    color: var(--blue);
}

body.app-page-loading .bottom-nav-item {
    pointer-events: none;
}

body.app-page-loading .app-content-host {
    opacity: 0.98;
}

.bottom-nav-item span {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 1rem;
}

.bottom-nav {
    padding: 8px 0 calc(18px + env(safe-area-inset-bottom));
    background: rgba(5, 8, 15, 0.98);
}

.bottom-nav-item {
    gap: 5px;
    min-height: 56px;
    padding: 4px 0;
    color: rgba(226, 232, 240, 0.72);
}

.bottom-nav-icon {
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    box-shadow: none !important;
    border: 0 !important;
}

.bottom-nav-item.active {
    color: #60a5fa;
    background: transparent !important;
    box-shadow: none !important;
    filter: none !important;
}

.bottom-nav-item.active .bottom-nav-icon,
.bottom-nav-item.active span.bottom-nav-icon,
.bottom-nav-item.active .bottom-nav-icon i {
    background: none !important;
    box-shadow: none !important;
    border: 0 !important;
    outline: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    color: inherit !important;
    filter: none !important;
    transform: none !important;
}

.bottom-nav-item i {
    font-size: 1.05rem;
}

.bottom-nav-item i {
    font-size: 1rem;
}

.bottom-nav-item small {
    max-width: 100%;
    font-size: 0.54rem;
    line-height: 1;
    letter-spacing: 0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 430px) {
    .mobile-app {
        width: 100%;
        padding-left: 14px;
        padding-right: 14px;
    }

    .hero-card {
        grid-template-columns: 1fr;
    }

    .vehicle-stage {
        min-height: 92px;
    }

    .realtime-stage {
        width: 100%;
    }

    .realtime-sheet {
        width: calc(100% - 16px);
        bottom: var(--bottom-panel-offset);
        min-height: 186px;
        max-height: min(40vh, 340px);
        padding: 9px 8px 8px;
    }

    .realtime-sheet.has-list-scroll {
        max-height: min(40vh, 340px);
    }

    body.single-vehicle-mode .realtime-sheet {
        min-height: 120px;
        max-height: 146px;
    }

    .realtime-sheet.has-list-scroll .realtime-vehicle-list,
    .realtime-vehicle-list.list-scroll-enabled {
        height: min(calc((60px * 4) + 18px), calc(40vh - 90px));
        max-height: min(calc((60px * 4) + 18px), calc(40vh - 90px));
    }

    .realtime-vehicle-list {
        gap: 7px;
    }

    .realtime-vehicle-list .vehicle-item {
        min-height: 60px;
        padding: 7px 10px;
        gap: 9px;
    }

    .rt-icon {
        width: 44px;
        height: 44px;
    }

    .rt-icon img {
        width: 39px;
        height: 39px;
    }

    .rt-plate {
        font-size: 0.88rem;
    }

    .rt-sub {
        font-size: 0.63rem;
    }

    .rt-loc {
        font-size: 0.6rem;
    }

    .rt-badge {
        max-width: 40%;
        font-size: 0.61rem;
        padding: 4px 8px;
    }

    .bottom-nav {
        width: 100%;
    }

    .bottom-nav-item {
        min-height: 50px;
    }

    .bottom-nav-item small {
        font-size: 0.5rem;
    }
}

/* Realtime map screen */
body.app-page-realtime {
    background: #eef2f7;
}

body.app-page-realtime .mobile-app {
    padding: 0;
    background: #eef2f7;
}

body.app-page-realtime .app-content-host {
    min-height: 100dvh;
}

body.app-page-realtime {
    --realtime-map-control-left: max(14px, env(safe-area-inset-left));
    --realtime-menu-control-size: 50px;
    --realtime-zoom-control-size: 44px;
    --realtime-zoom-control-offset: 3px;
    --realtime-map-pill-height: 40px;
}

.realtime-map-screen {
    min-height: 100dvh;
}

body.app-page-realtime .realtime-stage {
    width: min(100%, 430px);
    height: 100dvh;
    background: #eef2f7;
}

body.app-page-realtime .map-box,
body.app-page-realtime .map-box .leaflet-container {
    background: #eef2f7;
}

.realtime-menu-fab,
.realtime-grid-fab {
    position: fixed;
    z-index: 34;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}

.realtime-menu-fab {
    top: calc(74px + env(safe-area-inset-top));
    left: max(16px, calc(50vw - 215px + 16px));
    width: var(--realtime-menu-control-size);
    height: var(--realtime-menu-control-size);
    background: rgba(15, 23, 42, 0.92);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 1.36rem;
}

.realtime-grid-fab {
    left: max(22px, calc(50vw - 215px + 22px));
    bottom: var(--bottom-control-offset);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.96);
    color: #111827;
    font-size: 1.8rem;
}

.realtime-map-toolbar {
    position: fixed;
    top: calc(86px + env(safe-area-inset-top));
    right: max(16px, calc(50vw - 215px + 16px));
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(min(100vw, 430px) - 136px);
    overflow-x: auto;
    pointer-events: auto;
    touch-action: manipulation;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.realtime-map-toolbar::-webkit-scrollbar {
    display: none;
}

.realtime-map-pill {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    min-height: var(--realtime-map-pill-height);
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 999px;
    padding: 0 14px;
    background: rgba(15, 23, 42, 0.92);
    color: #dbeafe;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: none;
    pointer-events: auto;
    touch-action: manipulation;
    cursor: pointer;
}

.realtime-map-pill.icon-only {
    width: var(--realtime-zoom-control-size);
    padding: 0;
    font-size: 1.08rem;
}

.realtime-map-pill.icon-only::before {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 999px;
}

.realtime-map-pill.is-refreshing i {
    animation: realtime-refresh-spin 0.75s linear infinite;
}

.realtime-map-pill.refresh-done {
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.38);
    background: rgba(22, 163, 74, 0.22);
}

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

.refresh-toast {
    position: fixed;
    top: calc(74px + env(safe-area-inset-top));
    left: 50%;
    z-index: 1300;
    transform: translate(-50%, -8px);
    min-width: 132px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    color: #dbeafe;
    border: 1px solid rgba(147, 197, 253, 0.26);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.refresh-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.realtime-map-pill.active {
    background: rgba(37, 99, 235, 0.92);
    color: #fff;
    border-color: rgba(147, 197, 253, 0.46);
    box-shadow: none;
}

.realtime-zoom-control {
    position: fixed;
    top: calc(178px + env(safe-area-inset-top));
    left: max(28px, calc(50vw - 215px + 28px));
    z-index: 34;
    display: grid;
    width: var(--realtime-zoom-control-size);
    overflow: visible;
}

.realtime-zoom-control button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--realtime-zoom-control-size);
    height: var(--realtime-zoom-control-size);
    border: 0;
    background: rgba(15, 23, 42, 0.92);
    color: #93c5fd;
    font-size: 1.18rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.28);
}

.realtime-zoom-control button {
    border-left: 1px solid rgba(96, 165, 250, 0.18);
    border-right: 1px solid rgba(96, 165, 250, 0.18);
}

.realtime-zoom-control button:first-child {
    border-radius: 999px 999px 0 0;
    border-top: 1px solid rgba(96, 165, 250, 0.18);
}

.realtime-zoom-control button:last-child {
    border-radius: 0 0 999px 999px;
    border-top: 1px solid rgba(96, 165, 250, 0.18);
    border-bottom: 1px solid rgba(96, 165, 250, 0.18);
}

@media (max-width: 430px) {
    body.app-page-realtime {
        --realtime-map-control-left: max(12px, env(safe-area-inset-left));
        --realtime-menu-control-size: 42px;
        --realtime-zoom-control-size: 36px;
        --realtime-map-pill-height: 36px;
    }

    .realtime-menu-fab {
        left: max(12px, calc(50vw - 215px + 12px));
        font-size: 1.1rem;
    }

    .realtime-map-toolbar {
        right: max(12px, calc(50vw - 215px + 12px));
        gap: 5px;
        max-width: calc(min(100vw, 430px) - 104px);
    }

    .realtime-map-pill {
        padding: 0 10px;
        font-size: 0.78rem;
    }

    .realtime-map-pill.icon-only {
        font-size: 0.9rem;
    }

    .realtime-zoom-control {
        left: max(21px, calc(50vw - 215px + 21px));
    }

    .realtime-zoom-control button {
        font-size: 0.96rem;
    }
}

body.app-page-realtime .realtime-sheet {
    bottom: var(--bottom-panel-offset);
    width: calc(min(100%, 430px) - 18px);
    min-height: 190px;
    max-height: min(40vh, 360px);
    border-radius: 24px 24px 0 0;
    transform: translate(-50%, calc(100% + 18px));
    transition: transform 0.22s ease;
}

body.app-page-realtime.realtime-list-open .realtime-sheet {
    transform: translate(-50%, 0);
}

.realtime-sheet-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 2px 4px 4px;
}

.realtime-sheet-head h2 {
    margin: 0;
    color: #f1f5f9;
    font-size: 1rem;
}

.realtime-sheet-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

.realtime-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(2, 6, 23, 0.08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.app-page-realtime.realtime-list-open .realtime-sheet-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.realtime-detail-panel {
    position: fixed;
    left: 50%;
    bottom: var(--bottom-panel-offset);
    z-index: 32;
    width: calc(min(100%, 430px) - 28px);
    max-height: min(50vh, 430px);
    display: grid;
    gap: 10px;
    overflow-y: auto;
    transform: translate(-50%, calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.24s ease, opacity 0.2s ease;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.realtime-detail-panel::-webkit-scrollbar {
    display: none;
}

body.app-page-realtime.realtime-detail-open .realtime-detail-panel {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

.realtime-action-card,
.realtime-info-card {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #111827;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.realtime-action-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

.realtime-action-cell {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 12px 10px;
}

.realtime-action-cell + .realtime-action-cell {
    border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.realtime-action-cell strong {
    font-size: 0.9rem;
}

.realtime-toggle-switch {
    width: 50px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: #e5e7eb;
    padding: 2px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.16);
}

.realtime-toggle-switch span {
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
    transition: transform 0.18s ease;
}

.realtime-toggle-switch.active {
    background: #1478f2;
}

.realtime-toggle-switch.active span {
    transform: translateX(20px);
}

.realtime-route-btn {
    width: 52px;
    height: 36px;
    border: 0;
    border-radius: 14px;
    background: #1a73e8;
    color: #fff;
    font-size: 1.25rem;
}

.realtime-google-link {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 46px;
    padding: 9px 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.12);
    color: #111827;
}

.realtime-google-link span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-weight: 800;
    font-size: 0.98rem;
}

.realtime-google-link i {
    color: #1a73e8;
    font-size: 1.2rem;
}

.realtime-detail-tabs {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.realtime-detail-tabs button {
    width: 44px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    color: #111827;
    font-size: 1.35rem;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.realtime-detail-tabs button.active {
    background: #1a73e8;
    color: #fff;
}

.realtime-detail-view {
    display: none;
}

.realtime-detail-view.active {
    display: grid;
    gap: 10px;
}

.realtime-summary-card,
.realtime-spec-card,
.realtime-sensor-card {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    color: #111827;
    border: 1px solid rgba(229, 231, 235, 0.84);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.realtime-summary-card {
    overflow: hidden;
}

.realtime-summary-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

.realtime-summary-head img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.realtime-summary-head h2,
.realtime-summary-head p {
    margin: 0;
}

.realtime-summary-head h2 {
    font-size: 1.2rem;
    color: #050505;
}

.realtime-summary-head p {
    margin-top: 4px;
    color: #6b7280;
    font-size: 0.82rem;
}

.realtime-summary-metrics {
    display: grid;
    grid-template-columns: 0.95fr 1.8fr;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.12);
}

.realtime-summary-metrics > div {
    display: grid;
    gap: 6px;
    min-height: 58px;
    padding: 8px 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
}

.realtime-summary-metrics span,
.realtime-signal-grid span {
    color: #6b7280;
}

.realtime-summary-metrics strong {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: #050505;
    font-size: 1.1rem;
}

.realtime-summary-metrics strong em,
.realtime-signal-grid strong em {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #9ca3af;
    flex: 0 0 auto;
}

.realtime-summary-metrics strong b,
.realtime-signal-grid strong b {
    font: inherit;
}

.realtime-signal-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 10px 14px 12px;
}

.realtime-signal-grid > div {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-right: 1px solid rgba(15, 23, 42, 0.12);
}

.realtime-signal-grid > div:last-child {
    border-right: 0;
}

.realtime-signal-grid i {
    color: #38bdf8;
    font-size: 1.25rem;
}

.realtime-signal-grid > div:first-child i {
    color: #22c55e;
}

.realtime-signal-grid strong {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: #050505;
    font-size: 1.15rem;
}

.realtime-signal-grid strong em {
    background: #38bdf8;
}

.realtime-signal-grid > div:first-child strong em {
    background: #22c55e;
}

.realtime-summary-location {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 10px 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.12);
    color: #6b7280;
    line-height: 1.35;
}

.realtime-summary-location > span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.realtime-google-direct {
    flex: 0 0 auto;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.96);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

.realtime-google-direct i {
    font-size: 0.9rem;
    line-height: 1;
}

.realtime-google-direct[hidden] {
    display: none !important;
}

.realtime-spec-card {
    display: grid;
}

.realtime-spec-card div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 40px;
    padding: 0 14px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.12);
}

.realtime-spec-card div:last-child {
    border-bottom: 0;
}

.realtime-spec-card strong {
    color: #050505;
    font-size: 0.86rem;
}

.realtime-spec-card span {
    color: #9ca3af;
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.realtime-sensor-card {
    padding: 14px;
    font-size: 0.92rem;
}

.realtime-info-card {
    padding: 18px 18px 20px;
}

.realtime-info-card h2,
.realtime-info-card p {
    margin: 0;
}

.realtime-info-card h2 {
    font-size: 1.05rem;
    font-weight: 500;
    color: #4b5563;
}

.realtime-info-card p {
    margin-top: 6px;
    color: #6b7280;
    font-size: 0.98rem;
    line-height: 1.45;
}

.realtime-info-card p strong {
    color: #111827;
}

.realtime-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 26px;
    row-gap: 14px;
    margin-top: 14px;
}

.realtime-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    color: #6b7280;
}

.realtime-info-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.realtime-info-row strong {
    flex: 0 0 auto;
}

.realtime-status-pill,
.realtime-signal-pill,
.realtime-fuel-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 26px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
}

.realtime-status-pill {
    color: #fff;
    background: #9ca3af;
}

.realtime-status-pill.muted {
    min-width: 94px;
}

.realtime-fuel-pill {
    color: #111827;
    background: #f3f4f6;
}

.realtime-signal-pill.info {
    color: #fff;
    background: #38bdf8;
}

.realtime-signal-pill.danger {
    color: #fff;
    background: #ef476f;
}

.realtime-signal-pill.ok {
    color: #fff;
    background: #22c55e;
}

.realtime-marker-label {
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(0, 102, 170, 0.92) !important;
    color: #fff !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 5px rgba(15, 23, 42, 0.32) !important;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    padding: 3px 6px !important;
    text-shadow: 0 1px 1px rgba(15, 23, 42, 0.4);
}

.realtime-marker-label::before {
    display: none;
}

body.app-page-realtime .map-vehicle-core img {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
}

body.app-page-realtime .map-popup-wrap {
    display: none;
}

@media (max-width: 380px) {
    body.app-page-realtime {
        --realtime-menu-control-size: 50px;
        --realtime-zoom-control-offset: 1px;
    }

    .realtime-menu-fab {
        width: 50px;
        height: 50px;
        font-size: 1.42rem;
    }

    .realtime-map-toolbar {
        max-width: calc(100vw - 116px);
        gap: 6px;
    }

    .realtime-map-pill {
        min-height: 38px;
        padding: 0 12px;
        font-size: 0.86rem;
    }

    .realtime-map-pill.icon-only {
        width: 42px;
    }
}

/* Realtime detail color lock */
body.app-page-realtime .realtime-detail-panel .realtime-action-card,
body.app-page-realtime .realtime-detail-panel .realtime-info-card,
body.app-page-realtime .realtime-detail-panel .realtime-summary-card,
body.app-page-realtime .realtime-detail-panel .realtime-spec-card,
body.app-page-realtime .realtime-detail-panel .realtime-sensor-card {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94) 0%, rgba(3, 7, 18, 0.96) 100%) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(96, 165, 250, 0.22) !important;
    box-shadow: 0 22px 56px rgba(2, 6, 23, 0.38) !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-action-cell strong,
body.app-page-realtime .realtime-detail-panel .realtime-google-link,
body.app-page-realtime .realtime-detail-panel .realtime-google-link span,
body.app-page-realtime .realtime-detail-panel .realtime-info-card p strong,
body.app-page-realtime .realtime-detail-panel .realtime-summary-head h2,
body.app-page-realtime .realtime-detail-panel .realtime-summary-metrics strong,
body.app-page-realtime .realtime-detail-panel .realtime-signal-grid strong,
body.app-page-realtime .realtime-detail-panel .realtime-spec-card strong,
body.app-page-realtime .realtime-detail-panel .realtime-sensor-card strong {
    color: #f8fafc !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-info-card h2,
body.app-page-realtime .realtime-detail-panel .realtime-info-card p,
body.app-page-realtime .realtime-detail-panel .realtime-info-row,
body.app-page-realtime .realtime-detail-panel .realtime-summary-head p,
body.app-page-realtime .realtime-detail-panel .realtime-summary-metrics span,
body.app-page-realtime .realtime-detail-panel .realtime-signal-grid span,
body.app-page-realtime .realtime-detail-panel .realtime-summary-location,
body.app-page-realtime .realtime-detail-panel .realtime-spec-card span {
    color: rgba(203, 213, 225, 0.76) !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-info-row > strong:not(.realtime-status-pill):not(.realtime-signal-pill):not(.realtime-fuel-pill) {
    color: #f8fafc !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-route-btn {
    background: #2563eb !important;
    color: #ffffff !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-google-link i {
    color: #60a5fa !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-toggle-switch {
    background: rgba(71, 85, 105, 0.84) !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-toggle-switch span {
    background: #ffffff !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-status-pill {
    background: #9ca3af !important;
    color: #ffffff !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-fuel-pill {
    background: rgba(148, 163, 184, 0.18) !important;
    color: #e5e7eb !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-signal-pill.info {
    background: #38bdf8 !important;
    color: #ffffff !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-signal-pill.danger {
    background: #ef476f !important;
    color: #ffffff !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-signal-pill.ok {
    background: #22c55e !important;
    color: #ffffff !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-action-card,
body.app-page-realtime .realtime-detail-panel .realtime-summary-card,
body.app-page-realtime .realtime-detail-panel .realtime-spec-card,
body.app-page-realtime .realtime-detail-panel .realtime-sensor-card,
body.app-page-realtime .realtime-detail-panel .realtime-info-card {
    border-radius: 18px !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-google-link,
body.app-page-realtime .realtime-detail-panel .realtime-summary-metrics,
body.app-page-realtime .realtime-detail-panel .realtime-summary-location,
body.app-page-realtime .realtime-detail-panel .realtime-spec-card div {
    border-color: rgba(148, 163, 184, 0.18) !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-summary-metrics > div {
    background: rgba(15, 23, 42, 0.64) !important;
    border-color: rgba(96, 165, 250, 0.18) !important;
    border-radius: 14px !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-detail-tabs button {
    background: rgba(15, 23, 42, 0.92) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(96, 165, 250, 0.18) !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-detail-tabs button.active {
    background: #2563eb !important;
    color: #ffffff !important;
}

body.app-page-realtime .realtime-detail-panel {
    max-height: min(50vh, 430px) !important;
    gap: 10px !important;
}

/* Edge-to-edge mobile overrides */
body.app-mode .bottom-nav {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    transform: none !important;
    width: auto !important;
    min-width: 100dvw !important;
    max-width: none !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: max(18px, env(safe-area-inset-bottom)) !important;
    grid-template-columns: repeat(var(--bottom-nav-count, 7), minmax(0, 1fr)) !important;
}

body.app-mode .bottom-nav-item {
    min-width: 0 !important;
    min-height: 70px !important;
    padding: 8px 4px 6px !important;
    gap: 7px !important;
    color: rgba(226, 232, 240, 0.88) !important;
}

body.app-mode .bottom-nav-item.active {
    color: #60a5fa !important;
}

body.app-mode .bottom-nav-item i {
    font-size: 1.34rem !important;
    line-height: 1 !important;
}

body.app-mode .bottom-nav-item small {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    color: inherit !important;
    font-size: 0.72rem !important;
    line-height: 1.18 !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    text-align: center !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

body.app-page-realtime .mobile-app,
body.app-page-history .mobile-app {
    width: 100dvw !important;
    max-width: none !important;
    margin: 0 !important;
}

body.app-page-realtime .realtime-stage,
body.app-page-history .realtime-stage,
body.app-page-history .history-stage {
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100dvw !important;
    max-width: none !important;
}

body.app-page-realtime .realtime-grid-fab {
    bottom: calc(124px + env(safe-area-inset-bottom)) !important;
}

body.app-page-realtime .realtime-sheet {
    bottom: calc(84px + env(safe-area-inset-bottom)) !important;
}

body.app-page-realtime .realtime-detail-panel {
    bottom: calc(108px + env(safe-area-inset-bottom)) !important;
}

body.app-page-realtime:not(.realtime-list-open) .realtime-sheet {
    transform: translate(-50%, calc(100% + 180px)) !important;
    pointer-events: none !important;
}

body.app-page-realtime .realtime-detail-panel[hidden] {
    display: none !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-action-card {
    display: none !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-detail-tabs {
    display: none !important;
}

body.app-page-realtime .realtime-detail-panel .realtime-spec-card,
body.app-page-realtime .realtime-detail-panel .realtime-sensor-card {
    display: none !important;
}

body.app-page-realtime:not(.realtime-detail-open) .realtime-detail-panel {
    transform: translate(-50%, calc(100% + 180px)) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body.app-page-realtime.realtime-detail-open .realtime-detail-panel {
    padding-bottom: 0 !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
}

body.app-page-realtime.realtime-list-open .realtime-sheet {
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 12px,
        #000 calc(100% - 18px),
        transparent 100%
    );
    mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 12px,
        #000 calc(100% - 18px),
        transparent 100%
    );
}

/* Cleaner map controls */
body.app-page-realtime .realtime-menu-fab {
    top: calc(16px + env(safe-area-inset-top)) !important;
    left: var(--realtime-map-control-left) !important;
    width: var(--realtime-menu-control-size) !important;
    height: var(--realtime-menu-control-size) !important;
}

body.app-page-realtime .realtime-map-toolbar {
    top: calc(26px + env(safe-area-inset-top)) !important;
    right: max(18px, env(safe-area-inset-right)) !important;
    max-width: calc(100vw - 132px) !important;
    justify-content: flex-end;
}

body.app-page-realtime .realtime-zoom-control {
    top: calc(110px + env(safe-area-inset-top)) !important;
    left: calc(var(--realtime-map-control-left) + var(--realtime-zoom-control-offset)) !important;
}

body.app-page-realtime .realtime-grid-fab,
body.app-page-history .history-map-actions {
    display: none !important;
}

/* Replay layout polish */
body.app-page-history .history-log-panel {
    flex-basis: 50vh !important;
    min-height: 300px !important;
    max-height: 50vh !important;
    border-radius: 0 !important;
}

body.app-page-history .history-log-panel::before {
    border-radius: 0 !important;
}

body.app-page-history .history-log-panel .history-list::before {
    display: none !important;
    content: none !important;
}

body.app-page-history .history-log-panel .history-item.active {
    border-color: rgba(96, 165, 250, 0.98) !important;
    box-shadow:
        0 0 0 2px rgba(96, 165, 250, 0.42),
        0 0 24px rgba(37, 99, 235, 0.36),
        0 16px 30px rgba(30, 64, 175, 0.22) !important;
}

body.app-page-history.history-playback-running .history-log-panel .history-item.active {
    border-color: rgba(125, 211, 252, 1) !important;
    box-shadow:
        0 0 0 2px rgba(125, 211, 252, 0.58),
        0 0 30px rgba(14, 165, 233, 0.48),
        0 18px 34px rgba(8, 47, 73, 0.32) !important;
}

body.app-page-history .history-playback-control {
    top: calc(38px + env(safe-area-inset-top)) !important;
    left: 20px !important;
}

body.app-page-history .map-box .leaflet-control-attribution {
    display: none !important;
}

body.app-page-history [data-history-count] {
    display: none !important;
}

/* Compact realtime mobile detail */
body.app-page-realtime .realtime-summary-card {
    overflow: hidden !important;
}

body.app-page-realtime .realtime-summary-head {
    position: relative;
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 10px 14px 9px 14px !important;
}

body.app-page-realtime .realtime-summary-head:has(.realtime-engine-command:not([hidden])) {
    padding-right: 52px !important;
}

body.app-page-realtime .realtime-summary-head > div {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

body.app-page-realtime .realtime-summary-head img {
    width: 34px !important;
    height: 34px !important;
    margin-top: 1px;
}

body.app-page-realtime .realtime-summary-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

body.app-page-realtime .realtime-summary-title-row h2 {
    flex: 1;
    min-width: 0;
    margin: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.08rem !important;
}

body.app-page-realtime .realtime-summary-title-row [data-detail-status] {
    flex: 0 0 auto;
    margin-left: auto;
    max-width: 112px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca !important;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.app-page-realtime .realtime-driver-card-icon {
    width: 34px;
    height: 28px;
    margin-left: 2px;
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.13);
}

body.app-page-realtime .realtime-engine-command {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(248, 113, 113, 0.22);
    border-radius: 999px;
    padding: 0;
    background: rgba(127, 29, 29, 0.42);
    color: #fecaca;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1;
}

body.app-page-realtime .realtime-engine-command.restore {
    border-color: rgba(52, 211, 153, 0.24);
    background: rgba(6, 78, 59, 0.46);
    color: #bbf7d0;
}

body.app-page-realtime .realtime-engine-command[hidden] {
    display: none !important;
}

body.app-page-realtime .realtime-summary-head p {
    margin-top: 3px !important;
    font-size: 0.68rem !important;
    line-height: 1.22;
}

body.app-page-realtime .realtime-summary-driver {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #34d399 !important;
    font-weight: 800;
}

body.app-page-realtime .realtime-summary-metrics {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    padding: 8px 12px !important;
}

body.app-page-realtime .realtime-summary-metrics > div {
    min-height: 44px !important;
    padding: 7px 9px !important;
    border-radius: 12px !important;
    gap: 4px !important;
}

body.app-page-realtime .realtime-summary-metrics strong {
    font-size: 0.9rem !important;
    gap: 6px !important;
}

body.app-page-realtime .realtime-signal-grid {
    padding: 5px 10px 6px !important;
    align-items: center !important;
}

body.app-page-realtime .realtime-signal-grid > div {
    min-height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 0 3px !important;
    white-space: nowrap !important;
}

body.app-page-realtime .realtime-signal-grid i {
    font-size: 0.84rem !important;
    line-height: 1 !important;
    flex: 0 0 auto !important;
}

body.app-page-realtime .realtime-signal-grid strong {
    order: 3 !important;
    flex: 0 1 auto !important;
    font-size: 0.78rem !important;
    line-height: 1.1 !important;
    gap: 3px !important;
    min-width: 0 !important;
}

body.app-page-realtime .realtime-signal-grid span {
    order: 2 !important;
    flex: 0 1 auto !important;
    font-size: 0.62rem !important;
    line-height: 1 !important;
    margin-top: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

body.app-page-realtime .realtime-summary-metrics strong em,
body.app-page-realtime .realtime-signal-grid strong em {
    width: 8px !important;
    height: 8px !important;
}

body.app-page-realtime .realtime-summary-location {
    padding: 7px 12px 9px !important;
    font-size: 0.74rem !important;
    line-height: 1.28;
    gap: 6px !important;
}

body.app-page-realtime .realtime-summary-location > i {
    flex: 0 0 auto !important;
}

body.app-page-realtime .realtime-google-direct {
    min-height: 24px !important;
    padding: 0 8px !important;
    font-size: 0.66rem !important;
}

body.app-page-realtime .realtime-google-direct i {
    font-size: 0.78rem !important;
}

/* Lock replay page; only the log list should scroll */
body.app-page-history {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

body.app-page-history .mobile-app {
    width: 100dvw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    padding: 0 !important;
    overflow: hidden !important;
}

body.app-page-history .app-content-host {
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

body.app-page-history .app-page[data-page-section="history"],
body.app-page-history .app-page[data-page-section="history"].active {
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    overflow: hidden !important;
}

body.app-page-history .history-stage,
body.app-page-history .history-log-panel {
    min-height: 0 !important;
}

body.app-page-history .history-log-panel .history-list {
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
}
