/* Headshot — dark by default. The door device is used in low light and the operator has
   about two seconds to read a verdict, so the result states are loud and everything else
   deliberately is not. */

:root {
    --bg: #0b0d10;
    --surface: #14181d;
    --surface-2: #1b2028;
    --line: #262c35;
    --line-soft: #1e242c;
    --ink: #e9e7e2;
    --ink-dim: #9aa2ad;
    --ink-faint: #666e79;
    --accent: #d8c9a3;
    --accent-ink: #1a1509;

    --ok: #45d483;
    --warn: #f0b429;
    --bad: #ff5f57;
    --info: #7aa2f7;

    --r: 10px;
    --r-lg: 16px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.55 var(--sans);
    letter-spacing: -.005em;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { letter-spacing: -.022em; line-height: 1.2; margin: 0 0 .4em; font-weight: 600; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- chrome */

.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: .7rem 1.25rem;
    background: rgba(11, 13, 16, .82);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--line-soft);
    position: sticky;
    top: 0;
    z-index: 40;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(216, 201, 163, .16);
}

.topbar nav { display: flex; gap: .35rem; margin-right: auto; flex-wrap: wrap; }
.topbar nav a {
    color: var(--ink-dim);
    padding: .35rem .7rem;
    border-radius: 7px;
    font-size: .9rem;
}
.topbar nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.topbar nav a.nav-scan { color: var(--accent); }

.signout button {
    background: none; border: 1px solid var(--line);
    color: var(--ink-dim); padding: .35rem .75rem;
    border-radius: 7px; font: inherit; font-size: .85rem; cursor: pointer;
}
.signout button:hover { border-color: var(--ink-faint); color: var(--ink); }

main { max-width: 940px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }
main.bare-main { max-width: 420px; padding-top: 8vh; }
body.bare { display: block; }

/* ---------------------------------------------------------------- surfaces */

.card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.25rem; }
.card h2 { margin-bottom: 1rem; }

.muted { color: var(--ink-dim); }
.faint { color: var(--ink-faint); font-size: .85rem; }
.mono { font-family: var(--mono); }

.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap;
}
.section-head p { margin: 0; }

/* ---------------------------------------------------------------- forms */

label { display: block; font-size: .85rem; color: var(--ink-dim); margin-bottom: .35rem; }

input[type=text], input[type=email], input[type=password],
input[type=datetime-local], input[type=file], select, textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--ink);
    padding: .6rem .75rem;
    border-radius: var(--r);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(216, 201, 163, .13);
}
input[type=file] { padding: .45rem; color: var(--ink-dim); font-size: .9rem; }

.field { margin-bottom: 1rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 620px) { .row { grid-template-columns: 1fr; } }

button, .btn {
    background: var(--accent);
    color: var(--accent-ink);
    border: 1px solid transparent;
    padding: .6rem 1.1rem;
    border-radius: var(--r);
    font: inherit; font-weight: 600; font-size: .92rem;
    cursor: pointer;
    transition: filter .15s, background .15s;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button:active { filter: brightness(.95); }

.btn-quiet, button.quiet {
    background: transparent; color: var(--ink-dim); border-color: var(--line);
    font-weight: 500;
}
.btn-quiet:hover, button.quiet:hover { color: var(--ink); border-color: var(--ink-faint); filter: none; }

button.danger { background: transparent; border-color: rgba(255, 95, 87, .4); color: var(--bad); font-weight: 500; }
button.danger:hover { background: rgba(255, 95, 87, .1); filter: none; }

.wide { width: 100%; }

.alert {
    border-radius: var(--r);
    padding: .7rem .9rem;
    font-size: .9rem;
    margin-bottom: 1.1rem;
    border: 1px solid;
}
.alert-bad { background: rgba(255, 95, 87, .09); border-color: rgba(255, 95, 87, .3); color: #ffb3ae; }
.alert-ok { background: rgba(69, 212, 131, .08); border-color: rgba(69, 212, 131, .28); color: #93e9ba; }
.alert-warn { background: rgba(240, 180, 41, .08); border-color: rgba(240, 180, 41, .3); color: #f3d08a; }

/* ---------------------------------------------------------------- login */

.auth-head { text-align: center; margin-bottom: 1.75rem; }
.auth-head .brand-mark { display: inline-block; margin-bottom: 1rem; }
.auth-head h1 { font-size: 1.35rem; }
.auth-head p { color: var(--ink-dim); font-size: .92rem; }

.code-input {
    font-family: var(--mono);
    font-size: 1.7rem;
    text-align: center;
    letter-spacing: .35em;
    text-indent: .35em;
    padding: .75rem;
}

.secret-block {
    font-family: var(--mono);
    font-size: .95rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: .7rem;
    text-align: center;
    word-break: break-all;
    letter-spacing: .06em;
    color: var(--accent);
}

.qr-frame {
    background: #fff;
    border-radius: var(--r);
    padding: 12px;
    display: inline-block;
    line-height: 0;
}
.qr-centre { text-align: center; margin: 1.25rem 0; }

/* ---------------------------------------------------------------- lists */

.list { display: flex; flex-direction: column; gap: .6rem; }

.item {
    display: flex; align-items: center; gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r);
    padding: .85rem 1rem;
}
.item:hover { border-color: var(--line); }
.item-main { flex: 1; min-width: 0; }
.item-main strong { display: block; font-weight: 600; }
.item-main .faint { display: block; }
.item-actions { display: flex; gap: .5rem; align-items: center; flex-shrink: 0; }

.avatar {
    width: 44px; height: 44px; border-radius: 50%;
    object-fit: cover; background: var(--surface-2);
    border: 1px solid var(--line);
    flex-shrink: 0;
}
.avatar-fallback {
    display: grid; place-items: center;
    font-size: .9rem; font-weight: 600; color: var(--ink-faint);
}

.pill {
    display: inline-block;
    font-size: .72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em;
    padding: .18rem .5rem; border-radius: 999px;
    border: 1px solid var(--line); color: var(--ink-dim);
    white-space: nowrap;
}
.pill-ok { color: var(--ok); border-color: rgba(69, 212, 131, .35); background: rgba(69, 212, 131, .08); }
.pill-warn { color: var(--warn); border-color: rgba(240, 180, 41, .35); background: rgba(240, 180, 41, .08); }
.pill-bad { color: var(--bad); border-color: rgba(255, 95, 87, .35); background: rgba(255, 95, 87, .08); }
.pill-info { color: var(--info); border-color: rgba(122, 162, 247, .35); background: rgba(122, 162, 247, .08); }
.pill-accent { color: var(--accent); border-color: rgba(216, 201, 163, .35); background: rgba(216, 201, 163, .08); }

.empty {
    text-align: center; padding: 3rem 1rem;
    color: var(--ink-faint); border: 1px dashed var(--line);
    border-radius: var(--r-lg);
}

.stat-row { display: flex; gap: 2rem; flex-wrap: wrap; }
.stat b { display: block; font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.stat span { font-size: .8rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
    text-align: left; font-weight: 600; font-size: .74rem;
    text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint);
    padding: .5rem .6rem; border-bottom: 1px solid var(--line);
}
td { padding: .6rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------- guest invite */

.invite-hero { text-align: center; }
.invite-hero h1 { font-size: 1.75rem; margin-bottom: .25rem; }
.invite-hero .venue { color: var(--ink-dim); }

.countdown {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .85rem; color: var(--ink-dim);
}
.countdown-ring {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    animation: spin var(--step, 30s) linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .countdown-ring { animation: none; } }

.invite-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.invite-meta div span { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.invite-meta div b { font-weight: 500; }

/* ---------------------------------------------------------------- door scanner */

.scanner-shell { max-width: 560px; margin: 0 auto; }

#video-wrap {
    position: relative;
    background: #000;
    border-radius: var(--r-lg);
    overflow: hidden;
    aspect-ratio: 3 / 4;
    border: 1px solid var(--line);
}
#video { width: 100%; height: 100%; object-fit: cover; display: block; }

.reticle {
    position: absolute; inset: 12%;
    border: 2px solid rgba(216, 201, 163, .5);
    border-radius: 14px;
    pointer-events: none;
}
.reticle::before, .reticle::after {
    content: ''; position: absolute; left: -2px; right: -2px; height: 2px;
    background: var(--accent); opacity: .8;
}
.reticle::before { top: -2px; }
.reticle::after { bottom: -2px; }

.scan-hint {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: .9rem; text-align: center; font-size: .88rem;
    color: var(--ink-dim);
    background: linear-gradient(transparent, rgba(0, 0, 0, .8));
}

/* The verdict. Full screen, unmissable, one colour per outcome. */
.verdict {
    position: fixed; inset: 0; z-index: 100;
    display: flex; flex-direction: column;
    background: var(--bg);
    animation: verdict-in .18s ease-out;
}
@keyframes verdict-in { from { opacity: 0; transform: scale(.99); } }
@media (prefers-reduced-motion: reduce) { .verdict { animation: none; } }

.verdict-banner {
    padding: 1.1rem 1.25rem;
    text-align: center;
    font-size: 1.5rem; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
}
.verdict-body {
    flex: 1; overflow-y: auto;
    padding: 1.5rem 1.25rem 1rem;
    display: flex; flex-direction: column; align-items: center; text-align: center;
}
.verdict-message { color: var(--ink-dim); font-size: 1rem; max-width: 34ch; margin-bottom: 1.5rem; }

.verdict-photo {
    width: min(62vw, 260px); aspect-ratio: 1;
    border-radius: 50%; object-fit: cover;
    border: 3px solid var(--line);
    background: var(--surface-2);
    margin-bottom: 1.1rem;
}
.verdict-name { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.verdict-sub { color: var(--ink-dim); font-size: .9rem; margin-bottom: 1.25rem; }

.verdict-details {
    width: 100%; max-width: 380px;
    background: var(--surface); border: 1px solid var(--line-soft);
    border-radius: var(--r); padding: .3rem .9rem; text-align: left;
}
.verdict-details div {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .55rem 0; border-bottom: 1px solid var(--line-soft);
    font-size: .88rem;
}
.verdict-details div:last-child { border-bottom: none; }
.verdict-details span { color: var(--ink-faint); }
.verdict-details b { font-weight: 500; text-align: right; }

.verdict-actions { padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom)); }
.verdict-actions button { width: 100%; padding: .95rem; font-size: 1rem; }

.v-valid .verdict-banner { background: var(--ok); color: #04220f; }
.v-valid .verdict-photo { border-color: var(--ok); }
.v-duplicate .verdict-banner { background: var(--info); color: #061529; }
.v-duplicate .verdict-photo { border-color: var(--info); }
.v-stale .verdict-banner { background: var(--warn); color: #2a1c00; }
.v-stale .verdict-photo { border-color: var(--warn); }
.v-wrong_event .verdict-banner { background: var(--warn); color: #2a1c00; }
.v-wrong_event .verdict-photo { border-color: var(--warn); }
.v-forged .verdict-banner,
.v-revoked .verdict-banner,
.v-unknown .verdict-banner,
.v-malformed .verdict-banner { background: var(--bad); color: #2b0603; }
.v-forged .verdict-photo, .v-revoked .verdict-photo { border-color: var(--bad); }
