:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #16a34a;
    --warning: #d97706;
    --error: #dc2626;
    --bg: #f7f7fb;
    --text: #1f2430;
    --muted: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
}

* { box-sizing: border-box; }

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

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

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 64px;
}
.container-narrow { max-width: 480px; }
.container-wide { max-width: 1280px; }

.hero {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    background-size: cover;
    background-position: center;
    color: #fff;
    padding: 80px 20px;
}
.hero-overlay {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    background: rgba(0,0,0,0.35);
    padding: 32px;
    border-radius: var(--radius);
}
.hero h1 { font-size: 2rem; margin: 0 0 8px; }
.hero-meta { margin: 0 0 24px; font-size: 1.05rem; }

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.text-center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #eef0ff; color: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-link { color: var(--primary); text-decoration: none; margin-left: 12px; font-size: 0.9rem; }

.btn-tiny {
    font-size: 0.75rem;
    padding: 4px 8px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 4px;
}
.btn-tiny-danger { border-color: var(--error); color: var(--error); }

.form label {
    display: block;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 0.9rem;
}
.form input, .form textarea, .form select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}
.inline-form { display: inline-flex; gap: 6px; align-items: center; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

.qr-box { margin: 24px 0; }
.qr-box img { border: 8px solid #fff; box-shadow: 0 0 0 1px var(--border); border-radius: 8px; }

/* ---------- Escáner ---------- */
.scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.qr-reader { width: 100%; border-radius: var(--radius); overflow: hidden; margin: 16px 0; }

.result-panel {
    text-align: center;
    padding: 20px 16px;
    border-radius: var(--radius);
    margin-top: 16px;
    transition: background-color 0.15s ease;
}
.result-status { font-size: 1.1rem; font-weight: 700; margin: 0; }
.result-panel-idle { background: #eef0ff; color: var(--primary-dark); }
.result-panel-pending { background: #eef0ff; color: var(--primary-dark); }
.result-panel-success { background: #dcfce7; color: #166534; }
.result-panel-warning { background: #fef3c7; color: #92400e; }
.result-panel-error { background: #fee2e2; color: #991b1b; }

.result-attendee { margin-top: 10px; }
.result-attendee.hidden { display: none; }
.attendee-name { font-size: 1.6rem; font-weight: 800; margin: 4px 0 2px; }
.attendee-email { font-size: 1rem; opacity: 0.8; margin: 0 0 6px; }
.attendee-extra { font-size: 0.95rem; opacity: 0.85; margin: 0; }

.result-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.result-actions.hidden { display: none; }
.result-actions .hidden { display: none; }
.result-actions .btn-primary { font-size: 1.1rem; padding: 16px 24px; }

/* ---------- Panel admin ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.stat-num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--primary); }

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.actions-cell { white-space: nowrap; }

.table-toolbar .inline-form input[type="text"] { width: 260px; }

.badge { padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-registered { background: #eef0ff; color: var(--primary-dark); }
.badge-checked_in { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

.pagination { display: flex; gap: 6px; margin-top: 16px; }
.pagination a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.banner-preview { max-width: 240px; display: block; margin-top: 8px; border-radius: 8px; }

.footer { text-align: center; padding: 24px; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 600px) {
    .hero { padding: 48px 16px; }
    .hero h1 { font-size: 1.5rem; }
}
