@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #fff7fb;
    --panel: rgba(255, 255, 255, 0.95);
    --panel-2: #ffffff;
    --line: rgba(190, 24, 93, 0.10);
    --text: #3b1230;
    --muted: #8a5d76;
    --text-soft: #6f4760;
    --primary: #ec4899;
    --primary-2: #f9a8d4;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow: 0 18px 45px rgba(190, 24, 93, 0.10);
    --radius: 22px;
    --body-bg: radial-gradient(circle at top left, #ffffff 0%, #fff4fa 42%, #fde7f3 100%);
    --sidebar-bg: rgba(255, 255, 255, 0.82);
    --ghost-bg: rgba(255, 255, 255, 0.80);
    --soft-surface: rgba(236, 72, 153, 0.08);
    --soft-surface-2: rgba(190, 24, 93, 0.04);
    --input-bg: #ffffff;
    --input-text: #3b1230;
    --input-border: rgba(190, 24, 93, 0.14);
    --thead-bg: #fff1f7;
    --brand-shadow: 0 16px 35px rgba(236, 72, 153, 0.22);
    --focus-ring: 0 0 0 4px rgba(236, 72, 153, 0.14);
    --table-link: #db2777;
    --danger-link: #dc2626;
    --empty-bg: rgba(255, 255, 255, 0.38);
}

html[data-theme="dark"] {
    --bg: #0b1020;
    --panel: rgba(17, 24, 39, 0.84);
    --panel-2: rgba(15, 23, 42, 0.78);
    --line: rgba(148, 163, 184, 0.18);
    --text: #e5eefc;
    --muted: #9fb0cc;
    --text-soft: #cbd5e1;
    --primary: #7c5cff;
    --primary-2: #17c3ff;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 22px 55px rgba(2, 8, 23, 0.38);
    --body-bg: radial-gradient(circle at top left, #1b2442 0%, #0b1020 55%, #070b16 100%);
    --sidebar-bg: rgba(7, 11, 22, 0.65);
    --ghost-bg: rgba(255, 255, 255, 0.04);
    --soft-surface: rgba(255, 255, 255, 0.05);
    --soft-surface-2: rgba(255, 255, 255, 0.03);
    --input-bg: var(--panel-2);
    --input-text: #ffffff;
    --input-border: rgba(148, 163, 184, 0.18);
    --thead-bg: rgba(255, 255, 255, 0.03);
    --brand-shadow: 0 16px 35px rgba(124, 92, 255, 0.34);
    --focus-ring: 0 0 0 4px rgba(124, 92, 255, 0.14);
    --table-link: #92c6ff;
    --danger-link: #ff9d9d;
    --empty-bg: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--body-bg);
    color: var(--text);
}

body.menu-open {
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }
small, p { color: var(--muted); margin: 0; }
strong, h1, h2, h3 { margin: 0; }

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    position: relative;
}

.sidebar {
    padding: 24px 18px;
    border-right: 1px solid var(--line);
    background: var(--sidebar-bg);
    backdrop-filter: blur(18px);
    display: flex;
    flex-direction: column;
    gap: 22px;
    z-index: 30;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: .25s ease;
    z-index: 25;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.brand-card, .topbar-user, .panel, .stat-card, .auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.brand-card {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 16px;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: var(--brand-shadow);
}

.brand-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.menu { display: grid; gap: 8px; }

.menu-link {
    padding: 12px 14px;
    border-radius: 16px;
    color: var(--muted);
    border: 1px solid transparent;
    transition: .2s ease;
}

.menu-link:hover, .menu-link.active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(249, 168, 212, 0.18));
    border-color: rgba(236, 72, 153, 0.18);
}

html[data-theme="dark"] .menu-link:hover,
html[data-theme="dark"] .menu-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.20), rgba(23, 195, 255, 0.15));
    border-color: rgba(124, 92, 255, 0.25);
}

.sidebar-footer { margin-top: auto; display: grid; gap: 14px; }
.family-names { display: grid; gap: 8px; color: var(--muted); }
.full-width { width: 100%; }

.content { padding: 28px; min-width: 0; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.12);
}

.grid-cards, .split, .summary-list, .alert-list, .feature-grid, .form-grid {
    display: grid;
    gap: 18px;
}

.grid-cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.split.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-gap { margin-bottom: 18px; }
.section-gap { margin-top: 22px; }

.stat-card { padding: 22px; display: grid; gap: 8px; }
.stat-card.primary { background: linear-gradient(135deg, rgba(236, 72, 153, 0.14), rgba(249, 168, 212, 0.18)); }
.stat-card.warning { background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(239, 68, 68, 0.08)); }

html[data-theme="dark"] .stat-card.primary {
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.28), rgba(23, 195, 255, 0.12));
}

html[data-theme="dark"] .stat-card.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.20), rgba(239, 68, 68, 0.12));
}

.stat-card strong { font-size: 2rem; }

.panel { padding: 22px; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.single-column { grid-template-columns: 1fr; }
.form-grid .full, .button-row.full { grid-column: 1 / -1; }

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: .93rem;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--input-text);
    border-radius: 16px;
    padding: 13px 14px;
    outline: none;
    font: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(236, 72, 153, 0.65);
    box-shadow: var(--focus-ring);
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
    border-color: rgba(124, 92, 255, 0.7);
}

textarea { resize: vertical; }

.button-row { display: flex; gap: 12px; flex-wrap: wrap; }

.primary-btn, .ghost-btn {
    border: 0;
    border-radius: 16px;
    padding: 14px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.primary-btn {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 16px 32px rgba(236, 72, 153, 0.18);
}

html[data-theme="dark"] .primary-btn {
    box-shadow: 0 16px 32px rgba(124, 92, 255, 0.22);
}

.ghost-btn {
    background: var(--ghost-bg);
    color: var(--text);
    border: 1px solid var(--line);
}

.primary-btn:hover, .ghost-btn:hover { transform: translateY(-1px); }

.theme-toggle { min-width: 150px; }

.menu-toggle {
    display: none;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 14px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
}
@media (max-width: 920px) {
    .menu-toggle {
        display: inline-flex;
    }
}
.table-wrap {
    overflow: auto;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--panel);
    -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; min-width: 620px; }

th, td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

th { color: var(--text-soft); background: var(--thead-bg); }
tr:last-child td { border-bottom: none; }

.table-link { color: var(--table-link); }
.danger-link { color: var(--danger-link); }

.badge, .pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: .82rem;
    border: 1px solid var(--line);
    background: var(--soft-surface);
}

.pill.success { background: rgba(34, 197, 94, 0.14); color: #15803d; }
.pill.warning { background: rgba(245, 158, 11, 0.14); color: #b45309; }

html[data-theme="dark"] .pill.success { color: #8ef0af; }
html[data-theme="dark"] .pill.warning { color: #ffd68a; }

.callout {
    margin-top: 16px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
}

.callout.info { background: var(--soft-surface); }

.summary-list div, .alert-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--soft-surface-2);
    border: 1px solid var(--line);
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 180px;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: var(--empty-bg);
}

.empty-state.compact { min-height: 120px; }

.flash-stack { display: grid; gap: 10px; margin-bottom: 18px; }

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.flash-success { background: rgba(34, 197, 94, 0.12); }
.flash-error { background: rgba(239, 68, 68, 0.12); }

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: min(640px, 100%);
    display: grid;
    gap: 16px;
}

.auth-toolbar {
    display: flex;
    justify-content: flex-end;
}

.auth-card {
    width: 100%;
    padding: 28px;
}

@media (max-width: 1180px) {
    .grid-cards.four, .split.two { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 920px) {
    .app-shell { grid-template-columns: 1fr; }

    .menu-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(86vw, 320px);
        height: 100vh;
        border-right: 1px solid var(--line);
        border-bottom: none;
        transform: translateX(-105%);
        transition: transform .28s ease;
        overflow-y: auto;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .content {
        padding: 18px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-left,
    .topbar-actions {
        width: 100%;
    }

    .topbar-actions {
        justify-content: space-between;
    }
}

@media (max-width: 720px) {
    .grid-cards.four,
    .split.two,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .panel, .stat-card, .auth-card {
        padding: 18px;
    }

    .topbar-actions,
    .auth-toolbar,
    .button-row {
        width: 100%;
    }

    .theme-toggle {
        width: 100%;
        min-width: 0;
    }

    .topbar-user {
        width: 100%;
    }
}
.request-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
}

.modal-backdrop.is-open {
    display: flex;
}

.modal-card {
    width: min(820px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 22px 10px;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    opacity: .75;
    padding: 4px;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 0 22px 22px;
}

.modal-note {
    margin-bottom: 14px;
}

@media (max-width: 720px) {
    .modal-card {
        border-radius: 18px;
    }

    .modal-header,
    .modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }
}
.submenu-group {
    margin: 6px 0 10px 0;
    display: grid;
    gap: 6px;
}

.submenu-link {
    margin-left: 14px;
    font-size: 14px;
    opacity: .92;
}
.settings-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    border: none;
    background: transparent;
    cursor: pointer;
}

.submenu-group {
    display: none;
    margin: 6px 0 10px;
    gap: 6px;
}

.submenu-group.is-open {
    display: grid;
}

.submenu-link {
    margin-left: 14px;
    font-size: 14px;
    opacity: .95;
}

.submenu-caret {
    font-size: 14px;
    transition: transform .2s ease;
}

.settings-toggle[aria-expanded="true"] .submenu-caret {
    transform: rotate(180deg);
}
button.menu-link {
    font: inherit;
    color: inherit;
    line-height: inherit;
    appearance: none;
    -webkit-appearance: none;
}
.modal-lg {
    max-width: 980px;
    width: min(980px, calc(100% - 32px));
}

.section-subtitle {
    margin: 0;
    opacity: .8;
}