:root {
    --brand-orange: #ED4F18;
    --brand-orange-dark: #cf3f0f;
    --brand-dark: #283948;
    --brand-darker: #1b2935;
    --shell-bg: #f3f5f8;
    --shell-card: #ffffff;
    --shell-border: #e5e9ef;
    --shell-text: #1e2935;
    --shell-muted: #7a8793;
    --sidebar-width: 276px;
    --topbar-height: 84px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body.system-body {
    margin: 0;
    background: var(--shell-bg);
    color: var(--shell-text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.system-shell { min-height: 100vh; }

.system-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    padding: 22px 17px 18px;
    color: #fff;
    background:
        radial-gradient(circle at 18% 5%, rgba(237,79,24,.24), transparent 27%),
        linear-gradient(180deg, #2d4050 0%, #22323f 48%, #192630 100%);
    border-right: 1px solid rgba(255,255,255,.06);
    box-shadow: 18px 0 45px rgba(26,39,50,.12);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    min-height: 62px;
    gap: 13px;
    padding: 5px 8px 20px;
    border-bottom: 1px solid rgba(255,255,255,.09);
}

.brand-mark {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 9px 24px rgba(0,0,0,.22);
}

.brand-mark img { width: 100%; height: 100%; object-fit: contain; }

.brand-fallback {
    width: 100%;
    height: 100%;
    display: none;
    place-items: center;
    color: #fff;
    font-size: 22px;
    background: var(--brand-orange);
}

.brand-copy { min-width: 0; }
.brand-copy strong {
    display: block;
    font-size: 18px;
    line-height: 1.1;
    letter-spacing: -.35px;
}
.brand-copy span {
    display: block;
    margin-top: 5px;
    color: rgba(255,255,255,.58);
    font-size: 11px;
    letter-spacing: .45px;
    text-transform: uppercase;
}

.sidebar-close {
    margin-left: auto;
    color: #fff;
    border: 0;
    background: transparent;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 19px 0;
    scrollbar-width: thin;
}

.nav-section-label {
    padding: 13px 13px 8px;
    color: rgba(255,255,255,.38);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.35px;
    text-transform: uppercase;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 48px;
    gap: 12px;
    margin: 4px 0;
    padding: 8px 12px;
    color: rgba(255,255,255,.72);
    border: 1px solid transparent;
    border-radius: 13px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
    transition: .18s ease;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,.075);
    transform: translateX(2px);
}

.sidebar-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(237,79,24,.98), rgba(218,59,5,.95));
    border-color: rgba(255,255,255,.12);
    box-shadow: 0 10px 24px rgba(237,79,24,.23);
}

.nav-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: rgba(255,255,255,.82);
    background: rgba(255,255,255,.08);
}

.sidebar-link.active .nav-icon { background: rgba(255,255,255,.18); }

.nav-pulse {
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-radius: 50%;
    background: #ffb08f;
    box-shadow: 0 0 0 5px rgba(237,79,24,.15);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 10px;
    border: 1px solid rgba(255,255,255,.085);
    border-radius: 16px;
    background: rgba(255,255,255,.055);
}

.user-avatar {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: var(--brand-orange);
    font-size: 15px;
    font-weight: 800;
}

.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta span {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.user-meta strong { font-size: 13px; }
.user-meta span { margin-top: 2px; color: rgba(255,255,255,.5); font-size: 11px; }

.logout-button {
    width: 33px;
    height: 33px;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.68);
    border: 0;
    border-radius: 10px;
    background: transparent;
    transition: .18s ease;
}
.logout-button:hover { color: #fff; background: rgba(255,255,255,.1); }

.system-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.system-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 15px 30px;
    border-bottom: 1px solid rgba(211,217,225,.84);
    background: rgba(247,249,251,.88);
    backdrop-filter: blur(18px);
}

.topbar-left { display: flex; align-items: center; gap: 13px; }
.topbar-eyebrow {
    margin-bottom: 3px;
    color: var(--brand-orange);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 1.15px;
    text-transform: uppercase;
}
.system-topbar h1 {
    margin: 0;
    color: var(--brand-dark);
    font-size: 22px;
    font-weight: 780;
    letter-spacing: -.45px;
}

.mobile-menu-button {
    width: 42px;
    height: 42px;
    display: none;
    place-items: center;
    border: 1px solid var(--shell-border);
    border-radius: 12px;
    color: var(--brand-dark);
    background: #fff;
    font-size: 22px;
}

.topbar-right { display: flex; align-items: center; gap: 14px; }
.system-state, .topbar-date {
    display: flex;
    align-items: center;
    min-height: 37px;
    padding: 0 13px;
    border: 1px solid var(--shell-border);
    border-radius: 11px;
    color: #63717e;
    background: #fff;
    font-size: 12px;
    font-weight: 650;
}
.system-state span {
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: #28b36a;
    box-shadow: 0 0 0 4px rgba(40,179,106,.12);
}

.system-content {
    width: 100%;
    flex: 1;
    padding: 0 12px 30px;
}

/* Existing uploaded views already contain Bootstrap containers. */
.system-content > .container,
.system-content > .container-fluid {
    max-width: 100%;
}

.system-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 17px 30px 22px;
    color: #8b96a0;
    font-size: 11px;
}

.sidebar-overlay { display: none; }

/* Login */
.auth-layout {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 18% 20%, rgba(237,79,24,.21), transparent 27%),
        radial-gradient(circle at 85% 80%, rgba(61,88,108,.28), transparent 31%),
        linear-gradient(135deg, #1b2935, #2d4354);
}

.login-shell {
    width: min(980px, 100%);
    min-height: 590px;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 32px 80px rgba(4,13,20,.34);
}

.login-visual {
    position: relative;
    overflow: hidden;
    padding: 48px;
    color: #fff;
    background:
        linear-gradient(160deg, rgba(40,57,72,.86), rgba(20,31,40,.96)),
        url('/images/login-cover.jpg') center/cover;
}

.login-visual::after {
    content: "";
    position: absolute;
    right: -90px;
    bottom: -100px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(237,79,24,.18);
    filter: blur(4px);
}

.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand-mark {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--brand-orange);
    font-size: 20px;
}
.login-brand strong { display: block; font-size: 17px; }
.login-brand span { color: rgba(255,255,255,.56); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }

.login-message { position: absolute; left: 48px; right: 48px; bottom: 50px; z-index: 1; }
.login-message .label {
    display: inline-flex;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.login-message h1 { max-width: 430px; margin: 18px 0 12px; font-size: 38px; line-height: 1.08; letter-spacing: -1.5px; }
.login-message p { max-width: 390px; margin: 0; color: rgba(255,255,255,.63); line-height: 1.7; font-size: 13px; }

.login-panel { display: flex; align-items: center; padding: 52px; }
.login-panel-inner { width: 100%; }
.login-panel h2 { margin: 0 0 7px; color: var(--brand-dark); font-size: 28px; letter-spacing: -.8px; }
.login-panel .subtitle { margin-bottom: 31px; color: #89939c; font-size: 13px; }

.login-field { margin-bottom: 17px; }
.login-field label { margin-bottom: 7px; color: #465461; font-size: 12px; font-weight: 750; }
.input-wrap { position: relative; }
.input-wrap > i {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 2;
    color: #9aa4ad;
    transform: translateY(-50%);
}
.login-control {
    width: 100%;
    height: 49px;
    padding: 0 43px;
    border: 1px solid #dfe4e9;
    border-radius: 13px;
    outline: none;
    color: #283948;
    background: #f9fafb;
    font-size: 13px;
    transition: .18s ease;
}
.login-control:focus {
    border-color: var(--brand-orange);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(237,79,24,.1);
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    color: #89939c;
    background: transparent;
    transform: translateY(-50%);
}
.login-options { display: flex; align-items: center; justify-content: space-between; margin: 7px 0 24px; font-size: 12px; }
.login-button {
    width: 100%;
    height: 49px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-orange), #d8430f);
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 12px 25px rgba(237,79,24,.22);
}
.login-button:hover { filter: brightness(.97); transform: translateY(-1px); }
.login-help { margin-top: 24px; color: #9aa4ad; text-align: center; font-size: 11px; }

.validation-summary-errors {
    margin-bottom: 17px;
    padding: 11px 13px;
    border: 1px solid #ffd2c3;
    border-radius: 11px;
    color: #a83b16;
    background: #fff3ee;
    font-size: 12px;
}
.validation-summary-errors ul { margin: 0; padding-left: 17px; }

@media (max-width: 991.98px) {
    .system-sidebar {
        transform: translateX(-105%);
        transition: transform .22s ease;
    }
    .system-sidebar.open { transform: translateX(0); }
    .system-main { margin-left: 0; }
    .mobile-menu-button { display: grid; }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 1030;
        background: rgba(8,17,24,.55);
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.show { display: block; }
}

@media (max-width: 760px) {
    .system-topbar { min-height: 72px; padding: 12px 15px; }
    .system-topbar h1 { font-size: 18px; }
    .topbar-right { display: none; }
    .system-content { padding: 0 4px 22px; }
    .system-footer { padding: 14px 17px 20px; }
    .login-shell { grid-template-columns: 1fr; min-height: auto; }
    .login-visual { display: none; }
    .login-panel { padding: 38px 26px; }
}
