:root {
    --surface: rgba(255, 251, 245, 0.78);
    --surface-strong: #fffaf1;
    --ink: #1f1d1a;
    --muted: #635c52;
    --accent: #c65d2e;
    --teal: #0f6c72;
    --line: rgba(31, 29, 26, 0.08);
    --shadow: 0 24px 60px rgba(82, 54, 30, 0.12);
    --radius-xl: 28px;
    --radius-lg: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(198, 93, 46, 0.18), transparent 28%),
        radial-gradient(circle at 85% 15%, rgba(15, 108, 114, 0.16), transparent 22%),
        linear-gradient(180deg, #f8f2ea 0%, #f4efe6 55%, #efe7da 100%);
}

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

button,
input,
select {
    font: inherit;
}

.page-shell,
.auth-shell,
.dashboard-shell,
.map-shell {
    width: min(1240px, calc(100% - 32px));
    margin: 20px auto 48px;
}

.hero,
.section-block,
.reports-panel,
.alert-panel,
.auth-panel,
.sidebar-card,
.module-panel,
.detail-focus,
.pipeline-card,
.map-header,
.map-sidebar,
.map-stage,
.event-panel {
    backdrop-filter: blur(18px);
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--shadow);
    border-radius: 32px;
}

.hero,
.section-block,
.map-header,
.map-sidebar,
.map-stage,
.event-panel,
.sidebar-card,
.module-panel,
.detail-focus,
.pipeline-card,
.auth-panel {
    padding: 24px;
}

.topbar,
.hero-grid,
.split-block,
.auth-shell,
.dashboard-shell,
.dashboard-content,
.map-layout {
    display: grid;
    gap: 20px;
}

.topbar {
    grid-template-columns: 1fr auto;
    align-items: center;
    margin-bottom: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), #f2b78e);
    color: white;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
}

h1,
h2,
h3,
h4,
.brand h1 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
}

.eyebrow,
.mini-title {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.73rem;
    color: var(--muted);
    margin: 0 0 8px;
}

.topbar-actions,
.hero-actions,
.role-switcher,
.map-toolbar,
.quick-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.status-pill,
.ghost-link,
.role-chip,
.report-tags span,
.alert-grid article,
.sidebar-links a,
.vehicle-list-card {
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.7);
}

.ghost-link,
.sidebar-links a,
.link-button {
    padding: 11px 16px;
}

.compact-link {
    display: inline-flex;
    margin-bottom: 20px;
}

.hero-grid {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: stretch;
}

.hero-copy h2 {
    font-size: clamp(2.2rem, 5vw, 4.4rem);
    line-height: 0.98;
    max-width: 11ch;
    margin-bottom: 16px;
}

.hero-text,
.stack-list article span,
.login-card p,
.sidebar-note span,
.vehicle-list-card span,
.event-list,
#detail-description {
    color: var(--muted);
    line-height: 1.7;
}

.primary-button,
.secondary-button,
.link-button {
    border: 0;
    cursor: pointer;
    border-radius: 999px;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-button,
.secondary-button {
    padding: 14px 22px;
}

.primary-button,
.link-button.primary-button {
    background: var(--accent);
    color: white;
    box-shadow: 0 14px 30px rgba(198, 93, 46, 0.3);
}

.secondary-button {
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink);
    border: 1px solid var(--line);
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-button:hover,
.secondary-button:hover,
.role-chip:hover,
.module-item:hover,
.sidebar-links a:hover,
.link-button:hover {
    transform: translateY(-2px);
}

.hero-metrics,
.live-stats,
.architecture-grid,
.report-tags,
.alert-grid,
.detail-panels,
.kpi-grid,
.pipeline-steps,
.stack-list,
.role-cards {
    display: grid;
    gap: 14px;
}

.hero-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.architecture-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-block { grid-template-columns: 1.1fr 0.9fr; }

.hero-metrics article,
.stack-list article,
.role-cards article,
.pipeline-steps div,
.live-stats div {
    padding: 16px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.hero-metrics strong,
.live-stats strong {
    display: block;
    font-size: 1.8rem;
    font-family: "Space Grotesk", sans-serif;
}

.panel-card,
.reports-panel,
.alert-panel {
    background: var(--surface-strong);
    padding: 20px;
    border-radius: var(--radius-xl);
}

.quick-links {
    flex-direction: column;
    align-items: stretch;
}

.quick-links a {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: white;
}

.arch-card {
    padding: 22px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,248,240,0.82));
}

.arch-card span {
    color: var(--accent);
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
}

.auth-shell {
    grid-template-columns: 1fr 0.92fr;
    min-height: calc(100vh - 68px);
    align-items: stretch;
}

.auth-body,
.dashboard-body,
.map-body {
    min-height: 100vh;
}

.auth-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-copy h1 {
    font-size: clamp(2.2rem, 4vw, 4rem);
    max-width: 12ch;
    margin-bottom: 16px;
}

.auth-form-panel {
    display: grid;
    place-items: center;
}

.login-card {
    width: min(100%, 430px);
    padding: 28px;
    background: rgba(255, 255, 255, 0.82);
    border-radius: 28px;
    border: 1px solid rgba(31, 29, 26, 0.08);
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.login-form label {
    display: grid;
    gap: 8px;
}

.login-form input,
.login-form select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(31, 29, 26, 0.12);
    background: rgba(255, 255, 255, 0.94);
}

.checkbox-row {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.full-width {
    width: 100%;
}

.login-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    font-size: 0.92rem;
}

.form-error {
    margin: 14px 0 0;
    color: #b42318;
    font-weight: 600;
}

.login-hint {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid var(--line);
    color: var(--muted);
}

.dashboard-shell {
    grid-template-columns: 290px 1fr;
}

.sidebar-brand {
    margin-bottom: 24px;
}

.sidebar-links {
    display: grid;
    gap: 10px;
}

.sidebar-links a.active {
    background: var(--ink);
    color: white;
}

.sidebar-note {
    margin-top: 26px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.66);
}

.dashboard-top {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 18px;
}

.role-chip {
    padding: 12px 18px;
    cursor: pointer;
}

.role-chip.active {
    background: var(--ink);
    color: white;
    border-color: transparent;
}

.role-chip:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 20px;
}

.kpi-card,
.module-item,
.detail-card,
.vehicle-list-card {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
}

.kpi-card strong {
    display: block;
    font-size: 2rem;
    font-family: "Space Grotesk", sans-serif;
}

.dashboard-content {
    grid-template-columns: 360px 1fr;
}

.module-list {
    display: grid;
    gap: 12px;
}

.module-item {
    text-align: left;
    cursor: pointer;
}

.module-item.active {
    border-color: rgba(198, 93, 46, 0.38);
    box-shadow: 0 16px 30px rgba(198, 93, 46, 0.12);
}

.module-item strong,
.vehicle-list-card strong {
    display: block;
}

.detail-stack {
    display: grid;
    gap: 20px;
}

.detail-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pipeline-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pipeline-steps strong {
    display: block;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.4rem;
}

.admin-forms-grid,
.admin-lists-grid {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.admin-forms-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-lists-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-form-card {
    display: grid;
    gap: 10px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
}

.admin-form-card input,
.admin-form-card select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(31, 29, 26, 0.12);
    background: white;
}

.admin-workspace ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.7;
}

.map-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    margin-bottom: 20px;
}

.map-layout {
    grid-template-columns: 300px 1fr 320px;
}

.map-sidebar,
.event-panel {
    display: grid;
    gap: 16px;
    align-content: start;
}

.vehicle-stream {
    display: grid;
    gap: 12px;
}

.vehicle-list-card {
    border-radius: 20px;
}

.vehicle-list-card.active {
    background: linear-gradient(180deg, rgba(198, 93, 46, 0.16), rgba(255,255,255,0.92));
}

.map-stage {
    display: grid;
    gap: 16px;
}

.map-canvas {
    position: relative;
    min-height: 620px;
    border-radius: 28px;
    overflow: hidden;
    background:
        linear-gradient(rgba(15, 108, 114, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 108, 114, 0.08) 1px, transparent 1px),
        linear-gradient(160deg, #e2efe7 0%, #d8e8e4 48%, #ebdfcf 100%);
    background-size: 40px 40px, 40px 40px, auto;
}

.map-radar {
    position: absolute;
    inset: 18% auto auto 22%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 108, 114, 0.24), transparent 65%);
    animation: pulse 4s infinite;
}

.map-radar.large {
    width: 220px;
    height: 220px;
    inset: 24% auto auto 34%;
}

.vehicle-chip {
    position: absolute;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.chip-a { top: 18%; right: 18%; }
.chip-b { bottom: 18%; left: 14%; }
.chip-c { bottom: 22%; right: 10%; }
.chip-d { top: 44%; left: 18%; }

.event-list {
    margin: 0;
    padding-left: 18px;
}

code {
    font-family: Consolas, monospace;
}

@keyframes pulse {
    0% { transform: scale(0.92); opacity: 0.45; }
    50% { transform: scale(1.04); opacity: 0.9; }
    100% { transform: scale(0.92); opacity: 0.45; }
}

@media (max-width: 1100px) {
    .hero-grid,
    .split-block,
    .auth-shell,
    .dashboard-shell,
    .dashboard-content,
    .map-layout,
    .architecture-grid,
    .pipeline-steps,
    .kpi-grid,
    .admin-forms-grid,
    .admin-lists-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .page-shell,
    .auth-shell,
    .dashboard-shell,
    .map-shell {
        width: min(100% - 20px, 100%);
        margin: 10px auto 28px;
    }

    .hero,
    .section-block,
    .auth-panel,
    .sidebar-card,
    .module-panel,
    .detail-focus,
    .pipeline-card,
    .map-header,
    .map-sidebar,
    .map-stage,
    .event-panel {
        padding: 18px;
        border-radius: 24px;
    }

    .topbar,
    .dashboard-top,
    .map-header,
    .detail-panels,
    .hero-metrics,
    .alert-grid {
        grid-template-columns: 1fr;
    }

    .hero-copy h2,
    .auth-copy h1 {
        max-width: none;
        font-size: 2.5rem;
    }

    .map-canvas {
        min-height: 360px;
    }

    .login-footer {
        flex-direction: column;
    }
}
