* { box-sizing: border-box; }

:root {
    --bg: #eef3f8;
    --ink: #132033;
    --muted: #6b7890;
    --line: rgba(148, 163, 184, .26);
    --panel: rgba(255,255,255,.9);
    --nav: #111827;
    --blue: #2563eb;
    --violet: #7c3aed;
    --teal: #0f766e;
    --amber: #d97706;
    --green: #16a34a;
    --red: #dc2626;
    --shadow: 0 24px 60px rgba(15, 23, 42, .13);
    --radius: 8px;
}

html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 16% 10%, rgba(37, 99, 235, .18), transparent 28rem),
        radial-gradient(circle at 88% 4%, rgba(15, 118, 110, .18), transparent 28rem),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(15,23,42,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15,23,42,.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.45), transparent 72%);
}

a { color: var(--blue); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; }

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

.login-card {
    width: min(470px, 100%);
    padding: 38px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.88));
    border: 1px solid rgba(255,255,255,.78);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 6px;
    background: linear-gradient(90deg, var(--teal), var(--blue), var(--violet), var(--amber));
}

.brand-mark, .side-brand span, .avatar {
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 900;
    background: linear-gradient(135deg, var(--teal), var(--blue), var(--violet));
    box-shadow: 0 14px 28px rgba(37, 99, 235, .25);
}

.brand-mark {
    width: 62px;
    height: 62px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    letter-spacing: .08em;
}

h1, h2 { margin: 0 0 12px; line-height: 1.08; letter-spacing: -.025em; }
h1 { font-size: clamp(32px, 5vw, 52px); }
h2 { font-size: 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow {
    margin: 0 0 8px;
    color: var(--teal);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

label {
    display: block;
    margin-top: 18px;
    color: #334155;
    font-size: 13px;
    font-weight: 850;
    text-transform: uppercase;
}

input, button {
    width: 100%;
    padding: 14px 15px;
    margin-top: 8px;
    border-radius: var(--radius);
    font-size: 15px;
}

input {
    border: 1px solid rgba(148, 163, 184, .65);
    background: rgba(255,255,255,.95);
    outline: none;
    transition: .18s ease;
}

input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .13);
    transform: translateY(-1px);
}

button, .map-button {
    border: 0;
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(135deg, var(--teal), var(--blue), var(--violet));
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(37, 99, 235, .25);
    transition: transform .18s ease, box-shadow .18s ease;
}

button:hover, .map-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 40px rgba(37, 99, 235, .30);
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    background:
        linear-gradient(180deg, rgba(15,118,110,.16), transparent),
        linear-gradient(180deg, #0b1220, #151c2f);
    color: #e5edff;
    box-shadow: 18px 0 44px rgba(15, 23, 42, .18);
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
    padding: 4px 8px;
}

.side-brand span {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
}

.side-brand strong { font-size: 19px; }

.sidebar a {
    display: flex;
    align-items: center;
    min-height: 44px;
    margin-bottom: 6px;
    padding: 0 13px;
    border-radius: var(--radius);
    color: #dbeafe;
    text-decoration: none;
    border: 1px solid transparent;
    transition: .18s ease;
}

.sidebar a:hover, .sidebar a.active {
    background: rgba(255,255,255,.11);
    border-color: rgba(255,255,255,.14);
    color: #fff;
    transform: translateX(3px);
}

.main {
    position: relative;
    z-index: 1;
    width: min(1180px, 100%);
    padding: 30px 26px 54px;
}

.page-hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
    padding: 28px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,250,252,.86));
    border: 1px solid rgba(255,255,255,.75);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.page-hero.vibrant {
    color: #fff;
    background:
        linear-gradient(135deg, rgba(255,255,255,.14), transparent),
        linear-gradient(135deg, #0f766e, #1d4ed8 52%, #7c3aed);
}
.page-hero.vibrant .eyebrow, .page-hero.vibrant p { color: #e0f2fe; }

.status-pill, .gps-ok, .gps-error, .gps-wait {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 9px 13px;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}
.status-pill { background: rgba(255,255,255,.18); color: #fff; }
.gps-ok { background: #dcfce7; color: #166534; }
.gps-error { background: #fee2e2; color: #991b1b; }
.gps-wait { background: #fef3c7; color: #92400e; }
.gps-ok::before, .gps-error::before, .gps-wait::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.cards, .live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.card, .panel, .live-card, .empty-state {
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid rgba(255,255,255,.8);
    box-shadow: 0 16px 36px rgba(15,23,42,.10);
    backdrop-filter: blur(10px);
}

.card {
    min-height: 142px;
    padding: 22px;
    color: #fff;
    position: relative;
    overflow: hidden;
    transition: .18s ease;
}
.card:hover { transform: translateY(-4px); text-decoration: none; box-shadow: var(--shadow); }
.card::after {
    content: "";
    position: absolute;
    width: 96px;
    height: 96px;
    right: -24px;
    bottom: -24px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
}
.card span { display: block; margin-bottom: 10px; color: rgba(255,255,255,.78); }
.card strong { display: block; max-width: 76%; font-size: 22px; line-height: 1.1; }
.gradient-a { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.gradient-b { background: linear-gradient(135deg, #2563eb, #06b6d4); }
.gradient-c { background: linear-gradient(135deg, #7c3aed, #2563eb); }
.gradient-d { background: linear-gradient(135deg, #b7791f, #ea580c); }

.panel {
    padding: 24px;
    margin-bottom: 18px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 13px;
    margin: 18px 0;
}
.timeline div {
    padding: 18px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff, #f8fafc);
    border: 1px solid var(--line);
    border-left: 5px solid var(--blue);
}
.timeline span { display: block; color: var(--muted); font-weight: 700; font-size: 13px; }
.timeline strong { display: block; margin-top: 8px; font-size: 26px; }

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

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}
table { width: 100%; min-width: 760px; border-collapse: collapse; background: #fff; }
th, td { padding: 14px 15px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #f8fafc; color: #475569; text-transform: uppercase; font-size: 12px; }
tr:hover td { background: #f8fbff; }

.live-card { padding: 16px; }
.live-top { display: flex; gap: 12px; align-items: center; margin-bottom: 13px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; }
.live-top h2 { margin-bottom: 3px; font-size: 20px; }
.live-top p { margin: 0; color: var(--muted); }
.map-preview {
    height: 230px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    background: #dbeafe;
}
.map-preview iframe { width: 100%; height: 100%; border: 0; }
.live-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0;
    color: var(--muted);
    font-size: 13px;
}
.map-button {
    display: block;
    padding: 12px;
    text-align: center;
}
.empty-state { grid-column: 1 / -1; padding: 28px; }

.alert {
    padding: 14px 15px;
    border-radius: var(--radius);
    margin: 13px 0;
    font-weight: 800;
}
.danger { background: #fee2e2; color: #991b1b; }
.success { background: #dcfce7; color: #166534; }

.ripple {
    position: absolute;
    border-radius: 999px;
    transform: scale(0);
    background: rgba(255,255,255,.45);
    animation: ripple .55s linear;
    pointer-events: none;
}

@keyframes ripple { to { transform: scale(4); opacity: 0; } }

@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .side-brand { width: 100%; margin-bottom: 8px; }
    .sidebar a { margin: 0; }
    .main { padding: 20px 14px 42px; }
    .page-hero, .panel-head { flex-direction: column; }
}

@media print {
    .sidebar, form, button { display: none !important; }
    body { background: #fff; }
    body::before { display: none; }
    .app-shell { display: block; }
    .main { width: 100%; padding: 0; }
    .panel { box-shadow: none; border: 0; }
}
