:root {
    --sidebar-bg: #1f2740;
    --sidebar-bg-2: #27314f;
    --sidebar-text: #cfd7ef;
    --sidebar-active: #ffffff;
    --sidebar-active-bg: #2e3a5e;
    --topbar-bg: #ffffff;
    --page-bg: #f4f6fb;
    --card-bg: #ffffff;
    --text-main: #1c2434;
    --text-muted: #6b7280;
    --primary-accent: #223a5e;
    --shadow-soft: 0 8px 24px rgba(27, 39, 94, 0.08);
    --radius-lg: 18px;
}

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text-main);
    font-family: Inter, system-ui, sans-serif;
}

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

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar-bg), #1b2238);
    color: var(--sidebar-text);
    padding: 18px 14px;
    transition: width 0.25s ease, transform 0.25s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1050;
}

.sidebar.collapsed {
    width: 84px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .sidebar-link span {
    display: none;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 24px;
    padding: 8px 10px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.14);
    font-size: 18px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.sidebar-link i {
    font-size: 1.05rem;
    min-width: 18px;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
}

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

.topbar {
    height: 78px;
    background: var(--topbar-bg);
    border-bottom: 1px solid #e9edf5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 1040;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-toggle {
    font-size: 1.5rem;
    color: var(--text-main);
    text-decoration: none;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f3fa;
    border-radius: 999px;
    padding: 10px 16px;
    min-width: 240px;
}

.topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--text-main);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f7f9fd;
    border: 1px solid #e5e9f2;
    padding: 8px 12px;
    border-radius: 999px;
}

.user-chip-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.user-chip-text small {
    color: var(--text-muted);
    text-transform: capitalize;
}

.app-content {
    padding: 24px 0 34px;
}

.card {
    border: none !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-soft);
}

.table thead th {
    background: var(--primary-accent);
    color: #fff;
    font-size: 0.82rem;
    text-transform: uppercase;
    white-space: nowrap;
    border: none !important;
}

.table-responsive {
    border-radius: 14px;
    overflow: hidden;
}

.form-control,
.form-select,
textarea {
    border-radius: 10px !important;
    border: 1px solid #dde3ee !important;
    min-height: 46px;
    box-shadow: none !important;
}

.btn {
    border-radius: 10px;
    font-weight: 600;
}

.alert {
    border-radius: 14px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 1rem;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        width: 260px;
    }

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

    .app-main {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .topbar {
        padding: 0 14px;
    }

    .user-chip {
        display: none;
    }
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link-toggle {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    justify-content: space-between;
    cursor: pointer;
}

.sidebar-link-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding-left: 18px;
}

.sidebar-submenu.is-open {
    display: flex;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 0.92rem;
}

.sidebar-sublink:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-sublink.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
}

.sidebar-caret {
    transition: transform 0.2s ease;
}

.sidebar-caret.is-rotated {
    transform: rotate(180deg);
}