/* Employee portal. Colours follow the portal design ("Precision Slate & Emerald").
   --brand comes from /brand.css (BRAND_COLOR). */
:root {
  --brand: #006c49;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #ffffff);
  --surface: #f8f9ff;
  --card: #ffffff;
  --low: #eff4ff;
  --container: #e5eeff;
  --high: #dce9ff;
  --text: #0b1c30;
  --muted: #3c4a42;
  --outline: #6c7a71;
  --outline-soft: #bbcabf;
  --ok-text: #065f46; --ok-bg: #ecfdf5; --ok-border: #a7f3d0;
  --info-text: #3d4560; --info-bg: #dae2fd; --info-border: #bec6e0;
  --bad-text: #991b1b; --bad-bg: #fef2f2; --bad-border: #fecaca;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-raised: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--surface); color: var(--text); font: 15px/1.45 var(--font); }
h1, h2, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.3; font-weight: 700; letter-spacing: -0.015em; }
h2, .h2 { font-size: 19px; line-height: 1.35; font-weight: 700; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.icon { flex-shrink: 0; }
[hidden] { display: none !important; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 0 18px;
  border: 0; border-radius: var(--radius); font: 600 15px var(--font);
  text-decoration: none; cursor: pointer; transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.65; cursor: progress; }
.btn:focus-visible, .input:focus-visible, .tab:focus-visible, .icon-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.btn-lg { min-height: 56px; font-size: 16px; }
.btn-primary { background: var(--brand); color: #ffffff; }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--outline-soft); }
.btn-danger-outline { background: var(--card); color: var(--bad-text); border: 2px solid var(--bad-border); }

.input {
  width: 100%; height: 52px; padding: 0 16px;
  border: 1px solid var(--outline-soft); border-radius: 14px; background: var(--card);
  color: var(--text); font: 16px var(--font); /* 16px: stops iPhone zooming in */
}
.input:focus { border-color: var(--brand); }
.input-code { height: 60px; text-align: center; font-size: 24px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .btn { margin-top: 12px; }

/* ---------- Chips, flashes ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid; }
.chip .dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.chip-ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.chip-muted { background: var(--high); color: var(--muted); border-color: var(--outline-soft); }

.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid; font-size: 14px; }
.flash-success { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.flash-info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
.flash-error { background: var(--bad-bg); color: var(--bad-text); border-color: var(--bad-border); }

/* ---------- Brand ---------- */
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #ffffff;
  font-weight: 700; font-size: 12px; letter-spacing: 0.02em;
}
.logo-lg { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); }

/* ---------- Sign-up pages ---------- */
.auth { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.auth-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px 28px; background: var(--brand-soft); text-align: center; }
.auth-body { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 28px 24px 32px; }
.auth-center { justify-content: center; align-items: center; gap: 16px; padding: 32px 24px; text-align: center; }
.auth-center .btn { max-width: 340px; }
.code-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--card); color: var(--ok-text); font-weight: 700; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.note { font-size: 13px; color: var(--muted); text-align: center; }
.subbar { display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 12px 0 4px; background: var(--card); box-shadow: var(--shadow); font-weight: 700; font-size: 17px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; color: var(--text); }
.icon-circle { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 999px; background: var(--bad-bg); color: var(--bad-text); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--outline); font-size: 12px; margin: 8px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--outline-soft); }

.scanner { display: flex; flex-direction: column; gap: 14px; }
.viewfinder { position: relative; aspect-ratio: 1; border-radius: 24px; overflow: hidden; background: #213145; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.corner { position: absolute; width: 44px; height: 44px; border: 4px solid #ffffff; }
.corner.tl { top: 16px; left: 16px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.corner.tr { top: 16px; right: 16px; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.corner.bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.corner.br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }

/* ---------- Signed-in layout ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(12px); box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 16px 16px calc(88px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 10;
  width: 100%; max-width: 560px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(12px); border-top: 1px solid var(--high);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; }
.tab.active { color: var(--brand); font-weight: 700; }

.card { background: var(--card); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.card-raised { box-shadow: var(--shadow-raised); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.attendance { display: flex; flex-direction: column; gap: 16px; }
.big-time { font-size: 44px; line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.location-note { display: flex; align-items: center; gap: 6px; }

.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; flex-shrink: 0; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 20px; }
.details { margin: 0; }
.details div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--container); }
.details div:first-child { border-top: 0; padding-top: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
