@font-face { font-family: 'Johnson Text'; src: url('/fonts/JohnsonText-Light.otf') format('opentype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Johnson Text'; src: url('/fonts/JohnsonText-Regular.otf') format('opentype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Johnson Display'; src: url('/fonts/JohnsonDisplay-Regular.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Johnson Display'; src: url('/fonts/JohnsonDisplay-Bold.otf') format('opentype'); font-weight: 700; font-display: swap; }

:root {
  --red: #eb1700;
  --red-dark: #b81200;
  --pink: #f3e5e5;
  --pink-strong: #f0dcdc;
  --ink: #212121;
  --muted: #605e5c;
  --line: #d2d0ce;
  --field: #f4f4f4;
  --bg: #f7f7f7;
  --ok: #107c10;
  --text: 'Johnson Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --display: 'Johnson Display', 'Johnson Text', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--text); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--red); }

/* ---------- Form shell ---------- */
.banner { height: 180px; background: linear-gradient(120deg, var(--red) 0%, #c41400 55%, #8f0e00 100%); position: relative; overflow: hidden; }
.banner::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.18), transparent 45%), radial-gradient(circle at 10% 120%, rgba(255,255,255,.12), transparent 40%); }
.sheet { max-width: 800px; margin: -90px auto 48px; background: #fff; border-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 0 1px rgba(0,0,0,.12); position: relative; padding: 40px 40px 32px; }
.form-title { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1.25; margin: 0 0 12px; color: var(--ink); }
.form-desc { color: var(--muted); font-size: 14px; margin: 0 0 32px; }
.req-note { font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.star { color: var(--red); }

.section-head { background: var(--pink); border-radius: 4px; padding: 18px 20px; margin: 40px -12px 28px; }
.section-head h2 { font-family: var(--display); font-weight: 400; color: var(--red); font-size: 20px; margin: 0; }
.section-head .note { font-size: 13px; margin-top: 12px; color: var(--ink); }
.section-head .note p { margin: 0 0 8px; }

.q { margin: 0 0 32px; }
.q[hidden] { display: none; }
.q-head { background: var(--pink); border-radius: 4px; padding: 0 16px 14px; position: relative; display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.q-num { display: inline-block; background: var(--red); color: #fff; font-size: 12px; min-width: 24px; height: 24px; line-height: 24px; text-align: center; border-radius: 0 0 4px 4px; padding: 0 6px; margin-bottom: 8px; }
.q-text { flex: 1 1 260px; }
.q-label { display: block; font-size: 15px; }
.q-hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.q-head.no-num { padding-top: 14px; }
.q-body { padding: 14px 0 0; }

.input { width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; min-height: 40px; outline: none; transition: border-color .15s, background .15s; }
.input:hover { border-color: #8a8886; }
.input:focus { border-color: var(--red); background: #fff; box-shadow: inset 0 -2px 0 var(--red); }
.input.half { max-width: 340px; }
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 520px; }

.choices { display: flex; flex-direction: column; gap: 4px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 7px 6px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.choice:hover { background: #faf4f4; }
.choice input[type="radio"] { appearance: none; width: 18px; height: 18px; border: 1px solid #605e5c; border-radius: 50%; margin: 0; flex: 0 0 auto; display: grid; place-items: center; cursor: pointer; }
.choice input[type="radio"]::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--red); transform: scale(0); transition: transform .12s; }
.choice input[type="radio"]:checked { border-color: var(--red); }
.choice input[type="radio"]:checked::before { transform: scale(1); }
.choice input[type="radio"]:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.choice .other-input { flex: 1; max-width: 360px; }

.size-chart { background: #fff; border-radius: 4px; padding: 10px 12px 12px; margin-top: 12px; flex: 0 0 auto; }
.size-chart h4 { margin: 0 0 6px; font-family: var(--display); font-size: 14px; color: var(--red); }
.size-chart.polo h4 { color: #003479; }
.size-chart table { border-collapse: collapse; font-size: 13px; min-width: 220px; }
.size-chart th { background: var(--red-dark); color: #fff; text-align: left; padding: 6px 10px; font-weight: 500; }
.size-chart.polo th { background: #003479; }
.size-chart td { padding: 4px 10px; border-bottom: 1px solid #eee; background: #f7f7f7; }
.size-chart td + td { text-align: center; }

.q.invalid .q-body .input, .q.invalid .choices { border-color: var(--red); }
.q.invalid .choices { border-left: 3px solid var(--red); padding-left: 8px; }
.err { color: var(--red); font-size: 13px; margin-top: 8px; display: none; }
.q.invalid .err { display: block; }

.actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.btn { background: var(--red); color: #fff; border: 0; border-radius: 4px; padding: 10px 28px; font-size: 15px; cursor: pointer; min-height: 40px; }
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f3f2f1; }
.form-error { color: var(--red); font-size: 14px; }

.footer { text-align: center; color: var(--muted); font-size: 12px; margin: 0 auto 40px; max-width: 800px; padding: 16px; border-top: 1px solid var(--line); }

/* ---------- Thank you ---------- */
.ty { text-align: center; padding-top: 48px; }
.ty-check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin: 0 auto 20px; }
.ty h1 { font-family: var(--display); font-weight: 700; font-size: 28px; margin: 0 0 8px; }
.ty .sub { color: var(--muted); margin: 0 0 28px; }
.ty-card { display: inline-flex; flex-direction: column; align-items: center; border: 1px solid var(--line); border-top: 6px solid var(--red); border-radius: 8px; padding: 28px 40px 24px; background: #fff; min-width: 300px; }
.ty-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ty-name { font-family: var(--display); font-weight: 700; font-size: 26px; margin: 4px 0 14px; }
.ty-id { font-family: var(--display); font-size: 22px; color: var(--red); letter-spacing: .04em; margin: 4px 0 18px; }
.ty-qr { width: 220px; height: 220px; }
.ty-qr img, .ty-qr svg { width: 100%; height: 100%; image-rendering: pixelated; }
.ty-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.ty-note { font-size: 13px; color: var(--muted); margin-top: 20px; }

/* ---------- Admin ---------- */
.admin-top { background: var(--red); color: #fff; padding: 14px 28px; display: flex; align-items: center; gap: 16px; }
.admin-top h1 { font-family: var(--display); font-weight: 700; font-size: 18px; margin: 0; flex: 1; }
.admin-top .btn { background: rgba(255,255,255,.15); padding: 6px 14px; min-height: 32px; font-size: 13px; }
.admin-top .btn:hover { background: rgba(255,255,255,.28); }
.admin-wrap { max-width: 1400px; margin: 0 auto; padding: 24px 28px 48px; }
.login { max-width: 380px; margin: 12vh auto; background: #fff; padding: 32px; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.login h1 { font-family: var(--display); font-size: 22px; margin: 0 0 6px; }
.login p { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.login .btn { width: 100%; margin-top: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 6px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border-left: 4px solid var(--red); }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }

.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 20px; }
.panel { background: #fff; border-radius: 6px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.panel h3 { font-family: var(--display); font-size: 14px; margin: 0 0 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 32px; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 6px; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 10px; background: #f1eeee; border-radius: 5px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--red); border-radius: 5px; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input { width: auto; min-width: 160px; background: #fff; }
.toolbar .search { flex: 1 1 260px; }
.toolbar .count { color: var(--muted); font-size: 13px; margin-left: auto; }

.table-wrap { background: #fff; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; background: #faf7f7; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid #eee; white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 10px 12px; border-bottom: 1px solid #f1f1f1; white-space: nowrap; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: #fdf6f6; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #f1eeee; }
.tag.yes { background: #fde7e4; color: var(--red-dark); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.drawer-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: #fff; z-index: 11; overflow: auto; box-shadow: -4px 0 16px rgba(0,0,0,.15); }
.drawer-head { background: var(--red); color: #fff; padding: 20px 24px; display: flex; gap: 16px; align-items: flex-start; }
.drawer-head h2 { font-family: var(--display); margin: 0; font-size: 20px; }
.drawer-head .id { opacity: .9; font-size: 14px; margin-top: 2px; }
.drawer-head .close { margin-left: auto; background: none; border: 0; color: #fff; font-size: 26px; cursor: pointer; line-height: 1; }
.drawer-body { padding: 20px 24px 32px; }
.drawer-qr { width: 140px; height: 140px; margin: 0 0 16px; }
.drawer-qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.drawer h4 { font-family: var(--display); color: var(--red); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin: 22px 0 8px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.danger { color: var(--red); background: none; border: 1px solid var(--red); border-radius: 4px; padding: 6px 14px; cursor: pointer; margin-top: 24px; }

@media (max-width: 640px) {
  .banner { height: 120px; }
  .sheet { margin: -60px 10px 32px; padding: 28px 18px; }
  .section-head { margin: 32px -6px 24px; }
  .name-row { grid-template-columns: 1fr; }
  .admin-wrap { padding: 16px; }
  .kv { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .banner, .ty-actions, .footer { display: none; }
  .sheet { box-shadow: none; margin: 0 auto; }
}
