:root {
    color-scheme: dark;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --background: #0b0b0d;
    --surface: #141418;
    --card: #1c1c22;
    --border: #2a2a32;
    --primary: #e50914;
    --primary-dark: #8b0a12;
    --text: #ffffff;
    --muted: #b8b8be;
    --disabled: #7a7a82;
    --success: #4caf50;
    --film-silver: #a8a8b0;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--background);
    color: var(--text);
}

body {
    min-width: 320px;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

.admin-shell {
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 24px 18px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    padding: 0 8px 28px;
    border: 0;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.brand-logo {
    width: min(100%, 168px);
    height: auto;
    display: block;
}

.brand-mark {
    display: none;
}

.main-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
}

.nav-section {
    margin: 20px 12px 6px;
    color: var(--disabled);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.main-nav a,
.nav-disabled {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--muted);
    transition: background-color .2s ease, color .2s ease;
}

.main-nav a:hover {
    background: #252a34;
    color: var(--text);
}

.main-nav a.active {
    background: rgba(229, 9, 20, .14);
    color: #fff;
}

.main-nav a.active > span:first-child {
    color: var(--primary);
}

.nav-disabled {
    color: #686d77;
    cursor: not-allowed;
}

.nav-disabled small {
    margin-left: auto;
    font-size: .68rem;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 10px 0;
    color: var(--disabled);
    font-size: .78rem;
}

.logout-button {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.logout-button:hover {
    border-color: var(--primary);
    color: #fff;
}

.session-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 72px;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
}

.topbar-mark {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.page-brand-mark {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.auth-loading {
    display: grid;
    min-height: 100vh;
    place-content: center;
    justify-items: center;
    gap: 14px;
    color: var(--muted);
}

.login-shell {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    overflow: hidden;
    background: #050507;
}

.login-seats {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .42;
}

.login-spotlight {
    position: absolute;
    top: -12%;
    left: 50%;
    width: 70vw;
    height: 55vh;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(229, 9, 20, .22), transparent 70%);
    pointer-events: none;
}

.login-content {
    position: relative;
    z-index: 1;
    width: min(440px, calc(100% - 32px));
    padding: 28px 0 48px;
}

.login-card {
    padding: 32px 28px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 20px;
    background: rgba(12, 12, 16, .86);
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.login-logo {
    display: block;
    width: min(240px, 100%);
    margin: 0 auto 14px;
}

.login-tagline {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.5;
    text-align: center;
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 1.55rem;
    text-align: center;
}

.login-subtitle {
    margin: 0 0 24px;
    color: var(--muted);
    text-align: center;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: .86rem;
}

.input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #101015;
    color: var(--text);
    outline: none;
}

.input:focus {
    border-color: var(--primary);
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 18px;
    color: var(--muted);
    font-size: .88rem;
}

.login-error {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(244, 67, 54, .35);
    border-radius: 12px;
    background: rgba(244, 67, 54, .1);
    color: #ffb4b0;
    font-size: .9rem;
}

.login-button {
    width: 100%;
    min-height: 48px;
}

.validation-message {
    color: #ff8f88;
    font-size: .8rem;
}

.admin-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    margin-left: auto;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    font-weight: 700;
}

.admin-content {
    min-width: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, .12);
}

.content-container {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 40px 36px 64px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
}

.page-header h1 {
    margin: 5px 0 8px;
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    line-height: 1.1;
}

.page-header p,
.catalog-summary p {
    margin: 0;
    color: var(--muted);
}

.eyebrow {
    color: var(--primary);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.status-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: .82rem;
}

.catalog-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.catalog-summary div {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.catalog-summary strong {
    font-size: 1.6rem;
}

.catalog-summary span {
    color: var(--muted);
}

.category-grid,
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.category-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    transition: transform .2s ease, border-color .2s ease;
}

.category-card:hover {
    transform: translateY(-3px);
    border-color: #444a57;
}

.category-visual {
    position: relative;
    display: grid;
    height: 138px;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, #2c1115, #171a20);
}

.category-visual img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .55;
}

.category-visual span {
    position: relative;
    color: var(--primary);
    font-size: 2rem;
}

.category-body {
    padding: 18px;
}

.category-body h2 {
    margin: 7px 0;
    font-size: 1.15rem;
}

.category-body p {
    min-height: 42px;
    margin: 0 0 14px;
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.5;
}

.category-body code {
    color: #ef8c91;
}

.category-order {
    color: var(--disabled);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.state-panel {
    display: flex;
    min-height: 330px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    padding: 32px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--muted);
    text-align: center;
}

.state-panel strong {
    color: var(--text);
    font-size: 1.05rem;
}

.state-panel-error {
    border-color: rgba(244, 67, 54, .4);
}

.state-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 14px;
    background: var(--card);
    color: var(--primary);
    font-size: 1.5rem;
}

.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.primary-button {
    margin-top: 8px;
    padding: 11px 18px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.primary-button:hover {
    background: var(--primary-dark);
}

.primary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.header-action {
    margin-top: 0;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.header-actions .ghost-button,
.header-actions .primary-button,
.header-actions a.ghost-button {
    margin-top: 0;
    text-decoration: none;
}

a.ghost-button {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.ghost-button,
.danger-button {
    padding: 9px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}

.ghost-button {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
}

.ghost-button:hover {
    border-color: #555b68;
    background: rgba(255, 255, 255, .03);
}

.danger-button {
    border: 1px solid rgba(244, 67, 54, .45);
    background: rgba(244, 67, 54, .12);
    color: #ff8a80;
}

.danger-button:hover {
    background: rgba(244, 67, 54, .2);
}

.editor-panel {
    margin-bottom: 24px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}

.editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.editor-header h2 {
    margin: 4px 0 0;
    font-size: 1.25rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field-span {
    grid-column: 1 / -1;
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    color: var(--muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.form-alert {
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(244, 67, 54, .4);
    border-radius: 12px;
    background: rgba(244, 67, 54, .1);
    color: #ff8a80;
}

.toast-success {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(76, 175, 80, .35);
    border-radius: 12px;
    background: rgba(76, 175, 80, .12);
    color: #a5d6a7;
}

.category-table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
}

.category-table {
    width: 100%;
    border-collapse: collapse;
}

.category-table th,
.category-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.category-table th {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.category-table tbody tr:last-child td {
    border-bottom: 0;
}

.category-table td strong {
    display: block;
    margin-bottom: 4px;
}

.table-muted {
    display: block;
    color: var(--muted);
    font-size: .85rem;
    line-height: 1.4;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.confirm-label {
    color: #ff8a80;
    font-size: .85rem;
    font-weight: 700;
}

.row-danger {
    background: rgba(244, 67, 54, .06);
}

.badge {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
}

.badge-active {
    background: rgba(76, 175, 80, .15);
    color: #a5d6a7;
}

.badge-inactive {
    background: rgba(158, 158, 158, .15);
    color: #bdbdbd;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.stat-card strong {
    font-size: 1.7rem;
    line-height: 1;
}

.stat-card span {
    color: var(--muted);
    font-size: .82rem;
}

.dashboard-card {
    display: flex;
    width: 100%;
    min-height: 120px;
    align-items: center;
    gap: 16px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.dashboard-card:hover:not(.dashboard-card-disabled) {
    border-color: #484e5b;
}

.dashboard-icon {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 14px;
    background: rgba(229, 9, 20, .14);
    color: var(--primary);
    font-size: 1.25rem;
}

.dashboard-card strong {
    font-size: 1.05rem;
}

.dashboard-card p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: .85rem;
}

.dashboard-arrow {
    margin-left: auto;
    color: var(--muted);
    font-size: 1.4rem;
}

.dashboard-card-disabled {
    opacity: .55;
}

#blazor-error-ui {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: none;
    padding: 14px 18px;
    border: 1px solid #792f34;
    border-radius: 12px;
    background: #3b1d20;
    color: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
}

#blazor-error-ui .reload {
    margin-left: 10px;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    margin-left: 14px;
    cursor: pointer;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 800px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 16px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .brand {
        padding-bottom: 14px;
    }

    .main-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .main-nav .nav-section,
    .nav-disabled,
    .sidebar-footer {
        display: none;
    }

    .main-nav a {
        flex: 0 0 auto;
    }

    .topbar {
        display: none;
    }

    .content-container {
        padding: 28px 18px 48px;
    }

    .page-header,
    .catalog-summary,
    .editor-header,
    .form-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .table-actions {
        justify-content: flex-start;
    }
}
