/* ============================================================
   Site Bilete — design system
   Layout: sticky app bar; one content column (max 1120px) for forms and
   cards, fluid width for data tables; a card marks only the primary
   panel of each page. Door-staff screens are optimised for one hand,
   at night, on a phone.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=Manrope:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    /* Color — cool ink neutrals with a violet bias, rose accent (wristband) */
    --bg: #f4f4f9;
    --surface: #ffffff;
    --surface-2: #ebebf4;
    --fg: #16162b;
    --fg-muted: #5c5c78;
    --line: #d9d9e6;
    --line-strong: #b9b9cf;
    --accent: #c8275e;
    --accent-hover: #a91c4d;
    --accent-fg: #ffffff;
    --accent-soft: #fbe3ec;
    /* Semantic state colors (separate from the accent) */
    --ok: #1f8a4c;
    --ok-soft: #dff5e7;
    --warn: #b7791f;
    --warn-soft: #fff1d6;
    --bad: #c62828;
    --bad-soft: #fde3e3;
    --info: #2f6fed;
    --info-soft: #e2ecff;
    --whatsapp: #128c7e;
    --shadow: 0 1px 2px rgba(22, 22, 43, 0.06), 0 10px 28px -14px rgba(22, 22, 43, 0.22);
    --shadow-pop: 0 24px 60px -20px rgba(22, 22, 43, 0.45);
    --radius: 12px;
    --radius-sm: 7px;
    /* Type */
    --font-display: 'Syne', 'Manrope', system-ui, sans-serif;
    --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --nav-h: 60px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f0f1c;
        --surface: #171729;
        --surface-2: #202036;
        --fg: #ededf6;
        --fg-muted: #a3a3bf;
        --line: #2c2c47;
        --line-strong: #43435f;
        --accent: #ff5c93;
        --accent-hover: #ff7aa8;
        --accent-fg: #1a0712;
        --accent-soft: #3a1527;
        --ok: #4ade80;
        --ok-soft: #11301f;
        --warn: #f6c453;
        --warn-soft: #3a2c0f;
        --bad: #ff6b6b;
        --bad-soft: #3b1515;
        --info: #7aa2ff;
        --info-soft: #16254a;
        --whatsapp: #25d366;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
        --shadow-pop: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0f0f1c;
    --surface: #171729;
    --surface-2: #202036;
    --fg: #ededf6;
    --fg-muted: #a3a3bf;
    --line: #2c2c47;
    --line-strong: #43435f;
    --accent: #ff5c93;
    --accent-hover: #ff7aa8;
    --accent-fg: #1a0712;
    --accent-soft: #3a1527;
    --ok: #4ade80;
    --ok-soft: #11301f;
    --warn: #f6c453;
    --warn-soft: #3a2c0f;
    --bad: #ff6b6b;
    --bad-soft: #3b1515;
    --info: #7aa2ff;
    --info-soft: #16254a;
    --whatsapp: #25d366;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    --shadow-pop: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
}

/* Legacy variable names still referenced by inline styles in a few places */
:root { --primary-color: var(--accent); }

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
    text-wrap: balance;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 0.75em; }
small, .form-text { font-size: 0.82rem; color: var(--fg-muted); }
strong { font-weight: 700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.w-100 { width: 100%; }
.mt-2 { margin-top: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mono, .tabular { font-variant-numeric: tabular-nums; }

/* ---------- App bar ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
}
.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    min-height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.nav-logo {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    white-space: nowrap;
    color: var(--fg);
}
.nav-logo .mark {
    display: inline-block;
    width: 1.5rem;
    height: 1.1rem;
    margin-right: 0.45rem;
    vertical-align: -0.15em;
    border-radius: 3px;
    background: var(--accent);
    -webkit-mask: radial-gradient(circle at 0 50%, transparent 0.22rem, #000 0.24rem) left/50% 100% no-repeat,
                  radial-gradient(circle at 100% 50%, transparent 0.22rem, #000 0.24rem) right/50% 100% no-repeat;
    mask: radial-gradient(circle at 0 50%, transparent 0.22rem, #000 0.24rem) left/50% 100% no-repeat,
          radial-gradient(circle at 100% 50%, transparent 0.22rem, #000 0.24rem) right/50% 100% no-repeat;
}
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.nav-link, .theme-toggle, .logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--fg-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .theme-toggle:hover, .logout-btn:hover { background: var(--surface-2); color: var(--fg); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-soft); }
.logout-btn { color: var(--bad); }
.logout-btn:hover { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 720px) {
    .nav-container { gap: 0.5rem; }
    .nav-menu { gap: 0; flex-wrap: nowrap; }
    .nav-link span, .theme-toggle span, .logout-btn span { display: none; }
    .nav-link, .theme-toggle, .logout-btn { padding: 0.5rem 0.5rem; font-size: 1.05rem; }
}

/* ---------- Page frame ---------- */
.main-content {
    flex: 1;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding-block: 1.75rem 3rem;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.main-content.container-fluid { max-width: 1480px; }
.page-head { margin-bottom: 1.5rem; }
.page-head h2 { margin-bottom: 0.25rem; }
.page-head p { color: var(--fg-muted); margin: 0; }
.eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.4rem;
}
.footer {
    border-top: 1px solid var(--line);
    padding-block: 1.25rem;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    color: var(--fg-muted);
    font-size: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    justify-content: center;
}
.footer p { margin: 0; }
.footer a { color: var(--fg-muted); text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { color: var(--fg); }

/* ---------- Cards & panels ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.card.elevated { box-shadow: var(--shadow); }
.card h3 { display: flex; align-items: center; gap: 0.5rem; }
.card h3 i { color: var(--accent); }
.panel { padding-block: 1rem; border-top: 1px solid var(--line); }
.panel:first-child { border-top: 0; padding-top: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 40px;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--fg);
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); border-color: var(--surface-2); }
.btn-secondary:hover { background: var(--line); border-color: var(--line); }
.btn-success { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn-success:hover { border-color: var(--ok); }
.btn-danger { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); }
.btn-warning { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.btn-warning:hover { border-color: var(--warn); }
.btn-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.btn-info:hover { border-color: var(--info); }
.btn-whatsapp, .btn-success.btn-sm .fa-whatsapp { color: var(--whatsapp); }
.btn-sm { min-height: 32px; padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn-lg { min-height: 48px; padding: 0.75rem 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }
label { font-weight: 600; font-size: 0.88rem; color: var(--fg); }
label i { color: var(--accent); margin-right: 0.35rem; }
input[type="text"], input[type="tel"], input[type="password"], input[type="email"],
input[type="search"], input[type="number"], select, textarea, .form-control, .form-select {
    width: 100%;
    min-height: 44px;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--fg);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 96px; font-family: var(--font-mono); font-size: 0.9rem; }
input[type="tel"], input[inputmode="tel"] { font-family: var(--font-mono); letter-spacing: 0.02em; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--fg-muted); opacity: 0.8; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--fg-muted) 50%), linear-gradient(135deg, var(--fg-muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat; }
input.is-valid { border-color: var(--ok); }
input.is-invalid { border-color: var(--bad); }
.form-inline { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; }
.form-inline .form-control { flex: 1 1 200px; min-width: 0; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Messages, toasts, banners ---------- */
.error-message, .success-message, .banner {
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    font-weight: 600;
    font-size: 0.92rem;
}
.error-message { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); margin-top: 1rem; }
.success-message {
    position: fixed;
    left: 50%;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 200;
    background: var(--fg);
    color: var(--bg);
    box-shadow: var(--shadow-pop);
    max-width: min(92vw, 480px);
    animation: toast-in 0.2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.terms-update-banner, .service-suspension-banner, .event-ended-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
    font-size: 0.92rem;
}
.terms-update-banner { background: var(--info-soft); color: var(--info); }
.service-suspension-banner { background: var(--warn-soft); color: var(--warn); }
.event-ended-banner { background: var(--bad-soft); color: var(--bad); gap: 0.6rem; justify-content: flex-start; }
.banner-content { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.banner-content a { color: inherit; text-decoration: underline; }
.banner-close-btn { background: transparent; border: 0; color: inherit; font-size: 1rem; cursor: pointer; padding: 0.3rem; border-radius: 4px; }
.banner-close-btn:hover { background: rgba(0, 0, 0, 0.08); }

/* ---------- Badges & status ---------- */
.status-badge, .badge, .ticket-type, .group-badge, .tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--fg);
}
.ticket-type { background: var(--accent-soft); color: var(--accent); }
.group-badge { background: var(--surface-2); color: var(--fg-muted); }
.status-badge.status-verified, .badge-success, .tag.ok, .status-verified { background: var(--ok-soft); color: var(--ok); }
.status-badge.status-pending, .badge-warning, .tag.warn, .status-pending { background: var(--warn-soft); color: var(--warn); }
.badge-danger, .tag.bad { background: var(--bad-soft); color: var(--bad); }
.badge.active, .status-badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.inactive, .status-badge.inactive { background: var(--bad-soft); color: var(--bad); }
td.status-verified, td.status-pending { background: transparent; font-weight: 600; white-space: nowrap; }
td.status-verified { color: var(--ok); }
td.status-pending { color: var(--warn); }

/* ---------- Auth pages ---------- */
.auth-container { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; padding-block: 1rem; }
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}
.auth-card h2 { margin-bottom: 1.25rem; }
.auth-card h2 i { display: block; color: var(--accent); font-size: 1.6rem; margin-bottom: 0.6rem; }
.auth-links { margin-top: 1.25rem; text-align: center; color: var(--fg-muted); font-size: 0.9rem; }
.auth-links p { margin: 0; }

/* ---------- Dashboard ---------- */
.dashboard-header { margin-bottom: 1.5rem; }
.dashboard-header h2 { margin-bottom: 0.25rem; }
.dashboard-header p { margin: 0; color: var(--fg-muted); }
.dashboard-content {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}
.ticket-form-section, .tickets-section, .admin-tools-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.ticket-form-section { grid-row: span 2; box-shadow: var(--shadow); }
.tickets-section p, .admin-tools-section p { color: var(--fg-muted); }
.group-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}
.group-info p { margin: 0; }
@media (max-width: 820px) {
    .dashboard-content { grid-template-columns: 1fr; }
    .ticket-form-section { grid-row: auto; }
}

/* ---------- Tickets table page ---------- */
.tickets-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.tickets-header h2 { margin-bottom: 0.15rem; }
.tickets-header p { margin: 0; color: var(--fg-muted); }
.whatsapp-status { font-size: 0.85rem; }
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--fg-muted);
    font-weight: 600;
}
.status-indicator.success, .status-indicator.active { background: var(--ok-soft); color: var(--ok); }
.status-indicator.error { background: var(--bad-soft); color: var(--bad); }
.status-indicator.warning { background: var(--warn-soft); color: var(--warn); }
.tickets-controls {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.tickets-controls .filter-group { display: flex; flex-direction: column; gap: 0.3rem; }
.tickets-controls label { font-size: 0.78rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.search-box { display: flex; flex-direction: column; justify-content: flex-end; }
@media (max-width: 900px) { .tickets-controls { grid-template-columns: 1fr 1fr; } .search-box { grid-column: 1 / -1; } }
@media (max-width: 480px) { .tickets-controls { grid-template-columns: 1fr; } }

.tickets-table-container {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
}
.tickets-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tickets-table th, .tickets-table td { padding: 0.7rem 0.85rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.tickets-table th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    color: var(--fg-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}
.tickets-table tbody tr:last-child td { border-bottom: 0; }
.tickets-table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.tickets-table td:nth-child(1) { color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.tickets-table td { font-variant-numeric: tabular-nums; }
.tickets-table .actions { display: flex; flex-wrap: wrap; gap: 0.35rem; min-width: 260px; }
.sent-checkbox-label { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; font-weight: 600; font-size: 0.85rem; }
.sent-checkbox-label .checkmark { display: none; }
.sent-checkbox { width: 18px; height: 18px; accent-color: var(--ok); cursor: pointer; }

/* Stacked rows on phones: each cell gets its column name from the header text set via data-label in the page */
@media (max-width: 760px) {
    .tickets-table thead { display: none; }
    .tickets-table, .tickets-table tbody, .tickets-table tr, .tickets-table td { display: block; width: 100%; }
    .tickets-table tr { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
    .tickets-table tr:last-child { border-bottom: 0; }
    .tickets-table td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.4rem 1rem; border: 0; }
    .tickets-table td::before { content: attr(data-label); flex: 0 0 38%; color: var(--fg-muted); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
    .tickets-table td.actions { flex-direction: column; align-items: stretch; }
    .tickets-table td.actions::before { display: none; }
    .tickets-table td.actions .btn { justify-content: flex-start; }
    .tickets-table .actions { min-width: 0; }
}

#pagination-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; }
.pagination-info { color: var(--fg-muted); font-size: 0.88rem; }
.pagination-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.pagination-buttons .btn { min-height: 36px; padding: 0.35rem 0.7rem; }
.pagination-buttons select { width: auto; min-height: 36px; padding-block: 0.3rem; }
.loading-spinner, .loading-indicator { display: flex; align-items: center; justify-content: center; gap: 0.6rem; padding: 2rem 1rem; color: var(--fg-muted); }
.loading-spinner i { font-size: 1.3rem; color: var(--accent); }
.loading-spinner p { margin: 0; }
.no-tickets, .no-tickets-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--fg-muted);
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
}
.no-tickets i { font-size: 2rem; color: var(--accent); margin-bottom: 0.75rem; display: block; }
.no-tickets h3 { color: var(--fg); }

/* ---------- Modals ---------- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(10, 10, 26, 0.55);
    backdrop-filter: blur(3px);
    padding: 1rem;
    overflow-y: auto;
}
.modal-content {
    position: relative;
    background: var(--surface);
    color: var(--fg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    width: 100%;
    max-width: 480px;
    margin: 8vh auto;
    padding: 1.5rem;
}
.modal-content h3 { padding-right: 2rem; }
.modal .close {
    position: absolute;
    top: 0.75rem;
    right: 0.9rem;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--fg-muted);
    cursor: pointer;
}
.modal .close:hover { color: var(--fg); }
.modal-footer { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
#qr-code-container { display: grid; place-items: center; padding: 1rem; background: #fff; border-radius: var(--radius-sm); margin-bottom: 1rem; }
#qr-code-container img { max-width: 240px; }
#ticket-details .ticket-info, .ticket-info { padding: 0.9rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 1rem; }
.ticket-info p { margin: 0.15rem 0; }

/* ---------- Verification ---------- */
.verification-container { max-width: 760px; margin: 0 auto; }
.verification-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}
.verification-card > h2 { margin-bottom: 0.25rem; }
.verification-card > p { color: var(--fg-muted); }
.scanner-section { padding-block: 0.75rem 1.25rem; }
.scanner-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1rem; }
.scanner-container { border-radius: var(--radius); overflow: hidden; background: #000; }
#qr-reader { width: 100% !important; border: 0 !important; }
#qr-reader video { border-radius: var(--radius); }
#qr-reader__dashboard { padding: 0.5rem; background: var(--surface-2); color: var(--fg); }
#qr-reader__dashboard button, #qr-reader__dashboard select { font: inherit; }
.manual-input-section, .phone-verify-section { padding-block: 1.25rem; border-top: 1px solid var(--line); }
.manual-input-section h3, .phone-verify-section h3 { font-size: 1rem; color: var(--fg-muted); font-family: var(--font-body); font-weight: 600; margin-bottom: 0.75rem; }
.verification-result {
    margin-top: 1.25rem;
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface-2);
}
.verification-result h4 { font-size: 1.25rem; margin-bottom: 0.75rem; }
.verification-result.success { background: var(--ok-soft); border-color: var(--ok); }
.verification-result.success h4 { color: var(--ok); }
.verification-result.error { background: var(--bad-soft); border-color: var(--bad); }
.verification-result.error h4 { color: var(--bad); }
.verification-result.warning { background: var(--warn-soft); border-color: var(--warn); }
.verification-result.loading { color: var(--fg-muted); }
.verification-result .ticket-info { background: var(--surface); margin-bottom: 0; }
.fraud-warning { border-radius: var(--radius-sm) !important; }
.scan-feedback { margin-top: 0.75rem; padding: 0.6rem 0.9rem; border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 600; font-size: 0.9rem; }
.ticket-option:hover { transform: translateY(-1px); }

/* Ticket preview (verificare.html?id=) */
.ticket-preview-container { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.ticket-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem 1.25rem; }
.ticket-field { display: flex; flex-direction: column; gap: 0.15rem; }
.ticket-field label { font-size: 0.74rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ticket-field span { font-weight: 600; font-variant-numeric: tabular-nums; }
.ticket-preview-image { margin-block: 1.25rem; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.ticket-preview-image img { display: block; width: 100%; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* Mobile scanner page: scanner first, big targets, no footer */
.verification-mobile .main-content { padding-block: 1rem 2rem; }
.verification-mobile .verification-card { padding: 1rem; }
.verification-mobile .verification-mobile-scanner { min-height: 280px; }
.grid.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.box { background: var(--surface-2); border-radius: var(--radius-sm); padding: 1rem; }
.box h3 { font-size: 0.95rem; font-family: var(--font-body); color: var(--fg-muted); margin-bottom: 0.6rem; }

/* ---------- Logs ---------- */
.logs-header { margin-bottom: 1.25rem; }
.logs-header p { color: var(--fg-muted); margin: 0; }
.group-selector-section { display: grid; grid-template-columns: minmax(240px, 360px) 1fr; gap: 1rem; align-items: end; margin-bottom: 1.25rem; }
.group-selector-section .form-group { margin: 0; }
.logs-container .group-info { margin: 0; flex-direction: row; gap: 1.5rem; flex-wrap: wrap; }
@media (max-width: 640px) { .group-selector-section { grid-template-columns: 1fr; } }

/* ---------- Admin tools ---------- */
.admin-container { display: grid; gap: 1.25rem; }
.admin-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.admin-section h2 { font-size: 1.2rem; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.admin-section h2 i { color: var(--accent); }
.group-list, .ticket-list { display: grid; gap: 0.5rem; }
.group-list > p, .ticket-list > p { color: var(--fg-muted); margin: 0; }
.group-item, .ticket-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
}
.group-item.inactive, .ticket-item.inactive { opacity: 0.65; background: var(--surface-2); }
.group-item small, .ticket-item small { color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.ticket-item { flex-direction: column; align-items: stretch; }
.ticket-item h4 { margin-bottom: 0.25rem; }

/* ---------- Terms page ---------- */
.terms-container { max-width: 760px; margin: 0 auto; }
.terms-header { margin-bottom: 2rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.terms-header h1 { margin-bottom: 0.25rem; }
.terms-header p { color: var(--fg-muted); margin: 0; }
.terms-content { font-size: 0.97rem; line-height: 1.7; }
.terms-content h2 { font-size: 1.2rem; margin-top: 2rem; }
.terms-content h3 { font-size: 1rem; margin-top: 1.25rem; }
.terms-content ul, .terms-content ol { padding-left: 1.4rem; }
.terms-content li { margin-bottom: 0.3rem; }
.terms-content .highlight, .terms-content .important { background: var(--warn-soft); color: var(--fg); padding: 0.1rem 0.3rem; border-radius: 3px; }
.print-actions, .back-link { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
    .navbar, .footer, .theme-toggle, .btn, .print-actions, .back-link { display: none !important; }
    body { background: #fff; color: #000; }
}
