:root {
    --bg-0: #060a14;
    --bg-1: #0b1327;
    --bg-2: #121f3d;
    --panel: #101b33d9;
    --panel-strong: #0e1830f2;
    --line: #2a4472;
    --text: #ecf3ff;
    --muted: #9fb2d1;
    --accent: #35b8ff;
    --accent-2: #2bd8a3;
    --danger: #ff5470;
    --ok: #1ec98b;
}

/* Local replacements for utility classes previously coming from Tailwind CDN */
.text-slate-100 { color: #f1f5f9 !important; }
.text-slate-300 { color: #cbd5e1 !important; }
.text-slate-400 { color: #94a3b8 !important; }
.text-slate-500 { color: #64748b !important; }
.text-cyan-300 { color: #67e8f9 !important; }
.text-emerald-300 { color: #6ee7b7 !important; }
.text-orange-300 { color: #fdba74 !important; }

body.hes-bg {
    margin: 0;
    color: var(--text);
    font-family: "Poppins", "Trebuchet MS", sans-serif;
    background:
        radial-gradient(45rem 35rem at 8% 10%, #1893ff33, transparent 60%),
        radial-gradient(45rem 35rem at 92% 8%, #20d4a733, transparent 58%),
        linear-gradient(145deg, var(--bg-0) 0%, var(--bg-1) 55%, var(--bg-2) 100%);
}

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #0a1327f7, #091124f7);
    border-right: 1px solid #3150828a;
    box-shadow: 0 18px 36px #0000006e;
    transition: width 0.24s ease, transform 0.24s ease;
}

.brand-label {
    color: var(--text);
    font-size: 1.3rem;
    letter-spacing: 0.01em;
}

.side-group {
    display: grid;
    gap: 0.3rem;
}

.side-main {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 0.85rem;
    padding: 0.7rem 0.78rem;
    background: #14224157;
    color: #e4eeff;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 500;
    text-align: left;
    transition: all 0.16s ease;
}

.side-main:hover {
    border-color: #4c73af82;
    background: #1a315a80;
}

.side-main.active {
    border-color: #57cbff;
    background: linear-gradient(125deg, #34b9ff42, #2ad8a541);
    box-shadow: 0 0 0 3px #5bcfff2b;
}

.side-main.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.chev {
    color: #8fa9ce;
    font-size: 1.2rem;
    transition: transform 0.16s ease;
}

.chev.open {
    transform: rotate(90deg);
}

.side-icon {
    width: 1.2rem;
    text-align: center;
}

.side-icon i {
    font-size: 1.1rem;
}

.side-sub {
    display: grid;
    gap: 0.22rem;
    margin-left: 2rem;
    margin-bottom: 0.2rem;
}

.sub-link {
    color: #bed0ee;
    text-decoration: none;
    padding: 0.34rem 0.48rem;
    border-radius: 0.55rem;
    font-size: 0.93rem;
}

.sub-link:hover {
    background: #2647796e;
    color: #ffffff;
}

[x-cloak] {
    display: none !important;
}

.sidebar.compact {
    width: 72px;
}

.sidebar.compact .brand-label {
    font-size: 0;
}

.sidebar.compact .brand-label::after {
    content: "H";
    font-size: 1.15rem;
    color: #ffffff;
}

.sidebar.compact .side-main {
    justify-content: center;
    border-radius: 0;
    border: 0;
    border-bottom: 1px solid #ffffff14;
    min-height: 64px;
    background: transparent;
}

.sidebar.compact .side-main.active {
    background: #1f63df;
    box-shadow: none;
}

.sidebar.compact .chev,
.sidebar.compact .side-label,
.sidebar.compact .side-sub {
    display: none !important;
}

.sidebar.compact .side-icon {
    font-size: 1.6rem;
    width: auto;
}

.top-header {
    background: #0a1327e0;
    border-bottom: 1px solid #36578875;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1100;
}

.account-nav .btn,
.account-nav .badge {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
}

.account-nav .btn-outline-info {
    border-color: #5ecbff;
    color: #b8e7ff;
}

.account-nav .btn-outline-light {
    border-color: #8ea7cb;
    color: #f4f8ff;
}

.account-nav .dropdown-menu {
    background: #0f1a32;
    border: 1px solid #3a5d93;
    min-width: 220px;
    z-index: 1200;
}

.account-nav .dropdown-item-text {
    color: #eaf3ff;
}

.account-nav .dropdown-item {
    color: #cfe1ff;
}

.account-nav .dropdown-item:hover,
.account-nav .dropdown-item:focus {
    color: #ffffff;
    background: #1a2c4f;
}

.account-nav .dropdown-divider {
    border-color: #31507f;
}

.panel-card,
.metric-card,
.auth-shell {
    background: linear-gradient(180deg, #101c35d6, #0f1a32d6);
    border: 1px solid #3557899e;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 12px 28px #0000003d;
}

.panel-card {
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.panel-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px #0000004a;
}

.metric-card {
    min-height: 142px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.metric-label {
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    color: #a9c1e3;
}

.metric-value {
    font-size: clamp(1.55rem, 2.7vw, 2.2rem);
    font-weight: 700;
    margin: 0.3rem 0;
}

.metric-sub {
    color: var(--muted);
    font-size: 0.85rem;
}

.bg-hes-panel-soft {
    background: #193058a8;
}

.border-hes-line {
    border-color: #4068a58a !important;
}

.table-dark {
    --bs-table-bg: #101b33db;
    --bs-table-striped-bg: #19315bc2;
    --bs-table-hover-bg: #24457ecf;
    --bs-table-border-color: #37598aa8;
}

.table-frame {
    border: 1px solid #3a5d93;
    border-radius: 0.75rem;
    padding: 0.6rem;
    background: #0f1b33d0;
    box-shadow: inset 0 0 0 1px #223a63;
}

.form-control,
.form-select,
.modern-search .input-group-text {
    background: #132544eb;
    border-color: #4a72ac;
    color: #edf4ff;
}

.form-control::placeholder {
    color: #93aacb;
}

.form-control:focus,
.form-select:focus {
    border-color: #62d0ff;
    box-shadow: 0 0 0 0.2rem #60d3ff33;
    background: #152a4ced;
    color: #ffffff;
}

.btn-info {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    border: 0;
    color: #03253f !important;
    font-weight: 700;
}

.btn-info:hover {
    filter: brightness(1.05);
}

.auth-shell {
    width: min(980px, 95vw);
    overflow: hidden;
}

.auth-left {
    background: linear-gradient(160deg, #172a4df0, #12213ff0);
}

.auth-right {
    background: #101d38f0;
}

.auth-copy {
    color: #b8cceb;
}

.auth-shell form p {
    margin: 0;
}

.auth-shell form p label {
    display: block;
    margin-bottom: 0.35rem;
    color: #d6e5ff;
    font-size: 0.9rem;
}

.auth-shell form input:not([type="checkbox"]) {
    width: 100%;
    background: #132545f0;
    border: 1px solid #4a72ac;
    color: #f2f7ff;
    border-radius: 0.75rem;
    padding: 0.65rem 0.75rem;
}

.password-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-shell form ul,
.auth-shell form .helptext {
    color: #a6bde0;
    font-size: 0.8rem;
}

.chart-wrap {
    position: relative;
    height: 260px;
    max-height: 260px;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.profile-check {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid #4068a5a1;
    border-radius: 0.7rem;
    padding: 0.55rem 0.7rem;
    background: #1b3159bf;
}

.profile-check input {
    accent-color: #10b981;
}

.form-check-input {
    appearance: auto;
    width: 1rem;
    height: 1rem;
    border: 1px solid #7fa1cf;
    background-color: #102447;
}

.form-check-input:checked {
    accent-color: #35b8ff;
    background-color: #35b8ff;
    border-color: #35b8ff;
}

.event-expand {
    border-left: 2px solid #10b98166;
    padding-left: 0.8rem;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1050;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }
}

@media (min-width: 992px) {
    .sidebar.compact + .flex-grow-1 {
        width: calc(100% - 72px);
    }
}

.app-footer {
    background: #0b1630cc;
    margin-top: auto;
}

.footer-links a {
    color: #b7ceed;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: #ffffff;
}

.content-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

html.theme-light body.hes-bg {
    color: #0f1f38;
    background:
        radial-gradient(35rem 25rem at 12% 8%, #8ac9ff44, transparent 60%),
        radial-gradient(35rem 25rem at 88% 10%, #89e1cb4a, transparent 58%),
        linear-gradient(145deg, #f5f9ff 0%, #ecf3ff 100%);
}

html.theme-light .top-header {
    background: #f4f8ffea;
    border-bottom-color: #b6caea !important;
}

html.theme-light .sidebar {
    background: linear-gradient(180deg, #edf4ff, #e6efff);
    border-right-color: #b6caea !important;
}

html.theme-light .side-main {
    background: #d8e7ff;
    color: #17325a;
}

html.theme-light .side-main:hover {
    background: #cfe1ff;
}

html.theme-light .side-main.active {
    border-color: #2f7dd6;
    background: linear-gradient(125deg, #79b8ff4f, #7cd8c24a);
}

html.theme-light .sub-link {
    color: #20426f;
}

html.theme-light .sub-link:hover {
    background: #c1d8fb;
    color: #0f2746;
}

html.theme-light .panel-card,
html.theme-light .metric-card,
html.theme-light .auth-shell {
    background: linear-gradient(180deg, #f9fbff, #edf3ff);
    border-color: #b4cbed;
    color: #112746;
}

html.theme-light .metric-label,
html.theme-light .metric-sub,
html.theme-light .auth-copy,
html.theme-light .text-secondary,
html.theme-light .text-secondary-emphasis {
    color: #4b678d !important;
}

html.theme-light .table-dark {
    --bs-table-bg: #f6f9ff;
    --bs-table-striped-bg: #eaf2ff;
    --bs-table-hover-bg: #dbe9ff;
    --bs-table-color: #132a49;
    --bs-table-border-color: #b6caea;
}

html.theme-light .form-control,
html.theme-light .form-select,
html.theme-light .modern-search .input-group-text {
    background: #ffffff;
    color: #142847;
    border-color: #9db8df;
}

html.theme-light .account-nav .btn-outline-light {
    color: #13335d;
    border-color: #8eadd8;
}

html.theme-light .account-nav .btn-outline-info {
    color: #0b6dc7;
    border-color: #47a8ff;
}

html.theme-light .account-nav .dropdown-menu {
    background: #ffffff;
    border-color: #9db8df;
}

html.theme-light .account-nav .dropdown-item,
html.theme-light .account-nav .dropdown-item-text {
    color: #17335b;
}

html.theme-light .app-footer {
    background: #eaf2ff;
}

html.theme-light .footer-links a {
    color: #22538f;
}

html.theme-light .footer-links a:hover {
    color: #10325d;
}
