/* EB — Extended Bio FaceScan Time · design tokens lifted from the FieldHR prototype */
:root {
  --deep: #064E3B;
  --deep-2: #083f32;
  --primary: #16C784;
  --primary-2: #21d18d;
  --mint: #CFFAEA;
  --mint-soft: #ECFDF5;
  --bg: #F6FAF8;
  --card: #FFFFFF;
  --text: #063F32;
  --muted: #6B7C75;
  --line: #E2EBE7;
  --warning: #F59E0B;
  --warning-soft: #FEF3E2;
  --danger: #EF4444;
  --danger-soft: #FDECEC;
  --shadow: 0 12px 32px rgba(6, 78, 59, 0.10);
  --r-xl: 28px; --r-lg: 22px; --r-md: 16px; --r-sm: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(22,199,132,.35); outline-offset: 2px;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
@media (min-width: 900px) { #app.wide { max-width: 1080px; } }

/* ---------- screens ---------- */
.screen { display: none; flex: 1; flex-direction: column; padding: 20px 18px 96px; }
.screen.active { display: flex; }

/* ---------- header ---------- */
.appbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.appbar .back { border: 1px solid var(--line); background: var(--card); border-radius: 12px; width: 38px; height: 38px; display: grid; place-items: center; font-size: 18px; }
.appbar h2 { font-size: 20px; font-weight: 700; }
.appbar .spacer { flex: 1; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px; background: linear-gradient(135deg, var(--deep), var(--primary));
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: .02em;
}
.brand small { display: block; color: var(--muted); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.brand b { font-size: 17px; }

/* ---------- cards & layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); }
.card + .card, .section + .section { margin-top: 14px; }
.card.flat { box-shadow: none; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 22px 0 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--r-md); padding: 13px 18px; font-weight: 700; font-size: 15px;
  background: var(--mint-soft); color: var(--deep); width: 100%;
}
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 10px 22px rgba(22,199,132,.35); }
.btn.dark { background: var(--deep); color: #fff; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 8px 12px; font-size: 13px; width: auto; border-radius: 12px; }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: var(--r-md);
  padding: 12px 14px; font-size: 15px;
}
textarea.input { resize: vertical; min-height: 72px; }

/* ---------- pills / status ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.pill.ok { background: var(--mint-soft); color: #0B7A55; }
.pill.warn { background: var(--warning-soft); color: #B45309; }
.pill.bad { background: var(--danger-soft); color: #B91C1C; }
.pill.info { background: #EAF2FE; color: #1D4ED8; }
.pill.dim { background: #F0F3F2; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot.on { background: var(--primary); box-shadow: 0 0 0 4px rgba(22,199,132,.18); }
.dot.off { background: #C4CFCA; }

/* ---------- home hero / punch card ---------- */
.hero {
  background: linear-gradient(150deg, var(--deep) 0%, #0A6B50 60%, #0E8A64 100%);
  color: #fff; border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow);
}
.hero .greet { font-size: 13px; opacity: .82; }
.hero h1 { font-size: 24px; margin-top: 2px; font-weight: 800; }
.hero .clock { font-size: 40px; font-weight: 800; margin: 14px 0 2px; font-variant-numeric: tabular-nums; }
.hero .sub { font-size: 13px; opacity: .85; }
.hero .btn { margin-top: 16px; }
.hero .status-line { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hero .pill { background: rgba(255,255,255,.16); color: #fff; }

.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.stat-tile b { font-size: 20px; display: block; font-variant-numeric: tabular-nums; }
.stat-tile span { font-size: 11.5px; color: var(--muted); }

/* tool grid */
.tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.tool .ic { width: 36px; height: 36px; border-radius: 12px; background: var(--mint-soft); display: grid; place-items: center; font-size: 18px; }
.tool b { font-size: 14px; }
.tool span { font-size: 12px; color: var(--muted); }
.tool .badge { position: absolute; }

/* ---------- check-in flow ---------- */
.cam-wrap { position: relative; border-radius: var(--r-xl); overflow: hidden; background: #0b1512; aspect-ratio: 3/4; }
.cam-wrap video, .cam-wrap canvas, .cam-wrap img.preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-ring { position: absolute; inset: 8% 16%; border: 3px dashed rgba(255,255,255,.55); border-radius: 50%/44%; pointer-events: none; }
.cam-hint { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.check-steps { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.check-step { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); }
.check-step.ok { color: var(--text); }
.check-step .st { width: 22px; height: 22px; border-radius: 999px; background: #EDF2F0; display: grid; place-items: center; font-size: 12px; flex: none; }
.check-step.ok .st { background: var(--mint); color: #0B7A55; }
.check-step.err .st { background: var(--danger-soft); color: var(--danger); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
.item .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.item .top b { font-size: 14.5px; }
.item .meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--mint); color: var(--deep); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }

/* ---------- map ---------- */
#map, #mapMe { border-radius: var(--r-xl); border: 1px solid var(--line); height: 52vh; min-height: 320px; background: #E8F0EC; }
.leaflet-container { font: inherit; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: rgba(255,255,255,.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); display: flex; z-index: 500;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button { flex: 1; background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; color: var(--muted); font-size: 10.5px; font-weight: 600; border-radius: 12px; }
.tabbar button.active { color: var(--deep); }
.tabbar button .tic { font-size: 20px; line-height: 1; }
.tabbar button.active .tic { transform: translateY(-1px); }

/* ---------- login ---------- */
.login-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-bottom: 40px; }
.login-hero { text-align: center; margin-bottom: 26px; }
.login-hero .brand-mark { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 12px; font-size: 22px; }
.login-hero h1 { font-size: 24px; font-weight: 800; }
.login-hero p { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; }

/* ---------- toast / modal ---------- */
#toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: var(--deep); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .25s, translate .25s; z-index: 900;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; }
#toast.err { background: #7F1D1D; }

.modal-back { position: fixed; inset: 0; background: rgba(6,63,50,.45); display: none; place-items: end center; z-index: 800; }
.modal-back.show { display: grid; }
.modal { background: var(--card); border-radius: 24px 24px 0 0; width: 100%; max-width: 480px; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 86dvh; overflow-y: auto; }
.modal h3 { font-size: 17px; margin-bottom: 12px; }

/* offline banner */
#offlineBar {
  display: none; background: var(--warning-soft); color: #92400E; font-size: 12.5px; font-weight: 600;
  padding: 7px 14px; text-align: center; border-bottom: 1px solid #FBE3BF;
}
body.offline #offlineBar { display: block; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
table.data td { padding: 8px 10px; border-bottom: 1px solid #EFF4F1; white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13.5px; }
.selfie-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
