:root{
  --gold-primary:#d4af37;
  --gold-light:#f4e4bc;
  --gold-dark:#b8941f;
  --gold-glow:#ffd700;
  --white:#ffffff;
  --white-soft:#fafafa;
  --white-warm:#fffef7;
  --text-dark:#1a1a1a;
  --text-muted:#666666;
  --border-gold:#e8d5a3;
  --shadow-gold:rgba(212,175,55,0.2);
  --shadow-soft:rgba(0,0,0,0.08);
  --success:#10b981;
  --warning:#f59e0b;
  --error:#ef4444;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:'Segoe UI',system-ui,-apple-system,Roboto,Helvetica,Arial,sans-serif;color:var(--text-dark);background:linear-gradient(135deg,#fffef7 0%,#fafafa 50%,#fffef7 100%);min-height:100vh}
.container{max-width:1100px;margin:24px auto;padding:16px;min-height:calc(100vh - 120px);display:flex;flex-direction:column;justify-content:center}
.container.narrow{max-width:980px}
.card{margin-inline:auto}
.app-footer{margin:24px auto 32px auto}
.app-header{position:sticky;top:0;z-index:10;background:linear-gradient(135deg,var(--white) 0%,var(--white-warm) 100%);backdrop-filter:blur(20px);border-bottom:2px solid var(--border-gold);box-shadow:0 2px 20px var(--shadow-soft);display:flex;align-items:center;justify-content:space-between;padding:16px 24px}
.brand{font-weight:900;letter-spacing:.5px;color:var(--gold-dark);display:flex;align-items:center;gap:12px;font-size:22px;text-shadow:0 1px 2px var(--shadow-gold)}
.brand::before{content:"";display:inline-block;width:12px;height:12px;border-radius:50%;background:linear-gradient(135deg,var(--gold-primary),var(--gold-glow));box-shadow:0 0 12px var(--gold-glow),0 0 6px var(--gold-primary)}
.nav a{color:var(--text-muted);text-decoration:none;margin-left:12px;padding:10px 16px;border-radius:12px;transition:all 0.3s ease;font-weight:500}
.nav a.active,.nav a:hover{color:var(--gold-dark);background:linear-gradient(135deg,var(--gold-light),#fff8e7);box-shadow:0 2px 8px var(--shadow-gold),inset 0 1px 0 rgba(255,255,255,0.8);border:1px solid var(--border-gold)}
.card{background:linear-gradient(135deg,var(--white) 0%,var(--white-warm) 100%);border:2px solid var(--border-gold);border-radius:24px;padding:42px;box-shadow:0 20px 60px var(--shadow-soft),0 0 0 1px rgba(212,175,55,0.1),inset 0 1px 0 rgba(255,255,255,0.9);max-width:980px;width:100%;position:relative}
.card::before{content:"";position:absolute;top:0;left:0;right:0;height:4px;background:linear-gradient(90deg,var(--gold-primary),var(--gold-glow),var(--gold-primary));border-radius:24px 24px 0 0}
.card-title{margin:0 0 16px;color:var(--gold-dark);font-size:42px;line-height:1.2;font-weight:800;text-shadow:0 2px 4px var(--shadow-gold)}
.muted{color:var(--text-muted);font-size:16px}
.grid{display:grid;gap:20px}
.grid.two{grid-template-columns:1fr 1fr}
@media(max-width:900px){.grid.two{grid-template-columns:1fr}}
.field{display:flex;flex-direction:column;gap:10px}
label{font-weight:600;color:var(--text-dark);font-size:15px}
input[type=text],select{width:100%;padding:16px 18px;border:2px solid var(--border-gold);border-radius:16px;background:var(--white);color:var(--text-dark);outline:none;font-size:16px;transition:all 0.3s ease;box-shadow:0 2px 4px var(--shadow-soft)}
input[type=text]:focus,select:focus{border-color:var(--gold-primary);box-shadow:0 0 0 4px var(--shadow-gold),0 4px 12px var(--shadow-soft);background:var(--white-warm)}
.chip-group{display:flex;gap:12px;flex-wrap:wrap}
.chip{display:inline-flex;align-items:center;gap:12px;padding:16px 24px;border:2px solid var(--border-gold);border-radius:999px;background:linear-gradient(135deg,var(--white),var(--white-warm));color:var(--text-dark);cursor:pointer;box-shadow:0 4px 12px var(--shadow-soft),inset 0 1px 0 rgba(255,255,255,0.9);font-size:18px;font-weight:600;transition:all 0.3s ease;position:relative;min-width:140px;justify-content:flex-start}
.chip::before{content:"";width:24px;height:24px;border-radius:50%;border:4px solid var(--text-dark);background:transparent;transition:all 0.3s ease;flex-shrink:0;position:relative;z-index:1;box-shadow:inset 0 0 0 2px var(--gold-primary),0 0 0 1px var(--text-dark)}
.chip::after{content:"";position:absolute;left:36px;top:50%;transform:translateY(-50%);width:6px;height:6px;border-radius:50%;background:var(--gold-primary);transition:all 0.3s ease;z-index:2;opacity:0}
.chip span{position:relative;z-index:1;transition:color 0.3s ease}
.chip:hover{background:linear-gradient(135deg,var(--gold-light),#fff8e7);border-color:var(--gold-primary);box-shadow:0 6px 20px var(--shadow-gold),inset 0 1px 0 rgba(255,255,255,0.9);transform:translateY(-2px)}
.chip input{position:absolute;opacity:0;width:0;height:0;margin:0;padding:0}
.chip:has(input:checked){background:linear-gradient(135deg,var(--gold-primary),var(--gold-dark));color:var(--white)!important;border-color:var(--gold-dark);box-shadow:0 8px 24px var(--shadow-gold),inset 0 2px 4px rgba(0,0,0,0.1);transform:translateY(-1px)}
.chip:has(input:checked) span{color:var(--white)!important}
.chip:has(input:checked)::before{border-color:var(--white);background:var(--white);box-shadow:inset 0 0 0 2px var(--gold-primary),0 0 0 2px var(--gold-dark)}
.chip:has(input:checked)::after{opacity:1;background:var(--gold-primary);left:36px}
.camera{display:flex;gap:16px;align-items:center;justify-content:center}
.camera.big video,.camera.big canvas,.camera.big #preview{width:520px;height:390px}
video,canvas,#preview{width:260px;height:195px;border:3px solid var(--border-gold);border-radius:20px;background:#000;object-fit:cover;box-shadow:0 10px 30px var(--shadow-soft),0 0 0 1px rgba(212,175,55,0.2)}
.actions{margin-top:12px;display:flex;gap:12px}
button{padding:18px 28px;border:0;border-radius:18px;background:linear-gradient(135deg,var(--gold-primary),var(--gold-dark));color:var(--white);font-weight:800;cursor:pointer;letter-spacing:.3px;box-shadow:0 8px 24px var(--shadow-gold),inset 0 1px 0 rgba(255,255,255,0.3);font-size:18px;transition:all 0.3s ease;text-transform:uppercase;font-size:16px}
button:hover{transform:translateY(-2px);box-shadow:0 12px 32px var(--shadow-gold),inset 0 1px 0 rgba(255,255,255,0.3);background:linear-gradient(135deg,var(--gold-glow),var(--gold-primary))}
button:active{transform:translateY(0);box-shadow:0 4px 16px var(--shadow-gold)}
button.secondary{background:linear-gradient(135deg,var(--white),var(--white-warm));color:var(--text-dark);border:2px solid var(--border-gold);box-shadow:0 4px 12px var(--shadow-soft)}
button.secondary:hover{background:linear-gradient(135deg,var(--gold-light),#fff8e7);border-color:var(--gold-primary);color:var(--gold-dark)}
.pill{display:inline-block;padding:8px 14px;border-radius:999px;background:linear-gradient(135deg,var(--gold-light),#fff8e7);color:var(--gold-dark);border:2px solid var(--border-gold);font-weight:700;font-size:13px;box-shadow:0 2px 8px var(--shadow-soft)}
.submit{margin-top:16px}
.submit.right{display:flex;justify-content:flex-end}
.app-footer{margin:24px 0;text-align:center;color:var(--text-muted);font-size:14px}
.hidden{display:none}
.right{text-align:right}
.link{color:var(--gold-dark);text-decoration:none;font-weight:600;transition:all 0.2s}
.link:hover{color:var(--gold-primary);text-shadow:0 1px 2px var(--shadow-gold)}

/* Key/value list */
.kv>div{display:flex;justify-content:space-between;border-bottom:2px dashed var(--border-gold);padding:10px 0}
.kv .k{color:var(--text-muted);font-weight:600}
.kv .v{font-weight:700;color:var(--gold-dark)}

/* Badge layout */
body.print-page{background:var(--white-warm);color:var(--text-dark)}
.print-actions{max-width:860px;margin:16px auto;display:flex;gap:12px}
.badge{width:380px;height:560px;margin:16px auto;padding:0;border:3px solid var(--border-gold);border-radius:20px;display:grid;grid-template-rows:88px 1fr auto;background:linear-gradient(135deg,var(--white),var(--white-warm));color:var(--text-dark);box-shadow:0 10px 30px var(--shadow-soft),0 0 0 1px rgba(212,175,55,0.2)}
.badge::before{content:"";grid-row:1/2;background:linear-gradient(135deg,var(--gold-primary),var(--gold-dark));border-top-left-radius:17px;border-top-right-radius:17px;box-shadow:inset 0 1px 0 rgba(255,255,255,0.3)}
.badge .school{position:absolute;margin-top:18px;width:100%;text-align:center;font-size:24px;font-weight:900;color:var(--white);text-shadow:0 2px 4px rgba(0,0,0,0.3);letter-spacing:1px}
.badge .photo{margin:0 auto;margin-top:-48px;width:86%;padding:12px;border-radius:16px;background:var(--white);box-shadow:0 12px 28px var(--shadow-soft),0 0 0 2px var(--border-gold);border:2px solid var(--border-gold)}
.badge .photo img,.badge .photo .no-photo{width:100%;height:210px;border:2px solid var(--border-gold);border-radius:12px;object-fit:cover;box-shadow:inset 0 2px 4px var(--shadow-soft)}
.badge .info{padding:16px 20px 18px 20px;margin-top:0;display:grid;grid-template-columns:100px 1fr;grid-row-gap:12px}
.badge .label{font-weight:800;color:var(--gold-dark);font-size:13px}
.badge .value{border-bottom:2px dashed var(--border-gold);padding-bottom:8px;color:var(--text-dark);font-weight:600;font-size:14px}
.badge .footer{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-top:2px dashed var(--border-gold);background:linear-gradient(135deg,var(--gold-light),#fff8e7)}
.badge .footer .qr{width:56px;height:56px;border:2px solid var(--border-gold);border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:10px;background:var(--white);box-shadow:0 2px 8px var(--shadow-soft)}
.badge .footer .meta{font-size:12px;color:var(--gold-dark);text-align:right;font-weight:600}
.badge.preview{margin:0}
.badge .school{font-size:24px;font-weight:900;text-align:center;color:var(--gold-dark);text-shadow:0 1px 2px var(--shadow-gold)}
.badge .photo{display:flex;justify-content:center;align-items:center}
.badge .photo img,.badge .photo .no-photo{width:260px;height:200px;border:2px solid var(--border-gold);border-radius:12px;object-fit:cover}
.badge .no-photo{display:flex;align-items:center;justify-content:center;color:var(--text-muted);background:var(--white-soft);font-weight:600}
.badge .info{margin-top:8px;display:grid;grid-template-columns:90px 1fr;grid-row-gap:8px;grid-column-gap:10px}
.badge .label{font-weight:700;color:var(--gold-dark)}
.badge .value{border-bottom:2px dashed var(--border-gold);padding-bottom:6px}

@media print {
  body{margin:0;background:var(--white)}
  .badge{page-break-inside:avoid;border:2px solid var(--gold-primary)}
  .noprint{display:none!important}
  @page { size: A6; margin: 8mm }
}
