:root {
    --bg: #f7f4ec;
    --surface: #fffdf8;
    --surface-strong: #fff8ea;
    --text: #182126;
    --muted: #66727d;
    --line: rgba(24, 33, 38, 0.08);
    --green: #2f9e44;
    --yellow: #f08c00;
    --blue: #1971c2;
    --red: #c92a2a;
    --gray: #6c757d;
    --shadow: 0 18px 50px rgba(66, 45, 0, 0.08);
}

body {
    margin: 0;
    font-family: "Barlow", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(240, 140, 0, 0.10), transparent 35%),
        linear-gradient(180deg, #fcfaf4 0%, #f4efe3 100%);
}

body.section-conductor {
    min-height: 100dvh;
    overflow: hidden;
}

.admin-nav {
    background: rgba(255, 252, 245, 0.96);
    border-bottom: 1px solid rgba(24, 33, 38, 0.08);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(66, 45, 0, 0.06);
}

.admin-nav .navbar-brand,
.admin-nav .nav-link {
    color: var(--text);
}

.admin-nav .navbar-brand {
    font-size: 1.1rem;
    letter-spacing: 0.04em;
}

.admin-nav .nav-link {
    padding: 0.65rem 0.85rem;
    border-radius: 999px;
}

.admin-nav .nav-link:hover {
    background: rgba(240, 140, 0, 0.10);
}

.admin-nav .nav-link.active {
    font-weight: 700;
    color: var(--yellow);
    background: rgba(240, 140, 0, 0.14);
}

.hero-card,
.panel-card,
.metric-card {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero-card {
    position: relative;
    overflow: hidden;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.75rem;
    color: var(--yellow);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pill-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-weight: 700;
    color: #fff;
}

.status-green { background: var(--green); }
.status-yellow { background: var(--yellow); }
.status-blue { background: var(--blue); }
.status-gray { background: var(--gray); }
.status-red { background: var(--red); }

.metric-card {
    padding: 1.25rem;
}

.metric-label {
    display: block;
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 2rem;
    line-height: 1;
}

.panel-card {
    padding: 1.5rem;
}

.panel-header {
    margin-bottom: 1rem;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.phase-list {
    padding-left: 1.25rem;
}

.phase-list li + li {
    margin-top: 0.75rem;
}

.operational-table th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    border-bottom-color: rgba(24, 33, 38, 0.08);
}

.operational-table td {
    background: transparent;
    border-bottom-color: rgba(24, 33, 38, 0.08);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
}

.status-disponible { background: var(--green); color: #fff; }
.status-ocupado { background: var(--yellow); color: #fff; }
.status-en_carrera { background: var(--blue); color: #fff; }
.status-no_funciona { background: #c92a2a; color: #fff; }
.status-varado { background: #7b2cbf; color: #fff; }
.status-sin_gasolina { background: #e67700; color: #fff; }
.status-descanso,
.status-sin_conexion { background: var(--gray); color: #fff; }

.action-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.driver-shell {
    max-width: 560px;
}

.driver-top {
    padding: 1rem 0 0.25rem;
}

.driver-app-shell {
    min-height: 100dvh;
    padding: 0;
}

.driver-screen {
    min-height: 100dvh;
    max-height: 100dvh;
}

.driver-login-stage,
.driver-console-stage {
    min-height: 100dvh;
}

.driver-login-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
}

.driver-login-card,
.driver-console-card {
    background: rgba(255, 253, 248, 0.96);
    border: 1px solid rgba(24, 33, 38, 0.08);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.driver-login-card {
    width: 100%;
    max-width: 460px;
    padding: 1.4rem;
}

.driver-login-form {
    margin-top: 0.25rem;
}

.driver-title {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 700;
}

.driver-subtitle {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.driver-console-stage {
    position: relative;
    padding: 0.85rem;
    overflow: hidden;
}

.driver-console-card {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 1.7rem);
    max-height: calc(100dvh - 1.7rem);
    padding: 1rem 1rem 5.8rem;
    overflow: hidden;
}

.driver-console-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.driver-console-heading {
    min-width: 0;
}

.driver-name {
    display: block;
    font-size: 1rem;
}

.driver-topline,
.driver-meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.driver-dot {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: rgba(24, 33, 38, 0.24);
}

.driver-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.driver-trip-card {
    margin-top: 0.85rem;
    padding: 0.9rem;
    border-radius: 22px;
    background: #fff7e6;
    border: 1px solid rgba(240, 140, 0, 0.18);
    overflow: hidden;
}

.driver-trip-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.driver-trip-body {
    display: grid;
    gap: 0.35rem;
    color: #36414a;
    font-size: 0.93rem;
}

.driver-trip-body span {
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.driver-trip-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.driver-console-footer {
    margin-top: auto;
    padding-top: 0.85rem;
}

.driver-feedback {
    margin-top: 0.65rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.driver-utility-actions {
    display: flex;
    gap: 0.55rem;
    margin-top: 0.8rem;
    flex-wrap: wrap;
}

.driver-gps-fab {
    position: fixed;
    right: 0.95rem;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 0.95rem);
    top: auto;
    z-index: 1200;
    min-width: 104px;
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    background: #0b7285;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 12px 28px rgba(11, 114, 133, 0.28);
}

#gps-status[data-mode="live"] {
    color: var(--green);
    font-weight: 700;
}

#gps-status[data-mode="error"] {
    color: var(--red);
    font-weight: 700;
}

#gps-status[data-mode="loading"] {
    color: #0b7285;
    font-weight: 700;
}

.is-hidden {
    display: none !important;
}

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

.state-button {
    min-height: 52px;
    border: 0;
    border-radius: 18px;
    color: #fff;
    font-weight: 700;
    font-size: 0.94rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    box-shadow: 0 8px 20px rgba(24, 33, 38, 0.12);
}

.state-button--green {
    background: #2f9e44;
}

.state-button--amber {
    background: #f08c00;
}

.state-button--blue {
    background: #1971c2;
}

.state-button--red {
    background: #c92a2a;
}

.state-button--violet {
    background: #7b2cbf;
}

.state-button--orange {
    background: #e67700;
}

.state-button--gray {
    background: #6c757d;
}

.state-button:hover,
.state-button.is-active {
    transform: translateY(-1px);
    filter: saturate(1.08) brightness(1.03);
    box-shadow: 0 12px 24px rgba(24, 33, 38, 0.16);
}

.mini-card {
    padding: 1rem;
    border-radius: 18px;
    background: #fff7e6;
    border: 1px solid rgba(240, 140, 0, 0.18);
}

.btn-outline-primary {
    --bs-btn-color: #0b7285;
    --bs-btn-border-color: #0b7285;
    --bs-btn-hover-bg: #0b7285;
    --bs-btn-hover-border-color: #0b7285;
}

.map-stage {
    margin-bottom: 2rem;
}

.map-shell {
    padding: 1.5rem;
}

.map-shell-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.map-stat-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.map-stat {
    min-width: 160px;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: #fff7e6;
    border: 1px solid rgba(240, 140, 0, 0.14);
}

.map-stat span {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
}

.map-stat strong {
    display: block;
    font-size: 1.75rem;
    line-height: 1.1;
}

.map-dashboard-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.map-sidebar {
    max-height: 74vh;
    overflow: auto;
    padding-right: 0.25rem;
}

.map-sidebar-title {
    margin-bottom: 0.9rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.map-sidebar-item {
    padding: 0.95rem;
    border-radius: 18px;
    background: rgba(255, 247, 230, 0.76);
    border: 1px solid rgba(24, 33, 38, 0.08);
}

.map-sidebar-item + .map-sidebar-item {
    margin-top: 0.75rem;
}

.map-canvas-wrap {
    min-height: 74vh;
}

.operations-map {
    width: 100%;
    min-height: 74vh;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(24, 33, 38, 0.10);
}

.leaflet-container {
    font-family: "Barlow", sans-serif;
}

.map-popup-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.map-popup-meta {
    margin: 0;
    color: #47525d;
    font-size: 0.92rem;
}

.map-popup-link {
    display: inline-block;
    margin-top: 0.55rem;
    font-weight: 700;
    color: #1971c2;
    text-decoration: none;
}

.app-footer {
    margin-top: 2rem;
    padding: 1.6rem 0 2rem;
    border-top: 1px solid rgba(24, 33, 38, 0.08);
    background: rgba(255, 252, 245, 0.82);
}

.app-footer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.app-footer-label {
    display: inline-block;
    margin-bottom: 0.5rem;
    color: var(--yellow);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.app-footer p {
    color: var(--muted);
}

@media (max-width: 575.98px) {
    .state-grid {
        grid-template-columns: 1fr;
    }

    .driver-console-stage {
        padding: 0.7rem;
    }

    .driver-console-card {
        min-height: calc(100dvh - 1.4rem);
        max-height: calc(100dvh - 1.4rem);
        padding: 0.9rem 0.9rem 5.6rem;
    }

    .driver-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .state-button {
        min-height: 52px;
        font-size: 0.92rem;
    }

    .driver-trip-actions {
        grid-template-columns: 1fr 1fr;
    }

    .driver-utility-actions {
        flex-wrap: wrap;
    }

    .driver-gps-fab {
        right: 0.7rem;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 0.7rem);
        top: auto;
        min-width: 92px;
        min-height: 42px;
        font-size: 0.88rem;
    }
}

@media (max-width: 991.98px) {
    .map-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .map-sidebar {
        max-height: none;
    }

    .map-canvas-wrap,
    .operations-map {
        min-height: 58vh;
    }

    .app-footer-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-map-page {
    max-width: 100%;
}

.monitor-shell {
    min-height: calc(100vh - 190px);
}

.monitor-map-frame {
    position: relative;
    min-height: calc(100vh - 190px);
}

.monitor-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 500;
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
}

.monitor-actions {
    pointer-events: auto;
}

.monitor-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.monitor-sync-badge {
    min-width: 150px;
    padding: 0.7rem 0.9rem;
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.90);
    border: 1px solid rgba(24, 33, 38, 0.10);
    box-shadow: 0 8px 20px rgba(66, 45, 0, 0.08);
}

.monitor-sync-badge span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.monitor-sync-badge strong {
    display: block;
    font-size: 1rem;
    line-height: 1.2;
}

.map-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
}

.map-footer-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
}

.map-footer-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #36414a;
    font-size: 0.92rem;
    font-weight: 600;
}

.map-footer-info {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
}

.map-footer-info strong {
    color: var(--text);
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
}

.legend-green { background: var(--green); }
.legend-yellow { background: var(--yellow); }
.legend-blue { background: var(--blue); }
.legend-red { background: var(--red); }
.legend-gray { background: var(--gray); }

.operations-map-full {
    min-height: calc(100vh - 190px);
}

.leaflet-div-icon {
    background: transparent;
    border: 0;
}

.car-pin-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 991.98px) {
    .monitor-shell,
    .monitor-map-frame,
    .operations-map-full {
        min-height: calc(100vh - 230px);
    }

    .monitor-overlay {
        top: 0.75rem;
        left: 0.75rem;
        right: 0.75rem;
    }

    .monitor-overlay {
        justify-content: flex-start;
    }
}

@media (max-width: 575.98px) {
    .map-footer-bar,
    .map-footer-legend {
        flex-direction: column;
        align-items: flex-start;
    }

    .map-footer-legend {
        gap: 0.45rem 0.8rem;
    }
}
