:root {
    --cc-bg: #f4f6f8;
    --cc-panel: #ffffff;
    --cc-text: #172033;
    --cc-muted: #6b7280;
    --cc-line: #e5e9ef;
    --cc-soft: #f8fafc;
    --cc-dark: #121826;
    --cc-green: #15803d;
    --cc-red: #b91c1c;
    --cc-orange: #b45309;
    --cc-blue: #1d4ed8;
}

html,
body {
    width: 100%;
    overflow-x: hidden;
}

body {
    background: var(--cc-bg);
    color: var(--cc-text);
    font-size: 14px;
}

.container-fluid {
    max-width: 1480px;
    padding-left: clamp(12px, 2vw, 28px);
    padding-right: clamp(12px, 2vw, 28px);
}

.navbar .container-fluid {
    max-width: none;
}

.navbar {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.navbar-brand {
    letter-spacing: 0.2px;
    min-width: 0;
}

.app-brand-title {
    display: inline-block;
    line-height: 1.1;
    white-space: normal;
}

.navbar-logo-box {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 14px;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.navbar-logo-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.card,
.data-card,
.filter-card,
.stat-card {
    border: 1px solid var(--cc-line);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045) !important;
    background: var(--cc-panel);
}

.card-header {
    background: var(--cc-panel) !important;
    border-bottom: 1px solid var(--cc-line);
    padding: 12px 16px;
    border-radius: 16px 16px 0 0 !important;
}

.card-body {
    padding: 16px;
}

.stat-card .card-body {
    padding: 14px 16px;
}

.stat-card .stat-value,
.stat-card .fs-3,
.stat-card h2 {
    color: var(--cc-text) !important;
    font-size: 22px !important;
    line-height: 1.18;
    font-weight: 700 !important;
    margin: 2px 0 0;
    letter-spacing: -0.02em;
}

.compact-metrics .card,
.compact-metrics .metric-card {
    min-height: 104px;
}

.metric-card {
    min-height: 104px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    border-radius: 18px;
    text-decoration: none;
    color: var(--cc-text);
    background: #fff;
    border: 1px solid var(--cc-line);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.055);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.metric-card:hover {
    color: var(--cc-text);
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.09);
}

.metric-card::after {
    display: none;
}

.metric-card span {
    display: block;
    color: var(--cc-muted);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 700;
}

.metric-card strong {
    display: block;
    color: var(--cc-text);
    font-size: 25px;
    line-height: 1.1;
    margin-top: 2px;
    letter-spacing: -0.04em;
}

.metric-card small {
    display: block;
    color: var(--cc-muted);
    margin-top: 4px;
    line-height: 1.2;
}

.metric-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 13px;
    background: #f3f6fa;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
}

.metric-card-dark {
    background: #f8fafc;
    border-color: #dbe4ee;
}

.metric-card-amber {
    background: #fff7ed;
    border-color: #fed7aa;
}

.metric-card-green {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.metric-card-red {
    background: #fef2f2;
    border-color: #fecaca;
}

.metric-card-blue {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.metric-card-purple {
    background: #f5f3ff;
    border-color: #ddd6fe;
}

.metric-card-dark .metric-icon { color: #0f172a; background: #e8eef6; }
.metric-card-amber .metric-icon { color: var(--cc-orange); background: #ffedd5; }
.metric-card-green .metric-icon { color: var(--cc-green); background: #dcfce7; }
.metric-card-red .metric-icon { color: var(--cc-red); background: #fee2e2; }
.metric-card-blue .metric-icon { color: var(--cc-blue); background: #dbeafe; }
.metric-card-purple .metric-icon { color: #6d28d9; background: #ede9fe; }

.stat-card {
    background: #ffffff;
}

.stat-card.soft-blue { background: #eff6ff; border-color: #bfdbfe; }
.stat-card.soft-green { background: #f0fdf4; border-color: #bbf7d0; }
.stat-card.soft-amber { background: #fff7ed; border-color: #fed7aa; }
.stat-card.soft-red { background: #fef2f2; border-color: #fecaca; }
.stat-card.soft-purple { background: #f5f3ff; border-color: #ddd6fe; }

.dashboard-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--cc-line);
    border-radius: 999px;
}

.dashboard-filter-bar .filter-field {
    min-width: 150px;
}

.dashboard-filter-bar .form-label {
    display: none;
}

.dashboard-filter-bar .form-select,
.dashboard-filter-bar .form-control {
    border: 0;
    background-color: var(--cc-soft);
    border-radius: 999px;
    min-height: 34px;
    font-size: 13px;
}

.form-control,
.form-select {
    border-color: #d8dee8;
    border-radius: 10px;
}

.btn {
    border-radius: 10px;
}

.table {
    --bs-table-bg: transparent;
}

.table th {
    white-space: nowrap;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table td {
    vertical-align: middle;
}

.badge {
    font-size: 11px;
    border-radius: 999px;
    padding: 5px 8px;
}

.list-group-item {
    border-color: var(--cc-line);
    padding: 12px 16px;
}

.vehicle-status-list .list-group-item {
    padding: 12px 16px;
}

#tripMap,
#fleetMap,
#dashboardMap,
.fleet-live-map {
    height: 500px;
    width: 100%;
    border-radius: 0 0 16px 16px;
    overflow: hidden;
}

.fleet-large-map {
    height: 640px;
}

.trip-marker-icon,
.vehicle-map-icon {
    background: transparent;
    border: none;
}

.trip-marker {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: white;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.trip-start-marker { background: var(--cc-green); }
.trip-end-marker { background: var(--cc-red); }

.vehicle-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: max-content;
    padding: 4px 8px 4px 5px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.14);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.22);
    font-size: 12px;
    font-weight: 700;
    color: var(--cc-text);
    transform: translate(-16px, -14px);
}

.vehicle-symbol {
    width: 25px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
}

.vehicle-label {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vehicle-online .vehicle-symbol { background: var(--cc-green); }
.vehicle-offline .vehicle-symbol { background: var(--cc-red); }
.vehicle-unknown .vehicle-symbol { background: var(--cc-orange); }

.fleet-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.car-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--cc-line);
    border-radius: 999px;
    background: #fff;
    color: var(--cc-muted);
    font-size: 12px;
}

.car-chip::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.chip-online::before { background: var(--cc-green); }
.chip-offline::before { background: var(--cc-red); }
.chip-unknown::before { background: var(--cc-orange); }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(29, 78, 216, 0.18), transparent 32%),
        linear-gradient(145deg, #111827, #1f2937 52%, #334155);
}

.login-panel {
    width: 100%;
    max-width: 420px;
    border-radius: 22px;
    background: #fff;
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.login-logo {
    width: 128px;
    max-width: 42%;
    height: auto;
    display: block;
    margin: 0 auto 18px;
    object-fit: contain;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    color: #fff;
    font-weight: 800;
}

.pagination .page-link {
    border-radius: 10px;
    margin: 0 2px;
    border-color: #dde3ec;
    color: #1f2937;
}

.pagination .active .page-link {
    background-color: var(--cc-dark);
    border-color: var(--cc-dark);
}

@media (max-width: 991.98px) {
    .navbar-nav {
        padding-top: 10px;
    }

    .navbar-nav .nav-link {
        padding: 10px 6px;
    }

    .dropdown-menu {
        border: 0;
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
        margin-top: 14px !important;
    }

    #tripMap,
    #fleetMap,
    #dashboardMap,
    .fleet-live-map {
        height: 360px !important;
    }

    .fleet-large-map {
        height: 420px !important;
    }

    .card-body {
        padding: 14px;
    }

    .card-header {
        gap: 10px;
        flex-wrap: wrap;
    }

    .dashboard-filter-bar {
        width: 100%;
        border-radius: 18px;
        flex-wrap: wrap;
    }

    .dashboard-filter-bar .filter-field {
        flex: 1 1 100%;
    }

    .dashboard-filter-bar .btn {
        width: 100%;
        min-height: 38px;
    }

    .metric-card {
        min-height: 88px;
        padding: 12px 13px;
        border-radius: 16px;
    }

    .metric-icon {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        font-size: 19px;
    }

    .metric-card strong {
        font-size: 21px;
    }

    .metric-card small {
        font-size: 12px;
    }

    .list-group-item {
        padding: 11px 13px;
    }

    .login-page {
        padding: 16px;
        align-items: flex-start;
    }

    .login-panel {
        max-width: 390px;
        padding: 22px 18px;
        margin-top: 28px;
        border-radius: 20px;
    }

    .login-logo {
        width: 118px;
        max-width: 46%;
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: 13.5px;
    }

    h4 {
        font-size: 18px;
    }

    .navbar-logo-box {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .app-brand-title {
        max-width: calc(100vw - 115px);
        font-size: 14px;
    }

    .row {
        --bs-gutter-x: 0.8rem;
    }

    .compact-metrics {
        --bs-gutter-y: 0.75rem;
    }

    .card,
    .data-card,
    .filter-card,
    .stat-card,
    .metric-card {
        border-radius: 14px;
    }

    .card-header {
        padding: 11px 13px;
    }

    .filter-card .btn,
    .filter-card .form-control,
    .filter-card .form-select {
        min-height: 40px;
    }

    #tripMap,
    #fleetMap,
    #dashboardMap,
    .fleet-live-map {
        height: 320px !important;
    }

    .fleet-large-map {
        height: 370px !important;
    }

    .fleet-legend {
        width: 100%;
        gap: 6px;
    }

    .car-chip {
        font-size: 11px;
        padding: 5px 8px;
    }

    .vehicle-bubble {
        max-width: 170px;
        font-size: 11px;
        padding-right: 7px;
    }

    .vehicle-symbol {
        width: 23px;
        height: 23px;
        font-size: 13px;
    }

    .table-responsive.stack-on-mobile {
        overflow: visible;
    }

    .table-responsive.stack-on-mobile table,
    .table-responsive.stack-on-mobile thead,
    .table-responsive.stack-on-mobile tbody,
    .table-responsive.stack-on-mobile tr,
    .table-responsive.stack-on-mobile th,
    .table-responsive.stack-on-mobile td {
        display: block;
        width: 100%;
    }

    .table-responsive.stack-on-mobile thead {
        display: none;
    }

    .table-responsive.stack-on-mobile tbody tr {
        margin: 0 10px 10px;
        padding: 10px 12px;
        border: 1px solid var(--cc-line);
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
    }

    .table-responsive.stack-on-mobile tbody tr:first-child {
        margin-top: 10px;
    }

    .table-responsive.stack-on-mobile tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 14px;
        border: 0 !important;
        padding: 6px 0 !important;
        text-align: right;
        white-space: normal;
    }

    .table-responsive.stack-on-mobile tbody td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        color: var(--cc-muted);
        font-weight: 700;
        text-align: left;
    }

    .table-responsive.stack-on-mobile tbody td[colspan] {
        display: block;
        text-align: center;
    }

    .table-responsive.stack-on-mobile tbody td[colspan]::before {
        display: none;
    }

    .table-responsive.stack-on-mobile tbody td.text-end {
        justify-content: space-between;
    }

    .table-responsive.stack-on-mobile .btn {
        min-width: 88px;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 6px;
    }

    nav:has(.pagination) {
        flex-direction: column;
        gap: 8px;
    }
}

.leaflet-marker-icon.vehicle-map-icon {
    transition: transform 0.6s linear;
}

.confirm-box {
    border: 1px solid var(--cc-line);
    border-radius: 14px;
    padding: 12px;
    background: #f8fafc;
}

.confirm-box span {
    display: block;
    color: var(--cc-muted);
    font-size: 12px;
    margin-bottom: 3px;
}

.confirm-box strong {
    display: block;
    color: var(--cc-text);
    font-size: 15px;
}

.leaflet-control-layers {
    border-radius: 12px !important;
    border: 1px solid rgba(15, 23, 42, 0.16) !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16) !important;
}

.leaflet-control-layers-expanded {
    padding: 8px 10px !important;
    font-size: 13px;
}

.dashboard-page .compact-metrics {
    margin-bottom: 14px !important;
}

.dashboard-page .metric-card {
    min-height: 84px;
    padding: 11px 13px;
    border-radius: 15px;
    gap: 10px;
}

.dashboard-page .metric-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 11px;
    font-size: 18px;
}

.dashboard-page .metric-card strong {
    font-size: 21px;
}

.dashboard-page .metric-card span {
    font-size: 10px;
}

.dashboard-page .metric-card small {
    font-size: 11px;
    margin-top: 2px;
}

.dashboard-map-card #dashboardMap {
    height: 620px;
    border-radius: 0 0 16px 16px;
}

.dashboard-bottom-lists .list-group-item {
    padding-top: 10px;
    padding-bottom: 10px;
}

@media (max-width: 768px) {
    .dashboard-page .metric-card {
        min-height: 78px;
        padding: 10px 12px;
    }

    .dashboard-page .metric-icon {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        font-size: 17px;
    }

    .dashboard-map-card #dashboardMap {
        height: 430px !important;
    }
}

@media (max-width: 575.98px) {
    .dashboard-page .compact-metrics {
        --bs-gutter-y: 0.55rem;
    }

    .dashboard-page .metric-card {
        min-height: 74px;
    }

    .dashboard-map-card #dashboardMap {
        height: 390px !important;
    }
}
