/* =====================================================================
   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;
  /* --tabbar-h is measured at runtime (see app.js) and already includes the
     phone's safe-area inset; +28px keeps the last card clear of the bar. */
  padding: calc(14px + env(safe-area-inset-top)) 14px
           calc(var(--tabbar-h, 120px) + 28px);
}

/* ---------- 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; }
/* Lao reading of the brand, sits just under the logo */
.brand-lao {
  text-align: center; color: var(--accent2);
  font-size: 17px; font-weight: 700; letter-spacing: 1px;
  margin-top: -6px; margin-bottom: 2px;
}
.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; }
.sub-head {
  font-size: 13px; font-weight: 800; color: var(--accent2);
  margin: 14px 0 2px; padding-top: 10px; border-top: 1px solid var(--line);
}
.sub-head:first-of-type { margin-top: 8px; }
.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; }

.seller-bar {
  background: #123f26; color: var(--ok); border: 1px solid var(--ok);
  border-radius: 12px; padding: 9px 12px; font-size: 13px;
  margin-bottom: 12px; text-align: center;
}
.seller-bar.off { background: #3f3512; color: var(--accent2); border-color: var(--accent2); }
.seller-tag { font-size: 11.5px; color: var(--muted); }
.clash-row { background: #3a1616; border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.code-chip {
  background: var(--card2); border: 1px solid var(--accent2); color: var(--accent2);
  border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 800;
  letter-spacing: 1px;
}
/* compact segmented language toggle */
.lang-switch {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px;
}
.lang-btn {
  background: none; border: none; color: var(--muted);
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  line-height: 1; transition: background .15s, color .15s;
}
.lang-btn.on { background: var(--accent); color: #fff; }
.login-wrap .lang-switch { margin: 26px auto 0; display: flex; width: max-content; }
.free-btn { background: #3a2d10; color: var(--accent2); border-color: #6b5516; }
.pkg-btn.on { border-color: var(--accent2); background: #3a2d10; }

.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; }

/* free coins waiting for a colleague's one tap */
.confirm-card { border-color: var(--danger); background: #2a1418; }
.confirm-card .pay-row { margin-top: 6px; }
.confirm-card .pay-row .btn { padding: 10px 8px; font-size: 14px; }

/* ---------- 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; }

/* Mini-K — staff changing a booking's real start / finish time */
.minik-edit {
  margin-top: 10px; padding: 10px 12px;
  background: var(--card2); border: 1px solid var(--accent2);
  border-radius: 12px;
}
.minik-edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.minik-edit .field { margin: 4px 0; }
.minik-quick { display: flex; align-items: center; gap: 6px; margin: 10px 0 4px; }
.minik-quick > span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.minik-quick button {
  flex: 1; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 2px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.minik-quick button:active { border-color: var(--accent2); }

/* silver / gold coin counting — one box per denomination, side by side */
.coin-count { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.coin-count .field { margin: 6px 0; }
.coin-worth {
  float: right; font-size: 12px; font-weight: 700;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 20px; padding: 1px 8px;
}

/* ---------- 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; }

/* ---------- cash & deposits ---------- */
/* ---------- Mini-K queue (built for 14 rooms, 100+ bookings/day) ---------- */
.day-seg, .filter-seg { display: flex; gap: 5px; margin: 6px 0; }
.day-seg button, .filter-seg button {
  flex: 1; background: var(--card2); color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 4px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.day-seg button.on, .filter-seg button.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.room-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.room-chip {
  border-radius: 8px; padding: 5px 1px; text-align: center;
  display: flex; flex-direction: column; line-height: 1.2;
}
.room-chip b { font-size: 14px; }
.room-chip span { font-size: 9.5px; }
.room-chip.free { background: #123f26; color: var(--ok); border: 1px solid #1d6b41; }
.room-chip.busy { background: #3f3512; color: var(--accent2); border: 1px solid #6b5516; }
.room-chip.off  { background: #2a1418; color: var(--danger); border: 1px solid #6b2a2a; opacity: .75; }
.room-editor { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
button.room-chip { cursor: pointer; font: inherit; }

.hour-card { padding: 10px 12px; }
.bk-item { border-bottom: 1px solid var(--line); }
.bk-item:last-child { border-bottom: none; }
.bk-line {
  width: 100%; display: grid; grid-template-columns: 46px 26px 1fr 22px;
  align-items: center; gap: 8px; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 8px 0; cursor: pointer; font-size: 14px;
}
.bk-line.playing { background: rgba(47,213,124,.07); }
.bk-time { font-size: 13px; font-weight: 700; line-height: 1.25; }
.bk-time .muted { font-size: 11px; font-weight: 400; }
.bk-room {
  background: var(--card2); border: 1px solid var(--accent2); color: var(--accent2);
  border-radius: 6px; text-align: center; font-size: 12px; font-weight: 800; padding: 2px 0;
}
.bk-who { min-width: 0; overflow: hidden; }
.bk-who .muted { font-size: 11px; }
.bk-state { text-align: right; font-size: 15px; }
.bk-actions { padding: 2px 0 10px; }

/* weekly report: one block per machine / issue / plan row */
.mach-block {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 10px; margin: 8px 0; background: var(--card2);
}
.mach-name { display: block; margin-bottom: 6px; font-size: 14.5px; }
.mach-block input, .mach-block select, .mach-block textarea {
  width: 100%; box-sizing: border-box; margin-top: 5px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 14px;
}
.rate-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.rate-row label { font-size: 11.5px; color: var(--muted); }
.select.rate { padding: 7px 4px; font-size: 15px; text-align: center; }

/* sales export preview — monospace so columns line up while reading */
.export-pre {
  white-space: pre-wrap; word-break: break-word; margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.55; color: var(--text);
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; max-height: 60vh; overflow: auto;
}

/* weekly roster editor */
.roster-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 6px 0; }
.roster-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.roster-cell input {
  width: 100%; text-align: center; background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 1px; font-size: 11.5px;
}
.roster-grid { grid-template-columns: repeat(4, 1fr); }   /* two rows of days on a phone */
.roster-cell input + input { margin-top: 3px; }

/* overtime approval list in Payroll */
.ot-box {
  border: 1px solid #6b5516; background: #241d0c;
  border-radius: 12px; padding: 10px 12px; margin: 10px 0;
}
.ot-box > b { display: block; margin-bottom: 2px; }
.ot-line { align-items: flex-start; gap: 9px; font-size: 13.5px; padding: 6px 0; }
.ot-line.bad { display: block; padding: 7px 0; }
.ot-box .btn.small { margin-top: 6px; }

.dep-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.dep-row:last-child { border-bottom: none; }

/* compact deposit rows: one line of who/how-many/actions, one line of detail */
.dep-search {
  width: 100%; box-sizing: border-box; margin: 6px 0 4px;
  background: var(--card2); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; font-size: 15px;
}
.dep-search:focus { outline: none; border-color: var(--accent2); }
.dep-row.compact { padding: 7px 0; }
.dep-main { display: flex; align-items: center; gap: 8px; }
.dep-who { flex: 1; min-width: 0; font-size: 15px; line-height: 1.3; }   /* long names wrap; the code chip must stay visible */
.dep-coins { font-size: 15px; white-space: nowrap; }
.dep-acts { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.dep-acts .btn.small { padding: 6px 9px; margin: 0; font-size: 14px; }
.dep-acts .void-btn { padding: 2px 4px; }
.dep-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.slip-img {
  display: block; width: 90px; height: 90px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); margin: 8px 0;
  cursor: pointer;
}
.slip-img.big { width: 100%; height: auto; max-height: 260px; object-fit: contain; }

/* ---------- 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; } }
