/* AutoDimona Check-in — calm, big, touch-first. Company colours arrive as --brand / --accent (set from JS). */

:root {
  --brand: #4f46e5;
  --accent: #0ea5e9;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f0f1f6;
  --text: #151826;
  --muted: #6b7083;
  --line: #e3e5ee;
  --ok: #10b981;
  --ok-bg: #e7f8f1;
  --out: #2563eb;
  --danger: #dc2626;
  --danger-bg: #fdecec;
  --warn: #b45309;
  --warn-bg: #fff6e5;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 20, 40, .06), 0 8px 24px rgba(16, 20, 40, .07);
  --shadow-lg: 0 20px 60px rgba(16, 20, 40, .22);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-mode="kiosk"]) {
    --bg: #0f1117;
    --surface: #181b24;
    --surface-2: #20242f;
    --text: #eef0f6;
    --muted: #9aa0b4;
    --line: #2a2f3c;
    --ok-bg: #0f2a22;
    --danger-bg: #3a1717;
    --warn-bg: #33270f;
    --warn: #f5b04a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.lead { font-size: 1.15rem; }
.hint { font-size: .9rem; color: var(--muted); margin-top: 8px; }

.boot, .loading-page { min-height: 100vh; display: grid; place-items: center; }
.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; gap: 12px; }
.narrow { max-width: 520px; width: 100%; margin: 0 auto; }

/* ── buttons & fields ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 600; transition: transform .12s ease, background .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: transparent; color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: .92rem; border-radius: 11px; }
.btn.huge { min-height: 76px; font-size: 1.25rem; padding: 0 30px; border-radius: 20px; }
.btn.wide { width: 100%; }
.icon-btn { width: 52px; height: 52px; border-radius: 14px; border: 0; background: rgba(255, 255, 255, .16); color: inherit; font-size: 1.4rem; }
.row { display: flex; gap: 12px; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.center-row { justify-content: center; }

.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-bottom: 14px; }
.field > span { font-size: .9rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .search {
  min-height: 52px; padding: 0 16px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface-2); outline: none; transition: border .2s, box-shadow .2s; width: 100%;
}
.field input:focus, .field select:focus, .search:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.field.inline { flex-direction: row; align-items: center; gap: 12px; margin: 0; }
.field.inline select { width: auto; min-width: 180px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; width: 100%; text-align: left; }
.card.centered { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.error { color: var(--danger); background: var(--danger-bg); border-radius: 12px; padding: 10px 14px; font-weight: 500; }
.error.big { font-size: 1.15rem; }
.warn { color: var(--warn); background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; }
.ok { color: var(--ok); background: var(--ok-bg); border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.offline { position: sticky; top: 0; z-index: 50; background: #1f2937; color: #fff; text-align: center; padding: 10px 16px; font-weight: 600; }

.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid color-mix(in srgb, var(--brand) 20%, transparent); border-top-color: var(--brand); animation: spin .9s linear infinite; margin: 16px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── branding ── */
.brandline { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brandline b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { object-fit: contain; border-radius: 10px; background: #fff; }
.logo.sm { height: 36px; max-width: 120px; padding: 3px; }
.logo.md { height: 54px; max-width: 180px; padding: 5px; }
.logo-mark { display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; font-weight: 800; letter-spacing: .02em; flex: none; }
.logo-mark.sm { width: 36px; height: 36px; font-size: .85rem; }
.logo-mark.md { width: 54px; height: 54px; font-size: 1.15rem; }

.lang { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.lang button { border: 0; background: transparent; padding: 6px 10px; border-radius: 9px; font-weight: 700; font-size: .82rem; color: var(--muted); min-height: 34px; }
.lang button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ── first run ── */
.top { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; }
.start h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); max-width: 720px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; width: 100%; max-width: 760px; margin: 12px 0 8px; }
.choice {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left;
  border: 1px solid var(--line); background: var(--surface); border-radius: 22px; padding: 26px; box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s;
}
.choice:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.choice b { font-size: 1.2rem; }
.choice span:last-child { color: var(--muted); }
.choice-icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 1.6rem; color: #fff; background: linear-gradient(135deg, var(--brand), var(--accent)); }
.options { display: grid; gap: 10px; margin: 8px 0 16px; }
.option { text-align: left; border: 2px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-height: 60px; }
.option.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.install-ios { display: flex; flex-direction: column; align-items: center; }

/* ═════ the tablet ═════ */
[data-mode="kiosk"] body { user-select: none; -webkit-user-select: none; }
.kiosk { background: var(--bg); }
.kiosk-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 18px 28px; color: #fff;
  background: linear-gradient(120deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--accent)));
  box-shadow: 0 6px 30px color-mix(in srgb, var(--brand) 30%, transparent);
}
.kiosk-head .company { display: block; font-size: 1.2rem; }
.kiosk-head .where { display: block; opacity: .85; font-size: .95rem; }
.clock { display: flex; flex-direction: column; align-items: center; }
.clock .time { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; }
.clock .date { opacity: .9; margin-top: 4px; display: block; }
.clock .date::first-letter { text-transform: uppercase; }
.head-tools { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.kiosk-head .lang { background: rgba(255, 255, 255, .16); }
.kiosk-head .lang button { color: rgba(255, 255, 255, .85); }
.kiosk-head .lang button.on { background: #fff; color: var(--brand); }

.kiosk-main { padding: 24px 28px 40px; flex: 1; }
.kiosk-intro { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.kiosk-intro h1 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 0; }
.kiosk-intro p { margin: 4px 0 0; }
.search { margin-bottom: 18px; font-size: 1.1rem; max-width: 460px; background: var(--surface); }
.empty { text-align: center; padding: 40px 0; font-size: 1.1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  min-height: 168px; padding: 20px 12px 16px; border-radius: 22px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .2s;
}
.tile:active { transform: scale(.97); }
.tile b { font-size: 1.08rem; text-align: center; line-height: 1.2; }
.tile-sub { font-size: .88rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; min-height: 1.3em; }
.tile.is-in { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); background: linear-gradient(180deg, var(--ok-bg), var(--surface) 70%); }
.tile.is-in .tile-sub { color: var(--ok); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); display: inline-block; }

.avatar {
  --av: #6366f1;
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--av); color: #fff; font-weight: 700; font-size: 1.5rem; letter-spacing: .02em;
  box-shadow: inset 0 -6px 14px rgba(0, 0, 0, .12);
}
.avatar.big { width: 104px; height: 104px; font-size: 2.2rem; margin: 0 auto 10px; }
.m-row .avatar { width: 52px; height: 52px; font-size: 1.1rem; }

/* overlays */
.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(13, 16, 28, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px; animation: fade .18s ease;
}
.sheet {
  position: relative; background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-lg);
  width: min(560px, 100%); max-height: calc(100dvh - 40px); overflow: auto; padding: 34px 28px 28px; text-align: center; animation: rise .22s ease;
}
.close-x { position: absolute; top: 14px; right: 14px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 1.1rem; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(18px) scale(.98); opacity: 0; } }

.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin-top: 18px; }
.method { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 130px; justify-content: center; border-radius: 20px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.1rem; transition: transform .12s; }
.method:active { transform: scale(.97); }
.m-icon { font-size: 2.2rem; color: var(--brand); }

.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 10px 0 18px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); transition: background .15s, border .15s; }
.pin-dots i.on { background: var(--brand); border-color: var(--brand); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 360px; margin: 0 auto; }
.key { min-height: 76px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.8rem; font-weight: 600; transition: transform .08s, background .15s; }
.key:active { transform: scale(.95); background: color-mix(in srgb, var(--brand) 12%, var(--surface-2)); }
.key.soft { font-size: 1.4rem; color: var(--muted); }
.key.go { background: var(--brand); color: #fff; border-color: transparent; font-size: 1.3rem; }
.key.go:disabled { opacity: .4; }

.facecheck { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.camera { position: relative; width: min(420px, 100%); aspect-ratio: 4 / 3; border-radius: 24px; overflow: hidden; background: #0b0d14; }
.camera video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera.qr video { transform: none; }
.face-ring { position: absolute; inset: 12% 24%; border-radius: 50% / 45%; border: 4px solid rgba(255, 255, 255, .55); transition: border-color .2s; }
.camera.match .face-ring { border-color: var(--ok); box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 35%, transparent); }
.camera.face .face-ring { border-color: #fff; }
.camera.loading .face-ring { animation: pulse 1.4s ease-in-out infinite; }
.qr-frame { position: absolute; inset: 18%; border: 4px solid rgba(255, 255, 255, .85); border-radius: 22px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); }
@keyframes pulse { 50% { opacity: .35; } }
.progress { width: min(320px, 100%); height: 10px; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ok); transition: width .3s ease; }
.fp-pulse { font-size: 4.5rem; color: var(--brand); animation: pulse 1.4s ease-in-out infinite; margin: 10px 0; }

/* result */
.result {
  position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 32px; color: #fff; animation: fade .2s ease;
}
.result.in { background: radial-gradient(circle at 50% 30%, #34d399, #059669); }
.result.out { background: radial-gradient(circle at 50% 30%, #60a5fa, #1d4ed8); }
.result h1 { font-size: clamp(2rem, 6vw, 3.6rem); margin: 8px 0; }
.result .lead { font-size: clamp(1.2rem, 2.6vw, 1.6rem); opacity: .95; }
.result .warn { background: rgba(255, 255, 255, .92); }
.result-icon { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; font-size: 3.6rem; background: rgba(255, 255, 255, .2); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* manager mode */
.manager { padding: 24px 28px 40px; max-width: 1000px; width: 100%; margin: 0 auto; }
.manager-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.notes { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); margin-bottom: 16px; font-size: .93rem; color: var(--muted); }
.notes p:last-child { margin-bottom: 0; }
.m-list { display: grid; gap: 10px; }
.m-row { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 18px; padding: 12px 16px; box-shadow: var(--shadow); flex-wrap: wrap; }
.m-name { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 4px; }
.m-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--ok-bg); color: var(--ok); }
.badge.soft { background: var(--surface-2); color: var(--muted); }
.m-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }
.form { text-align: left; }
.form h2 { text-align: center; }

/* ═════ the phone ═════ */
.phone { max-width: 560px; margin: 0 auto; width: 100%; }
.phone-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); gap: 10px; }
.phone-main { padding: 4px 16px 32px; display: flex; flex-direction: column; gap: 16px; }
.greet { font-size: 1.7rem; margin: 6px 0 0; }
.status-card { display: flex; align-items: center; gap: 14px; padding: 20px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); font-size: 1.1rem; }
.status-card.in { background: linear-gradient(135deg, var(--ok-bg), var(--surface)); }
.status-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--muted); flex: none; }
.status-card.in .status-dot { background: var(--ok); box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 22%, transparent); }
.scanner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.scanner .camera { width: 100%; aspect-ratio: 1; }
.result-card { border-radius: 24px; padding: 26px 20px; text-align: center; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.result-card.in { background: linear-gradient(160deg, #34d399, #059669); }
.result-card.out { background: linear-gradient(160deg, #60a5fa, #1d4ed8); }
.result-card .result-icon { width: 84px; height: 84px; font-size: 2.6rem; }
.result-card .muted { color: rgba(255, 255, 255, .85); }
.result-card .btn { margin-top: 10px; background: rgba(255, 255, 255, .95); color: #111; border: 0; }
.list-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.list-card h3 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.shift-day { display: flex; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.shift-day:first-of-type { border-top: 0; }
.shift-day .day { min-width: 96px; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.shift-day .day.today { color: var(--brand); }
.phone-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── sizes ── */
@media (max-width: 760px) {
  .kiosk-head { grid-template-columns: 1fr auto; padding: 14px 16px; }
  .kiosk-head .clock { grid-column: 1 / -1; grid-row: 2; align-items: flex-start; }
  .kiosk-main, .manager { padding: 18px 16px 32px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .tile { min-height: 150px; }
  .avatar { width: 60px; height: 60px; font-size: 1.25rem; }
  .sheet { padding: 30px 18px 20px; border-radius: 24px; }
  .key { min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* a landscape tablet (1280×800) or a short phone: the PIN pad fits on the screen without scrolling */
@media (max-height: 860px) {
  .sheet { padding: 22px 24px 20px; }
  .avatar.big { width: 72px; height: 72px; font-size: 1.6rem; margin-bottom: 6px; }
  .pin-dots { margin: 6px 0 12px; }
  .keys { gap: 10px; max-width: 330px; }
  .key { min-height: 60px; font-size: 1.6rem; border-radius: 16px; }
  .method { min-height: 112px; }
}

/* signing in on a phone from the QR code */
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.code-input { font-size: 1.8rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.row-btns { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* answering shifts and saying when you can work */
.answer { display: flex; gap: 8px; margin-top: 6px; }
.badge-ok { font-size: .78rem; font-weight: 700; color: var(--ok, #059669); }
.avail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin: 10px 0; }
.avail { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: .8rem; color: inherit; }
.avail b { font-size: 1.1rem; }
.avail.available { background: color-mix(in srgb, #10b981 18%, var(--surface)); border-color: #10b981; }
.avail.unavailable { background: color-mix(in srgb, #ef4444 14%, var(--surface)); border-color: #ef4444; }
.small { font-size: .85rem; }
.avail-legend { display: flex; gap: 18px; flex-wrap: wrap; }

/* confirming a scan: one clear action */
.scan-confirm { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.scan-confirm .sc-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.scan-confirm.out .sc-icon { background: color-mix(in srgb, #2563eb 14%, var(--surface)); }
.scan-confirm .lead { margin: 0; font-size: 1.2rem; }
