*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #212529;
}

/* ── Full-viewport layout ─────────────────────────────── */

.map-page {
    display: flex;
    height: 100%;
    overflow: hidden;
}

#map-container {
    flex: 1;
    height: 100%;
}

/* ── Controls sidebar ─────────────────────────────────── */

.controls-panel {
    width: 270px;
    min-width: 270px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1rem;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: #0d6efd;
}

.control-section h2 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    margin: 0 0 0.5rem;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.control-section label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8rem;
    color: #495057;
}

.control-section input[type="date"] {
    padding: 0.35rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #212529;
}

/* ── Vehicle checkboxes ───────────────────────────────── */

.vehicle-check {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.2rem 0;
    font-size: 0.875rem;
    color: #212529;
}

.color-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Load button ──────────────────────────────────────── */

.load-btn {
    padding: 0.5rem 0.75rem;
    background: #0d6efd;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s;
}

.load-btn:hover:not(:disabled) {
    background: #0b5ed7;
}

.load-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ── Status message ───────────────────────────────────── */

.status-msg {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
}

.status-msg.error {
    color: #dc3545;
}

.muted {
    font-size: 0.8rem;
    color: #adb5bd;
    margin: 0;
}

/* ── Admin pages ──────────────────────────────────────── */

.admin-page {
    padding: 1.5rem 2rem;
    max-width: 900px;
}

.admin-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #212529;
    margin: 0 0 1.25rem;
}

.admin-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.admin-form label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
}

.form-input {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #212529;
    min-width: 180px;
}

.form-input-sm {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #212529;
    width: 110px;
}

.btn-primary {
    padding: 0.4rem 1rem;
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    align-self: flex-end;
    transition: background 0.15s;
}

.btn-primary:hover:not(:disabled) { background: #0b5ed7; }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; }

.btn-danger {
    padding: 0.25rem 0.6rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-danger:hover:not(:disabled) { background: #bb2d3b; }
.btn-danger:disabled { opacity: 0.65; cursor: not-allowed; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
}

.admin-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.admin-table tr:hover td { background: #f8f9fa; }

.admin-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin: 0 0 1rem;
}
