/**
 * Main Application Styles
 * Complete styling with light/dark theme support
 */

/* ============================================================
   CSS VARIABLES - LIGHT THEME
   ============================================================ */
[data-theme="light"],
:root {
    /* Base Colors */
    --bg: #ffffff;
    --bg-2: #f8f9fa;
    --card: #ffffff;
    --card-2: #f1f3f4;
    --text: #1a1a1a;
    --muted: #6c757d;
    --accent: #0066cc;
    --accent-2: #0052a3;
    --danger: #dc3545;
    --ok: #28a745;
    --ring: #0066cc33;
    --ring-strong: #0066cc90;
    --shadow: 0 10px 30px rgba(0, 0, 0, .1);
    --footer-bg-dark: #000000;
    --footer-bg-light: linear-gradient(180deg, #e9ecef 0%, #dee2e6 100%);
    --border-dark: 1px solid rgba(255, 255, 255, 0.08);
    --border-light: 1px solid rgba(0, 0, 0, 0.1);
    --text-primary-dark: rgba(255, 255, 255, 0.9);
    --text-secondary-dark: rgba(255, 255, 255, 0.7);
    --text-tertiary-dark: rgba(255, 255, 255, 0.6);
    --text-primary-light: rgba(0, 0, 0, 0.9);
    --text-secondary-light: rgba(0, 0, 0, 0.7);

    /* Gradients */
    --gradient-bg: linear-gradient(180deg, #f8f9fa, #e9ecef);
    --gradient-primary: linear-gradient(180deg, #0066cc, #0052a3);
    --gradient-danger: linear-gradient(180deg, #dc3545, #c82333);
    --gradient-success: linear-gradient(180deg, #28a745, #218838);

    /* Borders & Text */
    --border-light: #dee2e6;
    --border-medium: #ced4da;
    --text-light: #6c757d;
    --text-lighter: #adb5bd;

    /* Effects */
    --overlay: rgba(0, 0, 0, 0.1);
    --overlay-strong: rgba(0, 0, 0, 0.2);
    --highlight: rgba(0, 102, 204, 0.1);
    --success-bg: rgba(40, 167, 69, 0.1);
    --danger-bg: rgba(220, 53, 69, 0.1);
    --white-overlay: rgba(255, 255, 255, 0.9);
}

/* ============================================================
   CSS VARIABLES - DARK THEME
   ============================================================ */
[data-theme="dark"] {
    /* Base Colors */
    --bg: #0b0d14;
    --bg-2: #11141d;
    --card: #181b26;
    --card-2: #1d2130;
    --text: #e3e6ee;
    --muted: #8e95ab;
    --accent: #a78bfa;
    --accent-2: #a78bfa;
    --danger: #fb7185;
    --ok: #6ee7b7;
    --ring: #a78bfa33;
    --ring-strong: #a78bfa90;
    --shadow: 0 10px 30px rgba(0, 0, 0, .42);


    /* Gradients */
    --gradient-bg: linear-gradient(180deg, #0b0d14, #11141d);
    --gradient-primary: linear-gradient(180deg, #a78bfa, #a78bfa);
    --gradient-danger: linear-gradient(180deg, #fb7185, #fb7185);
    --gradient-success: linear-gradient(180deg, #6ee7b7, #6ee7b7);


    /* Borders & Text */
    --border-light: #282c3d;
    --border-medium: #31364a;
    --text-light: #8e95ab;
    --text-lighter: #8e95ab;


    /* Effects */
    --overlay: rgba(0, 0, 0, 0.40);
    --overlay-strong: rgba(0, 0, 0, 0.45);
    --highlight: rgba(167, 139, 250, 0.08);
    --success-bg: rgba(110, 231, 183, 0.10);
    --danger-bg: rgba(251, 113, 133, 0.10);
    --white-overlay: rgba(255, 255, 255, 0.03);
}


/* ============================================================
   BASE STYLES
   ============================================================ */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Helvetica, Arial, sans-serif;
    background: radial-gradient(1200px 800px at 10% -10%, #10182a 0%, transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    color: var(--text);
    min-height: 100%;
    background-color: var(--bg);
    overscroll-behavior: none;
    background-attachment: fixed;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .2s ease;
}

a:hover {
    color: var(--accent-2);
    text-decoration: underline;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
    display: flex;
    min-height: 100vh;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 0 0 0;
}

.container {
    flex: 1;
    width: 100%;
    max-width: min(1600px, 96vw);
    margin: 0 auto;
    padding: 20px;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    width: 240px;
    min-width: 240px;
    height: 100vh;
    padding: 16px 12px;
    background: var(--gradient-bg);
    border-right: 1px solid var(--border-light);
    transform: translateX(0);
    transition: transform .24s ease, width .24s ease, min-width .24s ease, box-shadow .24s ease;
    box-shadow: var(--shadow);
    z-index: 30;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: .2px;
    padding: 8px 10px 14px;
    color: var(--text);
    padding-left: 0;
}

@media (min-width: 1201px) {
    .sidebar:not(.is-collapsed) .brand {
        padding-left: 12px;
    }
}

.sidebar .brand .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gradient-primary);
    box-shadow: 0 0 0 3px var(--ring);
    animation: dotPulse 2s infinite;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
.sidenav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: visible;
    scrollbar-width: none;
    padding: 4px;
    margin: 0 -4px;
}

.sidenav::-webkit-scrollbar {
    display: none;
}

.sidenav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-medium);
    color: var(--accent);
    text-decoration: none;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(248, 249, 250, 0.9));
    transition: all .25s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    backdrop-filter: blur(2px);
}

.sidenav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(122, 182, 255, 0.15) 50%, transparent);
    transition: left .6s ease;
    z-index: -1;
}

.sidenav a:hover::before {
    left: 100%;
}

.sidenav a:hover {
    transform: translateX(4px) translateY(-1px);
    box-shadow: 0 8px 25px var(--overlay-strong), inset 0 1px 0 rgba(122, 182, 255, .2);
    border-color: var(--accent);
    background: var(--highlight);
    color: var(--accent-2);
}

.sidenav a.active {
    color: #ffffff;
    background: var(--gradient-primary);
    border-color: transparent;
    box-shadow: 0 6px 20px var(--ring-strong), inset 0 1px 0 rgba(255, 255, 255, .2), 0 0 0 1px var(--ring);
    font-weight: 600;
}

.sidenav a.active:hover {
    transform: translateX(4px) translateY(-2px);
    box-shadow: 0 8px 25px var(--ring-strong), inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 0 1px var(--ring);
    background: linear-gradient(145deg, #85c1ff, #55aeff);
}

.sidenav a:active {
    transform: translateX(2px) translateY(0px);
    transition-duration: .1s;
}

.sidenav a .icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .25s ease;
    filter: drop-shadow(0 1px 2px var(--overlay));
}

.sidenav a.active .icon {
    transform: scale(1.05);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .4));
}

.sidenav a.active::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: var(--gradient-primary);
    opacity: 0;
    z-index: -1;
    animation: buttonPulse 2s infinite;
}

/* ============================================================
   SIDEBAR FOOTER
   ============================================================ */
/* .side-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    display: grid;
    gap: 8px;
}

.side-footer .user {
    color: var(--muted);
    font-size: 12px;
} */

/* ============================================================
   THEME TOGGLE
   ============================================================ */
.theme-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(206, 212, 218, 0.5);
    border-radius: 12px;
    border: 1px solid var(--border-medium);
    transition: all 0.3s ease;
    cursor: pointer;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px var(--overlay);
}

[data-theme="dark"] .theme-toggle::before {
    transform: translateX(20px);
}

/* ============================================================
   SIDEBAR FAB (MOBILE)
   ============================================================ */
.sidebar-fab {
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 40;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border-medium);
    background: var(--gradient-bg);
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: transform .25s ease, background .2s, box-shadow .2s;
    will-change: transform;
}

.sidebar-fab .bar {
    display: block;
    width: 22px;
    height: 2px;
    margin: 3px 0;
    background: var(--text);
    border-radius: 2px;
    transition: transform .22s ease, opacity .18s ease, background .2s ease;
    will-change: transform, opacity;
}

.sidebar-fab .bar:nth-child(1),
.sidebar-fab .bar:nth-child(3) {
    transform-origin: center;
}

.sidebar-fab:hover .bar:nth-child(1) {
    transform: translateY(-.5px);
}

.sidebar-fab:hover .bar:nth-child(3) {
    transform: translateY(.5px);
}

body.sidebar-open .sidebar-fab .bar:nth-child(1),
.sidebar-fab.open .bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

body.sidebar-open .sidebar-fab .bar:nth-child(2),
.sidebar-fab.open .bar:nth-child(2) {
    opacity: 0;
}

body.sidebar-open .sidebar-fab .bar:nth-child(3),
.sidebar-fab.open .bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.sidebar-fab.open {
    background: var(--card);
    box-shadow: 0 16px 36px var(--overlay-strong);
    transform: scale(1.06);
}

.sidebar-fab:active {
    transform: scale(.98);
}

.sidebar-fab:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 36px var(--overlay-strong);
}

.sidebar-fab.pulse {
    animation: btnPulse .22s ease-out;
}

/* ============================================================
   HEADER & NAV
   ============================================================ */
.header {
    display: none !important;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: .2px;
    color: var(--text);
    padding-left: 6px;
}

.brand .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gradient-primary);
    box-shadow: 0 0 0 3px var(--ring);
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px;
    border-radius: 14px;
    background: var(--gradient-bg);
    border: 1px solid var(--border-light);
}

.nav::-webkit-scrollbar {
    display: none;
}

.nav a {
    padding: 9px 12px;
    border-radius: 12px;
    color: var(--accent);
    border: 1px solid var(--border-medium);
    background: none;
    transition: color .15s, background .15s, border-color .15s;
    white-space: nowrap;
}

.nav a:hover {
    color: var(--text);
    background: var(--highlight);
    border-color: var(--accent);
    text-decoration: none;
}

.nav a.active {
    color: #ffffff;
    background: var(--gradient-primary);
    border-color: transparent;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: linear-gradient(180deg, var(--card), var(--card-2));
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 18px;
    margin: 18px 0;
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 36px var(--overlay-strong);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 {
    font-size: 24px;
    margin: 0 0 12px;
    letter-spacing: .2px;
}

h2 {
    font-size: 18px;
    margin: 8px 0 12px;
    letter-spacing: .2px;
    color: var(--text);
}

small,
.muted {
    color: var(--muted);
}

.kbd {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    background: var(--card-2);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    padding: 2px 6px;
    color: var(--text);
}

/* ============================================================
   TABLES
   ============================================================ */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    overflow: hidden;
}

th,
td {
    padding: 12px 12px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}

th {
    position: sticky;
    top: 0;
    background: var(--card-2);
    color: var(--text);
    z-index: 1;
}

tr:nth-child(even) td {
    background: rgba(248, 249, 250, 0.5);
}

tr:hover td {
    background: var(--highlight);
}

caption {
    caption-side: bottom;
    color: var(--muted);
    padding: 8px 12px;
}

/* ============================================================
   FORMS
   ============================================================ */
label {
    display: block;
    margin: 10px 0 6px;
    color: var(--muted);
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-medium);
    background: var(--card);
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-lighter);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--ring);
}

input[disabled],
select[disabled],
textarea[disabled] {
    opacity: .6;
    cursor: not-allowed;
}

form .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-medium);
    background: var(--gradient-bg);
    cursor: pointer;
    color: var(--text);
    transition: transform .12s ease, box-shadow .12s ease, border-color .15s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px var(--overlay);
    border-color: var(--accent);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-primary);
    color: #ffffff;
    border-color: transparent;
}

.btn-primary:hover {
    filter: saturate(1.05) brightness(1.03);
}

.btn-danger {
    background: var(--gradient-danger);
    border-color: transparent;
    color: #ffffff;
}

.btn-ghost {
    background: none;
    border-color: var(--border-medium);
    color: var(--accent);
}

.btn-ghost:hover {
    background: var(--highlight);
}

/* ============================================================
   BUTTON ANIMATIONS
   ============================================================ */
.btn-animate-save {
    position: relative;
    overflow: hidden;
    isolate: isolate;
}

.btn-animate-save::before {
    content: "";
    position: absolute;
    inset: -1px;
    background: radial-gradient(120% 120% at -10% -10%, rgba(255, 255, 255, .12), transparent 35%) no-repeat,
        radial-gradient(120% 120% at 110% 110%, rgba(255, 255, 255, .08), transparent 35%) no-repeat;
    opacity: .0;
    transition: opacity .2s ease;
    z-index: -1;
}

.btn-animate-save:hover::before {
    opacity: .35;
}

.btn-animate-save .shine {
    pointer-events: none;
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(120deg, transparent 0%, rgba(0, 0, 0, 0.15) 50%, transparent 100%);
    transform: skewX(-20deg);
    animation: none;
}

.btn-animate-save:hover .shine {
    animation: btnShine 1.4s ease;
}

@keyframes btnShine {
    0% {
        transform: translateX(0) skewX(-20deg);
        opacity: 0;
    }

    10% {
        opacity: .6;
    }

    100% {
        transform: translateX(260%) skewX(-20deg);
        opacity: 0;
    }
}

.btn-animate-save.is-loading {
    pointer-events: none;
    filter: saturate(1.05) brightness(1.03);
}

.btn-animate-save.is-loading>.btn-text {
    opacity: 0;
}

.btn-animate-save.is-loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid rgba(26, 26, 26, .3);
    border-top-color: rgba(26, 26, 26, 0);
    animation: btnSpin 1s linear infinite;
}

@keyframes btnSpin {
    to {
        transform: rotate(360deg);
    }
}

.btn-animate-save .ripple {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, .4);
    animation: btnRipple .6s ease-out forwards;
}

@keyframes btnRipple {
    from {
        opacity: .5;
        transform: translate(-50%, -50%) scale(1);
    }

    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(18);
    }
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-medium);
    background: var(--card-2);
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
}

.badge.ok {
    background: var(--success-bg);
    border-color: var(--ok);
    color: var(--ok);
}

.badge.danger {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var, --danger;
}

.badge.info {
    background: var(--highlight);
    border-color: var(--accent);
    color: var(--accent);
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
    padding: 12px;
    border-radius: 12px;
    margin: 12px 0;
}

.flash.success {
    background: var(--success-bg);
    border: 1px solid var(--ok);
    color: var(--ok);
}

.flash.error {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* ============================================================
   DETAILS/SUMMARY
   ============================================================ */
details {
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 8px 12px;
    background: var(--gradient-bg);
}

details+details {
    margin-top: 8px;
}

details[open] {
    box-shadow: inset 0 0 0 1px var(--border-medium);
}

details>summary {
    cursor: pointer;
    list-style: none;
    color: var(--text);
    font-weight: 600;
}

details>summary::-webkit-details-marker {
    display: none;
}

details>summary:before {
    content: "▸";
    display: inline-block;
    margin-right: 8px;
    transition: transform .15s;
}

details[open]>summary:before {
    transform: rotate(90deg);
}

/* ============================================================
   WIP SECTION
   ============================================================ */
.wip-wrap {
    overflow: hidden;
}

.wip {
    position: relative;
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr 1.2fr;
    align-items: center;
    padding: 18px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(248, 249, 250, 0.85), rgba(233, 236, 239, 0.75));
    border: 1px solid var(--border-light);
}

.wip-illustration {
    padding: 12px 8px;
}

.wip-svg {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 10px 28px var(--overlay));
}

.wip-body {
    position: relative;
}

.wip-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--highlight);
    color: var(--accent);
    border: 1px solid var(--accent);
    font-size: 12px;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.wip-title {
    margin: 8px 0 6px;
    font-size: 22px;
    letter-spacing: .2px;
    color: var(--text);
}

.wip-text {
    color: var(--muted);
    line-height: 1.6;
}

.wip-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wip .btn {
    background: var(--gradient-bg);
}

.wip-ribbon {
    content: "";
    position: absolute;
    inset: -1px;
    background: repeating-linear-gradient(135deg,
            rgba(0, 102, 204, 0.05) 0px,
            rgba(0, 102, 204, 0.05) 14px,
            rgba(40, 167, 69, 0.05) 14px,
            rgba(40, 167, 69, 0.05) 28px);
    mask: linear-gradient(#000, transparent 55%);
    pointer-events: none;
    animation: wipshift 14s linear infinite;
    border-radius: 16px;
}

@keyframes wipshift {
    to {
        transform: translateX(-120px);
    }
}

/* ============================================================
   ADMIN PANEL
   ============================================================ */
.admin-panel {
    display: grid;
    gap: 16px;
}

.admin-roles-perms {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
}

.role-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 70vh;
    overflow: auto;
}

.role-list .role {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--gradient-bg);
    cursor: pointer;
}

.role-list .role.active {
    border-color: var(--accent);
    background: var(--highlight);
}

.role-list .role .name {
    font-weight: 700;
}

.role-list .role .count {
    color: var(--muted);
    font-size: 12px;
}

.perm-pane {
    min-height: 340px;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 10px;
}

.perm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.perm-toolbar .btn {
    padding: 7px 10px;
}

.perm-search {
    flex: 1;
    min-width: 220px;
}

.perm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 8px;
    align-content: start;
}

.chip-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--border-medium);
    background: var(--gradient-bg);
    cursor: pointer;
    user-select: none;
}

.chip-check input {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border-medium);
    background: var(--card);
    display: inline-block;
    position: relative;
}

.chip-check input:checked {
    background: var(--gradient-primary);
    border-color: transparent;
}

.chip-check input:checked::after {
    content: "";
    position: absolute;
    inset: 3px;
    background: var(--card);
    border-radius: 2px;
}

.chip-check .label {
    flex: 1;
}

.perm-section {
    margin-top: 6px;
}

.perm-section h3 {
    font-size: 14px;
    margin: 10px 0 6px;
    color: var(--text);
}

.perm-section .perm-grid {
    margin-top: 6px;
}

.perm-changed {
    box-shadow: 0 0 0 2px var(--ring-strong);
}

/* ============================================================
   ADMIN PAGE SPECIFIC
   ============================================================ */
body[data-page="admin"] .card {
    overflow: auto;
}

body[data-page="admin"] h1 {
    font-size: 22px;
    margin: 0 0 10px;
}

body[data-page="admin"] h2 {
    font-size: 17px;
    margin: 8px 0 10px;
}

body[data-page="admin"] .admin-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
    margin: 8px 0 12px;
}

body[data-page="admin"] form .row {
    grid-template-columns: 1fr 1fr;
}

body[data-page="admin"] table {
    font-size: 14px;
}

body[data-page="admin"] th,
body[data-page="admin"] td {
    padding: 10px;
}

body[data-page="admin"] .badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-medium);
    background: var(--gradient-bg);
    font-size: 12px;
    color: var(--text);
}

body[data-page="admin"] .badge.admin {
    background: var(--gradient-primary);
    color: #ffffff;
    border-color: transparent;
}

body[data-page="admin"] .badge.developer {
    background: var(--gradient-success);
    color: #ffffff;
    border-color: transparent;
}

body[data-page="admin"] .badge.host_L1,
body[data-page="admin"] .badge.host_L2,
body[data-page="admin"] .badge.host_L3,
body[data-page="admin"] .badge.host_L4 {
    background: var(--card-2);
    border-color: var(--border-medium);
}

body[data-page="admin"] .btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

body[data-page="admin"] .sticky-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(248, 249, 250, 0.9), rgba(233, 236, 239, 0.95));
    backdrop-filter: blur(6px);
    padding: 10px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

body[data-page="admin"] table input[type="checkbox"] {
    transform: translateY(1px);
}

body[data-page="admin"] .filters {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

body[data-page="admin"] .muted {
    color: var(--muted);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes dotPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 3px var(--ring);
    }

    50% {
        transform: scale(1.2);
        box-shadow: 0 0 10px 4px var(--ring-strong);
    }
}

@keyframes buttonPulse {

    0%,
    100% {
        opacity: 0;
        transform: scale(1);
    }

    50% {
        opacity: 0.1;
        transform: scale(1.02);
    }
}

@keyframes btnPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* ============================================================
   LIGHT THEME ADAPTATIONS - BACKGROUND
   ============================================================ */
[data-theme="light"] html,
[data-theme="light"] body {
    background: radial-gradient(1200px 800px at 10% -10%, #e3f2fd 0%, transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

/* ============================================================
   LIGHT THEME ADAPTATIONS - DARK MODE HARDCODED VALUES
   ============================================================ */
[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0b0d14, #11141d);
    border-right: 1px solid #282c3d;
}


[data-theme="dark"] .sidebar .brand {
    color: #e3e6ee;
}


[data-theme="dark"] .sidenav a {
    border: 1px solid rgba(40, 44, 61, .35);
    color: #e3e6ee;
    background: linear-gradient(145deg, rgba(24, 27, 38, .35), rgba(24, 27, 38, .42));
}


[data-theme="dark"] .sidenav a:hover {
    border-color: rgba(49, 54, 74, .40);
    background: linear-gradient(145deg, rgba(29, 33, 48, .40), rgba(29, 33, 48, .45));
    color: #e3e6ee;
}


[data-theme="dark"] .sidenav a.active {
    color: #0b0d14;
    background: linear-gradient(145deg, #a78bfa, #a78bfa);
}


[data-theme="dark"] .sidenav a.active:hover {
    background: linear-gradient(145deg, #a78bfa, #a78bfa);
}


/* [data-theme="dark"] .side-footer {
    border-top: 1px solid #282c3d;
}


[data-theme="dark"] .side-footer .user {
    color: #8e95ab;
} */


[data-theme="dark"] .theme-toggle {
    background: rgba(40, 44, 61, .38);
    border: 1px solid #282c3d;
}


[data-theme="dark"] .theme-toggle::before {
    background: linear-gradient(135deg, #a78bfa, #a78bfa);
}


[data-theme="dark"] .sidebar-fab {
    border: 1px solid #282c3d;
    background: linear-gradient(180deg, #181b26, #11141d);
    color: #e3e6ee;
}


[data-theme="dark"] .sidebar-fab .bar {
    background: #e3e6ee;
}


[data-theme="dark"] .sidebar-fab.open {
    background: linear-gradient(180deg, #1d2130, #11141d);
}


[data-theme="dark"] .header {
    background: linear-gradient(180deg, rgba(11, 13, 20, .40), rgba(11, 13, 20, .02));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #282c3d;
}


[data-theme="dark"] .brand {
    color: #e3e6ee;
}


[data-theme="dark"] .brand .dot {
    background: linear-gradient(180deg, #a78bfa, #a78bfa);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, .25);
}


[data-theme="dark"] .nav {
    background: linear-gradient(180deg, #0b0d14, #11141d);
    border: 1px solid #282c3d;
}


[data-theme="dark"] .nav a {
    color: #e3e6ee;
    border: 1px solid rgba(40, 44, 61, .40);
}


[data-theme="dark"] .nav a:hover {
    color: #fff;
    background: rgba(167, 139, 250, .08);
    border-color: #31364a;
}


[data-theme="dark"] .nav a.active {
    color: #0b0d14;
    background: linear-gradient(180deg, #a78bfa, #a78bfa);
}


[data-theme="dark"] .card {
    border: 1px solid #282c3d;
}


[data-theme="dark"] h2 {
    color: #e3e6ee;
}


[data-theme="dark"] table {
    border: 1px solid #282c3d;
}


[data-theme="dark"] th,
[data-theme="dark"] td {
    border-bottom: 1px solid #282c3d;
}


[data-theme="dark"] th {
    background: #181b26;
    color: #e3e6ee;
}


[data-theme="dark"] tr:nth-child(even) td {
    background: rgba(17, 20, 29, .40);
}


[data-theme="dark"] tr:hover td {
    background: #1d2130;
}


[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    border: 1px solid #282c3d;
    background: #0b0d14;
}


[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #8e95ab;
}


[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: #31364a;
}


[data-theme="dark"] .btn {
    border: 1px solid #282c3d;
    background: linear-gradient(180deg, #181b26, #11141d);
}


[data-theme="dark"] .btn:hover {
    border-color: #31364a;
}


[data-theme="dark"] .btn-primary {
    background: linear-gradient(180deg, var(--accent), #a78bfa);
    color: #0b0d14;
}


[data-theme="dark"] .btn-danger {
    background: linear-gradient(180deg, #fb7185, #fb7185);
    color: #0b0d14;
}


[data-theme="dark"] .btn-ghost {
    border-color: #282c3d;
    color: #e3e6ee;
}


[data-theme="dark"] .badge {
    border: 1px solid #282c3d;
    background: #0b0d14;
    color: #e3e6ee;
}


[data-theme="dark"] .badge.ok {
    background: rgba(110, 231, 183, .10);
    border-color: rgba(110, 231, 183, .35);
    color: #6ee7b7;
}


[data-theme="dark"] .badge.danger {
    background: rgba(251, 113, 133, .10);
    border-color: rgba(251, 113, 133, .35);
    color: #fb7185;
}


[data-theme="dark"] .badge.info {
    background: rgba(167, 139, 250, .10);
    border-color: rgba(167, 139, 250, .35);
    color: #d8cdff;
}


[data-theme="dark"] .flash.success {
    background: rgba(110, 231, 183, .12);
    border: 1px solid #6ee7b7;
}


[data-theme="dark"] .flash.error {
    background: rgba(251, 113, 133, .12);
    border: 1px solid #fb7185;
}


[data-theme="dark"] .kbd {
    background: #0b0d14;
    border: 1px solid #282c3d;
}


[data-theme="dark"] details {
    border: 1px solid #282c3d;
    background: linear-gradient(180deg, #0b0d14, #11141d);
}


[data-theme="dark"] details[open] {
    box-shadow: inset 0 0 0 1px #31364a;
}


[data-theme="dark"] details>summary {
    color: #e3e6ee;
}


[data-theme="dark"] .wip {
    background: linear-gradient(180deg, rgba(24, 27, 38, .38), rgba(24, 27, 38, .38));
    border: 1px solid #282c3d;
}


[data-theme="dark"] .wip-badge {
    background: rgba(167, 139, 250, .10);
    color: #e3e6ee;
    border: 1px solid rgba(167, 139, 250, .35);
}


[data-theme="dark"] .wip-text {
    color: #8e95ab;
}


[data-theme="dark"] .wip .btn {
    background: linear-gradient(180deg, #181b26, #11141d);
}


[data-theme="dark"] .wip-ribbon {
    background: repeating-linear-gradient(135deg,
            rgba(167, 139, 250, .06) 0px,
            rgba(167, 139, 250, .06) 14px,
            rgba(251, 191, 36, .08) 14px,
            rgba(251, 191, 36, .08) 28px);
}


[data-theme="dark"] body[data-page="admin"] .badge {
    border: 1px solid #282c3d;
    background: linear-gradient(180deg, #181b26, #11141d);
    color: #e3e6ee;
}


[data-theme="dark"] body[data-page="admin"] .badge.admin {
    background: linear-gradient(180deg, #a78bfa, #a78bfa);
    color: #0b0d14;
}


[data-theme="dark"] body[data-page="admin"] .badge.developer {
    background: linear-gradient(180deg, #6ee7b7, #6ee7b7);
    color: #0b0d14;
}


[data-theme="dark"] body[data-page="admin"] .badge.host_L1,
[data-theme="dark"] body[data-page="admin"] .badge.host_L2,
[data-theme="dark"] body[data-page="admin"] .badge.host_L3,
[data-theme="dark"] body[data-page="admin"] .badge.host_L4 {
    background: linear-gradient(180deg, #181b26, #1d2130);
}


[data-theme="dark"] body[data-page="admin"] .sticky-actions {
    background: linear-gradient(180deg, rgba(24, 27, 38, .40), rgba(24, 27, 38, .45));
    border-top: 1px solid #282c3d;
}


[data-theme="dark"] .btn-animate-save:hover::before {
    opacity: .55;
}


[data-theme="dark"] .btn-animate-save .shine {
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, .03) 50%, transparent 100%);
}


[data-theme="dark"] .btn-animate-save.is-loading::after {
    border: 2px solid rgba(11, 13, 20, .42);
    border-top-color: rgba(11, 13, 20, 0);
}

.site-footer {
    margin-top: auto;
    width: 100%;
    background: var(--footer-bg-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0;
    position: relative;
}

.footer-wrapper {
    max-width: min(1600px, 96vw);
    margin: 0 auto;
    padding: 36px 20px 24px;
    overflow-x: auto;
}

/* Основная сетка — 4 колонки строго в одну строку (flex, без переноса) */
.footer-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 24px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: var(--border-dark);
    min-width: 1000px;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    flex: 1 1 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.footer-col:nth-child(1) { flex: 2 1 0; }
.footer-col:nth-child(2) { flex: 1 1 0; }
.footer-col:nth-child(3) { flex: 1 1 0; }
.footer-col:nth-child(4) { flex: 1.2 1 0; }

/* Заголовки */
.footer-heading {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary-dark);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 4px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.footer-heading.footer-brand {
    font-size: 24px;
    font-weight: 700;
    margin-top: -6px;
    margin-bottom: 8px;
    text-transform: none;
    letter-spacing: 0;
}

/* Текстовые элементы — перенос длинных строк */
.footer-copyright,
.footer-text {
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-secondary-dark);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.footer-copyright {
    font-size: 13px;
    color: var(--text-secondary-dark);
}

.footer-text {
    color: var(--text-tertiary-dark);
}

.footer-text a,
.team-name a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    transition: color 0.2s, border-color 0.2s;
}

.footer-text a:hover,
.team-name a:hover {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* Ссылки */
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links li {
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-secondary-dark);
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.footer-links a:hover {
    color: var(--accent-2);
}

/* Команда */
.footer-team {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.team-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-name {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.team-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Нижняя строка — версия и сборка */
.footer-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 16px;
    margin-top: 0;
}

.footer-version {
    font-size: 12px;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    letter-spacing: 0.35px;
    color: rgba(255, 255, 255, 0.5);
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ============================================================
   RESPONSIVE (подвал — 4 колонки всегда в одну строку)
   ============================================================ */
@media (max-width: 768px) {
    .footer-wrapper {
        padding: 28px 16px 20px;
    }
}

@media (max-width: 480px) {
    .footer-heading {
        font-size: 18px;
    }

    .footer-heading.footer-brand {
        font-size: 20px;
        margin-bottom: 6px;
    }

    .footer-text,
    .footer-copyright {
        font-size: 11px;
    }

    .team-role {
        font-size: 10px;
    }
}

/* ============================================================
   СВЕТЛАЯ ТЕМА
   ============================================================ */
[data-theme="light"] .site-footer {
    background: var(--footer-bg-light);
    border-top-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .footer-grid {
    border-bottom-color: var(--border-light);
}

[data-theme="light"] .footer-heading {
    color: var(--text-primary-light);
}

[data-theme="light"] .footer-copyright,
[data-theme="light"] .footer-text {
    color: var(--text-secondary-light);
}

[data-theme="light"] .footer-text a {
    color: #0066cc;
    border-bottom-color: rgba(0, 102, 204, 0.3);
}

[data-theme="light"] .footer-text a:hover {
    color: #0052a3;
    border-bottom-color: rgba(0, 102, 204, 0.6);
}

[data-theme="light"] .footer-links a {
    color: var(--text-secondary-light);
}

[data-theme="light"] .footer-links a:hover {
    color: #0066cc;
}

[data-theme="light"] .team-name {
    color: rgba(0, 0, 0, 0.85);
}

[data-theme="light"] .team-name a:hover {
    color: #0066cc;
}

[data-theme="light"] .team-role {
    color: rgba(0, 0, 0, 0.55);
}

[data-theme="light"] .footer-version {
    color: rgba(0, 0, 0, 0.55);
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.1);
}

/* Темная тема - дополнительно */
[data-theme="dark"] .site-footer {
    background: #08090e;
    border-top-color: rgba(255, 255, 255, 0.15);
}

/* ============================================================
   RESPONSIVE DESIGN - LARGE SCREENS
   ============================================================ */
@media (max-width: 1200px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        height: 100vh;
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 24px 55px var(--overlay-strong);
    }

    .sidebar-fab {
        display: flex;
    }

    body.sidebar-open::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(6, 10, 18, .55);
        backdrop-filter: blur(3px);
        transition: opacity .2s ease;
    }

    .sidebar.is-collapsed .sidenav a {
        justify-content: center;
        padding: 12px;
        gap: 0;
    }

    .sidebar.is-collapsed .sidenav a .label {
        display: none;
    }

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

    body[data-page="admin"] .filters {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   RESPONSIVE DESIGN - TABLET
   ============================================================ */
@media (max-width: 1000px) {
    .admin-roles-perms {
        grid-template-columns: 1fr;
    }

    body[data-page="admin"] form .row {
        grid-template-columns: 1fr;
    }

    body[data-page="admin"] table {
        display: block;
        overflow: auto;
        white-space: nowrap;
    }
}

/* ============================================================
   RESPONSIVE DESIGN - MOBILE
   ============================================================ */
@media (max-width: 900px) {
    .header {
        padding: 8px 0;
    }

    .nav {
        gap: 6px;
    }

    .nav a {
        padding: 7px 10px;
        border-radius: 10px;
    }

    .container {
        padding: 16px;
    }

    form .row {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 22px;
    }

    .wip {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .wip-title {
        font-size: 20px;
    }

    body[data-page="admin"] .admin-toolbar {
        grid-template-columns: 1fr;
    }

    body[data-page="admin"] .btn-group .btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .sidenav a {
        padding: 14px 16px;
        font-size: 15px;
    }

    .sidenav a .icon {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 700px) {
    body[data-page="admin"] .filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 8px 0 10px;
        gap: 6px;
    }

    .brand {
        justify-content: center;
    }

    .nav {
        gap: 6px;
        padding: 6px;
    }

    .nav a {
        padding: 9px 12px;
        font-size: 14px;
    }
}