:root {
    --bg: #1e1f22;
    --sidebar: #2b2d31;
    --card: #313338;
    --card-2: #383a40;
    --hover: #3f4147;
    --border: #44464d;
    --text: #f2f3f5;
    --muted: #b5bac1;
    --soft: #949ba4;
    --primary: #5865f2;
    --primary-hover: #4752c4;
    --green: #23a559;
    --red: #f23f42;
    --yellow: #f0b232;
    --cyan: #00a8fc;
    --shadow: 0 18px 42px rgba(0, 0, 0, .28);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(88, 101, 242, .10), transparent 34%),
        linear-gradient(315deg, rgba(35, 165, 89, .08), transparent 30%),
        var(--bg);
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: 0;
}

.material-symbols-rounded {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    font-family: "Material Symbols Rounded";
    font-weight: normal;
    font-style: normal;
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    user-select: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 18px;
    height: 100vh;
    padding: 22px 16px;
    background: rgba(43, 45, 49, .96);
    border-right: 1px solid rgba(255, 255, 255, .06);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 10px;
    font-weight: 800;
}

.brand__icon,
.login-panel__mark {
    color: var(--text);
    background: var(--primary);
    box-shadow: 0 10px 22px rgba(88, 101, 242, .34);
}

.brand__icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
}

.side-nav {
    display: grid;
    gap: 6px;
}

.side-nav a,
.button,
.icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 42px;
    border-radius: var(--radius);
    transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.side-nav a {
    justify-content: flex-start;
    padding: 0 12px;
    color: var(--muted);
}

.side-nav a:hover,
.side-nav a.is-active {
    color: var(--text);
    background: var(--hover);
}

.side-nav a.is-active::before {
    content: "";
    position: absolute;
    left: -8px;
    width: 4px;
    height: 26px;
    border-radius: 0 5px 5px 0;
    background: var(--primary);
}

.profile-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-top: auto;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: var(--radius);
    background: var(--card);
}

.profile-card strong,
.profile-card span,
.table-title strong,
.table-title span,
.activity-row strong,
.activity-row span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-card span,
.table-title span,
.activity-row span {
    color: var(--muted);
    font-size: 13px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--hover);
}

.avatar--top {
    margin-left: auto;
}

.content-wrap {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 76px;
    padding: 14px 28px;
    background: rgba(30, 31, 34, .78);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    backdrop-filter: blur(20px);
}

.topbar h1,
.section-head h2,
.event-main h2,
.login-panel h1 {
    margin: 0;
    line-height: 1.1;
}

.topbar h1 {
    font-size: 24px;
}

.eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--soft);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.main-content {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.hero-card,
.stat-card,
.event-card,
.activity-panel,
.table-wrap,
.event-side,
.event-main,
.login-panel,
.empty-state,
.editor-shell,
.upload-zone {
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: var(--radius);
    background: rgba(49, 51, 56, .92);
    box-shadow: var(--shadow);
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    min-height: 180px;
    padding: 28px;
    overflow: hidden;
}

.hero-card h2 {
    margin: 0 0 10px;
    font-size: 34px;
}

.hero-card p,
.login-panel p,
.lead {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.hero-avatar {
    width: 116px;
    height: 116px;
    border: 4px solid rgba(255, 255, 255, .10);
    border-radius: 28px;
    object-fit: cover;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 28px;
}

.stat-card {
    display: flex;
    gap: 14px;
    align-items: center;
    min-height: 108px;
    padding: 18px;
    box-shadow: none;
}

.stat-card > .material-symbols-rounded {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    color: var(--primary);
    background: rgba(88, 101, 242, .14);
}

.stat-card strong {
    display: block;
    font-size: 30px;
    line-height: 1;
}

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

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-head--spaced {
    margin-top: 34px;
}

.section-head--mini {
    margin: 0 0 12px;
}

.section-head--mini h3 {
    margin: 0;
}

.event-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.event-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.event-card {
    overflow: hidden;
    box-shadow: none;
    transform: translateY(0);
    animation: rise .28s ease both;
}

.event-card:hover {
    transform: translateY(-4px);
    border-color: rgba(88, 101, 242, .42);
    box-shadow: 0 18px 34px rgba(0, 0, 0, .20);
}

.event-card__media {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--card-2);
}

.event-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .24s ease;
}

.event-card:hover .event-card__media img {
    transform: scale(1.04);
}

.event-card__media--empty,
.event-banner--empty,
.event-image--empty {
    background:
        linear-gradient(135deg, rgba(88, 101, 242, .52), rgba(0, 168, 252, .20)),
        var(--card-2);
}

.event-card__media--empty .material-symbols-rounded {
    font-size: 58px;
    color: rgba(255, 255, 255, .76);
}

.event-card__body {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.event-card__meta,
.event-card__footer,
.info-list div,
.participant-row,
.activity-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.event-card__meta {
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
}

.event-card h3 {
    margin: 0;
    font-size: 19px;
    line-height: 1.25;
}

.event-card p {
    min-height: 48px;
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.event-card__footer {
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
}

.event-card__footer span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
    background: var(--hover);
}

.status--open {
    background: rgba(35, 165, 89, .20);
    color: #7ee2a8;
}

.status--closed {
    background: rgba(242, 63, 66, .17);
    color: #ff9ca0;
}

.status--archived {
    background: rgba(181, 186, 193, .18);
    color: #d3d7de;
}

.button {
    padding: 0 15px;
    cursor: pointer;
    color: var(--text);
    border: 1px solid transparent;
    white-space: nowrap;
}

.button:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.button--primary {
    background: var(--primary);
    box-shadow: 0 10px 22px rgba(88, 101, 242, .28);
}

.button--primary:hover {
    background: var(--primary-hover);
}

.button--ghost {
    background: rgba(255, 255, 255, .04);
    border-color: rgba(255, 255, 255, .07);
}

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

.button--danger {
    background: rgba(242, 63, 66, .18);
    color: #ffb3b6;
}

.button--disabled {
    cursor: not-allowed;
    color: var(--soft);
    background: rgba(255, 255, 255, .04);
}

.button--large {
    min-height: 50px;
    padding: 0 20px;
    font-weight: 800;
}

.button--full {
    width: 100%;
}

.icon-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    cursor: pointer;
    color: var(--text);
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .07);
}

.icon-button--danger {
    color: #ff9ca0;
}

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

.input {
    display: grid;
    gap: 8px;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.input input,
.input textarea,
.input select {
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius);
    outline: 0;
    background: #242529;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.input textarea {
    resize: vertical;
}

.input input:focus,
.input textarea:focus,
.input select:focus {
    border-color: rgba(88, 101, 242, .72);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, .18);
}

.input--search {
    position: relative;
    flex: 1;
    display: block;
}

.input--search .material-symbols-rounded {
    position: absolute;
    left: 12px;
    top: 12px;
    color: var(--soft);
}

.input--search input {
    padding-left: 44px;
}

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

.event-banner {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    min-height: 280px;
    padding: 18px;
    border-radius: var(--radius);
    background-size: cover;
    background-position: center;
    box-shadow: var(--shadow);
}

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

.event-side,
.event-main {
    display: grid;
    gap: 16px;
    padding: 18px;
}

.event-image {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--card-2);
}

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

.event-image--empty .material-symbols-rounded {
    font-size: 72px;
}

.info-list {
    display: grid;
    gap: 10px;
    color: var(--muted);
}

.info-list .material-symbols-rounded {
    color: var(--primary);
}

.event-main h2 {
    font-size: 36px;
}

.rich-content {
    color: #dcdee3;
    line-height: 1.72;
}

.rich-content h2,
.rich-content h3 {
    margin-top: 28px;
}

.rich-content a {
    color: #9aa4ff;
    text-decoration: underline;
}

.link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.link-list a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: var(--radius);
    color: #dce1ff;
    background: rgba(88, 101, 242, .16);
}

.participant-list {
    display: grid;
    gap: 10px;
}

.participant-row,
.activity-row {
    min-width: 0;
    padding: 12px;
    border-radius: var(--radius);
    background: rgba(49, 51, 56, .72);
    border: 1px solid rgba(255, 255, 255, .06);
}

.participant-row > div,
.activity-row > div {
    min-width: 0;
    flex: 1;
}

.participant-row .status-pill {
    margin-left: auto;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.activity-panel {
    display: grid;
    gap: 10px;
    padding: 18px;
    box-shadow: none;
}

.table-wrap {
    overflow-x: auto;
    box-shadow: none;
}

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

.data-table th,
.data-table td {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, .025);
}

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

.table-actions form {
    margin: 0;
}

.event-form {
    display: block;
}

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

.form-main,
.form-side {
    display: grid;
    gap: 16px;
}

.form-row,
.link-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.editor-shell {
    display: grid;
    gap: 10px;
    padding: 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.editor-toolbar button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    cursor: pointer;
    color: var(--text);
    border-radius: var(--radius);
    background: #242529;
}

.editor-toolbar button:hover {
    background: var(--hover);
}

.rich-editor {
    min-height: 220px;
    padding: 14px;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius);
    outline: 0;
    background: #242529;
    line-height: 1.65;
}

.links-editor {
    display: grid;
    gap: 10px;
}

.link-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) 42px;
    align-items: end;
}

.upload-zone {
    position: relative;
    display: grid;
    place-items: center;
    gap: 6px;
    min-height: 164px;
    padding: 18px;
    cursor: pointer;
    color: var(--muted);
    text-align: center;
    overflow: hidden;
    box-shadow: none;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.upload-zone:hover,
.upload-zone.is-dragover {
    transform: translateY(-1px);
    border-color: rgba(88, 101, 242, .62);
    background: var(--hover);
}

.upload-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.upload-zone > .material-symbols-rounded {
    font-size: 42px;
    color: var(--primary);
}

.upload-zone img {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-zone.has-preview img {
    display: block;
}

.upload-zone.has-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .36);
}

.upload-zone.has-preview strong,
.upload-zone.has-preview small,
.upload-zone.has-preview .material-symbols-rounded {
    position: relative;
    z-index: 1;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.pagination a {
    display: grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--card);
    color: var(--muted);
}

.pagination a.is-active,
.pagination a:hover {
    color: var(--text);
    background: var(--primary);
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 12px;
    padding: 32px;
    color: var(--muted);
    text-align: center;
    box-shadow: none;
}

.empty-state--large {
    min-height: 420px;
}

.empty-state .material-symbols-rounded {
    font-size: 44px;
    color: var(--primary);
}

.toast-stack {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 60;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 28px));
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius);
    color: var(--text);
    background: #202225;
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: var(--shadow);
    animation: toastIn .22s ease both;
}

.app-dialog {
    width: min(420px, calc(100vw - 28px));
    padding: 0;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}

.app-dialog::backdrop {
    background: rgba(0, 0, 0, .58);
    backdrop-filter: blur(4px);
}

.app-dialog__body {
    display: grid;
    gap: 12px;
    padding: 20px;
}

.app-dialog h2 {
    margin: 0;
    font-size: 20px;
}

.app-dialog p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.app-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px 20px;
}

.toast--success .material-symbols-rounded {
    color: var(--green);
}

.toast--error .material-symbols-rounded {
    color: var(--red);
}

.auth-body {
    min-height: 100vh;
}

.auth-screen {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-panel {
    display: grid;
    gap: 18px;
    width: min(480px, 100%);
    padding: 34px;
    text-align: left;
}

.login-panel__mark {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: var(--radius);
}

.login-panel__mark .material-symbols-rounded {
    font-size: 34px;
}

.login-panel h1 {
    font-size: 36px;
}

code {
    color: #dce1ff;
    background: rgba(88, 101, 242, .14);
    border-radius: 5px;
    padding: 2px 6px;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        transform: translateX(-104%);
        transition: transform .2s ease;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .main-content {
        padding: 22px;
    }

    .event-grid,
    .stats-grid,
    .admin-grid,
    .form-grid,
    .event-detail__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .event-side,
    .form-side,
    .activity-panel {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1101px) {
    [data-nav-toggle] {
        display: none;
    }
}

@media (max-width: 720px) {
    .topbar {
        padding: 12px 16px;
    }

    .topbar h1 {
        font-size: 20px;
    }

    .main-content {
        padding: 16px;
    }

    .hero-card,
    .section-head,
    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .hero-card {
        grid-template-columns: 1fr;
    }

    .hero-card h2,
    .event-main h2,
    .login-panel h1 {
        font-size: 28px;
    }

    .hero-avatar {
        width: 84px;
        height: 84px;
        border-radius: var(--radius);
    }

    .event-grid,
    .event-grid--compact,
    .stats-grid,
    .admin-grid,
    .form-grid,
    .event-detail__grid,
    .form-row,
    .link-row {
        grid-template-columns: 1fr;
    }

    .event-banner {
        min-height: 190px;
    }

    .button {
        white-space: normal;
        text-align: center;
    }

    .table-actions {
        min-width: 240px;
    }

    .participant-row {
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .participant-row .status-pill {
        grid-column: 1 / -1;
        justify-self: start;
        margin-left: 0;
    }
}
