:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --border: #2d3a4f;
    --text: #e8edf4;
    --muted: #8b9cb3;
    --accent: #3d8bfd;
    --accent-hover: #5ba3ff;
    --danger: #f87171;
    --radius: 10px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background: radial-gradient(1200px 600px at 10% -10%, #1e3a5f 0%, transparent 55%),
        radial-gradient(900px 500px at 90% 0%, #2d1f4e 0%, transparent 50%), var(--bg);
    color: var(--text);
    line-height: 1.5;
}

body.has-sidebar {
    padding-left: 240px;
}

body.sidebar-open {
    overflow: hidden;
}

.site-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1rem 0.75rem;
}

.site-sidebar-brand {
    display: block;
    padding: 0.35rem 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
}

.site-sidebar-brand:hover {
    color: var(--accent);
}

.site-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.site-sidebar-category {
    margin-bottom: 0.25rem;
}

.site-sidebar-category-label {
    display: block;
    padding: 0.45rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    list-style: none;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
}

.site-sidebar-category-label::-webkit-details-marker {
    display: none;
}

.site-sidebar-category > summary.site-sidebar-category-label {
    position: relative;
    padding-right: 1.5rem;
}

.site-sidebar-category > summary.site-sidebar-category-label::after {
    content: "";
    position: absolute;
    right: 0.55rem;
    top: 50%;
    width: 0.4rem;
    height: 0.4rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-65%) rotate(45deg);
    transition: transform 0.15s ease;
}

.site-sidebar-category[open] > summary.site-sidebar-category-label::after {
    transform: translateY(-35%) rotate(-135deg);
}

.site-sidebar-category > summary.site-sidebar-category-label:hover {
    color: var(--text);
    background: rgba(61, 139, 253, 0.06);
}

.site-sidebar-links {
    list-style: none;
    margin: 0.15rem 0 0.5rem;
    padding: 0 0 0 0.35rem;
}

.site-sidebar-links li {
    margin: 0.1rem 0;
}

.site-sidebar-link,
.site-sidebar-logout {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.65rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid transparent;
}

.site-sidebar-link:hover,
.site-sidebar-logout:hover {
    color: var(--text);
    background: rgba(61, 139, 253, 0.08);
}

.site-sidebar-link.is-active,
.site-sidebar-link[aria-current="page"] {
    color: var(--accent);
    background: rgba(61, 139, 253, 0.12);
    border-color: rgba(61, 139, 253, 0.35);
}

.site-sidebar-empty-group {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.site-sidebar-category.is-empty {
    opacity: 0.45;
    pointer-events: none;
}

.site-sidebar-category.is-empty .site-sidebar-category-label {
    cursor: default;
}

.site-sidebar-logout {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.site-sidebar-logout:hover {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.08);
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 150;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
}

.sidebar-toggle:hover {
    border-color: rgba(61, 139, 253, 0.45);
    background: rgba(61, 139, 253, 0.08);
}

.sidebar-toggle-icon,
.sidebar-toggle-icon::before,
.sidebar-toggle-icon::after {
    display: block;
    width: 1.1rem;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.sidebar-toggle-icon {
    position: relative;
}

.sidebar-toggle-icon::before,
.sidebar-toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
}

.sidebar-toggle-icon::before {
    top: -6px;
}

.sidebar-toggle-icon::after {
    top: 6px;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(0, 0, 0, 0.55);
}

@media (max-width: 767px) {
    body.has-sidebar {
        padding-left: 0;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .site-sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
    }

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

    .page {
        padding-top: 3.75rem;
    }
}

.page {
    max-width: 880px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.35rem;
    letter-spacing: -0.02em;
}

.lead {
    color: var(--muted);
    margin: 0 0 1.75rem;
    font-size: 0.95rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem 1.25rem;
    margin-bottom: 1.25rem;
}

.card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

input:focus,
select:focus {
    outline: 2px solid rgba(61, 139, 253, 0.35);
    outline-offset: 1px;
    border-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-secondary:hover {
    background: rgba(61, 139, 253, 0.12);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
}

.message.visible {
    display: block;
}

.message.success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #86efac;
}

.message.error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.message code {
    font-size: 0.88em;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.25);
}
