:root {
    --primary: #005DB7;
    --primary-light: #E0F2FE;
    --secondary: #0F172A;
    --accent: #00D1FF;
    --bg-main: #F8FAFC;
    --bg-side: #FFFFFF;
    --text-main: #0F172A;
    --text-sub: #64748B;
    --border: #E2E8F0;
    --success: #10B981;
    --sidebar-w: 260px;
    --radius-l: 24px;
    --radius-m: 16px;
    --radius-s: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-main);
    background: var(--bg-main);
    overflow: hidden; /* Desktop app feel */
    height: 100vh;
}

/* Utils */
.hidden { display: none !important; }

/* Views */
#app {
    height: 100vh;
}

.auth-layout, .dash-layout {
    display: none;
    height: 100%;
}

.auth-layout.active { display: flex; }
.dash-layout.active { display: flex; }

/* --- AUTH SPLIT VIEW --- */
.auth-layout {
    background: white;
}

.auth-panel {
    flex: 0 0 440px;
    padding: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-brand {
    margin-bottom: 48px;
}

.cube {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 8px 16px rgba(0, 93, 183, 0.2);
}

.auth-brand h1 { font-size: 28px; font-weight: 800; }
.auth-brand span { font-size: 14px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 1px;}

.field { margin-bottom: 24px; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 8px; color: var(--text-sub); }
.field input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-s);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.login-trigger {
    width: 100%;
    padding: 16px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: var(--radius-s);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.login-trigger:hover { background: #000; transform: translateY(-1px); }

.alert {
    padding: 12px;
    background: #FEF2F2;
    color: var(--error);
    border-radius: var(--radius-s);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.auth-visual {
    flex: 1;
    background: var(--secondary);
    position: relative;
    padding: 80px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.bg-mesh {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: radial-gradient(circle at 50% 50%, #172B5C 0%, #0F172A 100%);
    opacity: 0.8;
}

.visual-content {
    position: relative;
    color: white;
    max-width: 500px;
}

.visual-content h2 { font-size: 42px; font-weight: 800; margin-bottom: 16px; line-height: 1.1; }
.visual-content p { font-size: 18px; color: #94A3B8; }

/* --- DASHBOARD LAYOUT --- */
.dash-layout {
    background: var(--bg-main);
}

.dash-sidebar {
    width: var(--sidebar-w);
    background: var(--bg-side);
    border-right: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 100;
}

.sidebar-top { flex: 1; }
.brand-logotype {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 8px;
}

.brand-logotype span { font-weight: 900; font-size: 20px; letter-spacing: -0.5px; }
.cube.mini { width: 32px; height: 32px; border-radius: 8px; margin: 0; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    border: none;
    background: transparent;
    padding: 12px 14px;
    border-radius: var(--radius-m);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.nav-item:hover { background: #F1F5F9; color: var(--text-main); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }

.sidebar-bottom {
    padding-top: 24px;
    border-top: 1.5px solid var(--border);
}

.sys-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-sub);
    font-weight: 700;
    margin-bottom: 16px;
    padding-left: 8px;
}

.status-pulse {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 4px #D1FAE5;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0px #D1FAE5; }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0px rgba(16, 185, 129, 0); }
}

.logout-trigger {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-s);
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-sub);
}

.logout-trigger:hover { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }

/* Main Content */
.dash-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.dash-header {
    height: 72px;
    background: var(--bg-side);
    border-bottom: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}

.header-left h2 { font-size: 20px; font-weight: 800; margin-bottom: 2px; }
.date-breadcrumb { font-size: 12px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; }

.admin-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px 6px 6px;
    background: #F1F5F9;
    border-radius: 99px;
}

.avatar { width: 32px; height: 32px; border-radius: 50%; background: white; }
.admin-info p { font-size: 13px; font-weight: 800; margin: 0; }
.admin-info span { font-size: 11px; font-weight: 700; color: var(--text-sub); }

.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
}

.page-content { display: none; }
.page-content.active { display: block; }

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-box {
    background: var(--bg-side);
    padding: 24px;
    border-radius: var(--radius-l);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-meta h3 { font-size: 13px; font-weight: 700; color: var(--text-sub); margin-bottom: 6px; }
.stat-meta p { font-size: 26px; font-weight: 800; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.cyan { background: #ECFEFF; }
.stat-icon.blue { background: #EFF6FF; }
.stat-icon.purple { background: #FAF5FF; }
.stat-icon.mesh { background: #F8FAFC; }

/* Mixed Layout Row */
.content-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.main-card {
    background: var(--bg-side);
    border-radius: var(--radius-l);
    border: 1.5px solid var(--border);
    padding: 24px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.card-head h3 { font-size: 16px; font-weight: 800; }

.map-placeholder {
    height: 300px;
    background: #F1F5F9;
    border-radius: var(--radius-m);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    font-weight: 700;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.btn-tool {
    padding: 6px 14px;
    background: #F1F5F9;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

/* Data Views */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.action-btn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-s);
    font-weight: 700;
    cursor: pointer;
}

.table-wrapper {
    background: var(--bg-side);
    border-radius: var(--radius-m);
    border: 1.5px solid var(--border);
    overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }
th { background: #F8FAFC; padding: 14px 24px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-sub); text-transform: uppercase; }
td { padding: 16px 24px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; }

/* Responsive adjustments */
@media (max-width: 1200px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .content-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .auth-visual { display: none; }
    .auth-panel { flex: 1; padding: 40px; }
    .dash-sidebar { position: fixed; transform: translateX(-100%); transition: transform 0.3s; }
}
