:root {
  --bg: #eef2f3; --surface: #ffffff; --ink: #17262c; --muted: #5b6d73; --line: #d5dfe2;
  --accent: #0f7a78; --accent-soft: #dcefee; --accent-ink: #ffffff; --warm: #c7563f; --ok: #2f7d4f; --ok-soft: #e1f1e6;
  --av-skin: #e9b48f; --av-skin-hi: #f8d9c0; --av-skin-sh: #c98c68; --av-hair: #3a2520; --av-hair-hi: #6b4336;
  --av-top: #0f7a78; --av-top-hi: #2a9d99; --av-iris: #4a3222; --av-iris-hi: #9a6a3f; --av-eyewhite: #fbf7f3;
  --av-mouth: #7a2e30; --av-lip: #b4524a; --av-tongue: #c9666a; --av-blush: #e58a7a; --av-gold: #d4a84b;
  --av-arch: #dcefee; --av-arch-hi: #f3f8f8;
  --display: "Young Serif", Georgia, serif;
  --body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1719; --surface: #182427; --ink: #e6eef0; --muted: #94a8ad; --line: #2b3b3f;
    --accent: #4fc3bd; --accent-soft: #173a3a; --accent-ink: #0b1517; --warm: #ef8a72; --ok: #6cc48f; --ok-soft: #173326; --av-arch: #1d3436; --av-arch-hi: #243f41; --av-eyewhite: #f1ece6; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.5;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(16px, env(safe-area-inset-left, 0px)); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.btn { font: inherit; font-weight: 600; border-radius: 12px; padding: 12px 18px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.btn.big { font-size: 1.2rem; padding: 16px 28px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn:focus-visible, .chip:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.note { font-size: 0.85rem; color: var(--muted); }
.warn { color: #a63d2a; font-weight: 600; }
@media (prefers-color-scheme: dark) { .warn { color: #f3a08c; } }
input { font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-width: 0; }

.start { min-height: 100%; display: grid; place-items: center; padding-block: 24px; }
.start-card { max-width: 520px; display: grid; gap: 14px; }
.start-card h1 { font-family: var(--display); font-weight: 400; font-size: 2.4rem; margin: 0; }
.start-card p { margin: 0; }
.eyebrow { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.tagline { font-family: var(--display); font-size: 1.15rem; line-height: 1.3; color: var(--ink); text-wrap: balance; }
.code-row { display: grid; gap: 6px; }

.kiosk { min-height: 100%; display: flex; flex-direction: column; gap: 12px; padding-block: 16px; }
.topbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.office { font-weight: 600; }
.office small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.controls { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 0.85rem; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.layout { flex: 1; display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.layout.with-staff { grid-template-columns: minmax(0, 1fr) 320px; }
@media (max-width: 860px) { .layout.with-staff { grid-template-columns: minmax(0, 1fr); } }

.face-zone { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 2vh; gap: 14px; text-align: center; min-width: 0; }
.avatar { width: min(70vw, 420px); max-width: 100%; aspect-ratio: 400 / 440; }
@media (min-width: 900px) and (min-height: 1000px) { .avatar { width: 520px; } .elena-line { font-size: 2.4rem; max-width: 26ch; } }
.avatar svg { width: 100%; height: 100%; display: block; }
.status { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.elena-line { font-family: var(--display); font-size: clamp(1.4rem, 3.2vw, 2.1rem); line-height: 1.25; margin: 0; max-width: 30ch; text-wrap: balance; min-height: 2.5em; }
.visitor-line { color: var(--muted); font-style: italic; margin: 0; min-height: 1.5em; max-width: 60ch; }
.type-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 560px; }
.type-form input { flex: 1 1 220px; }

.staff { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.staff h2 { margin: 0; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sched { display: grid; gap: 4px; font-size: 0.85rem; }
.sched div { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 8px; }
.sched .done { color: var(--ok); font-weight: 600; }
.t { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; font-size: 0.85rem; border-top: 1px solid var(--line); padding-top: 8px; }
.pill { display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: 1px 8px; margin-right: 6px; background: var(--accent-soft); color: var(--accent); }
.pill.alert { background: var(--warm); color: var(--surface); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.cam { width: 100%; border-radius: 12px; background: var(--bg); transform: scaleX(-1); aspect-ratio: 4 / 3; object-fit: cover; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.intake { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; display: grid; gap: 14px; text-align: left; }
.intake h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.2rem; }
.intake .q { display: grid; gap: 6px; }
.intake .q p { margin: 0; }
.intake .yn { display: flex; gap: 8px; }
.intake .consent { display: flex; gap: 8px; align-items: flex-start; font-size: 0.95rem; }
.intake .sign { font-family: var(--display); font-size: 1.2rem; }
.intake .btn[disabled] { opacity: .5; cursor: default; }

.cards { width: 100%; max-width: 560px; display: grid; gap: 12px; }
.cards:empty { display: none; }
.cards .card:nth-child(2) { opacity: .6; }
.cards .card:nth-child(n+3) { display: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; text-align: left; display: grid; gap: 8px; animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card h3 { margin: 0; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.card .big { font-family: var(--display); font-size: 1.5rem; line-height: 1.2; }
.card .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card .muted { color: var(--muted); font-size: 0.95rem; }
.card .ok { color: var(--ok); font-weight: 600; }
.slot { font: inherit; text-align: left; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 14px; padding: 12px 14px; cursor: pointer; display: grid; gap: 2px; }
.slot strong { font-size: 1.05rem; }
.slot span { color: var(--muted); font-size: 0.85rem; }
.slot:hover, .slot:focus-visible { border-color: var(--accent); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dob { display: grid; grid-template-columns: 1fr 1fr 1.3fr auto; gap: 8px; align-items: end; }
.dob label { display: grid; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.dob input { width: 100%; font-size: 1.1rem; text-align: center; }
@media (max-width: 480px) { .dob { grid-template-columns: 1fr 1fr; } }
.map { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; }
.map svg { width: 96px; height: 96px; }
.conf { font-family: var(--mono); font-size: 1.4rem; letter-spacing: 0.08em; }

.addappt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.addappt input { font-size: 0.9rem; padding: 8px 10px; }
.addappt #add-name { grid-column: 1 / -1; }

.video-avatar { position: relative; width: min(92vw, 720px); aspect-ratio: 16 / 9; border-radius: 24px; overflow: hidden; background: #1b1f22; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.video-avatar .va-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .4s ease; }
.video-avatar .va-halo { position: absolute; inset: 0; border-radius: 24px; box-shadow: inset 0 0 0 3px var(--accent); opacity: 0; transition: opacity .25s; pointer-events: none; }
.video-avatar .va-halo.on { opacity: .9; }
@media (min-width: 900px) and (min-height: 1000px) { .video-avatar { width: min(92vw, 860px); } }

.anam-face { position: relative; width: min(84vw, 560px); aspect-ratio: 1 / 1; border-radius: 28px; overflow: hidden; background: #1b1f22; box-shadow: 0 24px 70px rgba(0,0,0,.2); }
.anam-face .af-still, .anam-face .af-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.anam-face .af-still { animation: breathe 6s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes breathe { 0%, 100% { transform: scale(1.0); } 50% { transform: scale(1.012); } }
.anam-face .af-video { opacity: 0; transition: opacity .6s ease; }
.anam-face .af-video.on { opacity: 1; }
.anam-face .af-halo { position: absolute; inset: 0; border-radius: 28px; box-shadow: inset 0 0 0 3px var(--accent); opacity: 0; transition: opacity .25s; pointer-events: none; }
.anam-face .af-halo.on { opacity: .9; }
/* while the live face connects: a soft pulse plus a smile-ready still, so a short wait never reads as broken */
.anam-face.connecting .af-halo { animation: af-pulse 1.4s ease-in-out infinite; }
@keyframes af-pulse { 0%,100% { opacity: .15; } 50% { opacity: .6; } }
@media (min-width: 900px) and (min-height: 1000px) { .anam-face { width: min(84vw, 680px); } }

/* touch tiles: everything can be done without speaking */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 560px; }
.tile { font: inherit; font-weight: 600; text-align: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 16px; padding: 14px 12px; cursor: pointer; min-height: 56px; }
.tile:hover, .tile:focus-visible { border-color: var(--accent); }
/* larger text for visitors who need it */
body.big { font-size: 21px; }
body.big .elena-line { font-size: clamp(1.9rem, 4.4vw, 2.8rem); }
body.big .card .big { font-size: 1.9rem; }
body.big .tile { min-height: 72px; font-size: 1.15rem; }
/* staff tools */
.sched .act { font: inherit; font-size: .72rem; font-weight: 600; border: 1px solid var(--line); background: transparent; color: var(--accent); border-radius: 999px; padding: 1px 8px; cursor: pointer; margin-left: 4px; }
.sched div { align-items: center; }
.delays { display: grid; gap: 6px; font-size: .85rem; }
.delays label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.delays select { font: inherit; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.stat b { display: block; font-family: var(--mono); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .75rem; color: var(--muted); }
.feed a { color: var(--accent); word-break: break-all; }
.feed .qrmini img { width: 132px; height: auto; margin-top: 6px; background: #fff; padding: 6px; border-radius: 8px; image-rendering: pixelated; }
.rate { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rate .chip { padding: 6px 14px; }
.card-ready { border-color: var(--accent); }
.card-ready .big { font-size: 2rem; }

/* ================= Full-screen kiosk: Elena fills the screen; everything else floats over her ================= */
:root { --glass: rgba(16, 24, 28, .58); --glass-strong: rgba(16, 24, 28, .78); --on-glass: #f4f7f8; --on-glass-muted: rgba(244, 247, 248, .72); --pop: rgba(255, 255, 255, .94); }
@media (prefers-color-scheme: dark) { :root { --pop: rgba(24, 36, 39, .94); } }
body:has(#kiosk:not([hidden])) { overflow: hidden; background: #0d1214; }
.kiosk { position: fixed; inset: 0; padding: 0; display: block; }
.layout, .layout.with-staff { display: block; }
.face-zone { position: fixed; inset: 0; display: block; padding: 0; }

/* the face */
#avatar { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; aspect-ratio: auto; border-radius: 0; box-shadow: none; z-index: 0; background: #1b1f22; }
#avatar.anam-face .af-still, #avatar.anam-face .af-video { object-fit: cover; object-position: 50% 28%; }
/* Video-call framing (framing.js): the picture is placed and sized for the screen; a blurred copy of the room fills the sides */
#avatar.framed { overflow: hidden; }
#avatar.framed .af-still, #avatar.framed .af-video { inset: auto; max-width: none; max-height: none; object-fit: fill; }
#avatar.framed .af-bg { position: absolute; inset: -60px; width: calc(100% + 120px); height: calc(100% + 120px); object-fit: cover; filter: blur(36px) brightness(.62) saturate(1.05); opacity: 0; transition: opacity .3s ease; pointer-events: none; }
#avatar.framed.framed-sides .af-bg { opacity: 1; }
#avatar.anam-face .af-halo { border-radius: 0; box-shadow: inset 0 0 0 6px var(--accent); }
#avatar:not(.anam-face) svg { width: auto; height: 78dvh; margin: 6dvh auto 0; display: block; }
#avatar::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(0,0,0,.62) 0%, rgba(0,0,0,.18) 34%, rgba(0,0,0,0) 52%), linear-gradient(to bottom, rgba(0,0,0,.42) 0%, rgba(0,0,0,0) 16%); }
@media (prefers-reduced-motion: no-preference) { #avatar.anam-face .af-still { animation: breathe 7s ease-in-out infinite; } }

/* top bar floats */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left)); }
.office { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.office small { color: rgba(255,255,255,.8); }
.topbar .chip { background: var(--glass); color: var(--on-glass); border-color: rgba(255,255,255,.18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.topbar .chip[aria-pressed="true"] { background: #fff; color: #10181b; border-color: #fff; }
.status { position: fixed; z-index: 20; top: calc(var(--tb, calc(max(14px, env(safe-area-inset-top)) + 40px)) + 8px); left: max(18px, env(safe-area-inset-left)); margin: 0; padding: 4px 10px; border-radius: 999px; background: var(--glass); color: var(--on-glass-muted); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* subtitles */
.subs { position: fixed; z-index: 10; left: 50%; transform: translateX(-50%); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 150px); width: min(92vw, 900px); text-align: center; display: grid; gap: 6px; pointer-events: none; }
.subs .elena-line { color: #fff; font-size: clamp(1.35rem, 2.6vw, 2.2rem); max-width: none; min-height: 0; text-shadow: 0 2px 14px rgba(0,0,0,.65); margin: 0; }
.subs .elena-line:empty { display: none; }
.subs .visitor-line { color: rgba(255,255,255,.85); text-shadow: 0 1px 10px rgba(0,0,0,.7); margin: 0; min-height: 0; }
.subs .visitor-line:empty { display: none; }
body.big .subs .elena-line { font-size: clamp(1.8rem, 3.6vw, 3rem); }

/* touch tiles + type bar: bottom dock */
.tiles { position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 66px); width: min(94vw, 900px); max-width: none; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { background: var(--glass); color: var(--on-glass); border-color: rgba(255,255,255,.2); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.tile:hover, .tile:focus-visible { background: var(--glass-strong); border-color: #fff; }
@media (max-width: 640px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 62px); } .subs { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 196px); } }
.type-form { position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); width: min(94vw, 640px); max-width: none; flex-wrap: nowrap; }
.type-form input { background: var(--glass); color: var(--on-glass); border-color: rgba(255,255,255,.22); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.type-form input::placeholder { color: var(--on-glass-muted); }
.type-form .btn.ghost { background: var(--glass); color: var(--on-glass); border-color: rgba(255,255,255,.22); }

/* pop-up cards: to the side on wide screens, above the dock on tall screens; never over the face */
.cards { position: fixed; z-index: 25; right: max(22px, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); width: min(400px, 34vw); max-width: none; gap: 12px; }
.cards .card { background: var(--pop); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-color: rgba(255,255,255,.4); box-shadow: 0 18px 50px rgba(0,0,0,.35); animation: pop .32s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.cards .card:nth-child(2) { opacity: .55; transform: scale(.97); }
@media (orientation: portrait), (max-width: 900px) {
  .cards { right: auto; left: 50%; top: auto; transform: translateX(-50%); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 250px); width: min(92vw, 560px); }
  .cards .card:nth-child(2) { display: none; }
}

/* check-in form: centered modal over a dimmed screen */
.intake { position: fixed; z-index: 40; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(94vw, 560px); max-height: 86dvh; overflow-y: auto; background: var(--pop); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 0 0 100vmax rgba(0,0,0,.45), 0 24px 70px rgba(0,0,0,.4); animation: pop .3s cubic-bezier(.2,.9,.3,1.2); }

/* staff view: drawer over the right edge */
.staff { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); border-radius: 0; overflow-y: auto; padding-top: calc(max(14px, env(safe-area-inset-top)) + 54px); box-shadow: -20px 0 60px rgba(0,0,0,.35); }
.staff[hidden] { display: none !important; }
.subs .visitor-line { justify-self: center; }

/* staff drawer open: keep the visitor controls and pop-ups clear of it */
.layout.with-staff .subs, .layout.with-staff .tiles, .layout.with-staff .type-form, .layout.with-staff .intake, .layout.with-staff .attract { left: calc((100vw - min(380px, 92vw)) / 2); }
.layout.with-staff .intake { width: min(calc(100vw - min(380px, 92vw) - 32px), 560px); }
.layout.with-staff .cards { right: calc(min(380px, 92vw) + 20px); }
.staff { top: calc(max(14px, env(safe-area-inset-top)) + 52px); padding-top: 18px; border-top-left-radius: 18px; }
@media (orientation: portrait), (max-width: 900px) { .layout.with-staff .cards { right: auto; left: calc((100vw - min(380px, 92vw)) / 2); width: min(calc(100vw - min(380px, 92vw) - 32px), 560px); } }
@media (max-width: 700px) { .layout.with-staff .subs, .layout.with-staff .tiles, .layout.with-staff .type-form, .layout.with-staff .cards, .layout.with-staff .intake, .layout.with-staff .attract { left: 50%; right: auto; } .layout.with-staff .intake { width: min(94vw, 560px); } .layout.with-staff .staff { width: 100vw; } }

/* ===== Movie-style subtitles: low, compact, below the face ===== */
.subs { bottom: max(22px, env(safe-area-inset-bottom)); width: min(72vw, 980px); gap: 4px; }
.subs .elena-line { font-family: var(--body); font-weight: 500; font-size: clamp(1.05rem, 1.55vw, 1.5rem); line-height: 1.35; text-shadow: none; text-wrap: balance; }
.subs .elena-line:not(:empty) { justify-self: center; background: rgba(0, 0, 0, .62); color: #fff; padding: 6px 14px; border-radius: 8px; }
.subs .visitor-line { font-size: clamp(.85rem, 1.1vw, 1.05rem); color: rgba(255,255,255,.8); background: rgba(0,0,0,.38); padding: 2px 10px; border-radius: 6px; font-style: italic; }
body.big .subs .elena-line { font-size: clamp(1.4rem, 2.2vw, 2rem); }
/* the typing bar moves to the bottom-left corner so the subtitles own the bottom center */
.type-form { left: max(18px, env(safe-area-inset-left)); transform: none; bottom: max(18px, env(safe-area-inset-bottom)); width: min(30vw, 380px); }
.type-form input { flex: 1 1 auto; padding: 9px 12px; font-size: .95rem; }
.type-form .btn { padding: 9px 12px; font-size: .9rem; }
.tiles { bottom: calc(max(22px, env(safe-area-inset-bottom)) + 92px); width: min(72vw, 860px); }
.layout.with-staff .type-form { left: max(18px, env(safe-area-inset-left)); }
@media (max-width: 1400px), (orientation: portrait) {
  .type-form { left: 50%; transform: translateX(-50%); width: min(94vw, 560px); }
  .subs { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 62px); width: min(94vw, 900px); }
  .tiles { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 150px); width: min(94vw, 860px); }
  .layout.with-staff .type-form { left: calc((100vw - min(380px, 92vw)) / 2); }
}
@media (orientation: portrait), (max-width: 900px) { .cards { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 230px); } }
/* subtitle box hugs the text; keep it clear of the corner typing bar */
.subs { width: min(52vw, 860px); }
.subs .elena-line:not(:empty) { width: fit-content; max-width: 100%; }
.type-form { width: min(23vw, 380px); }
.type-form input { min-width: 110px; }
.type-form .btn { white-space: nowrap; }
@media (max-width: 1400px), (orientation: portrait) { .subs { width: min(94vw, 900px); } .type-form { width: min(94vw, 560px); } }
/* per-line subtitle background (each wrapped line gets its own box) */
.subs .elena-line:not(:empty) { background: none; padding: 0; width: auto; }
.subs .elena-line span { background: rgba(0, 0, 0, .66); color: #fff; padding: 3px 10px; border-radius: 6px; -webkit-box-decoration-break: clone; box-decoration-break: clone; line-height: 1.75; }

/* iPhone: one tap to turn her sound on if the browser still blocks it */
.af-tap { position: absolute; left: 50%; bottom: 24%; transform: translateX(-50%); z-index: 6; padding: 12px 20px; border-radius: 999px; border: 0; background: #fff; color: #10181b; font: 600 1rem/1 var(--sans, system-ui); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
/* device-voice fallback: her real photo, with a soft glow while she talks */
#avatar.photo.speaking .af-halo { opacity: .55; animation: af-pulse 1.1s ease-in-out infinite; }

/* idle welcome between visitors: tells people the desk is interactive, in all three languages in turn */
.attract { position: fixed; z-index: 12; left: 50%; transform: translateX(-50%); bottom: calc(max(22px, env(safe-area-inset-bottom)) + 92px); width: min(92vw, 720px); text-align: center; display: grid; gap: 6px; pointer-events: none; }
.attract p { margin: 0; color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.6); }
.attract-hi { font-family: var(--display); font-size: clamp(1.8rem, 3.4vw, 3rem); line-height: 1.1; }
.attract-line { font-size: clamp(1rem, 1.5vw, 1.3rem); color: rgba(255,255,255,.88); transition: opacity .45s ease; }
.attract-line.fade { opacity: 0; }
@media (max-width: 1400px), (orientation: portrait) { .attract { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 150px); } }
/* form actions: help on the left, submit on the right */
.intake .actions { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.intake .btn.help { border-color: var(--line); color: var(--muted); }
.intake h2:focus { outline: none; }

/* staff: voice audition */
.voice-lab { display: grid; gap: 8px; }
.voice-lab select { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg, #fff); color: inherit; font: inherit; }
.voice-lab .row { display: flex; gap: 6px; flex-wrap: wrap; }

/* one product, two front desks: dental (patients) and office (visitors and hosts) */
body:not(.mode-office) .office-only { display: none !important; }
body.mode-office .dental-only { display: none !important; }
.card-host .who { font-weight: 600; font-size: 1.15rem; }
.genform { display: grid; gap: 12px; }
.genform label { display: grid; gap: 6px; font-weight: 600; }
.genform input[type=text] { padding: 14px; border-radius: 12px; border: 1px solid var(--line); font: inherit; background: var(--bg, #fff); color: inherit; }
.genform .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.genform .check input { width: 24px; height: 24px; flex: none; margin-top: 2px; }
.emp-card .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; grid-column: 1 / -1; }
.emp-card .check input { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.tt-state { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tt-state.in { color: var(--ok, #3fbfa5); }
.tt-state.out { color: var(--warn, #e0a050); }
.cal-rows { display: grid; gap: 10px; }
.cal-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr); gap: 10px; }
@media (max-width: 560px) { .cal-row { grid-template-columns: 1fr; } }
.cal-row input { width: 100%; min-width: 0; }

/* sign-in form: touch choices, phone/email hints, photo for the host */
.genform fieldset.choice { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.genform fieldset.choice legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.genform .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.genform .chip { min-height: 48px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.genform .chip[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.genform input[type=tel], .genform input[type=email] { padding: 14px; border-radius: 12px; border: 1px solid var(--line); font: inherit; background: var(--bg, #fff); color: inherit; }
.genform .hint { color: var(--warm); font-weight: 500; }
.genform .photo-prev { display: flex; gap: 12px; align-items: center; }
.genform .photo-prev img { width: 96px; height: 72px; object-fit: cover; border-radius: 12px; transform: scaleX(-1); border: 1px solid var(--line); }
.btn.small { padding: 8px 14px; font-size: .9rem; }
.card-reply h3 { font-size: 1.35rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.start-card a { color: var(--accent); }
/* demo chooser (/demo) */
.demo-list { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.demo-card { display: grid; gap: 4px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.demo-card:hover, .demo-card:focus-visible { border-color: var(--accent); outline: none; }
.demo-card strong { font-size: 1.15rem; overflow-wrap: anywhere; }
.demo-card .kind { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); font-weight: 600; }
.demo-card .say { font-size: 0.9rem; color: var(--muted); }
/* staff menu (stop / leave) */
.staff-menu { border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: var(--surface); color: var(--ink); width: min(420px, calc(100vw - 32px)); }
.staff-menu[open] { display: grid; gap: 10px; }
.staff-menu::backdrop { background: rgba(8, 14, 16, 0.6); }
.staff-menu h2 { font-family: var(--display); font-weight: 400; font-size: 1.5rem; margin: 0 0 4px; }
.staff-menu .note { margin: 4px 0 0; }
.topbar .office { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.demo-field { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.cam-host { position: fixed; left: 0; bottom: 0; width: 2px; height: 2px; overflow: hidden; opacity: 0.01; pointer-events: none; z-index: -1; }
.cam-host .cam { width: 2px; height: 2px; }
/* admin assistant + memory */
.card-draft .draft-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 42vh; overflow-y: auto; font-size: 1rem; line-height: 1.45; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); user-select: text; -webkit-user-select: text; }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.draft-actions .btn { text-decoration: none; text-align: center; }
#boss-chip { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.mem-title { margin: 8px 0 0; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.mem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 30vh; overflow-y: auto; }
.mem-list li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; font-size: 0.92rem; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.mem-list li span { overflow-wrap: anywhere; }
.mem-x { flex: none; background: none; border: 0; color: var(--accent); font: inherit; font-size: 0.8rem; cursor: pointer; padding: 2px 0; }
.src-link { display: block; color: var(--accent); font-size: 0.92rem; overflow-wrap: anywhere; text-decoration: underline; }
.card-inbox .muted, .card-cal .muted { margin-top: -6px; }
@media (max-width: 600px) { .card-draft .draft-body { max-height: 30vh; } }

/* her studying a job (learn_job) */
.card-study .big { font-variant-numeric: tabular-nums; }

/* employee settings page (/employee) */
.emp-page, .emp-page > div { max-width: 860px; margin: 0 auto; padding-block: 28px 64px; display: grid; gap: 18px; }
.emp-page > div { padding-block: 0; width: 100%; }
.emp-head h1 { font-family: var(--display); font-weight: 400; font-size: 2.3rem; margin: 2px 0; text-wrap: balance; }
.emp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: grid; gap: 12px; min-width: 0; }
.emp-card h2 { font-family: var(--display); font-weight: 400; font-size: 1.35rem; margin: 0; }
.emp-card h3 { font-size: 0.95rem; margin: 6px 0 0; }
.emp-card label { display: grid; gap: 4px; font-weight: 600; font-size: 0.92rem; }
.emp-card textarea, .emp-card select { font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; min-width: 0; }
.emp-card input { font-weight: 400; width: 100%; }
.emp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.emp-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.emp-row input { flex: 1 1 220px; width: auto; }
.emp-row select { width: auto; }
.emp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.emp-item { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; overflow-wrap: anywhere; }
.emp-item.emp-row { display: flex; justify-content: space-between; }
.emp-report { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 0.85rem; margin: 0; padding: 10px 12px; background: var(--bg); border-radius: 12px; border: 1px solid var(--line); max-height: 50vh; overflow: auto; }
.pill { font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.emp-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; display: block; overflow-x: auto; }
.emp-table th, .emp-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }

/* Sign-in (/login) */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding-block: 28px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login-card { width: 100%; max-width: 420px; gap: 16px; }
.login-card h1 { font-family: var(--display); font-weight: 400; font-size: 2rem; margin: 2px 0 4px; text-wrap: balance; }
.login-sso, .login-form { display: grid; gap: 10px; }
.btn.sso { display: block; text-align: center; text-decoration: none; background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.sso:hover { border-color: var(--ink); }
.login-or { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; color: var(--muted); font-size: 0.85rem; }
.login-or::before, .login-or::after { content: ""; height: 1px; background: var(--line); }
.login-links { justify-content: space-between; }
.linkish { font: inherit; font-size: 0.9rem; background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; justify-self: start; }
.login-msg { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--ok-soft); color: var(--ink); font-size: 0.92rem; }
.login-msg.bad { background: color-mix(in srgb, var(--warm) 16%, var(--surface)); }
.emp-signin { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.signin-text { margin: 0; flex: 1 1 260px; min-width: 0; }
.emp-warn { margin: 0; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--warm, #e8a87c); background: color-mix(in srgb, var(--warm, #e8a87c) 14%, transparent); font-size: 0.92rem; }
.emp-card > * { min-width: 0; max-width: 100%; }
#usage { overflow-x: auto; }
/* Owner dashboard */
.emp-nav { display: flex; flex-wrap: wrap; gap: 6px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; padding-block: 8px; background: var(--bg); }
.emp-nav a { font-size: 0.88rem; font-weight: 600; color: var(--ink); text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.emp-nav a:hover, .emp-nav a:focus-visible { border-color: var(--ink); }
.emp-section { font-family: var(--display); font-weight: 400; font-size: 1.6rem; margin: 18px 0 0; }
.ov-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.ov-tile { display: grid; gap: 4px; align-content: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); min-width: 0; }
.ov-tile .note { margin: 0; }
.ov-label { font-size: 0.72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ov-num { font-family: var(--display); font-size: 2rem; line-height: 1.1; margin: 0; font-variant-numeric: tabular-nums; }
.ov-desks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.92rem; }
.ov-desks li { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: baseline; }
.ov-desks .note { grid-column: 2; margin: 0; font-size: 0.8rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 360px; overflow-y: auto; }
.thread li { max-width: 85%; padding: 8px 12px; border-radius: 14px; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 0.95rem; }
.thread .me { justify-self: end; background: var(--ink); color: var(--surface); border-bottom-right-radius: 4px; }
.thread .her { justify-self: start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.thread .when { display: block; font-size: 0.72rem; opacity: .7; margin-top: 2px; }
.talk-form { display: grid; gap: 8px; }
.talk-form textarea { font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; resize: vertical; }
.timeline .emp-item { grid-template-columns: minmax(4.5rem, auto) 1fr; display: grid; gap: 8px; }
.timeline .t { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
/* Owner access at the desk: a small mark in the corner, out of the visitor's way */
.owner-dot { position: fixed; right: calc(10px + env(safe-area-inset-right, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 40; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); opacity: .45; display: grid; place-items: center; cursor: pointer; padding: 0; }
.owner-dot:hover, .owner-dot:focus-visible { opacity: 1; }
.owner-dot svg { width: 16px; height: 16px; }
/* Video on or off: the boss's switch, with the other controls at the top of the screen */
.video-switch { display: inline-flex; align-items: center; gap: 8px; }
.video-switch[hidden] { display: none; }
.video-switch .vs-track { width: 30px; height: 18px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; flex: none; }
.video-switch .vs-knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .3); transition: transform .15s; }
.video-switch[aria-checked="true"] .vs-track { background: var(--accent); }
.video-switch[aria-checked="true"] .vs-knob { transform: translateX(12px); }
@media (prefers-reduced-motion: reduce) { .video-switch .vs-track, .video-switch .vs-knob { transition: none; } }
.owner-gate { border: 1px solid var(--line); border-radius: 18px; padding: 20px; max-width: 360px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); }
.owner-gate::backdrop { background: rgb(0 0 0 / .45); }
.owner-gate form, .owner-gate .owner-go { display: grid; gap: 10px; }
.owner-gate h2 { font-family: var(--display); font-weight: 400; margin: 0; font-size: 1.4rem; }
.owner-gate input { font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.talk-form a.btn, .owner-go a.btn { text-decoration: none; text-align: center; }
/* Privacy Policy and Terms (/privacy, /terms) */
.legal { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.legal p { margin: 0; line-height: 1.6; max-width: 70ch; }
.legal-list { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; line-height: 1.55; }
.legal .legal-foot { text-align: center; max-width: none; }
.legal ol.legal-list { padding-left: 1.4em; }
.legal q { font-style: italic; }
.optin-shot { margin: 8px 0 0; display: grid; gap: 8px; }
.optin-shot img { width: 100%; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
/* Wide screens: the picture's edges melt into the blurred room instead of a hard line */
#avatar.framed.framed-sides .af-still, #avatar.framed.framed-sides .af-video { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%); }
/* A phone on its side: the welcome sits low and small, so it never covers her face */
@media (orientation: landscape) and (max-height: 520px) { .attract { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 62px); gap: 2px; } .attract-hi { font-size: 1.35rem; } .attract-line { font-size: .9rem; } }
/* Her look (dashboard): the faces to pick from */
.looks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.look { display: grid; gap: 8px; align-content: start; min-width: 0; }
.look-pick { display: grid; gap: 4px; text-align: left; padding: 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; cursor: pointer; }
.look-pick:hover, .look-pick:focus-visible { border-color: var(--ink); }
.look.on .look-pick { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.look-pick img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 10px; display: block; }
.look-pick .note { margin: 0; font-size: 0.8rem; }
