:root {
    --paper: #f3ecdf;
    --paper-deep: #e7dccb;
    --card: #fffaf3;
    --ink: #241910;
    --muted: #6d5c4e;
    --line: #e4d5c4;
    --accent: #8d341c;
    --accent-hot: #b64024;
    --leaf: #24543d;
    --warn: #8a5a12;
    --shadow: 0 16px 40px rgba(60, 32, 16, 0.08);
    --radius: 22px;
    font-family: "Segoe UI", "Source Sans 3", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(182, 64, 36, 0.08), transparent 32rem),
        var(--paper);
}

body.layout-manager,
body.layout-admin { background: #efe6d8; }

a { color: var(--accent); }

img, svg { max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem 0.2rem;
    max-width: 1040px;
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    text-decoration: none;
    font-family: Georgia, "Iowan Old Style", serif;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.brand__mark,
.monogram {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fffaf3;
    font-family: Georgia, serif;
    font-weight: 700;
}

.topbar__side {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--muted);
}

.who { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.8rem 1rem 0;
    max-width: 1040px;
    margin: 0 auto;
}

.nav a {
    flex: 0 0 auto;
    text-decoration: none;
    color: var(--ink);
    background: transparent;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
}

.nav a.is-active { background: var(--ink); color: var(--paper); }

.shell {
    width: min(1040px, calc(100% - 1.4rem));
    margin: 0 auto;
    padding: 1rem 0 3rem;
}

.layout-customer .shell,
.layout-staff .shell,
.layout-plain .shell { width: min(460px, calc(100% - 1.4rem)); }

h1, h2, h3 {
    font-family: Georgia, "Iowan Old Style", serif;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin: 0 0 0.4rem;
}

h1 { font-size: 2rem; line-height: 1.1; }
h2 { font-size: 1.35rem; }
p { line-height: 1.45; }

.kicker {
    margin: 0 0 0.2rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.muted, .meta, .terms-meta { color: var(--muted); }
.site-note { color: var(--muted); text-align: center; font-size: 0.85rem; }

.card, .banner, .result {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.15rem;
    margin: 0 0 0.9rem;
}

.card__head, .banner__brand, .stats, .split, .row-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.card__head, .banner__brand { align-items: center; margin-bottom: 0.8rem; }
.card__head > div, .banner__brand > div { min-width: 0; }

.stats, .split { display: grid; gap: 0.8rem; align-items: stretch; }
.stats { grid-template-columns: 1fr 1fr; }
.split { grid-template-columns: 1fr; }
.stat .count { margin-bottom: 0; }

@media (min-width: 800px) {
    .split { grid-template-columns: 1fr 1fr; }
}

.logo { width: 3rem; height: 3rem; border-radius: 50%; object-fit: cover; }
.logo-lg { width: 4.2rem; height: 4.2rem; font-size: 1.6rem; }

.count {
    font-family: Georgia, serif;
    font-size: 2.4rem;
    margin: 0.2rem 0;
    letter-spacing: -0.04em;
}
.count span { color: var(--muted); font-size: 1.1rem; }

.dots { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.4rem 0 0.8rem; }
.dot {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    border: 2px dashed #c6a15b;
    background: transparent;
}
.dot.is-on { background: var(--accent-hot); border-style: solid; border-color: var(--accent); }

.reward-flag {
    margin: 0.6rem 0;
    padding: 0.7rem 0.8rem;
    border-radius: 14px;
    background: #e7f3ec;
    color: var(--leaf);
    font-weight: 650;
}

.banner { background: #fff8ef; border-color: #efd0c4; }
.is-highlight { outline: 2px solid rgba(182, 64, 36, 0.35); }

.pass { text-align: center; }
.qr { width: min(100%, 280px); margin: 0.4rem auto 0.6rem; background: white; border-radius: 18px; padding: 0.6rem; }
.qr svg { display: block; width: 100%; height: auto; }
.pin-label { margin-bottom: 0; }
.pin {
    font-family: Georgia, serif;
    font-size: 2.2rem;
    letter-spacing: 0.18em;
    margin: 0.1rem 0 0.4rem;
}

.join-url { word-break: break-all; }

.stack { display: grid; gap: 0.8rem; }
label { display: grid; gap: 0.3rem; font-size: 0.92rem; }
input, select, textarea {
    width: 100%;
    padding: 0.75rem 0.8rem;
    border-radius: 12px;
    border: 1px solid #d9cbb8;
    background: #fff;
    font-size: 16px;
}
textarea { resize: vertical; }

.btn, .text-button, .text-link {
    min-height: 44px;
}
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    border: 0;
    border-radius: 999px;
    padding: 0.85rem 1rem;
    background: var(--accent);
    color: #fffaf3;
    text-decoration: none;
    cursor: pointer;
}
.btn-dark { background: var(--ink); margin-top: 0.5rem; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.card .btn { width: auto; }
.pass .btn, .login-card .btn, .join-card .btn, .scanner .btn { width: 100%; }

.text-button, .text-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.flash, .result { border-radius: 16px; }
.flash { padding: 0.75rem 0.9rem; margin: 0 0 0.8rem; }
.is-ok { background: #e7f3ec; color: var(--leaf); border-color: #cfe4d8; }
.is-bad { background: #fdecea; color: #8d2418; border-color: #f3c7c1; }
.is-warn { background: #fff4df; color: var(--warn); }

.result h2 { margin-top: 0.2rem; }
.result form { margin-top: 0.6rem; }

.viewfinder {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    background: #1a120e;
    aspect-ratio: 3 / 4;
    margin-bottom: 0.8rem;
}
.viewfinder video { width: 100%; height: 100%; object-fit: cover; }

.log, .people { list-style: none; padding: 0; margin: 0; }
.log li, .people li {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: center;
    padding: 0.7rem 0;
    border-top: 1px solid var(--line);
}
.log li:first-child, .people li:first-child { border-top: 0; }
.people li { align-items: flex-start; }
.row-actions, .inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.inline-form input { width: 9rem; min-height: 44px; }

:focus-visible { outline: 3px solid var(--accent-hot); outline-offset: 2px; }

@media print {
    .topbar, .nav, .btn, form { display: none !important; }
    body { background: white; }
    .card { box-shadow: none; }
}
