:root {
    color-scheme: dark;
    --bg: #0b0d10;
    --surface: #12161b;
    --surface-2: #191f26;
    --surface-3: #0d1116;
    --border: #28313c;
    --border-soft: #202832;
    --text: #f4f7fa;
    --muted: #94a0ad;
    --accent: #e6a51d;
    --accent-hover: #f2b42a;
    --danger: #ff6b6b;
    --success: #55d98b;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(circle at top, #151a20 0, var(--bg) 42%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { min-height: 100vh; }
a { color: inherit; }

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.auth-card {
    width: min(470px, 100%);
    margin: 6vh auto 0;
    padding: 30px;
    background: rgba(18, 22, 27, .96);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

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

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--accent);
    color: #15100a;
    font-weight: 900;
}

.brand-mark-small {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }

h1, h2, p { margin-top: 0; }
h1 { font-size: 30px; margin-bottom: 8px; }
h2 { font-size: 20px; }
p { line-height: 1.6; }

.muted { color: var(--muted); line-height: 1.55; }

.form { display: grid; gap: 16px; margin-top: 24px; }
.form-large { margin-top: 0; }

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

.field-full { grid-column: 1 / -1; }

label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    font-weight: 650;
}

input, select, textarea {
    width: 100%;
    padding: 13px 14px;
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    font: inherit;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); }

button, .button-link {
    border: 0;
    border-radius: 11px;
    padding: 13px 16px;
    background: var(--accent);
    color: #171109;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font: inherit;
}

button:hover, .button-link:hover { background: var(--accent-hover); }

.button-secondary {
    padding: 9px 13px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.button-secondary:hover { background: #222a33; }

.button-small {
    padding: 8px 11px;
    font-size: 13px;
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 10px;
    line-height: 1.45;
}

.alert-error {
    color: #ffd8d8;
    background: rgba(255, 107, 107, .12);
    border: 1px solid rgba(255, 107, 107, .28);
}

.alert-success {
    color: #caffdd;
    background: rgba(85, 217, 139, .12);
    border: 1px solid rgba(85, 217, 139, .28);
}

.eyebrow {
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 7px;
}

.admin-nav {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 12px 14px;
    margin-bottom: 34px;
    background: rgba(18, 22, 27, .92);
    border: 1px solid var(--border);
    border-radius: 16px;
    position: sticky;
    top: 12px;
    z-index: 20;
    backdrop-filter: blur(16px);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.admin-brand span:last-child strong,
.admin-brand span:last-child small {
    display: block;
}

.admin-brand small {
    color: var(--muted);
    font-size: 11px;
    margin-top: 1px;
}

.admin-links {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
}

.admin-links a,
.nav-disabled {
    padding: 9px 12px;
    border-radius: 9px;
    color: #c7d0da;
    text-decoration: none;
    font-size: 14px;
}

.admin-links a:hover,
.admin-links a.active {
    background: var(--surface-2);
    color: var(--text);
}

.nav-disabled {
    color: #687482;
    cursor: default;
}

.nav-disabled small {
    font-size: 10px;
    margin-left: 3px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #c7d0da;
    font-size: 13px;
}

.admin-user form { margin: 0; }

.admin-content { width: 100%; }

.admin-content-narrow {
    width: min(790px, 100%);
    margin: 0 auto;
}

.page-header { margin-bottom: 24px; }

.page-header-actions,
.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
}

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

.stat-card, .panel, .table-card, .empty-state, .event-card-admin {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.stat-card {
    padding: 22px;
    text-decoration: none;
}

.stat-card span { color: var(--muted); font-size: 14px; }
.stat-card strong { display: block; font-size: 34px; margin-top: 12px; }

.stat-card small {
    display: block;
    color: #6f7b88;
    margin-top: 9px;
    font-size: 12px;
}

.stat-link {
    transition: border-color .18s ease, transform .18s ease;
}

.stat-link:hover {
    border-color: #4c5866;
    transform: translateY(-2px);
}

.stat-link small { color: var(--accent); }

.panel {
    margin-top: 18px;
    padding: 24px;
}

.panel p { color: var(--muted); }
.panel-heading h2 { margin-bottom: 4px; }

.version-badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(230, 165, 29, .12);
    border: 1px solid rgba(230, 165, 29, .25);
    color: #f1bd4e;
    font-size: 11px;
    font-weight: 800;
}

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th, td {
    padding: 16px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}

th {
    color: #8d99a6;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .015); }

.table-primary { font-weight: 750; }

.table-secondary {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.table-actions-col { width: 200px; }

.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.row-actions form { margin: 0; }

.status-badge {
    display: inline-flex;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.status-active {
    background: rgba(85, 217, 139, .11);
    color: #83e8ab;
    border: 1px solid rgba(85, 217, 139, .22);
}

.status-inactive {
    background: rgba(148, 160, 173, .10);
    color: #a7b0ba;
    border: 1px solid rgba(148, 160, 173, .18);
}

.status-draft {
    background: rgba(230, 165, 29, .10);
    color: #f1bd4e;
    border: 1px solid rgba(230, 165, 29, .20);
}

.status-danger {
    background: rgba(255, 107, 107, .10);
    color: #ff9a9a;
    border: 1px solid rgba(255, 107, 107, .22);
}

.empty-state {
    padding: 56px 24px;
    text-align: center;
}

.empty-state p {
    color: var(--muted);
    max-width: 480px;
    margin: 0 auto 22px;
}

.empty-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
    border-radius: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--accent);
    font-weight: 900;
}

.slug-input {
    display: flex;
    align-items: stretch;
}

.slug-input > span {
    display: flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: 11px 0 0 11px;
    background: #151a20;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.slug-input input { border-radius: 0 11px 11px 0; }

.field-help {
    color: var(--muted);
    font-weight: 400;
    font-size: 12px;
}

.optional-label {
    color: #74808c;
    font-size: 11px;
    font-weight: 500;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
}

.back-link {
    display: inline-block;
    margin-bottom: 22px;
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
}

.back-link:hover { color: var(--text); }

.event-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.event-card-admin {
    overflow: hidden;
}

.event-card-media {
    aspect-ratio: 16 / 6.8;
    background: #0d1116;
    overflow: hidden;
}

.event-card-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.event-card-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #56616d;
    font-weight: 900;
    letter-spacing: .14em;
}

.event-card-body { padding: 20px; }

.event-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 13px;
}

.category-pill {
    display: inline-flex;
    padding: 6px 9px;
    border-radius: 999px;
    color: #b5c0cb;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 11px;
}

.event-card-body h2 {
    margin-bottom: 5px;
    font-size: 21px;
}

.event-producer {
    color: var(--accent) !important;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 16px;
}

.event-meta {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.event-card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

.event-card-footer > div:first-child strong,
.event-card-footer > div:first-child span {
    display: block;
}

.event-card-footer > div:first-child strong {
    font-size: 18px;
}

.event-card-footer > div:first-child span {
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
}

.event-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 18px;
    align-items: start;
}

.event-form-main {
    display: grid;
    gap: 18px;
}

.event-form-main .panel,
.event-form-sidebar .panel {
    margin-top: 0;
}

.event-form-sidebar {
    display: grid;
    gap: 18px;
}

.form-section { padding: 24px; }

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-soft);
}

.section-heading-compact { display: block; }

.section-heading h2 {
    margin-bottom: 4px;
}

.section-heading p {
    margin-bottom: 0;
    font-size: 13px;
}

.section-number {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(230, 165, 29, .12);
    border: 1px solid rgba(230, 165, 29, .22);
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
}

.banner-preview {
    margin-bottom: 16px;
    aspect-ratio: 16 / 9;
    border-radius: 11px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0d1116;
}

.banner-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sticky-actions {
    position: sticky;
    top: 100px;
    display: grid;
    gap: 10px;
}

code {
    padding: 2px 5px;
    background: var(--surface-3);
    border-radius: 5px;
}

@media (max-width: 980px) {
    .event-form-layout {
        grid-template-columns: 1fr;
    }

    .event-form-sidebar {
        grid-template-columns: repeat(2, 1fr);
    }

    .sticky-actions {
        position: static;
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-nav { flex-wrap: wrap; }
    .admin-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

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

@media (max-width: 680px) {
    .shell {
        width: min(100% - 20px, 1180px);
        padding-top: 12px;
    }

    .admin-nav {
        position: static;
        margin-bottom: 24px;
    }

    .admin-user > span { display: none; }

    .page-header-actions,
    .panel-heading {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-actions .button-link,
    .panel-heading .button-link {
        align-self: flex-start;
    }

    .form-grid { grid-template-columns: 1fr; }
    .field-full { grid-column: auto; }

    .slug-input { display: grid; }

    .slug-input > span {
        border-right: 1px solid var(--border);
        border-bottom: 0;
        border-radius: 11px 11px 0 0;
        padding: 10px 12px;
    }

    .slug-input input { border-radius: 0 0 11px 11px; }

    .event-form-sidebar { grid-template-columns: 1fr; }
    .sticky-actions { grid-column: auto; }

    .event-card-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 430px) {
    .stats-grid { grid-template-columns: 1fr; }

    .auth-card {
        padding: 22px;
        border-radius: 15px;
    }

    .admin-brand span:last-child { display: none; }

    .form-actions { flex-direction: column-reverse; }
    .form-actions > * { width: 100%; }
}
