:root {
  --bg: #f3f6f8;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --line: #e3e8ee;
  --text: #122033;
  --muted: #5b6b7c;
  --accent: #00b7c7;
  --accent-dim: rgba(0, 183, 199, 0.12);
  --navy: #0d2137;
  --in: #22c55e;
  --in-dim: rgba(34, 197, 94, 0.12);
  --out: #ef4444;
  --out-dim: rgba(239, 68, 68, 0.1);
  --danger: #ef4444;
  --touch: 56px;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(13, 33, 55, 0.12);
  --font: "Inter", "Segoe UI", sans-serif;
  --display: "Inter", "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button, input, select, textarea {
  font-family: inherit;
  touch-action: manipulation;
}

[hidden] { display: none !important; }

.idle-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: var(--accent);
  transform-origin: left;
  z-index: 50;
}

.kiosk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--navy);
  color: #fff;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #04262b;
  font-size: 1.2rem;
  font-weight: 800;
}

.brand-kicker {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand h1, .view-intro h2, .pin-identity h2, .allocate-header h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-clock { text-align: right; }
.header-clock time {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
}
.header-clock p { margin: 0; color: #9fb0c3; font-size: 0.85rem; }

.view { padding: 20px 24px 36px; }
.view-intro { max-width: 720px; margin: 0 auto 16px; }
.view-intro p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
}
.view-intro a { color: var(--teal-dark, #0891a3); font-weight: 600; }

.employee-grid {
  display: grid;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
}

.employee-card {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  color: var(--text);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 10px 16px;
  cursor: pointer;
  appearance: none;
  box-shadow: 0 1px 2px rgba(13,33,55,0.04);
}

.employee-card:active { transform: scale(0.99); background: #f0fbfd; }
.employee-card strong { font-size: 1.05rem; font-weight: 650; flex: 1; text-align: left; }
.employee-card .chevron { color: #9aa8b6; font-size: 1.2rem; }

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #04262b;
  font-size: 0.95rem;
}
.avatar.lg { width: 72px; height: 72px; font-size: 1.3rem; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 33, 55, 0.55);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.overlay-full {
  place-items: stretch;
  background: var(--bg);
  padding: 0;
}

.pin-panel, .action-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 20px 20px;
  box-shadow: var(--shadow);
}

.pin-identity, .action-panel { text-align: center; }
.pin-identity p, .action-panel p { color: var(--muted); margin: 6px 0 0; }

.back-btn { display: inline-flex; min-height: 44px; margin-bottom: 8px; }
.text-btn, .btn { border: 0; cursor: pointer; }
.text-btn { background: none; color: var(--muted); font-size: 1rem; font-weight: 600; }

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0 10px;
}
.pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #c5d0da;
}
.pin-dots span.filled {
  background: var(--accent);
  border-color: var(--accent);
}

.error-text { color: var(--danger); min-height: 1.2em; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.keypad button {
  min-height: 68px;
  border-radius: 12px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
}
.keypad button:active { background: #dfe8ee; }
.key-muted { color: var(--muted); }
.key-go { background: var(--accent); color: #04262b; }

.elapsed {
  margin: 20px 0;
  padding: 16px;
  border-radius: 12px;
  background: var(--accent-dim);
}
.elapsed strong {
  display: block;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--navy);
}

.action-buttons { display: grid; gap: 10px; }

.btn {
  min-height: var(--touch);
  border-radius: 12px;
  padding: 0 18px;
  font-size: 1rem;
  font-weight: 750;
}
.btn-in {
  min-height: 84px;
  background: var(--in);
  color: #fff;
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.btn-out {
  min-height: 72px;
  background: var(--out);
  color: #fff;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.allocate-shell {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 100%;
}
.allocate-header .btn-ghost {
  color: #fff;
  border-color: rgba(255,255,255,0.28);
}

.allocate-header, .allocate-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--navy);
  color: #fff;
  border-bottom: 0;
}
.allocate-header h2, .allocate-header .brand-kicker { color: #fff; }
.allocate-footer {
  background: #fff;
  color: var(--text);
  border-top: 1px solid var(--line);
}

.recovery-banner {
  margin: 16px 24px 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
}

.allocate-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  padding: 16px 24px;
  overflow: auto;
}

.task-picker, .selected-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  min-height: 320px;
}

.area-block { border-bottom: 1px solid var(--line); padding: 10px 0 14px; }
.area-block h4 { margin: 0 0 8px; font-size: 0.9rem; }

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  padding: 4px 6px;
  border-radius: 8px;
}
.task-row input { width: 22px; height: 22px; accent-color: var(--accent); }

.selected-card {
  background: var(--bg);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}
.selected-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.hour-stepper { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.hour-stepper button {
  width: var(--touch);
  height: var(--touch);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 1.4rem;
}
.hour-stepper input {
  width: 92px;
  min-height: var(--touch);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.status-select, .notes-input {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

.alloc-helper { font-weight: 700; font-size: 0.98rem; }
.alloc-helper.mismatch { color: var(--danger); }
.alloc-helper.match { color: var(--in); }
.empty-hint { color: var(--muted); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 14px 18px;
  border-radius: 10px;
  z-index: 40;
  font-weight: 600;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .allocate-grid { grid-template-columns: 1fr; }
  .kiosk-header, .view { padding-left: 16px; padding-right: 16px; }
}
