/* Skysmart App: one stylesheet for the staff page, the door screen and the managers' page.
   Skysmart's colours (navy from their logo, white, sky blue); built for an iPhone 15 Pro Max first. */
:root {
  --navy: #050b6e; --navy2: #0b1690; --sky: #3d63ff; --sky-soft: #e8edff;
  --in: #0e8a4f; --in-soft: #e3f5ec; --out: #050b6e; --warn: #b45309; --warn-soft: #fff3e0; --bad: #c62828; --bad-soft: #fdecec;
  --bg: #eef1f8; --card: #fff; --ink: #0d1330; --muted: #5b6380; --line: #dfe3ef;
  --r: 18px; --head: 'Saira', 'Arial Narrow', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sky); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the bar along the top ---------- */
.top { background: var(--navy); color: #fff; padding: calc(var(--safe-t) + 12px) 16px 12px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; }
.top .logo { height: 22px; width: auto; display: block; max-width: 62vw; }
.top .clock { margin-left: auto; font: 700 italic 20px/1 var(--head); font-stretch: 110%; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.top .tagline { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }

.wrap { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(var(--safe-b) + 24px); }
.wide { max-width: 980px; }
h1, h2, h3 { font-family: var(--head); font-style: italic; font-weight: 800; font-stretch: 112%; line-height: 1.1; margin: 0 0 8px; letter-spacing: -.005em; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.card { background: var(--card); border-radius: var(--r); padding: 20px; box-shadow: 0 1px 0 rgba(13,19,48,.04), 0 8px 24px rgba(13,19,48,.06); margin-bottom: 14px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }

/* ---------- buttons and fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 0; background: var(--navy); color: #fff; font-weight: 700; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--line); }
.btn.soft { background: var(--sky-soft); color: var(--navy); }
.btn.green { background: var(--in); }
.btn.red { background: var(--bad); }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.linkbtn { background: none; border: 0; color: var(--sky); font-weight: 600; padding: 10px 4px; min-height: 44px; }
label.f { display: block; margin-bottom: 14px; font-weight: 600; font-size: 15px; }
label.f > span { display: block; margin-bottom: 6px; }
label.f small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=tel], input[type=search], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; font-size: 17px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; outline: none; -webkit-appearance: none; appearance: none;
}
select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235b6380' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(61,99,255,.18); }
.pin { letter-spacing: .5em; text-align: center; font-size: 24px !important; font-weight: 700; }
.err { background: var(--bad-soft); color: var(--bad); border-radius: 12px; padding: 12px 14px; font-weight: 600; margin-bottom: 14px; }
.note { background: var(--sky-soft); color: var(--navy); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.warnbox { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-weight: 600; }

/* ---------- the staff page ---------- */
.hello { font-size: 15px; color: var(--muted); margin-bottom: 2px; }
.state { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin: 6px 0 2px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #b7bdd1; flex: none; }
.dot.in { background: var(--in); box-shadow: 0 0 0 4px var(--in-soft); }
.punch { width: 100%; min-height: 128px; border-radius: 24px; border: 0; color: #fff; font: 800 italic 34px/1.05 var(--head); font-stretch: 112%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 10px; box-shadow: 0 10px 28px rgba(5,11,110,.22); -webkit-tap-highlight-color: transparent; }
.punch small { font: 600 15px/1.2 system-ui, sans-serif; opacity: .85; letter-spacing: 0; }
.punch.in { background: linear-gradient(160deg, #13a660, var(--in)); box-shadow: 0 10px 28px rgba(14,138,79,.28); }
.punch.out { background: linear-gradient(160deg, var(--navy2), var(--navy)); }
.punch:active { transform: scale(.985); }
.punch:disabled { opacity: .7; }
.swap { display: block; width: 100%; text-align: center; }
.scanhint { display: flex; gap: 14px; align-items: center; }
.scanhint svg { flex: none; width: 54px; height: 54px; }
.done { text-align: center; padding: 28px 20px; }
.tick { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; color: #fff; }
.tick.in { background: var(--in); } .tick.out { background: var(--navy); }
.tick svg { width: 52px; height: 52px; }
.big-time { font: 800 italic 56px/1 var(--head); font-stretch: 112%; font-variant-numeric: tabular-nums; margin: 6px 0 4px; }
.today { list-style: none; margin: 0; padding: 0; }
.today li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.today li:first-child { border-top: 0; }
.today b.in { color: var(--in); } .today b.out { color: var(--navy); }
.foot { text-align: center; font-size: 13px; color: var(--muted); padding: 8px 0 0; }
.foot a { color: var(--muted); }

/* ---------- the door screen ---------- */
body.door { background: var(--navy); color: #fff; min-height: 100dvh; display: flex; flex-direction: column; }
.door-in { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; padding: calc(var(--safe-t) + 3vh) 5vw calc(var(--safe-b) + 3vh); text-align: center; }
.door-in .logo { width: min(70vw, 560px); height: auto; }
.door-in h1 { font-size: clamp(28px, 5vh, 56px); margin: 0; }
.door-qr { background: #fff; border-radius: 28px; padding: 2.2vh; width: min(78vw, 58vh); aspect-ratio: 1; position: relative; }
.door-qr .qr { width: 100%; height: 100%; display: block; }
.door-qr.stale .qr { opacity: .15; }
.door-bar { width: min(78vw, 58vh); height: 8px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
.door-bar i { display: block; height: 100%; background: #fff; width: 100%; transform-origin: left; }
.door-clock { font: 800 italic clamp(32px, 7vh, 80px)/1 var(--head); font-stretch: 112%; font-variant-numeric: tabular-nums; }
.door-sub { opacity: .8; font-size: clamp(15px, 2.2vh, 22px); max-width: 680px; }
.door-msg { background: rgba(255,255,255,.12); border-radius: 16px; padding: 16px 20px; max-width: 560px; }

/* ---------- the managers' page ---------- */
.tabs { display: flex; gap: 4px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: calc(var(--safe-t) + 46px); z-index: 15; padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; border: 0; background: none; min-height: 48px; padding: 0 14px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs button[aria-selected=true] { color: var(--navy); border-bottom-color: var(--navy); }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 12px; flex-wrap: wrap; }
.head-row h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: 16px; padding: 14px; }
.stat b { display: block; font: 800 italic 28px/1 var(--head); font-stretch: 112%; color: var(--navy); }
.stat span { font-size: 13px; color: var(--muted); }
.list { background: #fff; border-radius: var(--r); overflow: hidden; margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.row:first-child { border-top: 0; }
button.row:active { background: #f6f8fd; }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-size: 14px; color: var(--muted); }
.row .right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--sky-soft); color: var(--navy); flex: none; }
.avatar.in { background: var(--in-soft); color: var(--in); }
.list-h { padding: 12px 16px 4px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--sky-soft); color: var(--navy); margin: 2px 4px 0 0; vertical-align: middle; }
.tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.in { background: var(--in-soft); color: var(--in); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; min-height: 44px; padding: 0 16px; font-weight: 600; }
.chips button[aria-pressed=true] { background: var(--navy); border-color: var(--navy); color: #fff; }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }
.daytitle { margin: 18px 4px 8px; font-weight: 700; color: var(--muted); font-size: 14px; }
.switchrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-bottom: 10px; font-weight: 600; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #c9cfe0; transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--in); }
.switch input:checked + i::after { transform: translateX(20px); }
.point { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: start; }
.point .qr { width: 96px; height: 96px; border-radius: 10px; border: 1px solid var(--line); }
.point .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; color: var(--muted); }

/* the sheet that slides up from the bottom */
.scrim { position: fixed; inset: 0; background: rgba(5,11,40,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: calc(100dvh - var(--safe-t) - 24px); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(40px); } }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 8px; }
.sheet-h h2 { margin: 0; }
.sheet-b { overflow-y: auto; padding: 8px 16px 16px; -webkit-overflow-scrolling: touch; }
.sheet-f { padding: 12px 16px calc(var(--safe-b) + 12px); display: flex; gap: 10px; border-top: 1px solid var(--line); background: #fff; }
.sheet-f .btn { flex: 1; }
.x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; font-size: 22px; line-height: 1; color: var(--muted); }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 22px; } }

.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 70px); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* the printed poster */
.poster { display: none; }
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  body.printing > *:not(.poster) { display: none !important; }
  body.printing { background: #fff; }
  body.printing .poster { display: flex !important; flex-direction: column; align-items: center; text-align: center; gap: 8mm; color: var(--navy); }
  .poster img { width: 150mm; height: auto; }
  .poster h1 { font-size: 34pt; margin: 4mm 0 0; }
  .poster .qr { width: 125mm; height: 125mm; }
  .poster p { font-size: 15pt; margin: 0; color: #222; max-width: 160mm; }
  .poster .pt { font: 800 italic 20pt var(--head); }
}
