:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #172033;
    --muted: #62708a;
    --line: #d9e0ea;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b42318;
    --shadow: 0 14px 40px rgba(23, 32, 51, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--primary-dark);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 800;
    text-decoration: none;
    color: var(--text);
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.show-picker label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.show-picker select {
    min-height: 34px;
    min-width: 180px;
    padding: 6px 10px;
}

.topbar nav a {
    text-decoration: none;
    color: var(--muted);
    font-weight: 650;
}

.topbar nav a.active,
.topbar nav a:hover {
    color: var(--primary-dark);
}

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.hero,
.panel,
.card,
.ticket {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
    padding: 36px;
}

.hero h1,
.panel h1 {
    margin: 0 0 10px;
    font-size: 32px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary-dark);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 13px;
}

.actions,
.actions-row,
.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.button.primary,
button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.button.danger,
button.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.button.ghost {
    background: transparent;
}

.grid {
    display: grid;
    gap: 18px;
}

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

.card,
.panel {
    padding: 24px;
    margin-bottom: 20px;
}

.form {
    max-width: 820px;
}

.form.narrow {
    max-width: 480px;
}

.form.wide {
    max-width: none;
}

label {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: var(--text);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

textarea {
    resize: vertical;
}

.check {
    display: flex;
    align-items: center;
    gap: 9px;
}

.check input {
    width: auto;
    min-height: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

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

.stats div {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.stats strong {
    display: block;
    font-size: 28px;
}

.stats span,
.muted {
    color: var(--muted);
}

.status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e7f6f4;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
}

.flash,
.error {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.flash.success {
    background: #ecfdf3;
    border: 1px solid #abefc6;
}

.error {
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: var(--danger);
}

.ticket {
    display: grid;
    grid-template-columns: 1fr 210px;
    gap: 24px;
    padding: 32px;
    align-items: center;
    max-width: 780px;
}

.ticket .code {
    font-size: 22px;
    font-weight: 850;
    letter-spacing: 1px;
}

.qr {
    width: 190px;
    height: 190px;
    border: 1px solid var(--line);
}

.scan-form {
    display: grid;
    gap: 12px;
}

.scanner {
    width: 100%;
    max-height: 360px;
    margin-top: 16px;
    border-radius: 8px;
    background: #000;
}

.details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 20px;
}

.inline-access {
    display: grid;
    gap: 6px;
}

.inline-access .button {
    justify-self: start;
    min-height: 34px;
    padding: 6px 10px;
}

@media (max-width: 760px) {
    .topbar,
    .hero,
    .ticket {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
    }

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

    .hero,
    .panel,
    .card,
    .ticket {
        padding: 18px;
    }

    table {
        display: block;
        overflow-x: auto;
    }
}
