/* =====================================================================
   W/R FUN Manager — mobile-first, dark arcade theme
   ===================================================================== */
:root {
  --bg: #0b0d14;
  --card: #151927;
  --card2: #1c2133;
  --line: #262d44;
  --text: #eef1fa;
  --muted: #8b93ad;
  --accent: #ff5c8a;       /* pink neon */
  --accent2: #ffd23f;      /* coin gold */
  --ok: #2fd57c;
  --danger: #ff5c5c;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans Lao", sans-serif;
  font-size: 16px;
  min-height: 100dvh;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(84px + env(safe-area-inset-bottom));
}

/* ---------- splash ---------- */
#splash {
  position: fixed; inset: 0; background: var(--bg); z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.splash-logo { font-size: 64px; }
.splash-logo-img { width: 180px; height: 180px; object-fit: contain; }
.splash-name { font-size: 28px; font-weight: 900; letter-spacing: 2px; color: var(--accent2); }
.splash-sub { color: var(--muted); }

/* ---------- mode banner ---------- */
#mode-banner {
  background: #3a2d10; color: #ffd98a; font-size: 12.5px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px; text-align: center;
  position: sticky; top: 0; z-index: 20;
}

/* ---------- generic ---------- */
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.ok-text { color: var(--ok); }
.danger-text { color: var(--danger); }
h1 { font-size: 22px; margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin: 6px 2px 14px; }
.page-head p { margin: 2px 0 0; font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card > b { display: block; margin-bottom: 8px; }

.row-line {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14.5px;
}
.row-line:last-child { border-bottom: none; }
.row-line.total { font-size: 16px; border-top: 2px solid var(--line); margin-top: 4px; padding-top: 10px; }
.row-line.voided { opacity: 0.45; text-decoration: line-through; }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 16px; font-size: 16px; font-weight: 700;
  cursor: pointer; margin-bottom: 10px;
  transition: transform .05s;
}
.btn:active { transform: scale(0.97); }
.btn.big { padding: 17px; font-size: 18px; }
.btn.small { padding: 8px 12px; font-size: 13.5px; width: auto; display: inline-block; margin: 4px 4px 0 0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.success { background: var(--ok); border-color: var(--ok); color: #04240f; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.link-btn {
  background: none; border: none; color: var(--muted);
  font-size: 14px; padding: 8px; cursor: pointer; display: block;
}
.link-btn.center { margin: 0 auto; }
.void-btn {
  background: none; border: none; color: var(--danger);
  font-size: 15px; cursor: pointer; padding: 2px 6px;
}

/* ---------- login ---------- */
.login-wrap { padding-top: 8vh; }
.login-logo { font-size: 56px; text-align: center; }
.login-logo-img { display: block; width: 170px; height: 170px; object-fit: contain; margin: 0 auto 4px; }
.login-title { text-align: center; font-size: 26px; margin: 6px 0 2px; }
.staff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.staff-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 10px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; color: var(--text);
}
.staff-card:active { border-color: var(--accent); }
.staff-code { font-size: 22px; font-weight: 900; color: var(--accent2); }
.staff-name { font-size: 14.5px; font-weight: 700; text-align: center; }
.staff-role { font-size: 11.5px; color: var(--muted); }

.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 22px; }
.pin-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--muted);
}
.pin-dot.on { background: var(--accent2); border-color: var(--accent2); }
.pinpad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  max-width: 300px; margin: 0 auto;
}
.pinkey {
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 50%;
  aspect-ratio: 1; font-size: 24px; font-weight: 700; cursor: pointer;
}
.pinkey:active { background: var(--card2); border-color: var(--accent); }
.pinkey.ghost { background: transparent; color: var(--muted); }

/* ---------- home ---------- */
.clock-card { text-align: center; }
.clock-card.on-shift { border-color: var(--ok); }
.clock-status { margin-bottom: 12px; font-size: 15px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.dot.live { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--muted); }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.stat { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-val { font-size: 22px; font-weight: 900; color: var(--accent2); }
.stat-val.small { font-size: 17px; }

.warn-card { border-color: #6b5516; background: #241d0c; }
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.quick-links .btn { margin-bottom: 0; padding: 12px 6px; font-size: 14px; }

/* ---------- POS ---------- */
.pkg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pkg-btn {
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 8px; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.pkg-btn:active { border-color: var(--accent2); transform: scale(0.97); }
.pkg-btn.custom { border-style: dashed; }
.pkg-coins { font-size: 22px; font-weight: 900; color: var(--accent2); }
.pkg-price { font-size: 15px; font-weight: 700; }

.pay-sheet { border-color: var(--accent2); }
.pay-title { text-align: center; font-size: 20px; margin-bottom: 4px; }
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.pay-row .btn { margin-bottom: 0; }

/* ---------- forms ---------- */
.field { display: block; font-size: 13.5px; color: var(--muted); margin: 10px 0; }
.field input, .field textarea, .select {
  display: block; width: 100%; margin-top: 5px;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 17px;
}
.field.inline { margin: 6px 0; }
.select { width: auto; padding: 10px 12px; font-size: 15px; }
.filter-row { display: flex; gap: 8px; margin-bottom: 12px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14.5px; margin: 8px 0; }
.check-line input { width: 20px; height: 20px; }

/* ---------- stepper ---------- */
.stepper { display: flex; align-items: center; gap: 10px; }
.step-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line); font-size: 20px; font-weight: 700; cursor: pointer;
}
.step-btn:active { border-color: var(--accent); }
.step-val { min-width: 22px; text-align: center; font-size: 17px; }

/* ---------- prizes ---------- */
.prize-card.low { border-color: #6b3016; }
.prize-head { display: flex; justify-content: space-between; align-items: center; }
.prize-name { font-weight: 800; font-size: 15.5px; }
.prize-stock { font-size: 19px; font-weight: 900; color: var(--accent2); }
.prize-meta { font-size: 12.5px; margin: 3px 0 8px; }
.prize-actions { display: flex; flex-wrap: wrap; }

/* ---------- closing ---------- */
.done-card { text-align: center; }
.done-check { font-size: 44px; }
.report-pre {
  text-align: left; background: var(--card2); border-radius: 10px;
  padding: 12px; font-size: 12.5px; white-space: pre-wrap;
  font-family: inherit; max-height: 300px; overflow-y: auto;
}

/* ---------- payroll ---------- */
.badge { font-size: 11px; font-weight: 900; padding: 4px 8px; border-radius: 20px; }
.badge-ok { background: #123f26; color: var(--ok); }
.badge-warn { background: #3f3512; color: var(--accent2); }
.payslip-card.paid { border-color: var(--ok); }
.pay-controls { margin: 6px 0 10px; }
.pay-cls { margin-bottom: 12px; }
.pay-cls u { color: var(--accent2); text-decoration: none; font-weight: 800; font-size: 13.5px; }

/* ---------- reports ---------- */
.chart-svg { width: 100%; height: auto; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* ---------- more menu ---------- */
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); text-align: left; font-size: 17px; font-weight: 700;
  padding: 17px 16px; cursor: pointer;
}
.menu-item:active { border-color: var(--accent); }
.menu-item.danger { color: var(--danger); }
.version { font-size: 12px; margin-top: 20px; }

/* ---------- tab bar ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(15, 18, 29, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; font-weight: 700; cursor: pointer; padding: 4px 10px;
  border-radius: 10px; flex: 1;
}
.tab-icon { font-size: 21px; }
.tab.active { color: var(--accent2); }

/* ---------- check-in selfie ---------- */
.selfie-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(5, 6, 10, 0.9);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.selfie-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; width: 100%; max-width: 340px; text-align: center;
}
.selfie-box p { margin: 0 0 10px; font-weight: 700; }
.selfie-box video {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 12px; margin-bottom: 12px; background: #000;
  transform: scaleX(-1);            /* mirror like a selfie camera */
}
.shift-photo {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  vertical-align: middle; margin-right: 6px; cursor: pointer;
  border: 2px solid var(--line);
}
.shift-photo.zoomed {
  position: fixed; inset: 0; margin: auto; z-index: 65;
  width: min(80vw, 320px); height: min(80vw, 320px);
  border-radius: 16px; border-color: var(--accent2);
  box-shadow: 0 0 0 100vmax rgba(5, 6, 10, 0.85);
}

/* ---------- toast ---------- */
#toast-wrap { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 60; display: flex; justify-content: center; pointer-events: none; }
.toast {
  background: #123f26; color: var(--ok); border: 1px solid var(--ok);
  padding: 10px 18px; border-radius: 30px; font-size: 14px; font-weight: 700;
  max-width: 90vw; animation: pop .18s ease-out;
}
.toast.err { background: #3f1212; color: var(--danger); border-color: var(--danger); }
@keyframes pop { from { transform: translateY(-16px); opacity: 0; } }
