:root {
    --bg: #0f172a;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #1d4ed8;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --soft: #f8fafc;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, Arial, Helvetica, sans-serif;
    background: #eef2ff;
    color: var(--text);
}
.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}
.topbar {
    background: var(--bg);
    color: white;
    padding: 16px 0;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .15);
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.brand {
    color: white;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2rem;
}
.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.nav a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 10px;
}
.nav a.active,
.nav a:hover { background: rgba(255,255,255,.12); color: white; }
.page { padding: 28px 16px 60px; }
.hero, .card {
    background: var(--card);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, .08);
    border: 1px solid rgba(226,232,240,.9);
}
.grid {
    display: grid;
    gap: 18px;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi { font-size: 2rem; font-weight: 800; }
.muted { color: var(--muted); }
.role-chip, .badge {
    display: inline-block;
    background: #dbeafe;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: .85rem;
}
.badge.status-delivered { background: #dcfce7; color: #166534; }
.badge.status-en_route,
.badge.status-arrived,
.badge.status-in_progress { background: #dbeafe; color: #1d4ed8; }
.badge.status-canceled,
.badge.status-blocked,
.badge.status-absent { background: #fee2e2; color: #991b1b; }
.badge.status-planned,
.badge.status-assigned,
.badge.status-new,
.badge.status-postponed { background: #fef3c7; color: #92400e; }
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}
th, td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
th { background: var(--soft); font-size: .92rem; }
form { display: grid; gap: 16px; }
.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
label { display: grid; gap: 8px; font-weight: 600; }
input, select, textarea, button {
    font: inherit;
}
input, select, textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 11px 12px;
    background: white;
}
textarea { min-height: 90px; resize: vertical; }
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
}
.btn-secondary { background: #334155; }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); }
.btn-danger { background: var(--danger); }
.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: #dcfce7; color: #166534; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card {
    max-width: 440px;
    width: 100%;
    background: white;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .12);
}
.footer {
    padding: 24px 0 40px;
    color: var(--muted);
    text-align: center;
}
.driver-list {
    display: grid;
    gap: 14px;
}
.driver-card {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--line);
    padding: 18px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}
.driver-card h3 { margin: 0 0 8px; }
.driver-meta { display: grid; gap: 6px; margin-bottom: 14px; }
.small { font-size: .9rem; }
@media (max-width: 768px) {
    .topbar-inner { align-items: flex-start; }
    .actions { flex-direction: column; }
    button, .btn { width: 100%; }
}
