/* Accents are drawn from the Zweldo mark: its gradient runs #4494c7 at the
   top to #37529b at the foot, and the badge is #58bb46. Those sit at 41-52%
   lightness, which is right on the mark's white ground and too dark to read
   on this one, so the blue is lifted to 62% for UI use while the badge green
   is taken as it is. Neutrals and spacing stay the mobile kiosk's own tokens
   (UareUApp/src/theme.ts). */
:root {
  --bg: #0b0d10;
  --backdrop: #06080a;
  --surface: #14171c;
  --surface-variant: #1c2027;
  --border: #262c35;
  --brand-blue: #4494c7;
  --brand-indigo: #37529b;
  --primary: #62acda;
  --primary-soft: rgba(98, 172, 218, .14);
  --text: #f5f7fa;
  --text-dim: #9aa4b2;
  --success: #56ba45;
  --success-soft: rgba(86, 186, 69, .14);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, .14);
  --overlay: rgba(9, 13, 18, .66);

  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 24px;

  --gutter: 16px;
  --app-width: 460px;
}

/* ---------- bulma theme ---------- */

/* Bulma 1.0 derives every shade from an h/s/l triplet, so the mobile palette
   is handed over as lightness stops rather than as finished hex values. */
:root[data-theme="dark"] {
  --bulma-scheme-h: 216;
  --bulma-scheme-s: 17%;
  --bulma-scheme-main-l: 5.3%;
  --bulma-scheme-main-bis-l: 9.4%;
  --bulma-scheme-main-ter-l: 13.1%;
  --bulma-background-l: 13.1%;
  --bulma-border-weak-l: 14%;
  --bulma-border-l: 17.8%;

  --bulma-text-h: 216deg;
  --bulma-text-s: 17%;
  --bulma-text-l: 97%;
  --bulma-text-strong-l: 100%;
  --bulma-text-weak-l: 65%;

  --bulma-primary-h: 203deg;
  --bulma-primary-s: 62%;
  --bulma-primary-l: 62%;
  --bulma-link-h: 203deg;
  --bulma-link-s: 62%;
  --bulma-link-l: 62%;
  --bulma-info-h: 203deg;
  --bulma-info-s: 62%;
  --bulma-info-l: 62%;
  --bulma-success-h: 111deg;
  --bulma-success-s: 46%;
  --bulma-success-l: 50%;
  --bulma-warning-h: 38deg;
  --bulma-warning-s: 92%;
  --bulma-warning-l: 50%;
  --bulma-danger-h: 0deg;
  --bulma-danger-s: 84%;
  --bulma-danger-l: 60%;

  --bulma-radius-small: 6px;
  --bulma-radius: 8px;
  --bulma-radius-medium: 12px;
  --bulma-radius-large: 16px;

  --bulma-family-primary: system-ui, -apple-system, "Segoe UI", sans-serif;
  --bulma-body-font-size: 15px;
  --bulma-body-background-color: var(--backdrop);

  --bulma-box-background-color: var(--surface);
  --bulma-box-radius: var(--bulma-radius-large);
  --bulma-box-shadow: none;
  --bulma-modal-content-width: var(--app-width);
}

[hidden] { display: none !important; }

html, body {
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--backdrop);
}

body { margin: 0; }

.overline {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---------- phone frame ---------- */

/* A phone-shaped column, centred and capped, so a 27" kiosk monitor reads as
   the same app rather than a stretched web page. */
.app-shell {
  width: 100%;
  max-width: var(--app-width);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.screens { flex: 1; display: flex; flex-direction: column; }

.screen {
  flex: 1;
  padding: var(--sp-lg) var(--gutter);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  animation: screen-in .2s ease-out;
}

.screen.is-back { animation-name: screen-back; }

@keyframes screen-in {
  from { transform: translateX(16px); opacity: 0; }
}

@keyframes screen-back {
  from { transform: translateX(-16px); opacity: 0; }
}

.stage-slot { display: contents; }

.screen-title { font-size: 21px; font-weight: 700; margin: 0; letter-spacing: -.2px; }

/* ---------- sign-in hero ---------- */

.hero-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--sp-xl) 0 var(--sp-sm);
}

.hero-mark {
  width: 84px;
  height: 84px;
  background: url("icons/logo.png") center / contain no-repeat;
}

.hero-word { font-size: 30px; font-weight: 600; letter-spacing: .5px; }
.hero-tag { font-size: 13px; color: var(--text-dim); }

/* ---------- enrollment capture ---------- */

.enroll-who { margin: 0; font-size: 15px; font-weight: 600; }

.shot-bar {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-variant);
  overflow: hidden;
}

.shot-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: var(--primary);
  transition: width .3s ease;
}

/* ---------- header ---------- */

.app-header {
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 15;
}

.app-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  min-height: 56px;
  padding: var(--sp-sm) var(--gutter);
}

.bar-title { font-size: 19px; font-weight: 700; letter-spacing: .2px; margin: 0; }

.icon-button {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text);
}

.icon-button:hover { background: var(--surface-variant); }
#menu-button { margin-left: auto; }

/* Three bars and a chevron, drawn rather than fetched — an icon font would
   be a second request for six lines of geometry. */
.burger, .burger::before, .burger::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.burger { position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }

.chevron {
  width: 11px;
  height: 11px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 4px;
}

/* ---------- menu ---------- */

/* Anchored to the header, not the page: the shell is a narrow column inside
   a wide window, and a menu positioned against the viewport lands out in the
   backdrop beside the app. */
.menu-sheet {
  position: absolute;
  top: calc(100% + 4px);
  right: var(--gutter);
  min-width: 232px;
  padding: 6px 0;
  background: var(--surface-variant);
  border: 1px solid var(--border);
  border-radius: var(--bulma-radius-medium);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
  z-index: 30;
  animation: menu-in .14s ease-out;
}

@keyframes menu-in {
  from { transform: translateY(-6px); opacity: 0; }
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover { background: var(--surface); }
.menu-item.is-danger { color: var(--danger); }
.menu-divider { margin: 6px 0; border: 0; border-top: 1px solid var(--border); }

.menu-icon { width: 20px; height: 20px; flex: none; opacity: .8; }
.menu-text { flex: 1; }

.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }

.mark {
  width: 32px;
  height: 32px;
  flex: none;
  background: url("icons/logo.png") center / contain no-repeat;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 15px; letter-spacing: .2px; }
.brand-text .overline { font-size: 10px; letter-spacing: 1px; }

.whoami {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  margin: 0;
  align-items: baseline;
}

#whoami-name { font-size: 15px; font-weight: 600; }
#whoami-branch { font-size: 12px; color: var(--text-dim); }

.statusline {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  margin: 0;
  font-size: 11px;
  color: var(--text-dim);
}

.statusline span + span::before { content: "·"; margin-right: 8px; opacity: .6; }
.statusline b { color: var(--text); font-weight: 600; }
.statusline .warn b { color: var(--warning); }
.statusline #rejected-state b { color: var(--danger); }

/* Outruns Bulma's `.buttons:not(:last-child)`, which adds 1.5rem here. */
.app-header .modes { margin-bottom: 0; }
.modes .button { flex: 1; margin-bottom: 0; }
.modes .button.active {
  background-color: var(--primary-soft);
  border-color: var(--primary);
  color: var(--text);
  z-index: 1;
}

/* ---------- login ---------- */

/* Employee mode takes the deep end of the mark's gradient, so the two
   sign-ins are told apart by the logo's own two blues. */
#login-card[data-login-mode="employee"] {
  --bulma-primary-h: 224deg;
  --bulma-primary-s: 48%;
  --bulma-primary-l: 45%;
  /* Bulma derives the label from the fill and lands on near-black here,
     which reads at 3:1 against this indigo. White is 7.5:1. */
  --bulma-primary-invert-l: 100%;
  --bulma-primary-invert-s: 0%;
}

#login-modes { margin-bottom: 0; }
#login-modes .button { flex: 1; margin-bottom: 0; }
#login-modes .button.active {
  background-color: var(--primary-soft);
  border-color: var(--primary);
  color: var(--text);
  z-index: 1;
}

.control.has-reveal { position: relative; }
.control.has-reveal .input { padding-right: 64px; }

.reveal {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  padding: 0 12px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.reveal:hover { color: var(--text); }

/* ---------- fields & boxes ---------- */

.box {
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.box .title { margin-bottom: 0; }
.box .field { margin-bottom: 0; }

.box form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

/* Labels above the field rather than inside it: a placeholder that doubles
   as the label disappears the moment someone starts typing. */
.label {
  display: block;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}

.input, .select select { min-height: 48px; }
.select, .select select { width: 100%; }
.button.is-tall { min-height: 50px; font-size: 16px; font-weight: 600; }

label.check {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  color: var(--text);
  font-size: 14px;
}

label.check input { width: auto; }

.notice {
  display: none;
  margin: 0;
  border-radius: 0;
  padding: 10px var(--gutter);
  background: var(--primary-soft);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

body.audio-blocked .notice { display: block; }

/* ---------- camera stage ---------- */

.stage {
  position: relative;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--bulma-radius-large);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  width: 100%;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

/* Scan frame — corner brackets over a dimmed surround, ported from the
   mobile overlay. The scrim is one huge spread shadow, so no extra layer. */
.scanframe {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(74%, 420px);
  aspect-ratio: 1;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45);
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 0 solid var(--primary);
  transition: border-color .18s ease;
}

.corner.tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; }
.corner.tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; }

.sweep {
  position: absolute;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--primary);
  box-shadow: 0 0 22px 5px var(--primary-soft);
  opacity: 0;
  transition: opacity .25s ease;
  animation: sweep 4.2s ease-in-out infinite;
}

/* The line is a sign that someone is being looked at, so it is tied to a face
   being in frame. Faded rather than switched off: the detector flickers
   between 0 and 1 faces at the edge of the zone, and a strobing line reads as
   a fault. */
.stage[data-scan="scanning"] .sweep,
.stage[data-scan="warn"] .sweep { opacity: .9; }

@keyframes sweep {
  0%, 100% { top: 14px; }
  50% { top: calc(100% - 16px); }
}

.stage[data-scan="locked"] .corner { border-color: var(--success); }
.stage[data-scan="warn"] .corner { border-color: var(--warning); }

.facelabel {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: var(--overlay);
  border: 1px solid var(--border);
  border-radius: var(--bulma-radius);
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.stage[data-scan="locked"] .facelabel { border-color: var(--success); color: var(--success); }

.hint {
  position: absolute;
  inset: auto 0 0 0;
  padding: 14px var(--gutter);
  background: linear-gradient(transparent, rgba(9, 13, 18, .88));
  font-size: 15px;
  font-weight: 500;
}

/* ---------- model splash ---------- */

/* The camera is live well before the model is, and a working viewfinder that
   answers nothing reads as a broken kiosk. This covers the stage until there
   is something behind it. */
.splash {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  padding: var(--gutter);
  text-align: center;
  background: rgba(9, 13, 18, .93);
  z-index: 3;
}

.splash-mark {
  width: 68px;
  height: 68px;
  background: url("icons/logo.png") center / contain no-repeat;
}

.splash-title { margin: 0; font-size: 16px; font-weight: 600; }
.splash-note { margin: 0; font-size: 13px; color: var(--text-dim); }

/* The loader reports two steps, not a percentage, so the bar paces rather
   than pretends to measure. */
.splash-bar {
  width: min(180px, 60%);
  height: 3px;
  border-radius: 2px;
  background: var(--surface-variant);
  overflow: hidden;
}

.splash-bar i {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: var(--primary);
  animation: splash-slide 1.3s ease-in-out infinite;
}

@keyframes splash-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.splash.is-error .splash-note { color: var(--danger); }
.splash.is-error .splash-bar { display: none; }

@media (prefers-reduced-motion: reduce) {
  .splash-bar i { animation: none; width: 100%; }
}

/* ---------- side panel ---------- */

.side { display: flex; flex-direction: column; gap: var(--sp-md); }

.result .name { font-size: 24px; font-weight: 650; letter-spacing: -.2px; }
.result .meta, .meta { color: var(--text-dim); font-size: 13px; margin: 0; }

.result.ok { border-left: 3px solid var(--success); padding-left: var(--sp-md); }
.result.bad { border-left: 3px solid var(--danger); padding-left: var(--sp-md); }

.ok { color: var(--success); }
.warn { color: var(--warning); }
.error, .bad { color: var(--danger); }

.log {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  max-height: 240px;
  overflow-y: auto;
}

/* Bulma leaves 2.5rem on the right for a delete button these have not got,
   and 1.5rem under each one. Both outrun `:not(:last-child)` on specificity
   by being nested. */
.log .notification {
  margin-bottom: 0;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.log .meta { font-size: 13px; }

.form-notice {
  margin-bottom: 0;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.45;
}

/* ---------- confirm sheet ---------- */

.sheet-card {
  gap: var(--sp-sm);
  animation: rise .18s ease-out;
}

@keyframes rise {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  margin-top: var(--sp-md);
}

.sheet-actions .button { margin-bottom: 0; }

/* The mobile sheet's cancel is a muted tint, not a red slab — Bulma's soft
   variant keeps the danger hue at full saturation, so it is dialled back. */
.sheet-actions .button.is-danger.is-soft { --bulma-button-s: 30%; }

/* ---------- breakpoints ---------- */

@media (min-width: 620px) {
  :root { --gutter: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-card { animation: none; }
  .sweep { animation: none; top: 50%; }
}
