:root {
    --primary: #e87c3e;
    --primary-hover: #d06828;
    --primary-light: #fdf0e8;
    --success: #2e7d52;
    --success-light: #e8f5ee;
    --danger: #c0392b;
    --muted: #888;
    --border: #e0e0e0;
    --card-bg: #fff;
    --header-bg: linear-gradient(135deg, #e87c3e 0%, #f4a261 100%);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font);
    background: #f7f4f0;
    color: #2d2d2d;
    margin: 0;
    min-height: 100vh;
}

/* ── Header public ── */
.site-header {
    background: var(--header-bg);
    color: #fff;
    padding: 2.5rem 1.5rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.site-header::before {
    content: '🎪 🎠 🎡 🎪';
    position: absolute;
    top: 0.5rem;
    left: 0;
    right: 0;
    font-size: 1.2rem;
    opacity: 0.3;
    letter-spacing: 2rem;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.header-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .header-inner { flex-direction: column; gap: 0.75rem; }
    .header-logo { width: 70px; height: 70px; }
}

.site-header h1 {
    margin: 0 0 0.25rem;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.site-header .subtitle {
    opacity: 0.9;
    font-size: 1.05rem;
    margin: 0;
}

/* ── Layout ── */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

main.container {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* ── Cards ── */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    margin: 0 0 1.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.6rem;
}

/* ── Form ── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 580px) {
    .form-grid { grid-template-columns: 1fr; }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.field.full { grid-column: 1 / -1; }

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #444;
}

label .req { color: var(--primary); }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color .15s;
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,124,62,.15);
}

.field-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.1rem;
}

/* ── Stands grid ── */
.stands-group { margin-bottom: 1.75rem; }
.stands-group-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.stands-group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.85rem;
}

.slot-card {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
    position: relative;
    background: #fff;
}

.slot-card:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(232,124,62,.15);
}

.slot-card.full {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

.slot-card input[type="radio"],
.slot-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.slot-card .slot-label {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.slot-card .slot-time {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.2rem;
}

.slot-card .slot-position {
    font-size: 0.83rem;
    color: #666;
    margin-bottom: 0.35rem;
}

.slot-card .slot-availability {
    font-size: 0.78rem;
    font-weight: 600;
}

.slot-availability.available { color: var(--success); }
.slot-availability.last { color: #e68a00; }
.slot-availability.full-label { color: var(--danger); }

.badge-full {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    background: #ddd;
    color: #777;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.conflict-msg {
    font-size: 0.75rem;
    color: #c0392b;
    font-weight: 600;
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid #fcd0cc;
}

.slot-registrants {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eee;
}

.registrant-chip {
    display: inline-block;
    font-size: 0.75rem;
    background: #f0f0f0;
    color: #555;
    border-radius: 20px;
    padding: 0.15rem 0.55rem;
    font-weight: 500;
}

.slot-card.full .registrant-chip {
    background: #e8e8e8;
    color: #777;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, transform .1s;
    text-decoration: none;
}

.btn:active { transform: scale(.98); }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: #eee;
    color: #333;
}
.btn-secondary:hover { background: #e0e0e0; }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #a93226; }

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
}

/* ── Alerts ── */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}
.alert-error {
    background: #fdecea;
    border: 1px solid #f5c6c1;
    color: var(--danger);
}
.alert-success {
    background: var(--success-light);
    border: 1px solid #a8d5be;
    color: var(--success);
}

/* ── Confirmation page ── */
.confirmation-box {
    text-align: center;
    padding: 3rem 2rem;
}
.confirmation-box .icon { font-size: 4rem; margin-bottom: 1rem; }
.confirmation-box h2 { color: var(--success); font-size: 1.75rem; margin-bottom: 0.5rem; }
.confirmation-detail {
    background: var(--success-light);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem auto;
    max-width: 420px;
    text-align: left;
}
.confirmation-detail p { margin: 0.3rem 0; }
.confirmation-detail strong { color: #1a5c38; }

/* ── Admin layout ── */
body.admin-body {
    background: #f0f2f5;
}

.admin-header {
    background: #1e293b;
    color: #fff;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-header .logo {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -.3px;
}

.admin-header .logo span { color: var(--primary); }

.admin-nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.admin-nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    transition: background .15s, color .15s;
}

.admin-nav a:hover, .admin-nav a.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.admin-main {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1.25rem;
}

.admin-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: #1e293b;
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: 10px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

thead tr { background: #f8fafc; }
th { font-weight: 700; color: #475569; text-align: left; }
th, td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
}
tbody tr:hover { background: #f8fafc; }

/* ── Dashboard badges ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}
.badge-ok { background: var(--success-light); color: var(--success); }
.badge-warn { background: #fff3cd; color: #856404; }
.badge-full { background: #fdecea; color: var(--danger); }

/* ── Admin form ── */
.admin-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.slot-row {
    display: grid;
    grid-template-columns: 1fr 130px 100px 100px 1fr 70px 36px;
    gap: 0.6rem;
    align-items: end;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.slot-row:last-child { border-bottom: none; }

.btn-remove-slot {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.3rem;
    border-radius: 4px;
}
.btn-remove-slot:hover { background: #fdecea; }

#slots-header {
    display: grid;
    grid-template-columns: 1fr 130px 100px 100px 1fr 70px 36px;
    gap: 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 0 0 0.4rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0.5rem;
}

/* ── Footer ── */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.82rem;
}

/* ── Misc ── */
.text-muted { color: var(--muted); font-size: 0.9rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; align-items: center; gap: 0.75rem; }
.spacer { flex: 1; }
.no-slots { color: var(--muted); font-style: italic; padding: 1rem 0; }

@media print {
    .admin-header, .admin-nav, .btn, form { display: none !important; }
    body { background: #fff; }
    table { font-size: 11pt; }
}
