*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --c-primary: #2563eb;
    --c-primary-dark: #1d4ed8;
    --c-success: #16a34a;
    --c-danger: #dc2626;
    --c-warning: #d97706;
    --c-bg: #f8fafc;
    --c-surface: #ffffff;
    --c-border: #e2e8f0;
    --c-text: #0f172a;
    --c-muted: #64748b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body { font-family: system-ui, -apple-system, sans-serif; background: var(--c-bg); color: var(--c-text); line-height: 1.6; font-size: 16px; }

.container { max-width: 860px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: .75rem 0; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.site-brand { font-weight: 700; font-size: 1.1rem; color: var(--c-primary); text-decoration: none; }
.site-header nav a { margin-left: .5rem; color: var(--c-muted); text-decoration: none; font-size: .9rem; }
.site-header nav a:hover { color: var(--c-text); }

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

.site-footer { border-top: 1px solid var(--c-border); padding: 1rem 0; text-align: center; color: var(--c-muted); font-size: .85rem; margin-top: 4rem; }

/* Cards */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding:.5em 1.5rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 0rem; }
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: .25rem; }
.card-subtitle { color: var(--c-muted); font-size: .9rem; margin-bottom: 1rem; }

/* Page heading */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; }
.page-header p { color: var(--c-muted); margin-top: .25rem; }

/* Forms */
.form-group { margin-bottom: 1rem; }
label { display: block; font-weight: 500; margin-bottom: .3rem; font-size: .9rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password],
textarea, select {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--c-surface);
    transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: .8rem; color: var(--c-muted); margin-top: .25rem; }
.field-error { font-size: .8rem; color: var(--c-danger); margin-top: .25rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1.25rem; border-radius: 6px; font-size: .95rem; font-weight: 500;
    cursor: pointer; border: none; text-decoration: none; transition: background .15s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover { background: var(--c-bg); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-sm { padding: .3rem .75rem; font-size: .85rem; }
.btn-full { width: 100%; }

/* Alerts */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .95rem; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* Status badges */
.badge { display: inline-block; padding: .2em .6em; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; padding: .6rem .75rem; font-weight: 600; border-bottom: 2px solid var(--c-border); color: var(--c-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
td { padding: .6rem .75rem; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--c-bg); }

/* QR code display */
.qr-wrapper { text-align: center; padding: 1.5rem; background: #fff; border: 2px dashed var(--c-border); border-radius: var(--radius); }
.qr-wrapper img { max-width: 220px; width: 100%; }
.qr-label { margin-top: .75rem; font-size: .85rem; color: var(--c-muted); }

/* Scan result states */
.scan-result { text-align: center; padding: 2rem 1rem; }
.scan-result .icon { font-size: 3rem; margin-bottom: 1rem; }
.scan-result h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: .5rem; }
.scan-result p { color: var(--c-muted); max-width: 480px; margin: 0 auto .5rem; }

/* Progress / steps */
.steps { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.step { flex: 1; padding: .4rem; text-align: center; font-size: .8rem; font-weight: 500; border-radius: 6px; background: var(--c-bg); color: var(--c-muted); border: 1px solid var(--c-border); }
.step.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.step.done   { background: #dcfce7; color: #166534; border-color: #bbf7d0; }

/* Leaderboard */
.leaderboard-row { display: flex; align-items: center; gap: 1rem; padding: .75rem; border-bottom: 1px solid var(--c-border); }
.leaderboard-rank { font-size: 1.1rem; font-weight: 700; min-width: 2rem; color: var(--c-muted); }
.leaderboard-rank.top { color: #d97706; }
.leaderboard-name { flex: 1; font-weight: 500; }
.leaderboard-score { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Utility */
.flex { display: flex; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.ms-2 {
    margin-left: 1rem;
}
.text-muted { color: var(--c-muted); }
.text-sm { font-size: .875rem; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
