:root {
    --green: #2e7d32;
    --green-dark: #1b5e20;
    --bg: #f5f2eb;
    --card: #fffdf8;
    --ink: #1a1a16;
    --muted: #6c6a62;
    --line: #e6e1d4;
    --danger: #b42318;
    --ok: #1b5e20;
    --watch: #0c0c0b;
    --watch-panel: #161614;
    --watch-line: #2a2a26;
    --watch-ink: #f4f1ea;
    --radius: 18px;
    --shadow: 0 24px 60px rgba(27, 94, 32, 0.08);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 18px; line-height: 1.4; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.03em; }
h1 { font-size: 40px; }
img { display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 22px;
    border: 0;
    border-radius: 14px;
    background: var(--green);
    color: #fff;
    font-weight: 650;
    text-decoration: none;
}
.btn:hover { background: var(--green-dark); }
.btn--ghost {
    background: transparent;
    color: var(--green-dark);
    border: 2px solid var(--line);
}
.btn--ghost:hover { background: #fff; }

.input {
    width: 100%;
    min-height: 52px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 0 16px;
    color: var(--ink);
}
.input:focus {
    outline: none;
    border-color: var(--green);
}
.input--area {
    min-height: 140px;
    padding: 14px 16px;
    resize: vertical;
}

.code-input {
    width: 100%;
    min-height: 72px;
    border: 0;
    border-radius: 16px;
    background: #f0ece2;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}
.code-input:focus { outline: 3px solid var(--green); }

.text-btn {
    background: none;
    border: 0;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    padding: 8px 0;
}
.text-btn:hover { color: var(--ink); }
.text-btn--light { color: #c9c6bc; }
.text-btn--light:hover { color: #fff; }
.text-btn--danger { color: var(--danger); }

.page-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}
.auth { width: min(440px, 100%); }
.auth__card {
    display: grid;
    gap: 18px;
    background: var(--card);
    border-radius: 28px;
    padding: 44px 36px 40px;
    box-shadow: var(--shadow);
    text-align: center;
}
.auth__logo { margin: 0 auto 8px; }
.lede, .error { margin: 0; }
.lede { color: var(--muted); font-size: 18px; }
.error { color: var(--danger); font-weight: 650; }

.page-login--split {
    padding: 0;
    place-items: stretch;
}
.gate {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 1fr) 1.15fr;
    grid-template-areas: "form visual";
}
.gate__visual {
    grid-area: visual;
    --gate-image: url("../login-hero.jpg");
    background:
        linear-gradient(180deg, rgba(27, 94, 32, 0.08), rgba(20, 16, 10, 0.32)),
        var(--gate-image) 52% 42% / cover no-repeat;
}
.gate__side {
    grid-area: form;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}
.gate__main {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 48px 40px 24px;
}
.gate__form {
    width: min(400px, 100%);
    display: grid;
    gap: 18px;
    text-align: center;
}
.gate__form .btn { width: 100%; }
.gate__foot {
    display: flex;
    justify-content: center;
    gap: 28px;
    padding: 20px 24px 28px;
}
.gate__foot a {
    color: var(--muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
}
.gate__foot a:hover { color: var(--ink); }

@media (max-width: 860px) {
    .gate {
        grid-template-columns: 1fr;
        grid-template-rows: 34vh 1fr;
        grid-template-areas: "visual" "form";
    }
    .gate__side { min-height: 0; }
    .gate__main { padding: 32px 22px 16px; }
}

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 28px;
}
.topbar--light {
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    text-decoration: none;
}
.brand--dark { color: #fff; }
.nav { display: flex; gap: 8px; flex: 1; }
.nav__link {
    padding: 10px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 650;
}
.nav__link--on, .nav__link:hover { background: var(--bg); color: var(--ink); }

.wrap { width: min(1080px, calc(100% - 40px)); margin: 36px auto 64px; }
.wrap--wide { width: min(1480px, calc(100% - 32px)); }
.event-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 520px);
    gap: 24px;
    align-items: start;
    margin-bottom: 28px;
}
.mail-preview {
    position: sticky;
    top: 16px;
    background: #ececec;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow);
    min-height: 280px;
}
.mail-preview__bar {
    display: grid;
    gap: 4px;
    padding: 14px 16px 12px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.mail-preview__bar span {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}
.mail-preview__bar strong {
    font-size: 15px;
    font-weight: 650;
    line-height: 1.3;
}
.mail-preview iframe {
    display: block;
    width: 100%;
    height: min(820px, calc(100vh - 140px));
    border: 0;
    background: #ececec;
}
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-admin h1 { margin-bottom: 24px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.tile {
    display: grid;
    gap: 8px;
    background: #fff;
    border-radius: 24px;
    padding: 36px;
    text-decoration: none;
    box-shadow: var(--shadow);
}
.tile strong { font-size: 56px; letter-spacing: -0.04em; }
.tile span { color: var(--muted); font-weight: 650; }

.panel {
    display: grid;
    gap: 16px;
    background: #fff;
    border-radius: 24px;
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
}
.panel label { font-weight: 650; }
.grid-2, .grid-3 { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 140px 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

.seg {
    border: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.seg legend { font-weight: 650; margin-bottom: 8px; width: 100%; }
.seg label {
    display: flex;
    cursor: pointer;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    background: var(--bg);
    font-weight: 650;
}
.seg input:checked + span { background: var(--green); color: #fff; }

.switch { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.switch input { width: 22px; height: 22px; accent-color: var(--green); }

.banner {
    padding: 16px 20px;
    border-radius: 14px;
    margin: 0 0 20px;
    font-weight: 650;
}
.banner--ok { background: #e8f3e8; color: var(--ok); }
.banner--err { background: #fdecea; color: var(--danger); }
.banner--code { background: #fff; box-shadow: var(--shadow); font-size: 22px; letter-spacing: 0.08em; }
.banner--code strong { letter-spacing: 0.18em; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card {
    display: grid;
    gap: 8px;
    background: #fff;
    border-radius: 20px;
    padding: 22px;
    text-decoration: none;
    box-shadow: var(--shadow);
}
.card--on { outline: 3px solid var(--green); }
.card__year { font-size: 28px; font-weight: 750; }
.card__title { color: var(--muted); }
.pill {
    justify-self: start;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    background: var(--bg);
}
.pill--live { background: #e8f3e8; color: var(--ok); }
.pill--archive { background: #ece8df; }
.pill--offline, .pill--draft { color: var(--muted); }

.search { margin: 8px 0 18px; }
.list { display: grid; gap: 10px; }
.row {
    display: grid;
    grid-template-columns: 1.3fr 1fr auto;
    gap: 16px;
    align-items: center;
    background: #fff;
    border-radius: 18px;
    padding: 18px 20px;
}
.row strong { display: block; }
.row span { color: var(--muted); }
.row__meta { display: flex; gap: 16px; color: var(--muted); flex-wrap: wrap; }
.row__actions { display: flex; align-items: center; gap: 12px; }
.row__actions form { display: flex; gap: 12px; }

.panel__title { font-size: 20px; }
.panel--list { gap: 18px; }
.ticket-create {
    display: grid;
    grid-template-columns: 220px 1fr 1.2fr auto;
    gap: 16px;
    align-items: end;
}
.ticket-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.ticket-toolbar .search {
    margin: 0;
    width: min(340px, 100%);
}
.chip {
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: var(--bg);
    font-weight: 650;
    color: var(--ink);
}
.chip.is-on { background: var(--green); color: #fff; }
.ticket-table { display: grid; gap: 8px; }
.ticket-cols,
.ticket-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.7fr) 72px 108px 110px 118px auto;
    gap: 12px 16px;
    align-items: center;
}
.ticket-cols {
    padding: 0 20px 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.ticket-group { display: grid; gap: 8px; }
.ticket-group h3 {
    margin: 10px 0 2px;
    padding: 0 8px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--muted);
}
.ticket-group:first-of-type h3 { margin-top: 0; }
.ticket-row {
    background: var(--bg);
    border-radius: 16px;
    padding: 14px 20px;
}
.ticket-row strong { display: block; }
.ticket-row strong + span { color: var(--muted); }
.ticket-row__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ticket-row__actions form { display: flex; gap: 8px; }

.sheet {
    border: 0;
    border-radius: 24px;
    padding: 32px;
    width: min(480px, calc(100% - 32px));
    box-shadow: var(--shadow);
    background: #fff;
}
.sheet::backdrop { background: rgba(26, 26, 22, 0.45); }
.sheet h2 { margin-bottom: 20px; }
.sheet .btn { margin-top: 20px; width: 100%; }
.meta { margin: 0; display: grid; gap: 14px; }
.meta div { display: grid; gap: 2px; }
.meta dt { color: var(--muted); font-size: 14px; font-weight: 650; }
.meta dd { margin: 0; font-size: 20px; font-weight: 650; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.08em; }
.meta__code {
    font-size: 32px;
    letter-spacing: 0.18em;
    font-weight: 750;
}
.muted { color: var(--muted); }

.page-watch {
    background: var(--watch);
    color: var(--watch-ink);
    height: 100vh;
    overflow: hidden;
}
.watch { height: 100vh; display: grid; grid-template-rows: 56px 1fr; }
.watch__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--watch-line);
}
.watch__body {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
}
.page-watch--chat .watch__body { grid-template-columns: minmax(0, 1fr) 360px; }
.watch__stage {
    overflow: auto;
    min-width: 0;
    padding: 18px 24px 40px;
}
.player {
    position: relative;
    padding-top: 56.25%;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
}
.player iframe, .player__wait {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.player__wait {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    font-size: 32px;
    font-weight: 650;
    color: #d6d3c8;
    padding: 24px;
    text-align: center;
}
.player__wait p { margin: 0; }
.player__wait span {
    font-size: 16px;
    font-weight: 600;
    color: #9d9a90;
}
.watch__info { padding: 28px 6px 0; max-width: 860px; }
.watch__info h1 { font-size: 30px; margin-bottom: 12px; }
.watch__info p { margin: 0; font-size: 18px; color: #c8c5ba; line-height: 1.45; }

.watch__more {
    margin-top: 36px;
    padding: 28px 6px 8px;
    border-top: 1px solid var(--watch-line);
    min-width: 0;
    max-width: 100%;
}
.watch__more h2 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: 0;
    color: #9d9a90;
}
.watch__offers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.watch__offer {
    min-width: 0;
    display: grid;
    gap: 6px;
    background: var(--watch-panel);
    border: 1px solid var(--watch-line);
    border-radius: 16px;
    padding: 18px 18px 16px;
    text-decoration: none;
    color: inherit;
}
.watch__offer:hover { border-color: #5a594f; }
.watch__offer--on {
    border-color: #80a033;
    box-shadow: inset 0 0 0 1px #80a033;
}
.watch__offer strong { font-size: 28px; letter-spacing: -0.03em; }
.watch__offer span {
    color: #c8c5ba;
    font-size: 15px;
    overflow-wrap: anywhere;
}
.watch__offer em {
    font-style: normal;
    font-size: 13px;
    font-weight: 700;
    color: #8aa34a;
}

.chat {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--watch-panel);
    border-left: 1px solid var(--watch-line);
}
.chat__head {
    padding: 16px 18px;
    font-weight: 700;
    border-bottom: 1px solid var(--watch-line);
}
.chat [hidden] { display: none !important; }
.chat__boot {
    flex: 1;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 18px;
    padding: 32px 18px;
    color: #9d9a90;
    font-size: 15px;
    font-weight: 650;
}
.chat__boot p { margin: 0; }
.chat__loader {
    position: relative;
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
}
.chat__loader img {
    width: 36px;
    height: 36px;
    animation: chat-pulse 1.6s ease-in-out infinite;
}
.chat__loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid #2a2a26;
    border-top-color: #80a033;
    border-right-color: #80a033;
    animation: chat-spin 0.85s linear infinite;
}
@keyframes chat-spin {
    to { transform: rotate(360deg); }
}
@keyframes chat-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.92); opacity: 0.7; }
}
.chat__gate {
    flex: 1;
    display: grid;
    gap: 14px;
    padding: 28px 18px;
    align-content: start;
}
.chat__room { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat__list {
    flex: 1;
    overflow: auto;
    padding: 16px 14px;
    display: grid;
    align-content: start;
    gap: 14px;
}
.chat__emojis {
    display: flex;
    gap: 2px;
    padding: 8px 10px 4px;
    border-top: 1px solid var(--watch-line);
    overflow-x: auto;
}
.chat__emoji {
    flex: 1;
    min-width: 32px;
    min-height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 18px;
    line-height: 1;
}
.chat__emoji:hover { background: #2a2a26; }
.chat__item {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 10px;
    align-items: start;
}
.chat__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 750;
    color: #fff;
    letter-spacing: 0.02em;
}
.chat__bubble strong { display: block; font-size: 13px; color: #9d9a90; margin-bottom: 2px; }
.chat__bubble p { margin: 0; font-size: 16px; word-break: break-word; }
.chat__form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--watch-line);
}
.chat__send {
    min-height: 52px;
    padding: 0 16px;
}
.chat .input {
    background: #0f0f0e;
    border-color: #33322d;
    color: #fff;
}
.chat .input:focus { border-color: var(--green); }

@media (max-width: 1100px) {
    .event-split { grid-template-columns: 1fr; }
    .mail-preview { position: static; }
    .mail-preview iframe { height: 640px; }
    .ticket-create { grid-template-columns: 1fr 1fr; }
    .ticket-create .btn { grid-column: 1 / -1; }
    .ticket-cols,
    .ticket-row { grid-template-columns: minmax(160px, 1.4fr) 64px 96px 100px auto; }
    .ticket-row > :nth-child(5) { display: none; }
    .ticket-cols > :nth-child(5) { display: none; }
}

@media (max-width: 860px) {
    h1 { font-size: 32px; }
    .tiles, .grid-2, .grid-3, .row, .ticket-create { grid-template-columns: 1fr; }
    .ticket-create .btn { grid-column: auto; }
    .ticket-toolbar { flex-direction: column; align-items: stretch; }
    .ticket-toolbar .search { width: 100%; }
    .ticket-cols { display: none; }
    .ticket-row { grid-template-columns: 1fr; gap: 10px; }
    .ticket-row > :nth-child(5) { display: grid; }
    .ticket-cell::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 2px;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
    }
    .ticket-row__actions { justify-content: flex-start; }
    .topbar { flex-wrap: wrap; }
    .page-watch, .watch { height: auto; min-height: 100vh; overflow: visible; }
    .page-watch--chat .watch__body { grid-template-columns: 1fr; }
    .watch__stage { padding: 12px 12px 24px; }
    .chat {
        min-height: 420px;
        border-left: 0;
        border-top: 1px solid var(--watch-line);
    }
}
