:root {
    --bg: #081120;
    --bg-soft: #0f1b32;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-strong: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #dbe5f1;
    --line-strong: #c9d7e8;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --soft: #f8fbff;
    --soft-blue: #eef4ff;
    --shadow-lg: 0 30px 80px rgba(8, 17, 32, 0.12);
    --shadow-md: 0 18px 40px rgba(8, 17, 32, 0.08);
    --radius-xl: 26px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 35%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 28%),
        linear-gradient(180deg, #f6f9ff 0%, #edf4ff 100%);
    min-height: 100vh;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
}

a:hover { text-decoration: none; }

h1, h2, h3 {
    letter-spacing: -0.03em;
    line-height: 1.08;
}

p { line-height: 1.6; }

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 22px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 18px 0;
    background: rgba(8, 17, 32, 0.84);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 12px 40px rgba(8, 17, 32, 0.18);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-weight: 900;
    font-size: 1.12rem;
    text-decoration: none;
}

.brand::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    box-shadow: 0 0 0 6px rgba(96, 165, 250, 0.18);
}

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

.nav a {
    color: rgba(255,255,255,0.74);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 999px;
    transition: .18s ease;
    font-weight: 600;
}

.nav a.active,
.nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.page {
    padding: 28px 22px 72px;
}

.hero,
.card,
.login-card {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 28px;
    background:
        radial-gradient(circle at top right, rgba(59,130,246,0.10), transparent 35%),
        linear-gradient(145deg, rgba(255,255,255,0.96), rgba(246,250,255,0.94));
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -80px -80px auto;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(37,99,235,0.08), transparent 65%);
    pointer-events: none;
}

.card {
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.grid {
    display: grid;
    gap: 18px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.kpi {
    margin-top: 12px;
    font-size: clamp(2rem, 4vw, 2.6rem);
    font-weight: 900;
    letter-spacing: -0.05em;
}

.muted { color: var(--muted); }
.small { font-size: .92rem; }

.role-chip,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: .84rem;
    font-weight: 700;
    line-height: 1;
    background: #e8f0ff;
    color: #1d4ed8;
    border: 1px solid rgba(37,99,235,0.14);
}

.role-chip::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    opacity: .72;
}

.badge.status-delivered { background: #dcfce7; color: #166534; border-color: rgba(22,101,52,0.12); }
.badge.status-en_route,
.badge.status-arrived,
.badge.status-in_progress { background: #dbeafe; color: #1d4ed8; border-color: rgba(37,99,235,0.12); }
.badge.status-canceled,
.badge.status-blocked,
.badge.status-absent { background: #fee2e2; color: #991b1b; border-color: rgba(153,27,27,0.12); }
.badge.status-planned,
.badge.status-assigned,
.badge.status-new,
.badge.status-postponed { background: #fff5d9; color: #9a6700; border-color: rgba(154,103,0,0.12); }

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

th, td {
    text-align: left;
    padding: 15px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: linear-gradient(180deg, #fbfdff, #f4f8ff);
    font-size: .84rem;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #475569;
}

tbody tr {
    transition: background-color .15s ease, transform .15s ease;
}

tbody tr:hover {
    background: #fafcff;
}

tbody tr:last-child td { border-bottom: 0; }

form {
    display: grid;
    gap: 18px;
}

.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
    display: grid;
    gap: 8px;
    font-size: .94rem;
    font-weight: 700;
    color: #1e293b;
}

input, select, textarea, button {
    font: inherit;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
    color: var(--text);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(37,99,235,0.42);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.10);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 11px 16px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 12px 22px rgba(37,99,235,0.18);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
    box-shadow: 0 16px 26px rgba(37,99,235,0.22);
}

button:active,
.btn:active { transform: translateY(0); }

.btn-secondary {
    background: linear-gradient(135deg, #334155, #1f2937);
    box-shadow: 0 12px 22px rgba(31, 41, 55, 0.18);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 12px 22px rgba(22, 163, 74, 0.18);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 12px 22px rgba(217, 119, 6, 0.18);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 12px 22px rgba(220, 38, 38, 0.18);
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-weight: 700;
}

.alert-success { background: #dcfce7; color: #166534; border-color: rgba(22,101,52,0.10); }
.alert-warning { background: #fff5d9; color: #92400e; border-color: rgba(146,64,14,0.10); }
.alert-danger { background: #fee2e2; color: #991b1b; border-color: rgba(153,27,27,0.10); }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions form {
    display: inline-flex;
    gap: 0;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-wrap {
    width: 100%;
    max-width: 1120px;
    display: grid;
    grid-template-columns: minmax(300px, 1.1fr) minmax(360px, .9fr);
    gap: 24px;
    align-items: stretch;
}

.login-showcase {
    padding: 34px;
    border-radius: 28px;
    color: #fff;
    background:
        radial-gradient(circle at top right, rgba(125, 211, 252, 0.24), transparent 28%),
        linear-gradient(145deg, #081120 0%, #0f1f3d 100%);
    box-shadow: 0 30px 70px rgba(8, 17, 32, 0.28);
    display: grid;
    gap: 22px;
}

.login-showcase h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
}

.login-bullets {
    display: grid;
    gap: 12px;
}

.login-bullet {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 14px;
    align-items: start;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
}

.login-bullet-dot {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-weight: 900;
    background: rgba(96,165,250,0.16);
    color: #bfdbfe;
}

.login-card {
    width: 100%;
    padding: 30px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.login-card h2 {
    margin: 10px 0 6px;
    font-size: 2rem;
}

.footer {
    padding: 10px 0 38px;
    color: #64748b;
    text-align: center;
}

.driver-list {
    display: grid;
    gap: 14px;
}

.driver-card {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border-radius: 20px;
    border: 1px solid var(--line);
    padding: 20px;
    box-shadow: 0 16px 28px rgba(8, 17, 32, 0.06);
}

.driver-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    border-radius: 20px 0 0 20px;
    background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.driver-card h3 {
    margin: 10px 0 8px;
    font-size: 1.2rem;
}

.driver-meta {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
}

hr.soft {
    border: 0;
    height: 1px;
    background: var(--line);
    margin: 14px 0;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.metric-grid .card {
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,251,255,0.94));
}

.metric-grid .card .muted {
    font-weight: 700;
    font-size: .92rem;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.checkbox-inline input {
    width: auto;
    transform: translateY(1px);
}

.text-right { text-align: right; }

@media (max-width: 980px) {
    .login-wrap {
        grid-template-columns: 1fr;
    }

    .login-showcase {
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .container { padding: 0 16px; }
    .page { padding: 20px 16px 56px; }
    .topbar { position: static; }
    .topbar-inner { align-items: flex-start; }
    .hero, .card, .login-card { padding: 20px; }
    .actions { flex-direction: column; align-items: stretch !important; }
    .actions form { display: flex; width: 100%; }
    button, .btn { width: 100%; }
    .driver-card::before { width: 4px; }
    th, td { padding: 12px 10px; }
}


.modal-open {
    overflow: hidden;
}

.hidden {
    display: none !important;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(8, 17, 32, 0.46);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-card {
    width: min(100%, 560px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 32px 80px rgba(8, 17, 32, 0.24);
}

.btn-icon {
    min-width: 46px;
    width: 46px;
    padding-left: 0;
    padding-right: 0;
}

@media (max-width: 768px) {
    .modal-card {
        padding: 18px;
        border-radius: 20px;
    }
}

.modal-card-lg {
    width: min(100%, 860px);
}

.upload-block {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px dashed var(--line-strong);
    border-radius: 18px;
    background: #fbfdff;
}

.upload-preview,
.proof-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mini-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eef4ff;
    color: #1d4ed8;
    font-size: .82rem;
    font-weight: 700;
    border: 1px solid rgba(37, 99, 235, 0.12);
}

.signature-wrap {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

#signature-canvas {
    width: 100%;
    max-width: 100%;
    height: 220px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--line-strong);
    touch-action: none;
    cursor: crosshair;
}

.proof-frame {
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    min-height: 220px;
    display: grid;
    place-items: center;
}

.proof-frame img {
    display: block;
    width: 100%;
    max-height: 460px;
    object-fit: contain;
    background: #fff;
}


.panel-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.panel-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    background: linear-gradient(180deg, #fff, #fbfdff);
}

.stat-stack {
    display: grid;
    gap: 10px;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.toolbar > * {
    flex: 1 1 180px;
}

.empty-state {
    padding: 22px;
    border: 1px dashed var(--line-strong);
    border-radius: 18px;
    background: #fbfdff;
}

.list-clean {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.list-clean li {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
}

.table-meta {
    display: grid;
    gap: 4px;
}

.status-open { background: #fee2e2; color: #991b1b; border-color: rgba(153,27,27,0.12); }
.status-resolved { background: #dcfce7; color: #166534; border-color: rgba(22,101,52,0.12); }
.status-closed { background: #e2e8f0; color: #334155; border-color: rgba(51,65,85,0.12); }

.metric-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.metric-pill {
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--line);
    min-width: 150px;
}

.metric-pill strong {
    display: block;
    font-size: 1.2rem;
    margin-top: 6px;
}

@media (max-width: 768px) {
    .toolbar > * { flex-basis: 100%; }
}
