/* Fitclan Scan — mobile entry check-in app */
:root { --ink: #1a0a2e; --purple: #2b1052; --violet: #6b3fb0; --orange: #f8a51c; --paper: #f4f0e8; --ok: #15803d; --warn: #b45309; --bad: #b42318; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--ink); color: var(--paper); font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
[hidden] { display: none !important; }
.screen { max-width: 560px; margin: 0 auto; padding: 12px 16px 24px; min-height: 100vh; display: flex; flex-direction: column; gap: 12px; }
.card { background: #fff; color: var(--ink); border-radius: 14px; padding: 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 20px; }
.brand small { display: block; color: #6b5a80; font-size: 13px; }
.brand.small strong { font-size: 16px; color: var(--paper); }
.mark { width: 40px; height: 40px; border-radius: 10px; background: var(--orange); color: var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 900; letter-spacing: .02em; flex-shrink: 0; }
.brand.small .mark { width: 32px; height: 32px; border-radius: 8px; font-size: 13px; }

/* login */
#login { justify-content: center; }
.login { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
input { height: 50px; padding: 0 14px; border: 2px solid #d9d1e4; border-radius: 10px; font: 500 17px system-ui, sans-serif; color: var(--ink); background: #fff; width: 100%; }
input:focus { outline: none; border-color: var(--violet); }
.err { margin: 0; color: var(--bad); font-size: 14px; font-weight: 600; min-height: 1em; }
.err:empty { display: none; }
.hint { margin: 0; font-size: 13px; color: #6b5a80; }
.btn { height: 48px; padding: 0 18px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink); font: 700 15px system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--orange); border-color: var(--orange); }
.btn.big { height: 56px; font-size: 17px; flex: 1; }
.btn:disabled { opacity: .6; }

/* scan screen */
.top { display: flex; align-items: center; gap: 10px; }
.stats { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--orange); text-align: right; line-height: 1.2; }
.icon-btn { width: 42px; height: 42px; border-radius: 10px; border: 1px solid rgba(244,240,232,.3); background: rgba(26,10,46,.6); color: var(--paper); font-size: 18px; cursor: pointer; }
.cam { position: relative; aspect-ratio: 3 / 4; max-height: 64vh; width: 100%; border-radius: 16px; overflow: hidden; background: #000; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.frame span { width: 66%; aspect-ratio: 1; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); border: 3px solid var(--orange); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { border-color: #fff; } }
.cam-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: rgba(26,10,46,.88); }
.cam-msg p { margin: 0; font-size: 16px; }
.cam-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 8px; }
.manual { display: flex; flex-direction: column; gap: 8px; }
.manual label { font-size: 13px; color: #4b3e5e; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; text-transform: uppercase; }
.who { margin: 0; text-align: center; font-size: 12px; color: #a99bbd; }

/* result sheet */
.sheet { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet-in { width: 100%; max-width: 560px; background: #fff; color: var(--ink); border-radius: 20px 20px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: up .22s ease-out; border-top: 10px solid var(--tone, var(--violet)); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.r-head { display: flex; align-items: center; gap: 12px; }
.r-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--tone, var(--violet)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; flex-shrink: 0; }
.r-head h2 { margin: 0; font-size: 24px; line-height: 1.1; color: var(--tone, var(--ink)); }
.r-msg { margin: 0; font-size: 15px; color: #4b3e5e; }
.r-msg:empty { display: none; }
.r-pass { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; background: #f8f6fb; }
.r-name { font-size: 26px; font-weight: 900; line-height: 1.1; }
.r-id { font: 600 15px ui-monospace, Menlo, monospace; color: var(--violet); }
.r-slot { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-weight: 800; font-size: 17px; }
.r-timing { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #ecfdf3; color: var(--ok); }
.r-timing.early, .r-timing.none { background: #fef7e6; color: var(--warn); }
.r-timing.late { background: #fef3f2; color: var(--bad); }
.r-dl { margin: 4px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.r-dl dt { color: #6b5a80; }
.r-dl dd { margin: 0; font-weight: 600; }
.r-dl a { color: var(--violet); }
.r-btns { display: flex; gap: 10px; }
.sheet.ok { --tone: var(--ok); }
.sheet.already { --tone: var(--warn); }
.sheet.bad { --tone: var(--bad); }
.sheet.ready { --tone: var(--violet); }
