:root {
    --font-sans: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --primary: #5a5ff6;
    --primary-dark: #4248db;
    --primary-light: #ececff;
    --primary-glow: rgba(90, 95, 246, 0.16);
    --accent: #ff4d67;
    --accent-soft: rgba(255, 77, 103, 0.12);
    --success: #16b86a;
    --success-soft: rgba(22, 184, 106, 0.12);
    --warning: #f4a21d;
    --warning-soft: rgba(244, 162, 29, 0.12);
    --info: #22a9ea;
    --background: #eef3ff;
    --sidebar-bg: rgba(255, 255, 255, 0.78);
    --card-bg: rgba(255, 255, 255, 0.96);
    --surface: rgba(255, 255, 255, 0.96);
    --surface-muted: #f5f8ff;
    --text-main: #102a56;
    --text-muted: #5e7699;
    --border-color: rgba(118, 144, 188, 0.18);
    --border-light: rgba(118, 144, 188, 0.1);
    --shadow-sm: 0 10px 24px rgba(18, 44, 86, 0.06);
    --shadow: 0 18px 38px rgba(18, 44, 86, 0.08);
    --shadow-lg: 0 24px 54px rgba(18, 44, 86, 0.1);
    --radius: 22px;
    --radius-sm: 16px;
}

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

body {
    font-family: var(--font-sans);
    background:
        radial-gradient(circle at top left, rgba(34, 169, 234, 0.14), transparent 26%),
        radial-gradient(circle at top right, rgba(90, 95, 246, 0.1), transparent 24%),
        linear-gradient(180deg, #f5f8ff 0%, #eef3ff 100%);
    color: var(--text-main);
}

.dashboard-layout {
    gap: 0;
}

.sidebar {
    width: 310px;
    margin: 18px 0 18px 18px;
    height: calc(100vh - 36px);
    border: 1px solid rgba(166, 185, 223, 0.22);
    border-right: 1px solid rgba(166, 185, 223, 0.22);
    border-radius: 32px;
    background: var(--sidebar-bg);
    box-shadow: 0 24px 48px rgba(20, 49, 89, 0.08);
    backdrop-filter: blur(18px);
}

.sidebar.collapsed {
    width: 88px;
}

.logo-container {
    padding: 18px 18px 14px;
    gap: 14px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: linear-gradient(135deg, #5a5ff6 0%, #6b52f0 60%, #7c5cff 100%);
    box-shadow: 0 18px 32px rgba(90, 95, 246, 0.28);
}

.logo-text {
    font-size: 1.72rem;
    font-weight: 800;
    background: linear-gradient(135deg, #2539b8 0%, #5a5ff6 60%, #6a54f1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#sidebarToggle {
    margin-left: auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-sm);
}

.sidebar-search {
    padding: 0 18px 16px;
}

.search-wrapper {
    min-height: 52px;
    border-radius: 18px;
    background: #f5f8ff;
    border: 1px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.sidebar-search-input {
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

.dashboard-shortcut {
    margin: 0 14px 18px;
    min-height: 56px;
    padding-inline: 18px;
    border-radius: 20px;
    background: #edefff;
    color: #3d4fd9;
    box-shadow: none;
}

.dashboard-shortcut:hover,
.dashboard-shortcut.active {
    background: linear-gradient(135deg, #5a5ff6 0%, #6a54f1 100%);
    color: #fff;
    box-shadow: 0 20px 34px rgba(90, 95, 246, 0.26);
}

.sidebar-menu-scroll {
    padding: 0 12px 8px;
}

.section-label,
.group-toggle,
.menu-item-link {
    border-radius: 18px;
}

.section-label {
    margin: 0 0 4px;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 700;
}

.section-label:hover {
    background: rgba(236, 240, 255, 0.78);
    color: #2a49c0;
}

.section-content {
    padding: 0 4px 10px 8px;
}

.group-toggle,
.menu-item-link {
    padding: 12px 14px;
    min-height: 48px;
}

.menu-item-link {
    color: #506792;
    font-weight: 600;
}

.menu-item-link:hover {
    background: rgba(236, 240, 255, 0.78);
    color: #2745be;
}

.menu-item-link.active {
    background: linear-gradient(135deg, rgba(90, 95, 246, 0.16) 0%, rgba(106, 84, 241, 0.12) 100%);
    color: #2438b4;
    box-shadow: inset 0 0 0 1px rgba(90, 95, 246, 0.12);
}

.sidebar-footer {
    margin: 8px 14px 14px;
    padding: 14px;
    border-top: 1px solid rgba(166, 185, 223, 0.18);
    border-radius: 20px;
    background: rgba(243, 247, 255, 0.84);
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(90, 95, 246, 0.12);
    color: #3f51d5;
}

.btn-logout {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 14px;
}

.main-content {
    padding: 24px 26px 28px;
    background: transparent;
}

.app-page-header {
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.page-heading-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.page-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-main);
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.page-kicker {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.page-title {
    margin: 0;
    font-size: clamp(2rem, 1.72rem + 1vw, 3rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
    color: #0e2550;
}

.page-subtitle {
    max-width: 760px;
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.65;
    color: var(--text-muted);
}

.topbar-actions {
    margin-left: auto;
    gap: 14px;
}

.status-badge {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    background: rgba(22, 184, 106, 0.12);
    border: 1px solid rgba(22, 184, 106, 0.18);
    box-shadow: var(--shadow-sm);
}

.status-text {
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #0c9154;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #1ac56f;
    box-shadow: 0 0 0 6px rgba(26, 197, 111, 0.15);
}

.btn-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    border: 1px solid rgba(118, 144, 188, 0.16);
    background: rgba(255, 255, 255, 0.96);
    color: #5a6f94;
    box-shadow: var(--shadow-sm);
}

.btn-icon:hover,
.page-back-link:hover {
    background: #fff;
    color: #2745be;
    border-color: rgba(90, 95, 246, 0.18);
    transform: translateY(-1px);
}

.content-shell {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.card,
.content-shell > section,
.content-shell > article {
    border-radius: 28px;
}

.card {
    padding: 24px;
    border: 1px solid rgba(118, 144, 188, 0.14);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}

.card::before {
    height: 3px;
    background: linear-gradient(90deg, #22a9ea 0%, #6a54f1 55%, #ff4d67 100%);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn,
button.btn,
a.btn,
input[type="button"].btn,
input[type="submit"].btn,
input[type="reset"].btn {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 16px;
    font-family: var(--font-sans);
    font-weight: 700;
}

.btn-primary {
    background: linear-gradient(135deg, #5a5ff6 0%, #6a54f1 100%);
    box-shadow: 0 18px 34px rgba(90, 95, 246, 0.18);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #474de0 0%, #6147ee 100%);
    box-shadow: 0 22px 38px rgba(90, 95, 246, 0.24);
}

.btn-outline,
.btn.glass,
.page-actions-slot .sys-pill-btn,
.page-actions-slot .sys-alert-btn {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(118, 144, 188, 0.16);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover,
.btn.glass:hover {
    background: #fff;
}

.nav-label,
.main-content label:not(.remember-me):not(.gsl-0546) {
    color: #35507a;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.main-content form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not(.btn),
.main-content form select:not(.btn),
.main-content form textarea:not(.btn),
input.btn.glass:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
select.btn.glass,
textarea.btn.glass {
    min-height: 50px;
    border-radius: 16px;
    border: 1px solid rgba(118, 144, 188, 0.18);
    background: #fff;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    color: var(--text-main);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.main-content form textarea:not(.btn),
textarea.btn.glass {
    min-height: 118px;
}

.main-content form input:focus,
.main-content form select:focus,
.main-content form textarea:focus {
    border-color: rgba(90, 95, 246, 0.42);
    box-shadow: 0 0 0 4px rgba(90, 95, 246, 0.1);
}

.alert {
    border-radius: 18px;
    border-width: 1px;
    box-shadow: var(--shadow-sm);
}

.table-responsive {
    overflow: auto;
    border-radius: 22px;
}

.data-table,
.main-content table {
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(118, 144, 188, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.data-table th,
.main-content table th {
    background: #edf3ff;
    color: #37537f;
    font-size: 0.79rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.data-table td,
.main-content table td {
    color: #102a56;
    padding-top: 16px;
    padding-bottom: 16px;
}

.empty-state {
    padding: 24px 12px;
}

.pagination-footer nav,
.pagination-footer .pagination {
    gap: 8px;
}

.pagination-footer .page-link,
.pagination-footer .page-item span {
    border-radius: 14px !important;
    border-color: rgba(118, 144, 188, 0.16) !important;
}

#ai-chat-toggle {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    background: linear-gradient(135deg, #5a5ff6 0%, #6a54f1 100%);
    box-shadow: 0 22px 40px rgba(90, 95, 246, 0.26);
}

#ai-chat-window {
    border-radius: 24px;
    border: 1px solid rgba(118, 144, 188, 0.16);
    box-shadow: var(--shadow-lg);
}

#ai-chat-window .chat-header {
    background: linear-gradient(135deg, #0f2450 0%, #15346d 100%);
}

.sys-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sys-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.sys-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.sys-toolbar-actions--stretch {
    width: 100%;
}

.sys-search-shell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: min(100%, 420px);
    min-height: 48px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(83, 111, 154, 0.2);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-sm);
}

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

.sys-pill-btn,
.sys-alert-btn,
.sys-mini-btn,
.sys-tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid rgba(96, 124, 168, 0.16);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text-main);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.sys-alert-btn {
    background: linear-gradient(135deg, #ff4767 0%, #ff1f57 100%);
    color: #fff;
    border-color: transparent;
}

.sys-tabbar,
.sys-panel,
.sys-flash,
.sys-console-card,
.sys-hero,
.sys-status-card,
.sys-box-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(96, 124, 168, 0.14);
    box-shadow: var(--shadow);
}

.sys-tabbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border-radius: 20px;
}

.sys-tab-btn {
    background: transparent;
    color: #4b6288;
}

.sys-tab-btn.is-active {
    background: #fff;
    color: #102a56;
}

.sys-panel,
.sys-console-card {
    border-radius: 24px;
    padding: 24px;
}

.sys-flash {
    padding: 14px 18px;
    border-radius: 16px;
    font-weight: 600;
}

.sys-hero,
.sys-status-card,
.sys-box-card {
    border-radius: 24px;
    padding: 22px;
}

@media (max-width: 1200px) {
    .sidebar {
        width: 286px;
    }

    .app-page-header {
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .sys-toolbar-actions--stretch .sys-search-shell {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 960px) {
    .sidebar {
        margin: 12px 0 0 12px;
        height: calc(100vh - 24px);
        border-radius: 26px;
    }

    .main-content {
        padding: 18px 16px 20px;
    }

    .page-title {
        font-size: clamp(1.8rem, 1.5rem + 1vw, 2.3rem);
    }

    .card {
        padding: 18px;
        border-radius: 24px;
    }
}

@media (max-width: 720px) {
    .sidebar {
        position: fixed;
        inset: 12px auto 12px 12px;
        z-index: 90;
        max-width: calc(100vw - 24px);
    }

    .sidebar.collapsed {
        width: 78px;
    }

    .page-back-link,
    .status-badge,
    .btn-icon {
        min-height: 42px;
    }

    .data-table th,
    .data-table td {
        white-space: nowrap;
    }

    .sys-toolbar-actions--stretch {
        flex-direction: column;
        align-items: stretch;
    }

    .sys-search-shell {
        min-width: 100%;
        width: 100%;
    }
}
