/* Turn Board — loaded after styles.css (reuses its colors + the picker styles). */
.board-page { --tap: 52px; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.bhead {
  max-width: 640px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.calc-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13px;
  white-space: nowrap;
}
.calc-link small, .mode small { display: inline; }
.lockbtn small { display: block; }
.live { margin-left: auto; font-size: 14px; font-weight: 700; color: #1d7a3a; white-space: nowrap; }
.live.off { color: var(--muted); }
.mode {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border-radius: 999px; font-weight: 800; font-size: 15px;
}
.mode.view { background: #eef0f3; color: #3c4450; }
.mode.edit { background: #e2f4e7; color: #155d2c; }
.mode.edit small { color: #3f7a52; }
.lockbtn {
  margin-left: auto; min-height: 48px; padding: 2px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 15px; line-height: 1.15;
}

.dateline { display: flex; align-items: center; gap: 8px; }
.dbtn {
  width: 52px; height: 48px; flex: none; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); font-size: 28px; font-weight: 800; line-height: 1;
}
.dbtn:disabled { opacity: .35; }
.dlabel { flex: 1; text-align: center; font-weight: 800; font-size: 17px; }
.dlabel small { display: block; }
.dlabel.past { color: #8a4b00; }

.nexts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.nx { border-radius: 14px; padding: 8px 12px; min-width: 0; }
.nx b { display: block; font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx.up { background: var(--accent-soft); color: var(--accent); }
.nx.bon { background: var(--gold-soft); color: #7a5300; }
.msg {
  margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: #fdecec; color: #8b1b1b;
  font-weight: 700; font-size: 15px;
}
.msg.ok { background: #e2f4e7; color: #155d2c; }

/* ---------- main ---------- */
.board-page main.bmain { max-width: 640px; margin: 0 auto; padding: 12px 14px 80px; }
.addtech { display: flex; gap: 10px; margin-bottom: 8px; }
.addtech input { flex: 1; min-width: 0; }
.add small, .ghost small { display: block; color: inherit; opacity: .8; font-size: 11px; }
.sec {
  margin: 18px 4px 8px; font-size: 14px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.sec .cnt { color: var(--ink); }
.empty-note { color: var(--muted); text-align: center; margin: 8px 0; }
.tlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.trow { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.trow.is-next { border-color: var(--accent); }
.trow.out, .trow.not { background: #faf8f5; }
.tmain {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 72px; padding: 8px 12px;
  border: 0; background: transparent; text-align: left;
}
.tpos {
  flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--bg);
  display: grid; place-items: center; font-weight: 800; color: var(--muted);
}
.trow.is-next .tpos { background: var(--accent); color: #fff; }
.tinfo { flex: 1; min-width: 0; }
.tname { font-weight: 800; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmeta { font-size: 14px; color: var(--muted); font-weight: 600; }
.tmeta .badge { color: var(--accent); font-weight: 800; }
.tturns { flex: none; text-align: right; line-height: 1; }
.tturns b { display: block; font-size: 38px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.tturns small { font-size: 12px; }
.tcounts { font-size: 14px; color: var(--ink); font-weight: 700; margin-top: 2px; }

.tact { display: flex; gap: 8px; padding: 0 12px 12px; flex-wrap: wrap; }
.tact button {
  min-height: 48px; min-width: 48px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); font-weight: 700; font-size: 15px; padding: 0 12px;
}
.tact .plus { flex: 1 1 140px; background: var(--accent); border-color: var(--accent); color: #fff; font-size: 18px; font-weight: 800; }
.tact .mv { font-size: 18px; width: 52px; padding: 0; }
.tact .mv:disabled { opacity: .35; }
.tact .cin { flex: 1 1 140px; background: #1d7a3a; border-color: #1d7a3a; color: #fff; font-weight: 800; }
.tact .warn { color: #8b1b1b; }

.tickets { list-style: none; margin: 0; border-top: 1px solid var(--line); padding: 8px 12px 12px; display: grid; gap: 8px; }
.tk { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--bg); }
.tk-top { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--muted); }
.tk-top .res { margin-left: auto; font-size: 20px; font-weight: 800; color: var(--accent); }
.tk-top .res.bonus { color: var(--gold); }
.tk-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 4px; }
.tk-chips span { font-size: 13px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.tk-reason { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.tk-act { display: flex; gap: 8px; margin-top: 8px; }
.tk-act button { flex: 1; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 700; }
.tk-act .warn { color: #8b1b1b; }
.tact button small, .tk-act button small { display: block; color: inherit; opacity: .75; font-size: 11px; }
.tk-act { list-style: none; }
.tk-empty { color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- dialogs ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 30; background: rgba(43, 29, 31, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dialog { width: 100%; max-width: 380px; background: var(--card); border-radius: 20px; padding: 18px; display: grid; gap: 12px; }
.dialog h2 { margin: 0; font-size: 20px; }
.dialog input[type="password"] {
  width: 100%; min-height: 60px; border: 2px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 0 14px; font-size: 28px; letter-spacing: .3em; text-align: center;
}
.drow { display: flex; gap: 10px; }
.drow > * { flex: 1; }
.ghost { min-height: var(--tap); border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 700; }
.err { color: #8b1b1b; font-weight: 700; font-size: 15px; }
.skip-dialog { max-width: 420px; }
.skip-hint { margin: 0; font-size: 15px; font-weight: 650; color: var(--text); line-height: 1.35; }
.skip-hint small { display: block; margin-top: 6px; color: var(--muted); font-weight: 600; font-size: 13px; }
.skip-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.skip-n {
  min-height: 64px; border: 2px solid var(--line); border-radius: 14px; background: #fff;
  font-weight: 900; font-size: 28px; line-height: 1;
}
.skip-n small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.skip-n:active { transform: scale(.97); background: #fde8ef; border-color: #c42d62; }
.skip-custom-lbl { font-weight: 700; font-size: 14px; }
.dialog input[type="number"] {
  width: 100%; min-height: 56px; border: 2px solid var(--line); border-radius: 14px; background: #fff;
  padding: 0 14px; font-size: 22px; font-weight: 800; text-align: center;
}
.skip-left, .emp-skip {
  font-weight: 800; color: #241500; background: #ffc93c;
  border-radius: 999px; padding: 2px 8px; line-height: 1.2;
}
.skip-left { margin-left: 6px; font-size: 13px; display: inline-block; }
.skip-left small { display: inline; margin-left: 4px; font-size: 11px; color: inherit; opacity: .9; }
.emp-skip {
  display: inline-block; font-size: 13px; margin-top: 3px; white-space: normal;
}
.emp-skip small { display: inline; margin-left: 4px; font-size: 11px; font-weight: 700; }



/* full-screen ticket sheet: see "ticket sheet (#sheet)" at the end of this file */
body.locked { overflow: hidden; }
.tinfo > span { display: block; }

/* ---------- sticky Next up / Next bonus ---------- */
.stick {
  position: sticky; top: 0; z-index: 15; max-width: 640px; margin: 0 auto;
  padding: 8px 14px; background: var(--bg); border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 10px rgba(251, 247, 240, .9);
}
.stick .nexts { margin-top: 0; }
/* styles.css sets overflow-x:hidden on html+body, which turns body into a scroll box and breaks
   position:sticky. clip hides overflow without that side effect (older Safari: visible). */
html.board, html.board body { overflow-x: visible; overflow-x: clip; }
.hint-note { color: var(--muted); font-size: 14px; margin: -4px 4px 8px; }

/* ---------- Not-in name grid ---------- */
.ngrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.nbtn {
  min-height: 64px; min-width: 0; padding: 8px 10px; border-radius: 14px;
  border: 2px solid #1d7a3a; background: #effaf2; color: #155d2c;
  font-weight: 800; font-size: 19px; line-height: 1.15; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.nbtn .nn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nbtn small { font-size: 12px; color: inherit; opacity: .8; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nbtn.out { border-style: dashed; }
.nbtn:active:not(:disabled) { transform: scale(.97); }
.nbtn:disabled, .nbtn.busy { opacity: 1; border-color: var(--line); background: #f3f0eb; color: #6f6560; cursor: default; }
.nbtn.busy { opacity: .6; }
body:not(.editing) #notHint { display: none; }

/* ---------- staff list (roster) ---------- */
.roster-toggle {
  width: 100%; min-height: 52px; margin-top: 18px; border: 1px dashed var(--muted); border-radius: 14px;
  background: transparent; font-weight: 700; font-size: 16px;
}
.roster-panel { margin-top: 10px; }
.rlist { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.rlist li {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px 4px 4px 12px; min-width: 0;
}
.rlist .rn { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rlist .rs { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.rlist button {
  flex: none; min-height: 48px; min-width: 48px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); font-weight: 700; font-size: 14px; padding: 0 10px;
}
.rlist button small { display: block; font-size: 11px; color: inherit; opacity: .75; }
.rlist .warn { color: #8b1b1b; }
.rlist button:disabled { opacity: .35; }

/* ---------- Bonus line (both layouts) ---------- */
.bl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bl-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 14px; background: var(--card); border: 2px solid var(--line);
}
.bl-pos { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: center; }
.bl-nm {
  min-width: 0;
  font-weight: 800;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.15;
}
.bl-ct { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bl-row.first { background: var(--gold-soft); border-color: var(--gold); color: #5c3d00; }
.bl-row.first .bl-pos { color: #5c3d00; }
/* edit layout: compact numbered chips, still always visible */
.bl-list.compact { display: flex; flex-wrap: wrap; gap: 6px; }
.bl-list.compact .bl-row { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 6px; padding: 6px 10px; border-width: 1px; font-size: 15px; max-width: 100%; min-width: 0; }
.bl-list.compact .bl-nm { flex: 1 1 auto; min-width: 0; }
.bl-list.compact .bl-row.first { border-width: 2px; font-size: 17px; }

/* ---------- Turn line · Hàng lượt and Bonus line: two equal columns, same size, tops aligned. ---------- */
.pair-lines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
/* One visible child (the other [hidden]) → no empty column */
.pair-lines:not(:has(> :not([hidden]) + :not([hidden]))) {
  grid-template-columns: 1fr;
}
.pair-lines > * {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: var(--card, #fff);
  border: 2px solid var(--line, #e4d8ce);
  border-radius: 16px;
  padding: 10px 12px 8px;
  overflow: hidden;
}
.emp .pair-lines > * {
  background: var(--emp-card, #fff);
  border-color: var(--emp-line, #e4d8ce);
}
.pair-lines .tl-list,
.pair-lines .bl-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
/* Headings inside the two cards match, so chrome + typography stay even. */
.pair-lines .tl-h,
.pair-lines .emp-h,
.pair-lines h2.sec {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #1a1412;
}
.pair-lines .tl-h small,
.pair-lines .emp-h small,
.pair-lines h2.sec small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
}
.pair-lines .tl-hint,
.pair-lines .bl-hint,
.pair-lines p.bl-hint {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  max-width: none;
}
.tl-sec { margin: 0; }
.tl-h { margin: 0 0 6px; font-size: 15px; font-weight: 900; letter-spacing: .02em; color: var(--ink, #1a1412); }
.tl-h small { display: inline; font-size: inherit; font-weight: 700; color: var(--muted, #5c524c); }
.tl-hint { margin: 0 0 6px; font-size: 12px; font-weight: 700; line-height: 1.3; color: var(--muted, #5c524c); }
.tl-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 6px;
  min-height: 44px;
}
.tl-chip {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px;
  min-height: 40px; max-width: 100%; box-sizing: border-box;
  padding: 5px 10px; border-radius: 14px; background: var(--card, #fff); border: 2px solid var(--line, #e4d8ce);
  font-weight: 800; font-size: 15px; color: var(--ink, #1a1412);
}
.tl-pos {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: #efe7e0; color: #1a1412; font-size: 12px; font-weight: 900; font-variant-numeric: tabular-nums;
}
.tl-nm {
  min-width: 0;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.15;
}
.tl-ct { font-variant-numeric: tabular-nums; color: var(--muted, #5c524c); white-space: nowrap; }
.tl-ct small { display: inline; font-size: .75em; font-weight: 700; color: inherit; }
.tl-chip.first { background: #fde8ef; border-color: #c42d62; color: #5a0f2a; }
.tl-chip.first .tl-pos { background: #c42d62; color: #fff; }
.tl-chip.first .tl-ct { color: #8b1b3d; }
.emp .tl-sec { margin: 0; }
.emp .tl-h { color: #1a1412; font-size: 16px; text-transform: uppercase; letter-spacing: .06em; }
.emp .tl-h small { text-transform: none; letter-spacing: 0; color: var(--emp-muted, #5c524c); }
.emp .tl-hint { color: #4a433e; }
.emp .tl-chip { background: var(--emp-card, #fff); border-color: var(--emp-line, #e4d8ce); color: #1a1412; font-size: 16px; }
.emp .tl-chip .tl-ct { color: #5c524c; }
.emp .tl-chip.first { background: #fde8ef; border-color: #c42d62; color: #5a0f2a; }
.emp .tl-chip.first .tl-ct { color: #8b1b3d; }
@media (min-width: 900px) and (orientation: landscape) {
  .emp .tl-chip { font-size: clamp(16px, 1.3vw, 26px); min-height: clamp(40px, 3.6vh, 56px); }
  .emp .tl-pos { width: clamp(22px, 1.8vw, 36px); height: clamp(22px, 1.8vw, 36px); font-size: clamp(12px, .9vw, 18px); }
  .emp .tl-h { font-size: clamp(15px, 1.1vw, 24px); }
}
@media (min-width: 1200px) {
  body.board-page:not(.view-mode) .tl-chip { font-size: 16px; }
  body.board-page:not(.view-mode) .tl-chip.first { font-size: 18px; }
  body.board-page:not(.view-mode) .tl-h { font-size: 16px; }
}
@media (max-width: 599px) {
  /* Phone tech view: two equal line columns fill the space under the banners. */
  body.view-mode .pair-lines { flex: 1 1 auto; width: 100%; gap: 8px; min-height: 0; overflow: hidden; }
  body.view-mode .pair-lines .tl-h,
  body.view-mode .pair-lines .emp-h,
  body.view-mode .pair-lines h2.sec,
  body.view-mode .emp .tl-h { font-size: 11px; margin: 0 0 2px; }
  body.view-mode .pair-lines .tl-hint,
  body.view-mode .pair-lines .bl-hint,
  body.view-mode .emp .tl-hint { font-size: 10px; margin: 0 0 4px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  body.view-mode .emp .tl-list { gap: 4px; }
  body.view-mode .emp .tl-chip { font-size: 14px; min-height: 40px; padding: 4px 8px; gap: 4px; }
  body.view-mode .emp .tl-pos { width: 20px; height: 20px; font-size: 11px; }
}
/* ---------- Reset today / Undo ---------- */
.reset-sec { margin-top: 32px; padding-top: 16px; border-top: 1px dashed var(--line); }
.reset-btn {
  width: 100%; min-height: 52px; border: 2px solid #b3261e; border-radius: 14px; background: #fff;
  color: #8b1b1b; font-weight: 800; font-size: 16px;
}
.reset-btn:disabled { opacity: .5; }
.reset-sec .hint-note { margin-top: 8px; }
.reset-txt { margin: 0; font-size: 15px; line-height: 1.4; }
.reset-txt small { display: block; color: var(--muted); margin-top: 4px; }
.danger {
  min-height: var(--tap); border: 0; border-radius: 14px; background: #b3261e; color: #fff; font-weight: 800;
}
.danger small { display: block; font-size: 11px; opacity: .85; }
.confirm-dialog { max-width: 400px; gap: 14px; }
.confirm-dialog h2 { font-size: 22px; line-height: 1.3; }
.confirm-dialog .reset-txt { font-size: 16px; }
.confirm-dialog .drow { gap: 12px; margin-top: 4px; }
.confirm-dialog .drow button { min-height: 56px; font-size: 17px; }
.confirm-dialog #confirmOk.add { background: var(--accent, #c42d62); color: #fff; }

.undo-btn {
  display: block; width: 100%; min-height: 48px; margin-top: 8px; border: 2px solid #1d7a3a; border-radius: 14px;
  background: #e2f4e7; color: #155d2c; font-weight: 800; font-size: 16px;
}
.undo-btn small { font-weight: 700; }

/* =====================================================================
   EMPLOYEE VIEW (body.view-mode): big, high contrast, readable across the room.
   Phone: one column. Landscape tablet / TV: banners side by side, order | bonus line.
   ===================================================================== */
body.view-mode { background: #faf6f0; color: #1a1412; --emp-card: #ffffff; --emp-line: #e4d8ce; --emp-muted: #5c524c; }
html.board:has(body.view-mode) { background: #faf6f0; }
body.view-mode .bhead {
  max-width: none; background: transparent; border-bottom: 1px solid var(--emp-line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 8px;
}
body.view-mode .brow { display: contents; }
body.view-mode .calc-link {
  order: 1; min-height: 44px; padding: 0 12px; background: var(--emp-card); border-color: var(--emp-line); color: #1a1412; font-size: 14px;
}
body.view-mode .calc-link small { display: none; }
body.view-mode .dateline { order: 2; flex: 1 1 200px; min-width: 0; }
body.view-mode .dbtn { width: 44px; height: 44px; font-size: 22px; background: var(--emp-card); border-color: var(--emp-line); color: #1a1412; }
body.view-mode .dlabel { font-size: 15px; color: #1a1412; }
body.view-mode .dlabel small { color: var(--emp-muted); font-size: 12px; }
body.view-mode .dlabel.past { color: #8a4b00; }
body.view-mode .live { order: 3; margin-left: 0; color: #1d7a3a; }
body.view-mode .live.off { color: var(--emp-muted); }
body.view-mode .mode { order: 4; min-height: 32px; font-size: 13px; background: #eef0f3; color: #3c4450; }
body.view-mode .lockbtn {
  order: 5; margin-left: auto; min-height: 44px; min-width: 44px; padding: 0 10px; font-size: 14px;
  background: transparent; border-color: var(--emp-line); color: var(--emp-muted);
}
body.view-mode .lockbtn small, body.view-mode .lockbtn .ul-txt { display: none; }
body.view-mode .stick { background: #faf6f0; border-bottom: 0; box-shadow: none; max-width: none; }

.emp { padding: 12px 14px 40px; max-width: 760px; margin: 0 auto; }
.emp-top { display: grid; gap: 10px; }
.emp-up, .emp-bon { border-radius: 20px; padding: 12px 16px 14px; min-width: 0; }
.emp-up { background: #8b1b3d; color: #fff; box-shadow: inset 0 0 0 3px #d14a74; }
.emp-bon { background: #ffc93c; color: #241500; box-shadow: inset 0 0 0 3px #e0a00a; }
.emp-lbl { font-weight: 900; letter-spacing: .08em; font-size: 16px; }
.emp-lbl small { display: inline; color: inherit; font-weight: 700; letter-spacing: 0; opacity: .9; font-size: 14px; margin-left: 6px; }
.emp-name {
  font-weight: 900; line-height: 1.05; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: clamp(48px, 15vw, 76px);
}
.emp-up .emp-name::before { content: '▶ '; font-size: .6em; vertical-align: .15em; }
.emp-bon .emp-name { font-size: clamp(36px, 11vw, 56px); }
.emp-none {
  display: grid; gap: 6px; text-align: center; padding: 28px 16px; border-radius: 20px;
  background: var(--emp-card); border: 2px dashed var(--emp-line);
}
.emp-none b { font-size: clamp(28px, 8vw, 44px); font-weight: 900; }
.emp-none small { font-size: 16px; color: var(--emp-muted); }
.emp-past { text-align: center; color: #8a4b00; font-weight: 800; margin: 4px 0 0; }
.emp-cols { display: grid; gap: 4px; }
.emp-h { margin: 18px 4px 8px; font-size: 18px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: #1a1412; }
.emp-h small { display: inline; text-transform: none; letter-spacing: 0; color: var(--emp-muted); font-weight: 700; margin-left: 4px; }
.emp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.emp-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 16px; background: var(--emp-card); border: 2px solid var(--emp-line);
}
.emp-pos {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: #efe7e0; font-weight: 900; font-size: 20px; color: #1a1412;
}
.emp-who { min-width: 0; }
.emp-nm { display: block; font-weight: 900; font-size: clamp(26px, 8vw, 36px); line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-meta { display: block; font-size: 17px; font-weight: 800; color: var(--emp-muted); margin-top: 2px; }
.emp-bn { color: #8a4b00; }
.emp-tk { font-size: 14px; font-weight: 700; margin-left: 6px; }
.emp-turns { text-align: right; line-height: 1; }
.emp-turns b { display: block; font-size: clamp(40px, 13vw, 60px); font-weight: 900; font-variant-numeric: tabular-nums; color: #1a1412; }
.emp-turns small { font-size: 13px; color: var(--emp-muted); font-weight: 700; }
.emp-row.is-next { background: #fde8ef; border-color: #c42d62; }
.emp-row.is-next .emp-pos { background: #c42d62; color: #fff; }
.emp-row.out { opacity: .5; border-style: dashed; }
.emp-row.out .emp-pos { font-size: 13px; background: transparent; border: 1px solid var(--emp-line); }

/* bonus war: big on the employee view */
.emp .bl-list { gap: 8px; }
.emp .bl-row { background: var(--emp-card); border-color: var(--emp-line); color: #1a1412; padding: 10px 14px; }
.emp .bl-pos { color: var(--emp-muted); font-size: 22px; }
.emp .bl-nm { font-size: clamp(24px, 7vw, 32px); }
.emp .bl-ct { font-size: clamp(22px, 6vw, 28px); color: #8a4b00; }
.emp .bl-row.first { background: #ffc93c; border-color: #ffe39a; color: #241500; box-shadow: 0 0 0 3px rgba(255, 201, 60, .35); }
.emp .bl-row.first .bl-pos, .emp .bl-row.first .bl-ct { color: #241500; }
.emp .bl-row.first .bl-nm { font-size: clamp(30px, 9vw, 42px); }
.emp .bl-row.first .bl-nm::after { content: ' 🎁'; }

/* Landscape tablet / TV (1280×720, 1920×1080 …) */
@media (min-width: 900px) and (orientation: landscape) {
  body.view-mode .bhead { padding: 10px 2.5vw; }
  body.view-mode .dateline { flex: 0 1 360px; margin: 0 auto; }
  .emp { max-width: none; padding: 1.6vh 2.5vw 3vh; }
  .emp-top { grid-template-columns: 3fr 2fr; gap: 1.6vw; }
  .emp-up, .emp-bon { padding: 1.4vh 1.6vw 1.8vh; border-radius: 24px; }
  .emp-lbl { font-size: clamp(16px, 1.6vw, 34px); }
  .emp-lbl small { font-size: .8em; }
  .emp-name { font-size: clamp(64px, 8.5vw, 190px); }
  .emp-bon .emp-name { font-size: clamp(48px, 6vw, 130px); }
  .emp-cols { grid-template-columns: 1fr; gap: 1.6vw; }
  .pair-lines { margin-bottom: 1.2vh; }

  .emp-cols .emp-h,
  .emp-order .emp-h { font-size: clamp(18px, 1.5vw, 32px); margin: 1.8vh 4px 1vh; }
  .pair-lines .tl-h,
  .pair-lines .emp-h,
  .pair-lines h2.sec { font-size: clamp(15px, 1.1vw, 24px); margin: 0 0 6px; }
  .emp-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1vh 1vw; }
  .emp-row { padding: .9vh 1vw; }
  .emp-pos { width: clamp(36px, 2.8vw, 60px); height: clamp(36px, 2.8vw, 60px); font-size: clamp(18px, 1.5vw, 32px); }
  .emp-nm { font-size: clamp(26px, 2.6vw, 56px); }
  .emp-meta { font-size: clamp(15px, 1.3vw, 28px); }
  .emp-tk { font-size: .8em; }
  .emp-turns b { font-size: clamp(36px, 3.6vw, 80px); }
  .emp .bl-row { padding: .9vh 1vw; }
  .emp .bl-nm { font-size: clamp(24px, 2.3vw, 50px); }
  .emp .bl-ct, .emp .bl-pos { font-size: clamp(20px, 2vw, 44px); }
  .emp .bl-row.first .bl-nm { font-size: clamp(30px, 3vw, 64px); }
}

/* ---------- manual adjust (±0.25) + skip + activity (edit only) ---------- */
.skip-next {
  display: block; width: 100%; min-height: 48px; margin-top: 6px; border: 2px solid var(--accent); border-radius: 12px;
  background: #fff; color: var(--accent); font-weight: 800; font-size: 15px;
}
.skip-next:disabled { opacity: .45; }
.tact.tadj { padding-top: 6px; gap: 8px; }
.tact .adj { flex: 1 1 72px; min-height: 48px; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; background: #fff7e8; border: 2px solid #8a4b00; color: #8a4b00; }
.tact .adj:not(:disabled):active, .tact .adj:not(:disabled):hover { background: #ffe3a3; }
.tact .adj:disabled, .tact .skip:disabled { opacity: .4; }
.tact .skip { flex: 1 1 96px; font-weight: 800; color: var(--accent); border-color: var(--accent); }
.tact .unskip { flex: 1 1 96px; font-weight: 700; border-style: dashed; }
.tturns .adjl { display: block; font-size: 11px; font-weight: 800; color: #8a4b00; white-space: nowrap; }
.skipped {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; font-size: 11px; font-weight: 700;
  line-height: 17px; background: #eee6dc; color: var(--muted); letter-spacing: .02em; vertical-align: 1px;
}
body.view-mode .skipped { background: transparent; border: 1px solid var(--emp-line); color: var(--emp-muted); }
.log-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.log-list .ev { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 15px; }
.log-list .ev:first-child { border-top: 0; }
.ev-t { flex: none; width: 72px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.ev-n { flex: none; font-weight: 800; }
.ev-w { color: var(--ink); }
.ev-w small { color: var(--muted); }
.ev.skip .ev-w, .ev.undoSkip .ev-w { color: var(--accent); }

/* ---------- manager Bonus view (edit only) ---------- */
.bonus-tab { margin-left: auto; }
.bonus-view { max-width: 640px; margin: 0 auto; padding: 8px 14px 28px; }
.bv-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.bv-back { min-height: 48px; min-width: 48px; padding: 8px 14px; }
.bv-h { flex: 1 1 auto; margin: 0; font-size: 22px; }
.bv-h small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.bv-counts { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bv-counts li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.bv-counts .bv-nm { font-weight: 800; font-size: 18px; }
.bv-counts .bv-n { font-weight: 800; font-size: 28px; font-variant-numeric: tabular-nums; color: var(--accent); }
.bv-tix { list-style: none; margin: 0; padding: 0; }
.bv-tix .bv-tk { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.bv-tix .bv-meta { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.bv-tix .bv-who { font-weight: 800; font-size: 18px; color: var(--text); }
.bv-tix .bv-svcs { margin: 6px 0; font-size: 15px; }
.bv-tix .bv-svcs b { font-variant-numeric: tabular-nums; }
.bv-tix .bv-reason { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.bv-tix .bv-act { display: flex; gap: 8px; }
.bv-tix .bv-act button { flex: 1; min-height: 48px; font-weight: 800; }
#reassignTo { width: 100%; min-height: 48px; font-size: 16px; margin: 8px 0 12px; border-radius: 10px; border: 1px solid var(--line); padding: 8px; background: #fff; }
body.view-mode #bonusViewBtn, body.view-mode #bonusView { display: none !important; }

/* Force a bright cream theme in every board mode, at every width.
   Windows / Edge / Chrome dark mode must not invert this page. */
html.board, html.board body, body.board-page,
body.view-mode, body.editing, html.board:has(body.view-mode), html.board:has(body.editing) {
  color-scheme: light only;
  supported-color-schemes: light;
  background: #fbf7f0;
  color: #1a1412;
}
@media (prefers-color-scheme: dark) {
  html.board, html.board body, body.board-page,
  body.view-mode, body.editing,
  html.board:has(body.view-mode), html.board:has(body.editing),
  body.view-mode .stick, body.view-mode .bhead {
    color-scheme: light only;
    background: #fbf7f0 !important;
    color: #1a1412;
  }
}

/* Table columns are phone-hidden; desktop (1280–1920) shows them. */
.emp-thead, .emp-bn-col, .emp-st { display: none; }
.emp-st small { display: block; font-size: .7em; }

/* ---------- Desktop / Windows board (1280–1920, also 1366×768) ----------
   Use the width: big banners on top, turn list as a table, bonus line beside it. */
@media (min-width: 1200px) {
  html.board, html.board body { background: #fbf7f0; color-scheme: light only; }

  /* Employee / TV / view-only */
  body.view-mode .bhead,
  body.view-mode .stick,
  body.view-mode .emp { max-width: 1760px; margin-left: auto; margin-right: auto; }
  body.view-mode .emp { padding: 1.2vh 2.2vw 3vh; }
  body.view-mode .emp-top { grid-template-columns: 3fr 2fr; gap: 1.4vw; margin-bottom: 1.4vh; }
  body.view-mode .emp-up, body.view-mode .emp-bon { padding: 1.2vh 1.5vw 1.5vh; border-radius: 24px; }
  body.view-mode .emp-lbl { font-size: clamp(18px, 1.5vw, 32px); }
  body.view-mode .emp-name { font-size: clamp(72px, 8.5vw, 160px); }
  body.view-mode .emp-bon .emp-name { font-size: clamp(56px, 6vw, 130px); }
  body.view-mode .emp-cols { grid-template-columns: 1fr; gap: 2vw; }
  body.view-mode .pair-lines { margin-bottom: 1.4vh; }

  body.view-mode .emp-cols .emp-h,
  body.view-mode .emp-order .emp-h { font-size: clamp(20px, 1.4vw, 32px); color: #1a1412; margin: 0 0 1vh; }
  body.view-mode .pair-lines .tl-h,
  body.view-mode .pair-lines .emp-h,
  body.view-mode .pair-lines h2.sec { font-size: clamp(15px, 1.1vw, 24px); margin: 0 0 6px; }
  body.view-mode .emp-list { grid-template-columns: 1fr; gap: 8px; }
  body.view-mode .emp-thead {
    display: grid;
    grid-template-columns: 4.2rem minmax(0, 1fr) 8.5rem 7.5rem 8.5rem;
    gap: 12px; align-items: end;
    padding: 0 14px 8px; font-size: clamp(13px, 1vw, 18px); font-weight: 800;
    letter-spacing: .06em; text-transform: uppercase; color: #5c524c;
  }
  body.view-mode .emp-row {
    grid-template-columns: 4.2rem minmax(0, 1fr) 8.5rem 7.5rem 8.5rem;
    gap: 12px; padding: 1vh 14px; min-height: 72px;
  }
  body.view-mode .emp-meta { display: none; }
  body.view-mode .emp-bn-col, body.view-mode .emp-st { display: block; }
  body.view-mode .emp-bn-col {
    font-size: clamp(22px, 1.8vw, 36px); font-weight: 800; color: #8a4b00; text-align: center;
  }
  body.view-mode .emp-st {
    font-size: clamp(16px, 1.2vw, 24px); font-weight: 800; color: #1d7a3a; text-align: right;
  }
  body.view-mode .emp-row.out .emp-st, body.view-mode .emp-row.is-skipped .emp-st { color: #8a4b00; }
  body.view-mode .emp-nm { font-size: clamp(28px, 2.4vw, 48px); }
  body.view-mode .emp-turns { text-align: center; }
  body.view-mode .emp-turns b { font-size: clamp(36px, 3vw, 64px); color: #1a1412; }
  body.view-mode .emp-pos { width: clamp(40px, 3vw, 56px); height: clamp(40px, 3vw, 56px); font-size: clamp(18px, 1.4vw, 28px); }
  body.view-mode .emp .bl-row { padding: 1vh 1vw; }
  body.view-mode .emp .bl-nm { font-size: clamp(18px, 1.5vw, 28px); color: #1a1412; }
  body.view-mode .emp .bl-ct, body.view-mode .emp .bl-pos { font-size: clamp(16px, 1.3vw, 26px); }
  body.view-mode .emp .bl-row.first .bl-nm { font-size: clamp(20px, 1.7vw, 32px); }

  /* Edit / PIN-unlocked: same cream, use the width */
  body.board-page:not(.view-mode) .bhead,
  body.board-page:not(.view-mode) .stick,
  body.board-page:not(.view-mode) .bmain,
  body.board-page:not(.view-mode) .bonus-view {
    max-width: 1760px; margin-left: auto; margin-right: auto;
  }
  body.board-page:not(.view-mode) .bhead,
  body.board-page:not(.view-mode) .stick,
  body.board-page:not(.view-mode) .bmain { padding-left: 2.2vw; padding-right: 2.2vw; }
  body.board-page:not(.view-mode) .nexts { gap: 16px; }
  body.board-page:not(.view-mode) .nx { padding: 14px 20px; border-radius: 18px; }
  body.board-page:not(.view-mode) .nx b { font-size: clamp(28px, 2.4vw, 48px); }
  body.board-page:not(.view-mode) .nx small { font-size: 15px; }
  body.board-page:not(.view-mode) .bmain {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.15fr);
    column-gap: 2vw; row-gap: 8px; align-items: stretch;
    padding-bottom: 8px;
  }
  body.board-page:not(.view-mode) #ordSec { grid-column: 1; grid-row: 1; }
  body.board-page:not(.view-mode) #editPair { grid-column: 2; grid-row: 1; }
  body.board-page:not(.view-mode) #noBoard { grid-column: 1 / -1; }
  body.board-page:not(.view-mode) .tname { font-size: 22px; }
  body.board-page:not(.view-mode) .trow .turns { font-size: 28px; }
  body.board-page:not(.view-mode) .bl-list.compact {
    display: grid; gap: 8px; flex-wrap: unset;
  }
  body.board-page:not(.view-mode) .bl-list.compact .bl-row {
    display: grid; grid-template-columns: 2.2rem 1fr auto; width: 100%;
    padding: 10px 14px; font-size: 18px; max-width: none;
  }
  body.board-page:not(.view-mode) .bl-list.compact .bl-row.first { font-size: 22px; }
  body.board-page:not(.view-mode) .bl-nm { font-size: 22px; }
  body.board-page:not(.view-mode) .bl-ct { font-size: 20px; }

  /* Manager Bonus tab */
  body.board-page:not(.view-mode) .bonus-view {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 2vw; padding: 12px 2.2vw 40px;
    background: #fbf7f0; color: #1a1412;
  }
  body.board-page:not(.view-mode) .bonus-view .bv-top { grid-column: 1 / -1; }
  body.board-page:not(.view-mode) .bonus-view > section:nth-of-type(3) { grid-column: 1 / -1; }
  body.board-page:not(.view-mode) .bv-counts { grid-template-columns: 1fr 1fr 1fr; }
  body.board-page:not(.view-mode) .dialog { max-width: 460px; background: #fff; color: #1a1412; }
}

/* Calculator stays cream on a wide desktop too */
@media (min-width: 1200px) {
  body:not(.board-page) .top,
  body:not(.board-page) main { max-width: 720px; }
}


/* Phone view-only (≤599px): turn list | Bonus line, banners on top, cream theme.
   Unlock / edit stay available. Desktop 900px+ / 1200px+ layouts are unchanged. */
@media (max-width: 599px) {
  body.view-mode {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    height: 100dvh;
  }
  body.view-mode .bhead {
    flex: none;
    max-width: none;
    padding: 6px 10px 8px;
    background: #fbf7f0;
  }
  body.view-mode .emp {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 6px 8px 10px;
    background: #fbf7f0;
  }
  /* Keep room for the NEXT UP | NEXT BONUS banners so .emp-cols does not jump
     when #empTop is un-hidden after the first snapshot (live 390 CLS). */
  body.view-mode .emp-top-slot {
    flex: none;
    min-height: 84px;
    margin-bottom: 8px;
  }
  body.view-mode .emp-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    flex: none;
    margin-bottom: 0;
  }
  body.view-mode .emp-up,
  body.view-mode .emp-bon {
    padding: 8px 10px 10px;
    border-radius: 14px;
  }
  body.view-mode .emp-lbl {
    font-size: 10px;
    letter-spacing: .06em;
    line-height: 1.15;
  }
  body.view-mode .emp-lbl small {
    display: block;
    margin-left: 0;
    font-size: 10px;
  }
  body.view-mode .emp-name {
    font-size: clamp(28px, 8.4vw, 40px);
  }
  body.view-mode .emp-bon .emp-name {
    font-size: clamp(24px, 7.4vw, 36px);
  }
  body.view-mode .emp-cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    flex: 1 1 40%;
    min-height: 160px;
    align-items: stretch;
  }

  body.view-mode .emp-order {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.view-mode .pair-lines {
    overflow: visible;
  }
  body.view-mode .emp-bl,
  body.view-mode .emp-tl,
  body.view-mode .pair-lines > * {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }
  body.view-mode .emp-h {
    font-size: 11px;
    margin: 0 0 6px;
    color: #1a1412;
  }
  body.view-mode .emp-thead,
  body.view-mode .emp-bn-col,
  body.view-mode .emp-st,
  body.view-mode .emp-meta { display: none !important; }
  body.view-mode .emp-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }
  body.view-mode .emp-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    padding: 6px 7px;
    min-height: 48px;
    border-radius: 12px;
    background: #fff;
    border: 1.5px solid #e4d8ce;
  }
  body.view-mode .emp-pos {
    width: 22px; height: 22px; font-size: 11px;
    background: #efe7e0; color: #1a1412;
  }
  body.view-mode .emp-row.is-next .emp-pos { background: #c42d62; color: #fff; }
  body.view-mode .emp-nm {
    font-size: clamp(16px, 4.8vw, 22px);
    font-weight: 900;
    color: #1a1412;
  }
  body.view-mode .emp-turns { text-align: right; line-height: 1; }
  body.view-mode .emp-turns b {
    font-size: clamp(22px, 6.4vw, 30px);
    color: #1a1412;
  }
  body.view-mode .emp-turns small { font-size: 9px; color: #5c524c; }
  body.view-mode .emp-skip {
    font-size: 10px;
    margin-top: 2px;
    padding: 2px 6px;
    color: #241500;
    background: #ffc93c;
  }
  body.view-mode .emp-skip small { display: block; margin-left: 0; font-size: 10px; }
  body.view-mode .emp .bl-row {
    display: grid;
    grid-template-columns: 1.3rem minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 6px;
    row-gap: 0;
    align-items: center;
    padding: 6px 7px;
    min-height: 48px;
    border-radius: 12px;
    background: #fff;
    border: 1.5px solid #e4d8ce;
    color: #1a1412;
  }
  body.view-mode .emp .bl-pos { font-size: 13px; color: #5c524c; grid-row: 1 / span 2; align-self: center; }
  body.view-mode .emp .bl-nm {
    font-size: clamp(15px, 4.4vw, 20px);
    color: #1a1412;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }
  body.view-mode .emp .bl-ct {
    font-size: clamp(13px, 3.6vw, 16px);
    color: #8a4b00;
    white-space: nowrap;
    grid-column: 2;
  }
  body.view-mode .emp .bl-row.first {
    background: #ffc93c;
    border-color: #e0a00a;
    color: #241500;
  }
  body.view-mode .emp .bl-row.first .bl-nm {
    font-size: clamp(16px, 4.8vw, 22px);
    color: #241500;
  }
  body.view-mode .emp .bl-row.first .bl-pos,
  body.view-mode .emp .bl-row.first .bl-ct { color: #241500; }
  body.view-mode .emp .bl-row.first .bl-nm::after { content: none; }
}

/* Bonus-line rule, shown in view and edit */
.bl-hint, p.bl-hint {
  margin: 0 4px 8px; font-size: 13px; font-weight: 700; line-height: 1.35;
  color: #5c524c; max-width: 52rem;
}
body.view-mode .bl-hint { color: #4a433e; font-size: 13px; margin: 0 4px 10px; }
@media (max-width: 599px) {
  body.view-mode .bl-hint { font-size: 12px; margin: 0 2px 8px; }
}

/* =====================================================================
   ticket sheet (#sheet) — "+ Ticket" / "Edit ticket" screen.
   Phone: compact sticky header + result card, sticky categories, sticky Save bar.
   >= 600px: centered column over a dim scrim.  >= 900px: two-pane panel
   (services left, ticket summary + Cancel/Save right).  Everything scoped to #sheet
   so the calculator page (same picker markup) is untouched.
   ===================================================================== */
#sheet {
  --sh-pad: 14px;
  --sh-shadow: 0 1px 2px rgba(43, 29, 31, .06), 0 8px 20px -10px rgba(43, 29, 31, .22);
  --sh-ease: cubic-bezier(.2, .8, .2, 1);
  position: fixed; inset: 0; z-index: 20; display: flex;
  max-width: none; margin: 0; background: var(--bg);
}
#sheet .sheet-panel {
  flex: 1; min-width: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; background: var(--bg);
}

/* ---- header (who + close, Walk-in/Appointment, result card) ---- */
#sheet .sheet-top {
  flex: none; position: relative; z-index: 4;
  padding: max(8px, env(safe-area-inset-top)) max(var(--sh-pad), env(safe-area-inset-right)) 12px max(var(--sh-pad), env(safe-area-inset-left));
  background: var(--bg); border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 16px -14px rgba(43, 29, 31, .5);
  max-height: 56vh; max-height: 56dvh; overflow-y: auto; overflow-x: hidden;
}
#sheet .sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
#sheet .sheet-who { flex: 1; min-width: 0; }
#sheet .sheet-title {
  margin: 0; font-weight: 800; font-size: 19px; letter-spacing: -.01em; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#sheet .sheet-sub {
  min-height: 16px; font-size: 13px; font-weight: 600; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#sheet .sheet-x {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-size: 19px; font-weight: 700; line-height: 1;
  transition: background .15s, color .15s, transform .12s;
}
#sheet .sheet-x:active { transform: scale(.94); }

#sheet .bar { gap: 8px; }
#sheet .seg { padding: 4px; gap: 4px; border-radius: 16px; box-shadow: inset 0 1px 3px rgba(43, 29, 31, .06); }
#sheet .seg-btn {
  min-height: 52px; border-radius: 12px; font-size: 16px;
  transition: background .2s var(--sh-ease), color .2s, box-shadow .2s;
}
#sheet .seg-btn.on { box-shadow: 0 4px 10px -4px rgba(122, 31, 61, .7); }
#sheet .clear {
  min-width: 70px; min-height: 60px; padding: 0 10px; border-radius: 16px; color: var(--accent);
  transition: background .15s;
}
#sheet .clear small { color: var(--muted); }

#sheet .result-card {
  margin-top: 10px; padding: 10px 12px 12px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--sh-shadow);
  transition: background .3s, border-color .3s;
}
#sheet .result { display: flex; align-items: center; gap: 12px; padding: 0; text-align: left; }
#sheet .result-num { flex: none; min-width: 92px; text-align: center; }
#sheet .big {
  margin: 0; font-size: 50px; letter-spacing: -1.5px; line-height: 1; transform-origin: 50% 60%;
}
#sheet .big.empty { color: #e2d3c2; }
#sheet .big.bonus { margin: 0; font-size: 30px; letter-spacing: .03em; color: #a86f00; }
#sheet .unit {
  min-height: 0; margin-top: 2px; font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
#sheet .reason {
  flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 650; line-height: 1.3;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
#sheet[data-state="empty"] .reason { color: var(--muted); font-weight: 600; }
#sheet[data-state="empty"] .result-card { background: rgba(255, 255, 255, .55); border-style: dashed; border-width: 2px; box-shadow: none; }
#sheet[data-state="empty"] .reason::before { content: "👆 "; }
#sheet[data-state="bonus"] .result-card {
  background: linear-gradient(135deg, #fffaea 0%, #ffefc4 100%); border-color: #f1cf78;
  box-shadow: 0 1px 2px rgba(168, 111, 0, .1), 0 10px 22px -12px rgba(201, 138, 6, .7);
}
#sheet[data-state="bonus"] .unit { color: #9b7a2c; }

/* chosen services: one swipeable row of removable chips on phones */
#sheet .chips-h { display: none; }
#sheet .chips {
  flex-wrap: nowrap; gap: 8px; overflow-x: auto; overflow-y: hidden;
  margin: 10px -12px 0; padding: 0 12px; scrollbar-width: none; overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 20px), transparent);
          mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 20px), transparent);
}
#sheet .chips::-webkit-scrollbar { display: none; }
#sheet .chip {
  min-height: 48px; gap: 8px; padding: 0 6px 0 14px; border-radius: 999px;
  border: 1px solid #ecd2da; background: var(--accent-soft); color: var(--accent);
  font-size: 15px; font-weight: 650;
  transition: background .15s, border-color .15s;
}
#sheet .chip b { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
#sheet .chip .z { background: #fff; }
#sheet .chip .x {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: #fff; color: var(--accent); font-size: 13px; font-weight: 800;
  transition: background .15s, color .15s;
}
#sheet .chip.combo { border-color: var(--accent); }

/* ---- body: categories + services + custom ---- */
#sheet .sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: 0 max(var(--sh-pad), env(safe-area-inset-right)) 24px max(var(--sh-pad), env(safe-area-inset-left));
  background: var(--bg); scroll-padding-top: 140px;
}
#sheet .cats {
  position: sticky; top: 0; z-index: 3; gap: 8px; padding: 12px 0 10px;
  background: var(--bg); box-shadow: 0 10px 8px -10px rgba(43, 29, 31, .18);
}
#sheet .cat {
  min-height: 52px; padding: 4px 6px; border-radius: 14px; border-width: 2px;
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; align-content: center;
  align-items: center; justify-items: start; text-align: left; font-size: 13.5px; line-height: 1.1;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .12s;
}
#sheet .cat .e { grid-row: 1 / span 2; font-size: 20px; }
#sheet .cat > span:not(.e):not(.n), #sheet .cat small {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#sheet .cat small { font-size: 11px; }
#sheet .cat.on { box-shadow: 0 4px 12px -6px rgba(122, 31, 61, .55); }
#sheet .cat.on > span:not(.e):not(.n) { color: var(--accent); }
#sheet .cat .n {
  top: -7px; left: -5px; right: auto; /* phones: over the emoji corner, never over the label */ min-width: 22px; height: 22px; line-height: 22px; font-size: 12px; font-weight: 800;
  box-shadow: 0 0 0 2px var(--bg);
}

#sheet .list { margin-top: 4px; }
#sheet .group-title { margin: 16px 2px 8px; font-size: 12px; }
#sheet .group-title:first-child { margin-top: 8px; }
#sheet .note { margin: -4px 2px 8px; }
#sheet .svcs { gap: 10px; }
#sheet .svc {
  min-height: 68px; padding: 10px 12px; border-radius: 16px; gap: 3px;
  box-shadow: 0 1px 2px rgba(43, 29, 31, .05);
  transition: background .18s, border-color .18s, box-shadow .18s, color .18s, transform .12s;
}
#sheet .svc .nm { font-size: 15px; padding-right: 26px; }
#sheet .svc .pr { font-size: 16px; font-variant-numeric: tabular-nums; }
#sheet .svc .ck { top: 9px; right: 9px; }
#sheet .svc.on { box-shadow: 0 8px 16px -8px rgba(122, 31, 61, .75); }

#sheet .custom { margin-top: 20px; }
#sheet .custom-toggle { min-height: 56px; border-radius: 16px; background: rgba(255, 255, 255, .5); color: var(--ink); }
#sheet .custom-toggle[aria-expanded="true"] { border-style: solid; border-color: var(--accent); background: var(--card); }
#sheet .custom-form { padding: 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
#sheet .custom-form input { min-width: 0; }
#sheet .custom-err { margin: 0; color: #a12626; font-weight: 700; font-size: 14px; }

/* ---- sticky action bar ---- */
#sheet .sheet-foot {
  flex: none; position: relative; z-index: 4;
  padding: 10px max(var(--sh-pad), env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(var(--sh-pad), env(safe-area-inset-left));
  background: var(--bg); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 16px -14px rgba(43, 29, 31, .5);
}
#sheet .sheet-foot .err {
  margin-bottom: 8px; padding: 8px 12px; border-radius: 12px; background: #fdecec;
}
#sheet .drow { display: grid; grid-template-columns: minmax(96px, 1fr) 2.3fr; gap: 10px; }
#sheet #sheetCancel { min-height: 58px; border-radius: 16px; font-size: 17px; line-height: 1.1; color: var(--ink); }
#sheet #sheetSave {
  min-height: 58px; min-width: 0; padding: 0 14px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 19px; line-height: 1.1;
  background: linear-gradient(180deg, #8c2747 0%, var(--accent) 100%);
  box-shadow: 0 10px 20px -10px rgba(122, 31, 61, .9), inset 0 1px 0 rgba(255, 255, 255, .15);
  transition: filter .15s, transform .12s, box-shadow .2s;
}
#sheet #sheetSave:active { transform: scale(.98); }
#sheet #sheetSave:disabled { filter: saturate(.6) opacity(.7); }
#sheet .save-lbl { display: flex; flex-direction: column; align-items: center; }
#sheet .save-sum {
  padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .17);
  font-size: 15px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums;
}
#sheet .save-sum:empty { display: none; }
#sheet[data-state="bonus"] .save-sum { background: #ffc93c; color: #241500; }

/* ---- motion (all disabled under prefers-reduced-motion below) ---- */
@keyframes tkSheetUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes tkScrim { from { opacity: 0; } to { opacity: 1; } }
@keyframes tkPanelIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes tkPop { 0% { transform: scale(.94); } 55% { transform: scale(1.035); } 100% { transform: scale(1); } }
@keyframes tkCheck { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes tkChipIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes tkBump { 0% { opacity: .35; transform: translateY(6px) scale(.88); } 100% { opacity: 1; transform: none; } }
@keyframes tkFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#sheet:not([hidden]) .sheet-panel { animation: tkSheetUp .3s var(--sh-ease); }
#sheet .svc.just-on { animation: tkPop .3s var(--sh-ease); }
#sheet .svc.just-on .ck { animation: tkCheck .32s var(--sh-ease); }
#sheet .chip.is-new { animation: tkChipIn .26s var(--sh-ease); }
#sheet .big.bump { animation: tkBump .3s var(--sh-ease); }
#sheet .list.cat-in > * { animation: tkFadeUp .24s var(--sh-ease) both; }
#sheet .custom-form:not([hidden]) { animation: tkFadeUp .2s var(--sh-ease); }

/* ---- small phones (≤ 360px): keep categories readable ---- */
@media (max-width: 360px) {
  #sheet .cat { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 4px; }
  #sheet .cat .e { grid-row: auto; font-size: 18px; }
  #sheet .cat small { display: none; }
  #sheet .drow { grid-template-columns: minmax(84px, 1fr) 2fr; }
}

/* ---- tablet portrait / small windows: centered column over a dim scrim ---- */
@media (min-width: 600px) {
  #sheet { background: rgba(36, 20, 25, .58); justify-content: center; }
  #sheet:not([hidden]) { animation: tkScrim .2s ease-out; }
  #sheet .sheet-panel { max-width: 720px; box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
  #sheet .cats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #sheet .cat { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; min-height: 64px; }
  #sheet .cat .e { grid-row: auto; font-size: 22px; }
  #sheet .cat .n { left: auto; right: -5px; }
  #sheet .svcs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #sheet .big { font-size: 60px; }
  #sheet .big.bonus { font-size: 38px; }
}

/* ---- desktop / tablet landscape: two panes, everything on one screen ---- */
@media (min-width: 900px) {
  #sheet { align-items: center; padding: max(20px, 2.5vh) max(20px, 2vw); }
  #sheet .sheet-panel {
    width: min(1320px, 100%); height: min(880px, 100%); max-width: none;
    border-radius: 24px; overflow: hidden;
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
    display: grid; grid-template-columns: minmax(0, 1fr) clamp(360px, 30vw, 420px);
    grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "body top" "body foot";
  }
  #sheet:not([hidden]) .sheet-panel { animation: tkPanelIn .3s var(--sh-ease); }

  /* left: services */
  #sheet .sheet-body { grid-area: body; padding: 0 26px 26px; scroll-padding-top: 110px; }
  #sheet .cats { padding: 22px 0 14px; gap: 10px; }
  #sheet .cat { min-height: 66px; font-size: 15px; }
  #sheet .cat .e { font-size: 24px; }
  #sheet .cat small { font-size: 12px; }
  #sheet .svcs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  #sheet .svc { min-height: 62px; padding: 9px 12px; }
  #sheet .group-title { margin-top: 14px; }

  /* right: ticket summary */
  #sheet .sheet-top {
    grid-area: top; max-height: none; display: flex; flex-direction: column;
    padding: 22px 22px 14px; background: var(--card);
    border-bottom: 0; border-left: 1px solid var(--line); box-shadow: none;
  }
  #sheet .sheet-head { margin-bottom: 14px; align-items: flex-start; }
  #sheet .sheet-title { font-size: 22px; }
  #sheet .sheet-sub { margin-top: 2px; font-size: 14px; }
  #sheet .seg { background: var(--bg); }
  #sheet .clear { background: var(--bg); }
  #sheet .result-card {
    flex: 1; display: flex; flex-direction: column; margin-top: 14px; padding: 0;
    border: 0; box-shadow: none; background: transparent; min-height: 0;
  }
  #sheet .result {
    flex-direction: column; align-items: stretch; gap: 6px; text-align: center;
    padding: 16px 16px 14px; border-radius: 20px; background: var(--bg); border: 1px solid var(--line);
    transition: background .3s, border-color .3s;
  }
  #sheet[data-state="bonus"] .result-card { background: transparent; box-shadow: none; }
  #sheet[data-state="bonus"] .result {
    background: linear-gradient(135deg, #fffaea 0%, #ffefc4 100%); border-color: #f1cf78;
    box-shadow: 0 12px 26px -14px rgba(201, 138, 6, .8);
  }
  #sheet[data-state="empty"] .result-card { background: transparent; border: 0; }
  #sheet[data-state="empty"] .result { border: 2px dashed var(--line); background: transparent; }
  #sheet[data-state="empty"] .reason::before { content: "👈 "; }
  #sheet .big { font-size: 92px; letter-spacing: -3px; }
  #sheet .big.empty { font-size: 64px; letter-spacing: 0; font-weight: 600; }
  #sheet .big.bonus { font-size: 60px; letter-spacing: .02em; }
  #sheet .unit { font-size: 13px; }
  #sheet .reason { font-size: 15px; -webkit-line-clamp: 3; line-clamp: 3; }

  #sheet .chips-h {
    display: flex; align-items: baseline; gap: 6px; margin: 18px 2px 8px;
    font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  }
  #sheet .chips-h small { display: inline; letter-spacing: 0; text-transform: none; font-size: 12px; }
  #sheet .sheet-total { margin-left: auto; font-size: 16px; letter-spacing: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
  #sheet .chips {
    flex-direction: column; flex-wrap: nowrap; gap: 6px; margin: 0; padding: 0;
    overflow: visible; -webkit-mask-image: none; mask-image: none;
  }
  #sheet .chips:empty {
    display: block; padding: 18px 14px; border: 2px dashed var(--line); border-radius: 16px;
    text-align: center; color: var(--muted); font-size: 14px; font-weight: 600;
  }
  #sheet .chips:empty::before { content: "← Pick services from the menu · Chọn dịch vụ"; }
  #sheet .chip {
    width: 100%; min-height: 48px; padding: 0 6px 0 14px; border-radius: 14px;
    background: var(--bg); border: 1px solid var(--line); color: var(--ink);
    white-space: normal; text-align: left; font-weight: 600;
  }
  #sheet .chip b { margin-left: auto; padding-left: 8px; }
  #sheet .chip .x { background: var(--card); color: var(--muted); border: 1px solid var(--line); }
  #sheet .chip.combo { border-left: 4px solid var(--accent); }

  #sheet .sheet-foot {
    grid-area: foot; padding: 14px 22px 20px; background: var(--card);
    border-left: 1px solid var(--line); border-top: 1px solid var(--line); box-shadow: none;
  }
  #sheet .drow { grid-template-columns: 1fr 2fr; }
}
@media (min-width: 900px) and (max-width: 1179px) {
  #sheet .cats { gap: 8px; }
  #sheet .cat { font-size: 13px; padding: 4px 3px; }
}
@media (min-width: 1180px) {
  #sheet .svcs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* short landscape screens: tighten the summary so Save never needs scrolling */
@media (min-width: 900px) and (max-height: 760px) {
  #sheet .big { font-size: 72px; }
  #sheet .result { padding: 10px 14px; }
  #sheet .cats { padding-top: 16px; }
  #sheet .cat { min-height: 58px; }
}

/* hover feedback only for real pointers (no "stuck" hover after a tap on phones) */
@media (hover: hover) {
  #sheet .sheet-x:hover { background: var(--accent-soft); color: var(--accent); }
  #sheet .seg-btn:not(.on):hover { background: var(--bg); }
  #sheet .clear:hover { background: var(--accent-soft); }
  #sheet .cat:not(.on):hover { border-color: #dcc8b4; }
  #sheet .svc:not(.on):hover { border-color: #dcc8b4; box-shadow: 0 4px 12px -8px rgba(43, 29, 31, .4); }
  #sheet .chip:hover { border-color: #e3bfcb; }
  #sheet .chip:hover .x { background: var(--accent); color: #fff; border-color: var(--accent); }
  #sheet #sheetSave:hover { filter: brightness(1.08); }
}
@media (hover: hover) and (min-width: 900px) {
  #sheet .chip:hover { background: var(--accent-soft); }
}

@media (prefers-reduced-motion: reduce) {
  #sheet, #sheet *, #sheet *::before, #sheet *::after {
    animation: none !important; transition: none !important;
  }
}


/* =====================================================================
   Tech view (body.view-mode, not PIN-unlocked): banners + Turn line | Bonus
   line only, big and glanceable. Turn order, tickets and edit controls hidden.
   Manager view (unlocked today): one screen, no page scroll. Order left,
   Turn line | Bonus line equal on the right (same size, tops aligned).
   Not-in, clocked-out, activity, staff and reset live in the Out sheet.
   ===================================================================== */

/* First paint and tech view (today): never show the turn-order list.
   A past day keeps the totals table because the two lines are today-only. */
body.view-mode:not(:has(#empPast:not([hidden]))) #empOrderSec,
body.view-mode:not(:has(#empPast:not([hidden]))) .emp-cols { display: none !important; }

/* Reserve the banner row at every width so #empTop filling in names cannot
   push the two line columns (live 1280/1440 CLS was ~0.35 without this). */
body.view-mode .emp-top-slot {
  flex: none;
  min-height: clamp(84px, 18vh, 220px);
  margin-bottom: 8px;
}

/* Do not let .emp / .bhead shrink-wrap or bounce between max-widths (760 / 1760 /
   none). That collapse (770px → 56px → 770px) was the live 1280/1440 CLS. */
html.board body.view-mode .bhead,
html.board body.view-mode .stick,
html.board body.view-mode .emp {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  align-self: stretch;
  box-sizing: border-box;
}

body.view-mode .out-panel-btn,
body.view-mode #outDlg { display: none !important; }

/* Fill the viewport on desktop too. `height: 100%` here used to beat the
   100dvh rule on specificity, and html itself had no height, so the body
   shrank to content (~580px in an 800px window). The two line cards then
   sat in the leftover, and flex: 1 1 0 / min-height: 0 rows squashed
   under their text and painted into the next row. */
html.board:has(body.board-page.view-mode),
html.board body.board-page.view-mode {
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
}
body.board-page.view-mode {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
/* Manager: do not squeeze to one screen. Page scroll is OK; rows keep full controls and numbers. */
body.board-page:not(.view-mode) {
  display: block;
  height: auto;
  min-height: 100dvh;
  max-height: none;
  /* visible (not auto): a body scroll box would break position:sticky
     on #stick and on the Turn line | Bonus line cards. The viewport scrolls. */
  overflow: visible;
}
body.board-page .bhead { flex: none; }
body.board-page.view-mode .stick { display: none; } /* emp banners replace the sticky bar */
body.board-page:not(.view-mode) .stick { flex: none; }

/* Tech view fills the remaining viewport with two equal line columns. */
body.view-mode .emp {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Don't leave 3vh of empty cream under the cards — that space belongs to the rows. */
html.board body.view-mode .emp,
body.view-mode .emp { padding-bottom: 8px; }
body.view-mode #empPair {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
}
body.view-mode #empPair > * {
  min-height: 0;
  height: 100%;
}
/* One-line rule reminder; don't let a long hint eat row space. */
body.view-mode .pair-lines .tl-hint,
body.view-mode .pair-lines .bl-hint {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11px;
  margin: 0 0 6px;
  max-height: 1.4em;
}

/* Manager one-screen main stage */
body.board-page:not(.view-mode) .bmain {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.15fr);
  column-gap: 10px;
  row-gap: 8px;
  align-items: start;
  overflow: visible;
  padding-bottom: 16px;
}
body.board-page:not(.view-mode) #ordSec {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
body.board-page:not(.view-mode) #editPair {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow: visible;
}
body.board-page:not(.view-mode) #ordSec .sec,
body.board-page:not(.view-mode) .pair-lines .tl-h,
body.board-page:not(.view-mode) .pair-lines h2.sec { flex: none; }
body.board-page:not(.view-mode) #inList,
body.board-page:not(.view-mode) .pair-lines .tl-list,
body.board-page:not(.view-mode) .pair-lines .bl-list {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  overflow: visible;
  gap: 8px;
}
body.board-page:not(.view-mode) .pair-lines .bl-list.compact {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
}
body.board-page:not(.view-mode) #inList .trow,
body.board-page:not(.view-mode) .pair-lines .tl-chip,
body.board-page:not(.view-mode) .pair-lines .bl-row {
  flex: none;
  min-height: auto;
  max-height: none;
  overflow: visible;
}
/* Scale type with the number of techs / viewport so 10–14 rows fit without page scroll. */
body.board-page:not(.view-mode) #inList .tname {
  font-size: clamp(13px, 2.4vh, 22px);
}
body.board-page:not(.view-mode) #inList .turns {
  font-size: clamp(16px, 3vh, 28px);
}

/* Full manager rows: number + name + turns + all action buttons, nothing clipped. */
body.board-page:not(.view-mode) #inList .trow {
  overflow: visible;
}
body.board-page:not(.view-mode) #inList .tmain { min-height: 64px; overflow: visible; }
body.board-page:not(.view-mode) #inList .tpos {
  flex: none;
  width: 34px;
  height: 34px;
  font-size: 16px;
  font-weight: 900;
}
body.board-page:not(.view-mode) #inList .tact { display: flex; }
body.board-page:not(.view-mode) #inList .tact button { min-height: 48px; min-width: 48px; }
body.board-page:not(.view-mode) #tlList .tl-pos,
body.board-page:not(.view-mode) #blList .bl-pos,
body.board-page:not(.view-mode) .pair-lines .tl-pos,
body.board-page:not(.view-mode) .pair-lines .bl-pos {
  flex: none;
  display: grid;
  place-items: center;
}

body.board-page:not(.view-mode) .pair-lines .tl-chip,
body.board-page:not(.view-mode) .pair-lines .bl-row {
  font-size: clamp(12px, 2.2vh, 18px);
  padding: clamp(2px, 0.6vh, 8px) 10px;
}
body.board-page:not(.view-mode) .pair-lines .tl-hint,
body.board-page:not(.view-mode) .pair-lines .bl-hint { display: none; }

/* Tech view: rows share leftover card height evenly. Full names wrap at word
   breaks and the row grows (min-height: 0 + shrinking rows used to clip and
   overlap on desktop). If there are too many techs the list scrolls. */
body.view-mode .pair-lines .tl-list,
body.view-mode .pair-lines .bl-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  gap: clamp(3px, 0.5vh, 8px);
}
body.view-mode .pair-lines .tl-chip,
body.view-mode .pair-lines .bl-row {
  /* grow evenly into the card, never shrink below the text (no overlap); too many → the list scrolls */
  flex: 1 0 auto;
  min-height: 36px;
  max-height: none;
  overflow: hidden;
  box-sizing: border-box;
  font-size: clamp(16px, 2.8vh, 32px);
  padding: 2px 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
body.view-mode .pair-lines .tl-nm,
body.view-mode .pair-lines .bl-nm,
body.view-mode .emp .tl-nm,
body.view-mode .emp .bl-nm,
body.view-mode .emp .bl-row.first .bl-nm {
  font-size: inherit;
  line-height: 1.15;
  min-width: 0;
  /* full names (live rule): wrap at word breaks, never ellipsis; the row grows instead */
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
  word-break: normal;
}
body.view-mode .emp .bl-pos,
body.view-mode .emp .bl-ct,
body.view-mode .pair-lines .tl-ct,
body.view-mode .pair-lines .bl-ct {
  font-size: 0.95em;
  white-space: nowrap;
  overflow: hidden;
}
body.view-mode .pair-lines .tl-pos,
body.view-mode .pair-lines .bl-pos,
body.view-mode .emp .tl-pos,
body.view-mode .emp .bl-pos {
  flex: none;
  width: 1.55em;
  height: 1.55em;
  font-size: 0.7em;
}
/* The count column already shows the gift; a ::after on the name forced wraps. */
body.view-mode .emp .bl-row.first .bl-nm::after { content: none; }

/* Phone: keep a readable min row, and stack Bonus line name above the count
   so "2 t 🎁 0" does not crush the name to one letter in a ~155px column. */
@media (max-width: 599px) {
  body.view-mode .pair-lines .tl-chip,
  body.view-mode .pair-lines .bl-row {
    min-height: 40px;
    font-size: clamp(15px, 4.4vw, 20px);
    padding: 2px 8px;
    gap: 6px;
  }
  body.view-mode .emp .bl-row,
  body.view-mode .pair-lines .bl-row {
    grid-template-columns: 1.4em minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 6px;
    row-gap: 0;
    padding: 4px 8px;
  }
  body.view-mode .emp .bl-pos,
  body.view-mode .pair-lines .bl-pos { grid-row: 1 / span 2; align-self: center; }
  body.view-mode .emp .bl-ct,
  body.view-mode .pair-lines .bl-ct { grid-column: 2; font-size: 0.82em; }
  body.view-mode .pair-lines .tl-hint,
  body.view-mode .pair-lines .bl-hint {
    -webkit-line-clamp: 1;
    max-height: 1.4em;
    font-size: 10px;
    margin: 0 0 4px;
  }
}

/* Clock-in easing: transform/opacity only — no layout shift. */
@keyframes justIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.trow.just-in,
.tl-chip.just-in,
.bl-row.just-in,
.emp-row.just-in {
  animation: justIn 0.28s ease-out;
}

/* Out button + sheet (manager). The sheet itself may scroll; the page may not. */
.out-panel-btn { position: relative; }
.out-count {
  display: inline-grid; place-items: center;
  min-width: 1.4em; height: 1.4em; margin-left: 4px; padding: 0 5px;
  border-radius: 999px; background: #1a1412; color: #fff;
  font-size: 13px; font-weight: 900; font-variant-numeric: tabular-nums;
}
.out-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #c42d62; color: #fff;
  font-size: 11px; font-weight: 900; line-height: 18px; text-align: center;
  font-variant-numeric: tabular-nums;
}
#outDlg.overlay { align-items: flex-end; }
#outDlg .out-sheet {
  width: min(720px, 100%);
  max-height: min(88dvh, 900px);
  display: flex; flex-direction: column;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  background: #fff; color: #1a1412;
}
.out-sheet-head {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--line, #e4d8ce);
}
.out-sheet-head h2 { flex: 1; margin: 0; font-size: 18px; }
.out-dlg-close {
  min-height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line, #e4d8ce); background: #fff; font-weight: 800;
}
.out-sheet-body {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 24px;
}
@media (min-width: 800px) {
  #outDlg.overlay { align-items: center; }
  #outDlg .out-sheet { border-radius: 20px; max-height: min(80dvh, 860px); }
}

@media (max-width: 599px) {
  /* Compact manager chrome so 14 rows can fit at 390×844. */
  body.board-page:not(.view-mode) .bhead { padding: 6px 8px 6px; }
  body.board-page:not(.view-mode) .brow { margin-bottom: 4px; }
  body.board-page:not(.view-mode) .stick { padding-left: 8px; padding-right: 8px; }
  body.board-page:not(.view-mode) .bmain {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.15fr);
    column-gap: 6px; padding-left: 6px; padding-right: 6px; padding-bottom: 6px;
  }
  body.board-page:not(.view-mode) .pair-lines { gap: 6px; }
  body.board-page:not(.view-mode) #inList .tname { font-size: clamp(12px, 2.6vh, 16px); }
  body.board-page:not(.view-mode) #inList .turns { font-size: clamp(14px, 3vh, 20px); }
  body.view-mode .pair-lines .tl-h,
  body.view-mode .pair-lines .emp-h { font-size: 12px; }
}

body[data-in-count="10"] .pair-lines .tl-chip,
body[data-in-count="11"] .pair-lines .tl-chip,
body[data-in-count="12"] .pair-lines .tl-chip,
body[data-in-count="13"] .pair-lines .tl-chip,
body[data-in-count="14"] .pair-lines .tl-chip,
body[data-in-count="10"] .pair-lines .bl-row,
body[data-in-count="11"] .pair-lines .bl-row,
body[data-in-count="12"] .pair-lines .bl-row,
body[data-in-count="13"] .pair-lines .bl-row,
body[data-in-count="14"] .pair-lines .bl-row,
body[data-in-count="10"] #inList .trow,
body[data-in-count="11"] #inList .trow,
body[data-in-count="12"] #inList .trow,
body[data-in-count="13"] #inList .trow,
body[data-in-count="14"] #inList .trow {
  gap: 4px;
}

/* Insights page link (manager Out sheet only; the page itself is read-only) */
.insights-link {
  display: block; margin-top: 14px; padding: 14px 16px; min-height: 48px; box-sizing: border-box;
  border: 2px solid var(--line, #e4d8ce); border-radius: 14px; background: #fff; color: var(--ink, #1a1412);
  font-weight: 800; text-decoration: none; text-align: center;
}
.insights-link small { font-weight: 600; color: var(--muted, #5c524c); }

/* Desktop manager (≥700px): Turn line | Bonus line stay on screen while the long
   Turn order list scrolls. Stick just below the already-sticky Next-up bar
   (#stick, z-index 15). Lists inside the cards scroll if the pair is taller
   than the leftover viewport. Phone layout is unchanged (see max-width: 699px). */
@media (min-width: 700px) {
  /* Extra space at the end of the order list so the sticky pair is not
     pushed up under #stick when the page is scrolled all the way down. */
  body.board-page:not(.view-mode) #ordSec { padding-bottom: 32px; }
  body.board-page:not(.view-mode) #editPair {
    position: sticky;
    top: var(--mgr-stick-h, 0px);
    z-index: 4;
    align-self: start;
    max-height: calc(100dvh - var(--mgr-stick-h, 0px) - 48px);
    overflow: hidden;
    box-sizing: border-box;
    grid-template-rows: minmax(0, 1fr);
  }
  body.board-page:not(.view-mode) #editPair > * {
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  body.board-page:not(.view-mode) #editPair .tl-list,
  body.board-page:not(.view-mode) #editPair .bl-list,
  body.board-page:not(.view-mode) #editPair .bl-list.compact {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Manager on a phone (<700px): Turn order on the left would squeeze Turn line | Bonus line to ~90px each
   (names and numbers clip). Stack instead: the two equal line cards on top, Turn order full width below.
   Wide screens keep Order left, lines right. */
@media (max-width: 699px) {
  body.board-page:not(.view-mode) .bmain { grid-template-columns: minmax(0, 1fr); }
  body.board-page:not(.view-mode) #editPair { grid-column: 1; grid-row: 1; }
  body.board-page:not(.view-mode) #ordSec { grid-column: 1; grid-row: 2; }
  body.board-page:not(.view-mode) #noBoard { grid-column: 1; grid-row: 3; }
}

/* =====================================================================
   Combine tickets / Add to last ticket (appended block — merge as one hunk)
   ===================================================================== */
.tk-tools { list-style: none; display: flex; align-items: center; gap: 8px; }
.tk-tools button { min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 800; font-size: 15px; }
.tk-tools button small { display: block; opacity: .75; font-size: 11px; font-weight: 700; }
.tk-tools .combine-btn { flex: 1; }
.tk-tools .add { background: var(--accent); border-color: var(--accent); color: #fff; }
.tk-tools button:disabled { opacity: .45; }
.tk-tools .tk-sel-n { flex: 1; font-weight: 800; font-size: 15px; }
.tk-tools .tk-sel-n small { display: block; font-size: 11px; opacity: .75; }
.tk.selecting .tk-top { gap: 10px; }
.tk-pick {
  flex: none; width: 44px; height: 44px; border: 2px solid var(--line); border-radius: 10px; background: var(--card);
  font-size: 24px; font-weight: 900; line-height: 1; color: #fff;
}
.tk.picked { border-color: var(--accent); background: #fff4f7; }
.tk.picked .tk-pick { background: var(--accent); border-color: var(--accent); }

#sheet .tk-mode { flex: none; width: 100%; margin: 0 0 8px; }
#sheet .tk-mode .seg-btn { min-height: 46px; font-size: 15px; }
#sheet .tk-mode .seg-btn small { display: block; font-size: 11px; }
#sheet .tk-mode-note {
  flex: none; margin: -2px 2px 8px; font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#sheet .chip.locked { opacity: .65; }
#sheet .chip.locked .x { display: none; }
#sheet .svc.locked { opacity: .65; }

.combine-dialog { max-width: 440px; max-height: 92dvh; overflow-y: auto; }
.combine-dialog h2 small { font-size: 13px; font-weight: 600; opacity: .7; }
.combine-who { margin: -6px 0 0; font-size: 15px; font-weight: 800; color: var(--muted); }
.combine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.combine-list li { display: flex; gap: 8px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 14px; font-weight: 600; }
.combine-list .cl-s { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.combine-dialog .seg-btn { min-height: 48px; }
.combine-dialog .seg-btn small { display: block; font-size: 11px; }
.combine-result { margin: 0; padding: 10px 12px; border-radius: 12px; background: #fffaea; border: 1px solid #f1cf78; font-size: 16px; font-weight: 700; }
.combine-result small { font-weight: 600; font-size: 13px; }
.combine-result .cr-b { color: #8b1b1b; }
.combine-dialog #combineOk.add { background: var(--accent, #c42d62); color: #fff; }

/* Insights is an <a> styled like the other header buttons (no link blue / underline) */
a.lockbtn { text-decoration: none; color: inherit; display: inline-flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
a.lockbtn[hidden] { display: none; }

/* Manager Turn line / Bonus line cards are narrow (phone: ~170px; 700–1100px: ~145px; 1280: ~270px with
   the bigger first row), so "2.75 t · 🎁 1" beside the name squeezed names to "Tamm/y". Everywhere below
   1500px put the count under the name (same as the tech phone view); names break only at spaces. */
@media (max-width: 1499px) {
  body.board-page:not(.view-mode) #editPair .bl-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 0;
    align-items: center;
  }
  body.board-page:not(.view-mode) #editPair .bl-pos { grid-row: span 2; }
  body.board-page:not(.view-mode) #editPair .bl-nm {
    font-size: 19px; line-height: 1.15; min-width: 0;
    white-space: normal; overflow-wrap: break-word; word-break: normal;
  }
  body.board-page:not(.view-mode) #editPair .bl-ct { grid-column: 2; font-size: 14px; }
  /* Turn line: same treatment (count under the name; names break only at spaces, never mid-word) */
  body.board-page:not(.view-mode) #editPair .tl-chip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 0;
    align-items: center;
  }
  body.board-page:not(.view-mode) #editPair .tl-pos { grid-row: span 2; }
  body.board-page:not(.view-mode) #editPair .tl-nm {
    font-size: 19px; line-height: 1.15; min-width: 0;
    white-space: normal; overflow-wrap: break-word; word-break: normal;
  }
  body.board-page:not(.view-mode) #editPair .tl-ct { grid-column: 2; font-size: 14px; }
}

/* Manager 700–1199px (tablet / small laptop): the 640px page cap squeezed Order + Turn line + Bonus line
   into ~640px (names at 7px wide). Use the width, like ≥1200px does. */
@media (min-width: 700px) and (max-width: 1199px) {
  body.board-page:not(.view-mode) .bhead,
  body.board-page:not(.view-mode) .stick,
  body.board-page:not(.view-mode) .bmain,
  body.board-page:not(.view-mode) .bonus-view {
    max-width: none; margin-left: auto; margin-right: auto;
  }
  body.board-page:not(.view-mode) .bhead,
  body.board-page:not(.view-mode) .stick,
  body.board-page:not(.view-mode) .bmain { padding-left: 14px; padding-right: 14px; }
  body.board-page:not(.view-mode) .bmain { column-gap: 12px; }
}

/* Multi-tap clock-in: sheet stays open; Done / ✕ / Escape close it. */
.out-dlg-done {
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 0;
  background: #155d2c; color: #fff; font-weight: 800; font-size: 16px; flex: 0 0 auto;
}
.out-dlg-close { min-width: 44px; font-size: 20px; line-height: 1; }
#justInSec { margin: 8px 0 16px; }
.just-in-list { display: flex; flex-wrap: wrap; gap: 8px; }
.just-in-chip {
  display: flex; align-items: center; gap: 8px; min-height: 44px; min-width: 0;
  padding: 4px 6px 4px 12px; border-radius: 999px;
  border: 2px solid #1d7a3a; background: #effaf2; color: #155d2c; font-weight: 800;
}
.just-in-chip .ji-mark { font-size: 16px; }
.just-in-chip .ji-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12em; }
.just-in-chip .ji-st { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
.just-in-chip .ji-undo {
  min-height: 36px; padding: 0 10px; border-radius: 999px;
  border: 1px solid #1d7a3a; background: #fff; color: #155d2c; font-weight: 700; font-size: 13px;
}
.just-in-chip .ji-undo:disabled { opacity: .5; }
