:root {
    --shell-bg: #f4f6fb;
    --shell-text: #182236;
    --sidebar-bg: linear-gradient(180deg, #10192c 0%, #0d1222 100%);
    --card-bg: #ffffff;
    --card-border: #e7ebf4;
    --muted: #6b7384;
    --success-soft: #d8f8e5;
    --success-text: #1d7a47;
    --danger-soft: #fee2e6;
    --danger-text: #9f2642;
    --neutral-soft: #eef1f6;
    --neutral-text: #4f596d;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    background: radial-gradient(circle at 15% 20%, #fdf8da 0%, #f4f6fb 42%);
    color: var(--shell-text);
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.app-sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: #e7ecfa;
    padding: 1.3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    min-height: 100vh;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.brand-link {
    color: inherit;
    text-decoration: none;
}

.brand-link:hover {
    color: inherit;
    text-decoration: none;
}

.brand-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #f2b705;
    box-shadow: 0 0 0 6px rgba(242, 183, 5, 0.24);
}

.brand-subtitle {
    margin: 0.7rem 0 1.3rem;
    font-size: 0.85rem;
    color: #a4acc5;
}

.sidebar-nav {
    gap: 0.35rem;
    width: 100%;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.8rem;
    padding: 0.6rem 0.7rem;
}

.sidebar-link .bi {
    width: 1.35rem;
    text-align: center;
}

.sidebar-toggle {
    border: 1px solid rgba(212, 220, 241, 0.25);
    background: rgba(255, 255, 255, 0.06);
    color: #e7ecfa;
    border-radius: 0.75rem;
    padding: 0.45rem 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
}

.sidebar-toggle-top {
    color: #2d3a58;
    border-color: #d7deec;
    background: #fff;
}

.sidebar-toggle-bottom {
    margin-top: 1rem;
    width: 100%;
    justify-content: center;
}

.app-shell.sidebar-collapsed .app-sidebar {
    width: 84px;
    padding: 1rem 0.65rem;
    align-items: center;
}

.app-shell.sidebar-collapsed .brand-subtitle,
.app-shell.sidebar-collapsed .nav-text {
    display: none;
}

.app-shell.sidebar-collapsed .brand-block {
    justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.62rem 0.45rem;
}

.app-shell.sidebar-collapsed .sidebar-link .bi {
    margin-right: 0 !important;
}

.app-shell.sidebar-collapsed .sidebar-toggle-bottom {
    width: auto;
}

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

.app-header {
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid var(--card-border);
    padding: 0 1.3rem;
    backdrop-filter: blur(6px);
}

.header-title {
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-date {
    margin-left: 0.25rem;
}

.app-content {
    padding: 1.3rem;
}

.app-footer {
    margin-top: auto;
    padding: 0.8rem 1.3rem;
    border-top: 1px solid var(--card-border);
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
}

.surface-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(20, 32, 62, 0.05);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.kpi-card {
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid #e6ebf5;
    padding: 1rem 1.1rem;
}

.kpi-label {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
}

.kpi-subtitle {
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.status-pill {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
}

.status-success {
    background: var(--success-soft);
    color: var(--success-text);
}

.status-danger {
    background: var(--danger-soft);
    color: var(--danger-text);
}

.status-neutral {
    background: var(--neutral-soft);
    color: var(--neutral-text);
}

.table-modern thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    border-bottom-width: 1px;
}

.table-modern td {
    vertical-align: middle;
}

.utility-card {
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 0.8rem 0.95rem;
    background: #fff;
}

.form-panel {
    border: 1px solid var(--card-border);
    background: #fff;
    border-radius: 16px;
    padding: 1rem;
}

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.auth-card {
    width: min(520px, 100%);
}

@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        position: static;
        width: 100%;
        min-height: auto;
        padding: 0.9rem;
    }

    .brand-subtitle {
        margin-bottom: 0.7rem;
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.1rem;
        gap: 0.45rem;
    }

    .sidebar-toggle-bottom {
        display: none;
    }

    .sidebar-nav .nav-item {
        flex: 0 0 auto;
    }

    .app-header {
        height: auto;
        padding: 0.8rem 0.9rem;
        gap: 0.65rem;
        flex-wrap: wrap;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .header-date {
        width: 100%;
        margin-left: 0;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 767.98px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .app-content {
        padding: 0.85rem;
    }

    .sidebar-link {
        padding: 0.58rem 0.7rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .sidebar-toggle-top {
        display: none;
    }

    .auth-wrap {
        align-items: flex-start;
        padding-top: 2rem;
    }
}
