@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #eceef3;
    --surface: #ffffff;
    --surface-muted: #f6f7fb;
    --text: #17191f;
    --text-soft: #6a7282;
    --line: #d8dde8;
    --accent: #4d56d8;
    --accent-strong: #3f47c2;
    --danger: #d64545;
    --shadow: 0 12px 30px rgba(21, 29, 45, 0.1);
    --shadow-strong: 0 24px 48px rgba(21, 29, 45, 0.18);
    --radius: 14px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body.app-body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

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

.app-shell {
    max-width: 1680px;
    margin: 18px auto;
    padding: 0 14px;
    display: grid;
    grid-template-columns: 272px 1fr;
    gap: 14px;
    transition: grid-template-columns 0.22s ease;
}

.app-shell.app-shell-collapsed {
    grid-template-columns: 88px 1fr;
}

.app-sidebar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow-strong);
    height: calc(100vh - 36px);
    position: sticky;
    top: 18px;
    overflow: auto;
    transition: width 0.2s ease, padding 0.2s ease, transform 0.2s ease;
    background-image: radial-gradient(circle at 10% 0%, rgba(77, 86, 216, 0.08) 0, transparent 42%);
    display: flex;
    flex-direction: column;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.app-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.app-brand-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.1;
}

.app-brand-subtitle {
    margin: 0;
    font-size: 11px;
    color: var(--text-soft);
}

.app-collapse-btn {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.app-collapse-icon {
    width: 8px;
    height: 8px;
    border-right: 2px solid #2d3648;
    border-bottom: 2px solid #2d3648;
    transform: rotate(135deg);
    transition: transform 0.2s ease;
}

.app-collapse-icon-flip {
    transform: rotate(-45deg);
}

.app-nav {
    display: grid;
    gap: 6px;
}

.app-sidebar-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.app-sidebar-logout {
    width: 100%;
    border: 1px solid #b91c1c;
    background: #dc2626;
    color: #fff;
    cursor: pointer;
    justify-content: center;
    font-weight: 700;
}

.app-sidebar-logout .app-nav-icon {
    color: #fff;
}

.app-sidebar-logout:hover {
    background: #b91c1c;
    border-color: #991b1b;
    color: #fff;
}

.app-sidebar-logout:focus-visible {
    outline: 2px solid #fecaca;
    outline-offset: 2px;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    border: 1px solid transparent;
}

.app-nav-icon {
    width: 20px;
    min-width: 20px;
    text-align: center;
    line-height: 1;
    color: #5d6778;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-nav-label {
    white-space: nowrap;
}

.app-nav-link-active .app-nav-icon {
    color: #2a328e;
}

.app-nav-link:hover {
    background: #f2f4f9;
    border-color: var(--line);
}

.app-nav-link-active {
    background: #eef0ff;
    color: #2a328e;
    border-color: #cfd4ff;
}

.app-shell.app-shell-collapsed .app-sidebar {
    padding: 14px 10px;
}

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

.app-shell.app-shell-collapsed .app-brand > div:not(.app-brand-mark) {
    display: none;
}

.app-shell.app-shell-collapsed .app-collapse-btn {
    position: absolute;
    top: 14px;
    right: 10px;
}

.app-shell.app-shell-collapsed .app-nav-link {
    width: 48px;
    height: 42px;
    margin-inline: auto;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
}

.app-shell.app-shell-collapsed .app-nav-icon {
    width: auto;
    min-width: 0;
}

.app-shell.app-shell-collapsed .app-nav-icon svg {
    width: 20px;
    height: 20px;
}

.app-shell.app-shell-collapsed .app-nav-label {
    display: none;
}

.app-main {
    min-width: 0;
}

.app-topbar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px 18px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.app-topbar-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.app-topbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
}

.app-menu-btn span {
    width: 16px;
    height: 2px;
    background: #2d3648;
    border-radius: 1px;
}

.app-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 25;
    display: none;
}

.app-content {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.rounded-xl.border,
.rounded-xl[class*="border-slate"],
.rounded-xl[class*="border-gray"] {
    border-color: var(--line) !important;
    border-radius: var(--radius) !important;
}

.bg-white {
    background-color: var(--surface) !important;
}

.shadow-sm {
    box-shadow: var(--shadow) !important;
}

.bg-slate-50 {
    background-color: var(--surface-muted) !important;
}

.text-slate-500,
.text-slate-600,
.text-gray-500,
.text-gray-600 {
    color: var(--text-soft) !important;
}

input,
select,
textarea {
    border-color: var(--line) !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    background-color: #fff;
}

button,
a[class*="rounded"] {
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

button:hover,
a[class*="rounded"]:hover {
    transform: translateY(-1px);
}

.bg-blue-600,
.bg-indigo-600,
.bg-violet-700,
.bg-sky-700,
.bg-slate-900,
.bg-black {
    background-color: var(--accent) !important;
}

.bg-blue-700,
.hover\:bg-blue-700:hover {
    background-color: var(--accent-strong) !important;
}

.bg-red-600 {
    background-color: var(--danger) !important;
}

table thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

table tbody td {
    font-size: 13px;
}

table {
    width: 100%;
}

button,
a,
input,
select,
textarea {
    max-width: 100%;
}

pre,
code {
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
        margin: 10px auto;
        padding: 0 10px;
    }

    .app-sidebar {
        height: 100vh;
        position: fixed;
        top: 0;
        left: -290px;
        width: 280px;
        max-width: calc(100vw - 20px);
        border-radius: 0 16px 16px 0;
        z-index: 30;
        transition: left 0.2s ease;
    }

    .app-sidebar.app-sidebar-open {
        left: 0;
    }

    .app-shell.app-shell-collapsed {
        grid-template-columns: 1fr;
    }

    .app-sidebar-overlay {
        display: block;
    }

    .app-collapse-btn {
        display: none;
    }

    .app-nav {
        grid-template-columns: 1fr;
    }

    .app-topbar {
        padding: 12px 14px;
        margin-bottom: 10px;
    }

    .app-topbar-title {
        font-size: 20px;
    }

    .app-menu-btn {
        display: inline-flex;
    }

    .app-content {
        gap: 10px;
    }

    .rounded-xl {
        border-radius: 12px !important;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 0 8px;
    }

    .app-topbar-title {
        font-size: 18px;
    }

    .app-content section {
        gap: 10px !important;
    }

    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    table thead th,
    table tbody td {
        white-space: nowrap;
    }
}
