:root {
    --bg: #0b1020;
    --bg-elevated: #121a2f;
    --panel: #151f38;
    --border: rgba(255, 255, 255, 0.08);
    --text: #eef2ff;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.12), transparent 25%),
        var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }

.auth-page { display: grid; place-items: center; padding: 24px; }

.auth-card {
    width: min(100%, 420px);
    background: rgba(21, 31, 56, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

.brand { text-align: center; margin-bottom: 28px; }

.brand-icon {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(34, 197, 94, 0.18));
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.brand h1, .panel-header h1 { margin: 0 0 8px; font-size: 1.75rem; }
.brand p, .muted, .subtitle { color: var(--muted); }
.auth-hint { margin-top: 20px; font-size: 0.9rem; text-align: center; }
.auth-hint code { color: #93c5fd; }

.login-form, .settings-form, .gps-form { display: grid; gap: 16px; }
label { display: grid; gap: 8px; font-size: 0.95rem; }

input, button { font: inherit; }

input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(11, 16, 32, 0.85);
    color: var(--text);
}

input:focus {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    border-color: rgba(59, 130, 246, 0.6);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: rgba(255, 255, 255, 0.06); border-color: var(--border); color: var(--text); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-block { width: 100%; }

.topbar {
    border-bottom: 1px solid var(--border);
    background: rgba(11, 16, 32, 0.75);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar-inner, .container {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
}

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

.topbar-brand { display: flex; align-items: center; gap: 14px; }
.topbar-brand strong { display: block; font-size: 1.05rem; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.user-pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-size: 0.9rem;
}

.status-pill {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-pill-online {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

.status-pill-offline {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

.status-pill-partial {
    background: rgba(245, 158, 11, 0.15);
    color: #fde68a;
}

.container { padding: 28px 0 48px; }
.container-narrow { width: min(640px, calc(100% - 32px)); }

.panel {
    background: rgba(21, 31, 56, 0.88);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow);
    padding: 24px;
}

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

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

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 960px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}

.hidden { display: none !important; }

.phone-shell {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
}

.phone-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(100%, 380px);
    gap: 12px;
}

.phone-bezel {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 19.5;
    border-radius: 36px;
    padding: 14px;
    background: linear-gradient(160deg, #1f2937, #0f172a);
    border: 3px solid #334155;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.phone-bezel::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 8px;
    border-radius: 999px;
    background: #0b1020;
    z-index: 2;
}

.vnc-frame {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 24px;
    background: #000;
}

.vnc-placeholder {
    position: absolute;
    inset: 14px;
    display: grid;
    place-content: center;
    text-align: center;
    border-radius: 24px;
    background: rgba(11, 16, 32, 0.92);
    padding: 20px;
}

.vnc-placeholder.hidden { display: none; }

.gps-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

.gps-map {
    height: 320px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 16px;
    overflow: hidden;
}

.settings-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 0 0 16px;
}

.settings-section legend {
    padding: 0 8px;
    font-weight: 600;
}

.section-note { font-size: 0.9rem; margin: 0 0 12px; }

.app-launcher {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-app {
    font-size: 0.88rem;
    padding: 8px 12px;
}

.nav-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(11, 16, 32, 0.9);
    border: 1px solid var(--border);
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-nav:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.45);
}

.btn-nav-home {
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.25rem;
    justify-self: center;
}

.nav-extra {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-nav-sm {
    font-size: 0.85rem;
    padding: 8px 12px;
}
