:root {
    --mbg-primary: #0f766e;
    --mbg-accent: #16a34a;
    --mbg-danger: #dc2626;
    --mbg-warning: #f59e0b;
    --mbg-background: #eef6f2;
    --mbg-radius: 22px;
    --mbg-ink: #10231f;
    --mbg-muted: #64748b;
    --mbg-card: rgba(255, 255, 255, 0.92);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(circle at 4% 2%, rgba(22, 163, 74, 0.13), transparent 32%),
        radial-gradient(circle at 94% 4%, rgba(37, 99, 235, 0.11), transparent 32%),
        linear-gradient(180deg, #f7fbf8 0%, var(--mbg-background, #eef6f2) 100%);
    color: var(--mbg-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.navbar-mbg {
    backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.86) !important;
    border-bottom: 1px solid rgba(15, 118, 110, 0.12);
}

.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 40px; height: 40px; border-radius: 14px; object-fit: contain; display: block; background: #ffffff; padding: 3px; }
.brand-title { line-height: 1.1; }
.brand-title strong { display: block; font-size: 1rem; letter-spacing: -0.02em; }
.brand-title span { display: block; font-size: 0.78rem; color: var(--mbg-muted); }

.dashboard-shell { padding: 24px; }

.page-hero {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--mbg-radius, 22px) + 8px);
    padding: 24px;
    margin-bottom: 22px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(12, 92, 78, 0.97), rgba(17, 119, 85, 0.93) 47%, rgba(30, 64, 175, 0.88)),
        radial-gradient(circle at 88% 12%, rgba(255,255,255,0.28), transparent 28%);
    box-shadow: 0 18px 45px rgba(15, 118, 110, 0.23);
}

.page-hero::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -65px;
    width: 270px;
    height: 270px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
}

.page-hero h1 { margin: 0; font-weight: 800; letter-spacing: -0.04em; }
.page-hero p { margin: 8px 0 0; color: rgba(255,255,255,0.82); max-width: 760px; }

.hero-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.13);
    color: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
}

.card-kpi, .owner-panel, .mbg-card {
    border: 1px solid rgba(15, 118, 110, 0.08);
    border-radius: var(--mbg-radius, 22px);
    background: var(--mbg-card);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.07);
}

.card-kpi h5, .mbg-card h5 { font-weight: 800; letter-spacing: -0.025em; }

.kpi-card {
    position: relative;
    overflow: hidden;
    min-height: 118px;
}
.kpi-card::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -38px;
    width: 118px;
    height: 118px;
    border-radius: 36px;
    background: linear-gradient(135deg, rgba(15,118,110,0.16), rgba(37,99,235,0.10));
    transform: rotate(20deg);
}
.kpi-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.11);
    color: var(--mbg-primary);
    font-weight: 800;
}
.kpi-value { font-size: 2.05rem; font-weight: 850; letter-spacing: -0.04em; }
.kpi-label { color: var(--mbg-muted); font-size: 0.86rem; }

.section-title-line {
    border-left: 7px solid var(--mbg-primary, #0f766e);
    padding-left: 13px;
    font-weight: 850;
    letter-spacing: -0.035em;
}

.section-subtitle { color: var(--mbg-muted); font-size: 0.92rem; }

.map-box, .small-map, .mini-map {
    width: 100%;
    border-radius: calc(var(--mbg-radius, 22px) - 4px);
    overflow: hidden;
    border: 1px solid rgba(15,118,110,0.12);
    background: #dfeee8;
}
.map-box { height: 430px; }
.small-map { height: 335px; }
.mini-map { height: 275px; }
.owner-compact-map { height: 300px; }

.leaflet-popup-content-wrapper { border-radius: 16px; }
.leaflet-popup-content { margin: 12px 14px; line-height: 1.45; }
.truck-marker, .school-marker {
    display: grid;
    place-items: center;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}
.truck-marker { width: 34px; height: 34px; background: #fff; font-size: 19px; border: 2px solid var(--mbg-primary); }
.school-marker { width: 24px; height: 24px; border: 3px solid #fff; }

.status-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    border-radius: 50%;
    margin-right: 7px;
}
.dot-grey { background: #94a3b8; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #16a34a; }
.dot-red { background: #dc2626; }

.badge-lg {
    font-size: 1rem;
    padding: 13px 18px;
    border-radius: 16px;
    white-space: normal;
    line-height: 1.35;
}

.pill-soft {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(15, 118, 110, 0.09);
    color: #0f766e;
    font-weight: 700;
    font-size: 0.84rem;
}

.log-list { max-height: 430px; overflow-y: auto; }
.log-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.log-thumb {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(220,38,38,0.12), rgba(245,158,11,0.12));
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--mbg-danger);
    font-weight: 800;
}

.table thead th {
    white-space: nowrap;
    color: #334155;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.table td { vertical-align: middle; }

.chart-wrap { position: relative; height: 300px; }
.owner-chart-wrap { height: 230px; }

.eta-card {
    background: linear-gradient(135deg, rgba(15,118,110,0.95), rgba(22,163,74,0.92));
    color: #fff;
    border-radius: calc(var(--mbg-radius, 22px) - 2px);
    padding: 18px;
}
.eta-number { font-size: 2.3rem; line-height: 1; font-weight: 900; letter-spacing: -0.06em; }
.eta-label { color: rgba(255,255,255,0.78); }

.food-badge {
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 20px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(22,163,74,0.12), rgba(14,165,233,0.10));
    border: 1px solid rgba(22,163,74,0.18);
}
.food-badge-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: #16a34a;
    color: white;
    font-size: 1.6rem;
    font-weight: 900;
}
.food-badge.danger { background: linear-gradient(135deg, rgba(220,38,38,0.10), rgba(245,158,11,0.11)); border-color: rgba(220,38,38,0.18); }
.food-badge.danger .food-badge-icon { background: #dc2626; }

.review-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    padding: 14px;
    background: rgba(255,255,255,0.72);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
    background:
        radial-gradient(circle at 15% 14%, rgba(34,197,94,0.24), transparent 32%),
        radial-gradient(circle at 86% 8%, rgba(37,99,235,0.18), transparent 34%),
        linear-gradient(135deg, #f7fff9 0%, #eaf6ef 48%, #edf5ff 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(90deg, rgba(15,118,110,0.06) 1px, transparent 1px),
        linear-gradient(rgba(15,118,110,0.06) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black, transparent 78%);
}
.login-visual {
    position: absolute;
    inset: auto 5vw 8vh auto;
    width: min(38vw, 480px);
    height: min(38vw, 480px);
    opacity: 0.20;
    background:
        radial-gradient(circle at 45% 40%, rgba(22,163,74,0.75), transparent 28%),
        conic-gradient(from 240deg, rgba(15,118,110,0.15), rgba(37,99,235,0.13), rgba(250,204,21,0.13), rgba(15,118,110,0.15));
    border-radius: 48% 52% 42% 58%;
}
.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 30px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.13);
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(20px);
}
.login-logo { width: 86px; height: 86px; display: block; margin: 0 auto 12px; }
.login-card .form-control {
    min-height: 48px;
    border-radius: 14px;
    border-color: rgba(15, 118, 110, 0.14);
}
.login-card .btn { min-height: 48px; border-radius: 14px; font-weight: 800; }
.login-copy { color: var(--mbg-muted); font-size: 0.94rem; }

.owner-quick-nav {
    position: sticky;
    top: 74px;
    z-index: 8;
    background: rgba(247,251,248,0.72);
    backdrop-filter: blur(12px);
    border-radius: 18px;
    padding: 10px;
    border: 1px solid rgba(15,118,110,0.08);
}

.form-control, .form-select { border-radius: 14px; }
.btn { border-radius: 14px; }

@media (max-width: 768px) {
    .dashboard-shell { padding: 16px; }
    .page-hero { padding: 20px; }
    .map-box { height: 320px; }
    .small-map, .mini-map { height: 260px; }
    .chart-wrap { height: 260px; }
}
