:root {
    color-scheme: dark;
    --bg: #0b0b0c;
    --card: #141315;
    --muted: #8f8b84;
    --gold: #d6b25e;
    --gold-soft: rgba(214, 178, 94, 0.2);
    --danger: #6b1f2b;
    --success: #1d3c2c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Manrope', sans-serif;
}

body {
    background: var(--bg);
    color: #f2f2f2;
}

.sidebar-toggle {
    display: none;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    padding: 32px 24px;
    background: #0f0f10;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
}

.sidebar-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-mobile-title {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar-close {
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f2f2f2;
    font-size: 12px;
}

.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.sidebar-toggle-btn {
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(214, 178, 94, 0.2);
    color: var(--gold);
    font-weight: 600;
    font-size: 13px;
}

.mobile-brand {
    font-weight: 600;
    color: #f2f2f2;
}

.sidebar-overlay {
    display: none;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand-mark {
    background: var(--gold);
    color: #0b0b0c;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 8px;
}

.brand-title {
    font-weight: 600;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--muted);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 18px;
}

.user-chip {
    display: flex;
    gap: 10px;
    align-items: center;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(214, 178, 94, 0.2);
    color: var(--gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-email {
    font-size: 12px;
    color: var(--muted);
}

.logout-btn {
    width: 100%;
    text-align: center;
}

.nav-link {
    color: #f2f2f2;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 12px;
    background: transparent;
    transition: all 0.2s ease-in-out;
}

.nav-link:hover {
    background: rgba(214, 178, 94, 0.15);
    color: var(--gold);
}

.nav-link.active {
    background: rgba(214, 178, 94, 0.2);
    color: var(--gold);
}

.sidebar-card {
    background: #151516;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(214, 178, 94, 0.2);
}

.sidebar-card-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.sidebar-card-body {
    color: var(--muted);
    font-size: 13px;
}

.content {
    flex: 1;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-left: 250px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 28px;
}

.eyebrow {
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 12px;
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--muted);
    margin-top: 6px;
}

.primary-btn,
.secondary-btn {
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.primary-btn {
    background: var(--gold);
    color: #0b0b0c;
}

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

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.grid-two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    background: var(--card);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-header {
    margin-bottom: 18px;
}

.card-subtitle {
    color: var(--muted);
    font-size: 14px;
}

.stat-card {
    background: #141314;
    border-radius: 16px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-title {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-meta {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.table-wrapper {
    overflow-x: auto;
}

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    min-width: 480px;
}

.table-wrapper th,
.table-wrapper td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

.table-wrapper th {
    color: var(--muted);
    font-weight: 500;
}

.pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    display: inline-block;
}

.pill.success {
    background: rgba(214, 178, 94, 0.15);
    color: var(--gold);
}

.pill.warning {
    background: rgba(214, 178, 94, 0.1);
    color: #f0c46a;
}

.pill.danger {
    background: rgba(107, 31, 43, 0.5);
    color: #ffb3bd;
}

.link {
    color: var(--gold);
    text-decoration: none;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid-wide {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.checkbox-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f2f2f2;
    font-size: 12px;
}

.checkbox-pill input {
    accent-color: var(--gold);
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.input {
    background: #1a1a1b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 12px;
    color: #f2f2f2;
}

textarea.input {
    resize: vertical;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-form .input {
    min-width: 160px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 11, 12, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
}

.modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--card);
    border-radius: 20px;
    padding: 24px;
    width: min(720px, 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-close {
    background: transparent;
    color: var(--gold);
    border: 1px solid rgba(214, 178, 94, 0.4);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
}

.auth-body {
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(214, 178, 94, 0.18), transparent 45%),
        #0b0b0c;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
}

.auth-panel,
.auth-visual {
    flex: 1;
    min-width: 0;
}

.auth-panel {
    padding: 64px 72px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    justify-content: center;
    background: rgba(15, 15, 16, 0.95);
}

.auth-brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.auth-mark {
    background: var(--gold);
    color: #0b0b0c;
    font-weight: 700;
    padding: 10px 12px;
    border-radius: 10px;
}

.auth-title {
    font-weight: 600;
    font-size: 16px;
}

.auth-subtitle {
    font-size: 12px;
    color: var(--muted);
}

.auth-headline h1 {
    font-size: 32px;
    margin-top: 6px;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-error {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(107, 31, 43, 0.45);
    color: #ffb3bd;
    font-size: 13px;
}

.auth-btn {
    padding: 12px 18px;
    font-size: 15px;
}

.auth-footnote {
    color: var(--muted);
    font-size: 13px;
}

.auth-visual {
    position: relative;
    overflow: hidden;
    background: #0f0f10;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.auth-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

canvas {
    max-width: 100%;
}

@media (max-width: 960px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(86vw, 320px);
        transform: translateX(-110%);
        transition: transform 0.25s ease;
        z-index: 30;
        overflow-y: auto;
    }

    .sidebar-mobile-header {
        display: flex;
    }

    .content {
        padding: 24px;
        margin-left: 0;
    }

    .mobile-topbar {
        display: flex;
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(11, 11, 12, 0.6);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 20;
    }

    .sidebar-toggle:checked ~ .app-shell .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle:checked ~ .app-shell .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .auth-shell {
        flex-direction: column;
    }

    .auth-panel {
        padding: 48px 32px;
    }

    .auth-visual {
        min-height: 320px;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }
}

@media (max-width: 640px) {
    .page-header {
        align-items: flex-start;
    }

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

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

    .sidebar {
        padding: 20px;
    }

    .sidebar-card {
        display: none;
    }

    .page-header h1 {
        font-size: 22px;
    }

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

    .primary-btn,
    .secondary-btn {
        width: 100%;
        text-align: center;
    }

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

    .input {
        padding: 12px 14px;
        font-size: 14px;
    }

    .auth-headline h1 {
        font-size: 26px;
    }

    .table-wrapper table {
        min-width: 420px;
    }

    .table-wrapper th,
    .table-wrapper td {
        padding: 10px 8px;
        font-size: 12px;
        white-space: nowrap;
    }

    .card {
        padding: 16px;
    }

    .card canvas {
        max-height: 220px;
    }
}
