:root {
    --bg-main: #EFF7FB;
    --bg-panel: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-input: #F4FAFD;
    --navy-bar: #072540;
    --navy-deep: #051B30;
    --border: rgba(28, 163, 200, 0.36);
    --border-soft: #D4E6F1;
    --primary: #1B6FB8;
    --primary-hover: #145A99;
    --turquoise: #22C7D6;
    --turquoise-bright: #3CE2EC;
    --gold: #1B6FB8;
    --gold-hover: #145A99;
    --purple: #0E7490;
    --purple-soft: rgba(27, 111, 184, 0.09);
    --cyan: #0284C7;
    --text-main: #0A2540;
    --text-muted: #4B6B88;
    --success: #0D9488;
    --danger: #DC2626;
    --warning: #F59223;
    --banner-grad: linear-gradient(95deg, #165BAA 0%, #1CA3C8 55%, #37C9D6 100%);
    --summary-grad: linear-gradient(180deg, #DFF1FA 0%, #F5FBFF 100%);
    --shadow: 0 10px 28px rgba(10, 37, 64, 0.08);
}

body.dark-mode {
    --bg-main: #061325;
    --bg-panel: #0B1E36;
    --bg-card: #102847;
    --bg-input: #08182E;
    --navy-bar: #041020;
    --navy-deep: #030B17;
    --border: rgba(56, 228, 242, 0.32);
    --border-soft: rgba(255, 255, 255, 0.11);
    --primary: #2185D5;
    --primary-hover: #329AEF;
    --turquoise: #2AD4E3;
    --turquoise-bright: #53EEF9;
    --gold: #38E4F2;
    --gold-hover: #67F2FC;
    --purple: #22D3EE;
    --purple-soft: rgba(34, 211, 238, 0.13);
    --cyan: #38BDF8;
    --text-main: #F0F9FF;
    --text-muted: #93B4D1;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --banner-grad: linear-gradient(95deg, #0E488A 0%, #1582A8 55%, #1FBAC8 100%);
    --summary-grad: linear-gradient(180deg, #112D50 0%, #0C213B 100%);
    --shadow: 0 16px 38px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    transition: background 0.2s ease, color 0.2s ease;
}

.hidden { display: none !important; }

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top right, rgba(34, 199, 214, 0.22), transparent 48%),
                radial-gradient(circle at bottom left, rgba(22, 91, 170, 0.18), transparent 48%),
                var(--bg-main);
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: var(--bg-panel);
    border: 1.5px solid var(--border);
    border-radius: 24px;
    padding: 34px 28px;
    box-shadow: var(--shadow);
}

.brand-badge { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand-badge img { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 4px 14px rgba(22, 91, 170, 0.28); }
.brand-title { font-size: 1.48rem; font-weight: 900; letter-spacing: 0.3px; color: var(--text-main); }
.brand-title span { color: #199EC2; }
body.dark-mode .brand-title span { color: #3CE2EC; }
.brand-sub { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.84rem; font-weight: 700; margin-bottom: 6px; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border-soft);
    background: var(--bg-input);
    color: var(--text-main);
    font-size: 0.94rem;
    outline: none;
}
.form-control:focus { border-color: var(--turquoise); box-shadow: 0 0 0 3px rgba(34, 199, 214, 0.16); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    transition: transform 0.12s ease, opacity 0.15s ease;
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-gold {
    background: linear-gradient(135deg, #1762B0, #1EA7C9);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(23, 98, 176, 0.26);
}
.btn-full { width: 100%; border-radius: 13px; padding: 12px 18px; }
.btn-outline { background: var(--bg-panel); border: 1.5px solid var(--border); color: var(--text-main); }
.btn-danger { background: #DC2626; color: #FFFFFF; }
.btn-success { background: #0D9488; color: #FFFFFF; }
.btn-cyan { background: #0284C7; color: #FFFFFF; }
.btn-whatsapp { background: #16A34A; color: #FFFFFF; padding: 7px 13px; font-size: 0.8rem; }

.alert-box { padding: 11px 14px; border-radius: 12px; font-size: 0.86rem; font-weight: 600; margin-bottom: 14px; }
.alert-error { background: rgba(220, 38, 38, 0.12); border: 1px solid rgba(220, 38, 38, 0.35); color: #B91C1C; }
body.dark-mode .alert-error { color: #FCA5A5; }
.alert-ok { background: rgba(13, 148, 136, 0.13); border: 1px solid rgba(13, 148, 136, 0.38); color: #0F766E; }
body.dark-mode .alert-ok { color: #5EEAD4; }

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

.sidebar {
    background: var(--navy-bar);
    color: #F8FAFC;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
}
.sidebar .brand-title { color: #FFFFFF; }
.sidebar .brand-title span { color: #3CE2EC; }
.sidebar .brand-sub { color: #93C5FD; }

.nav-list { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.nav-btn {
    width: 100%;
    text-align: left;
    padding: 11px 14px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    color: #CBD5E1;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-btn:hover { background: rgba(56, 228, 242, 0.12); color: #FFFFFF; }
.nav-btn.active {
    background: linear-gradient(90deg, rgba(28, 163, 200, 0.32), rgba(56, 228, 242, 0.14));
    border-color: rgba(60, 226, 236, 0.45);
    color: #3CE2EC;
    font-weight: 800;
}

.sidebar-logout-btn {
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #FFFFFF;
}

.main-area { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-soft);
    padding: 12px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.55rem;
    cursor: pointer;
    padding: 2px 8px;
}

.bell-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    cursor: pointer;
    font-size: 1.08rem;
}
.bell-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #DC2626;
    color: #FFFFFF;
    font-size: 0.67rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.safe-pill, .architecture-badge {
    font-size: 0.76rem;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(28, 163, 200, 0.13);
    border: 1px solid rgba(28, 163, 200, 0.35);
    color: var(--primary);
    font-weight: 700;
}
body.dark-mode .safe-pill, body.dark-mode .architecture-badge { color: #3CE2EC; }

.content-wrap { padding: 20px 24px 96px; max-width: 1240px; width: 100%; margin: 0 auto; }

.mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 27, 48, 0.62);
    backdrop-filter: blur(3px);
    z-index: 120;
}

.bottom-app-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-soft);
    box-shadow: 0 -6px 22px rgba(7, 37, 64, 0.10);
    z-index: 90;
    justify-content: space-around;
    align-items: center;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.bnav-item {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.71rem;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 2px;
}
.bnav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.bnav-item.active { color: #1693B8; }
body.dark-mode .bnav-item.active { color: #3CE2EC; }

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: -295px;
        top: 0;
        width: 276px;
        height: 100vh;
        transition: left 0.24s ease;
        z-index: 130;
    }
    .sidebar.drawer-open { left: 0; }
    .mobile-menu-btn { display: inline-flex; }
    .desktop-only-pill { display: none !important; }
    .topbar { padding: 10px 14px; }
    .content-wrap { padding: 14px 14px 94px; }
    .bottom-app-nav { display: flex; }
}
