@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
  --brown: #4E4542; --ink: #2F2725; --muted: #6B605B; --cream: #FAF6EE; --line: #E7DFD2; --line2: #CFC4B6;
  --yellow: #F0C232; --yellow-soft: #FFF6DA; --green: #2E7D4F; --green-soft: #DCEFE3; --red: #B3261E; --red-soft: #FDECEA;
  --amber: #9A4A12; --amber-soft: #FBE3D0; --white: #FFFFFF;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--cream); color: var(--ink); font-family: 'Montserrat', system-ui, sans-serif; }
body { -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
input { font-family: inherit; }
input:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }
button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
h1, h2, p { margin: 0; }

/* ---------- Kiosk ---------- */
.kiosk { height: 100vh; display: flex; flex-direction: column; overflow: hidden; user-select: none; }
.kiosk input { user-select: text; }
.k-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 40px; background: var(--white); border-bottom: 1px solid var(--line); }
.k-head img { height: 56px; width: auto; max-width: 220px; object-fit: contain; display: block; }
.k-head .right { display: flex; align-items: center; gap: 16px; }
.k-clock { display: flex; flex-direction: column; align-items: flex-end; }
.k-clock b { font-size: 26px; }
.k-clock span { font-size: 14px; color: var(--muted); }
.pill { padding: 10px 16px; border-radius: 999px; background: var(--brown); color: #fff; font-size: 15px; font-weight: 600; }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.k-steps { display: flex; gap: 10px; padding: 18px 40px 0; }
.k-steps div { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 600; color: #857A73; }
.k-steps div i { height: 6px; border-radius: 3px; background: #E2D8CA; }
.k-steps div.on { color: var(--ink); }
.k-steps div.on i { background: var(--brown); }
.k-main { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 40px; display: flex; flex-direction: column; gap: 22px; }

.h1 { font-size: 40px; font-weight: 800; line-height: 1.1; }
.h1.big { font-size: 46px; }
.sub { font-size: 19px; color: var(--muted); line-height: 1.45; }
.row { display: flex; align-items: center; gap: 16px; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 30px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.spacer { flex: 1; }

.btn { border: none; border-radius: 14px; padding: 16px 32px; min-height: 60px; font-size: 19px; font-weight: 700; background: var(--brown); color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line2); font-weight: 600; }
.btn.yellow { background: var(--yellow); color: var(--ink); }
.btn.small { padding: 12px 20px; min-height: 50px; font-size: 16px; }
.btn:disabled { background: #E2D8CA; color: var(--muted); }

.tiles { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; }
.tile { display: flex; align-items: center; gap: 24px; padding: 28px 32px; border-radius: 24px; text-align: left; border: 2px solid var(--brown); }
.tile b { display: block; font-size: 30px; }
.tile span span { display: block; font-size: 17px; font-weight: 500; margin-top: 6px; }
.tile.visitor { background: var(--yellow); border-color: var(--yellow); color: var(--ink); flex-direction: column; align-items: flex-start; justify-content: center; padding: 48px; min-height: 340px; }
.tile.visitor b { font-size: 42px; }
.tile.staff { background: var(--brown); color: #fff; flex: 1; }
.tile.out { background: #fff; color: var(--ink); flex: 1; }
.tile.out span span { color: var(--muted); }
.col { display: flex; flex-direction: column; gap: 24px; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; border-radius: 18px; background: #fff; border: 1px solid var(--line); font-size: 17px; color: var(--muted); }
.foot b { color: var(--ink); }
.fire-btn { display: flex; align-items: center; gap: 10px; padding: 12px 22px; min-height: 56px; border: 2px solid var(--red); border-radius: 14px; background: #fff; color: var(--red); font-size: 18px; font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 16px; font-weight: 600; }
.field label small { font-weight: 500; color: var(--muted); font-size: 15px; }
.input { height: 62px; padding: 0 20px; border: 2px solid var(--line2); border-radius: 14px; font-size: 22px; background: #fff; width: 100%; }
.chosen { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 62px; padding: 0 10px 0 20px; border: 2px solid var(--green); border-radius: 14px; background: #F1F8F3; font-size: 20px; font-weight: 600; }
.chosen small { font-size: 15px; font-weight: 500; color: var(--brown); }
.matches { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.matches button { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; min-height: 58px; border: none; border-bottom: 1px solid #F0EAE0; background: #fff; text-align: left; font-size: 19px; font-weight: 600; color: var(--ink); }
.matches button small { font-size: 15px; font-weight: 500; color: var(--muted); }

.person { display: flex; align-items: center; gap: 16px; padding: 16px; min-height: 92px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); text-align: left; width: 100%; }
.avatar { flex-shrink: 0; width: 56px; height: 56px; border-radius: 50%; background: #F3E9D2; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; color: var(--brown); }
.person .info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.person .info b { font-size: 19px; }
.person .info small { font-size: 14px; color: var(--muted); }
.status { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.status i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }

.qgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.q { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.q span { flex: 1; font-size: 15px; line-height: 1.4; }
.yn { width: 84px; height: 52px; border: 2px solid var(--brown); border-radius: 12px; background: #fff; color: var(--brown); font-size: 17px; font-weight: 700; }
.yn.on { background: var(--brown); color: #fff; }
.box { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 12px 18px; min-height: 48px; border: 2px solid var(--line2); border-radius: 999px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 600; }
.chip.on { background: var(--yellow); border-color: #C99A12; }

.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; }
.center p { max-width: 620px; }
.badge-icon { width: 120px; height: 120px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--green-soft); }
.badge-icon.amber { background: var(--amber-soft); }
.lead { font-size: 21px; line-height: 1.5; color: var(--brown); }
.small-muted { font-size: 15px; color: var(--muted); }

.photo-wrap { display: flex; align-items: center; gap: 56px; }
.cam { position: relative; flex-shrink: 0; width: 460px; height: 460px; border-radius: 28px; overflow: hidden; background: #3A322F; display: flex; align-items: center; justify-content: center; }
.cam video, .cam img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam .guide { position: absolute; inset: 40px 70px; border: 3px dashed rgba(240, 194, 50, .7); border-radius: 50% 50% 46% 46%; pointer-events: none; }
.cam .count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(47, 39, 37, .3); font-size: 200px; font-weight: 800; color: #fff; }
.cam .taken { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px; background: rgba(46, 125, 79, .92); color: #fff; font-size: 19px; font-weight: 700; text-align: center; }
.cam .flash { position: absolute; inset: 0; background: #fff; animation: flash .35s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.notice { display: flex; align-items: center; gap: 18px; padding: 20px 24px; border-radius: 16px; background: var(--yellow-soft); border: 1px solid var(--yellow); text-align: left; font-size: 18px; line-height: 1.45; max-width: 600px; }
.empty { padding: 32px; border-radius: 16px; background: #fff; border: 1px solid var(--line); font-size: 18px; color: var(--muted); text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 14px 22px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 16px; font-weight: 600; z-index: 50; max-width: 90vw; }

/* PIN / settings overlay */
.overlay { position: fixed; inset: 0; background: rgba(47, 39, 37, .55); display: flex; align-items: center; justify-content: center; z-index: 40; }
.panel { background: #fff; border-radius: 22px; padding: 28px; width: 460px; max-width: 92vw; display: flex; flex-direction: column; gap: 16px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; font-size: 32px; letter-spacing: 6px; min-height: 40px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pinpad button { height: 64px; border-radius: 14px; border: 1px solid var(--line2); background: #fff; font-size: 24px; font-weight: 700; color: var(--ink); }
.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 4px; border-radius: 12px; background: #EFE7DA; }
.seg button { min-height: 48px; border: none; border-radius: 9px; background: transparent; font-size: 16px; font-weight: 700; color: var(--ink); }
.seg button.on { background: #fff; }

/* Sign-in / loading */
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px; text-align: center; }
.splash img { width: 260px; max-width: 70vw; }

/* ---------- Roll call (phone) ---------- */
.rc { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--cream); }
.rc-head { padding: 22px 20px 18px; background: var(--red); color: #fff; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; z-index: 5; }
.rc-head h1 { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.rc-head small { font-size: 13px; opacity: .92; }
.bar { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.bar i { display: block; height: 10px; border-radius: 5px; background: #fff; transition: width .3s; }
.rc-body { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.site-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 20px; min-height: 96px; border: 2px solid var(--brown); border-radius: 18px; background: #fff; color: var(--ink); text-align: left; width: 100%; }
.site-btn b { display: block; font-size: 24px; }
.site-btn small { font-size: 15px; color: var(--muted); }
.sect { padding: 10px 4px 2px; font-size: 13px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.tick-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; min-height: 64px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); text-align: left; width: 100%; }
.tick-row .info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tick-row b { font-size: 17px; }
.tick-row small { font-size: 13px; color: var(--muted); }
.tick { flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; border: 2px solid #B9AEA6; background: #fff; display: flex; align-items: center; justify-content: center; }
.tick-row.safe { background: #EEF7F1; border-color: #A9D3B8; }
.tick-row.safe .tick { background: var(--green); border-color: var(--green); }
.rc-foot { padding: 12px 16px 20px; background: #fff; border-top: 1px solid var(--line); position: sticky; bottom: 0; }
.rc-foot .btn { width: 100%; }
.alert { padding: 16px; border-radius: 14px; background: var(--red-soft); border: 1px solid #F2B8B5; display: flex; flex-direction: column; gap: 6px; }
.ok { padding: 16px; border-radius: 14px; background: var(--green-soft); color: #1F5C39; font-weight: 700; text-align: center; }

/* Staff list with switches */
.staff-top { align-items: flex-start; gap: 20px; }
.input.search { width: 320px; height: 52px; font-size: 19px; }
.staff-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.srow { display: flex; align-items: center; gap: 14px; padding: 10px 14px; min-height: 72px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); text-align: left; width: 100%; }
.srow.in { background: #F1F8F3; border-color: #A9D3B8; }
.srow .avatar { width: 46px; height: 46px; font-size: 16px; }
.srow .info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.srow .info b { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .info small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .status { font-size: 14px; white-space: nowrap; }
.switch { flex-shrink: 0; position: relative; width: 74px; height: 42px; border-radius: 999px; background: #D6CCBF; transition: background .2s; }
.switch i { position: absolute; top: 4px; left: 4px; width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .2s; }
.switch.on { background: var(--green); }
.switch.on i { left: 36px; }
.switch.busy { opacity: .55; }

/* Questions: highlight the next one to answer */
.q.next { outline: 3px solid var(--yellow); outline-offset: 2px; }
.q { transition: outline-color .3s; }

/* While typing, hide the header and step bar so the on-screen keyboard leaves more room */
body.typing .k-head, body.typing .k-steps { display: none; }
body.typing .k-main { padding-top: 16px; padding-bottom: 50vh; }
.dot-in { width: 10px; height: 10px; border-radius: 50%; background: var(--green); display: inline-block; }
.btn:not(.ghost) .dot-in { background: #9FE0B6; }

/* Staff screen top bar: buttons never wrap; the heading text gives way instead */
.staff-top > div:first-child { flex: 1; min-width: 0; }
.staff-top > .row { flex-shrink: 0; }
.staff-top .btn { white-space: nowrap; flex-shrink: 0; }
.staff-top .input.search { width: 260px; }
@media (max-width: 1100px) { .staff-top .h1 { font-size: 34px; } .staff-top .input.search { width: 200px; } }
