/* ============================================
   Roster Ops - light "Vercel" theme, excel grid
   ============================================ */
:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #666666;
  --border: #eaeaea;
  --border-strong: #cfcfcf;
  --head-bg: #fafafa;
  --accent: #0070f3;
  --red: #e00;
  --red-bg: #ffe3e3;
  --green-bg: #d3f5d3;
  --yellow: #fff9c2;
  --lock-bg: #f2f2f2;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.45 -apple-system, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- top bar ---------- */
header.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  z-index: 40;
}
.brand { font-weight: 700; font-size: 15px; letter-spacing: -0.3px; }
.brand span { color: var(--muted); font-weight: 400; }
nav { display: flex; gap: 4px; }
.nav-btn {
  border: 1px solid transparent; background: none; color: var(--muted);
  padding: 6px 14px; border-radius: 0; font-size: 13px; cursor: pointer;
}
.nav-btn:hover { color: var(--fg); background: var(--head-bg); }
.nav-btn.active { color: var(--fg); border-color: var(--border-strong); background: #fff; font-weight: 600; }
.top-right { margin-left: auto; display: flex; gap: 8px; }

.btn {
  border: 1px solid var(--border-strong); background: #fff; color: var(--fg);
  padding: 5px 12px; border-radius: 0; cursor: pointer; font-size: 12.5px;
}
.btn:hover { border-color: #999; }
.btn.primary { background: #000; color: #fff; border-color: #000; }
.btn.primary:hover { background: #333; }
.btn.tiny { padding: 2px 7px; font-size: 11px; }
.btn.danger { color: var(--red); }

#page { padding: 16px 20px 60px; }
.no-server-banner {
  background: #d33; color: #fff; font-weight: 700; text-align: center;
  padding: 6px 10px; font-size: 12.5px;
}

.page-title { margin: 4px 0 2px; font-size: 18px; letter-spacing: -0.3px; }
.hint { color: var(--muted); margin: 2px 0 14px; font-size: 12px; }
.sec-title { margin: 22px 0 6px; font-size: 14px; }

/* ---------- date tabs ---------- */
.date-tabs { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 6px; align-items: center; }
.date-tabs.days { margin-bottom: 12px; }
.tab {
  border: 1px solid var(--border); background: var(--head-bg); color: var(--muted);
  padding: 4px 10px; border-radius: 0; font-size: 12px; cursor: pointer;
}
.tab.done { color: #b5b5b5; }
.tab.active { background: #fff; color: var(--accent); border-color: var(--border-strong); font-weight: 700; }
.tab.day { min-width: 32px; text-align: center; padding: 4px 0; }
/* TODAY is unmistakable for everyone: month + day tabs go royal blue
   (a flag's red, staff-only, still wins when both apply - rule below) */
.tab.day.today, .tab.todaym { background: royalblue; border-color: #2c4fa3; color: #fff; font-weight: 800; }
.tab.yr { border-radius: 0; padding: 4px 8px; }
/* Jump to today matches TODAY's blue (red is reserved for flags/errors) */
.tab.jump.attn {
  background: royalblue; border-color: #2c4fa3; color: #fff; font-weight: 800;
  animation: todayGlow 1.4s ease-in-out infinite;
}
@keyframes todayGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(65, 105, 225, 0); }
  50% { box-shadow: 0 0 0 5px rgba(65, 105, 225, .4); }
}
.yr-label { font-weight: 800; font-size: 13px; padding: 0 4px; }
.date-picker { margin-left: 8px; border: 1px solid var(--border-strong); border-radius: 0; padding: 3px 6px; font-size: 12px; }

/* ---------- day head ---------- */
.day-head {
  display: flex; align-items: baseline; gap: 16px;
  border: 1px solid var(--border-strong); border-bottom: none;
  background: var(--head-bg); padding: 8px 14px;
}
.day-head.peak { background: #dbe5ff; }
.day-head.offpeak { background: #dcf2dc; }
.day-title { font-size: 17px; font-weight: 700; }
.day-date { color: var(--muted); letter-spacing: 1px; font-size: 12px; }
.notes-box {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border-strong); border-bottom: none;
  background: #fff; padding: 6px 14px;
}
.notes-lab { font-weight: 700; font-size: 12.5px; flex-shrink: 0; }
.notes-field {
  flex: 1; border: none; background: transparent;
  padding: 4px 0; font-weight: 600; font-size: 13px;
}
.notes-field:focus { outline: none; border-bottom: 2px solid var(--accent); }
.rate-badge {
  border: 1px solid transparent; border-radius: 0; cursor: pointer;
  font-weight: 800; font-size: 13px; letter-spacing: 1px; padding: 6px 18px;
  margin-left: auto;
}
.rate-badge.peak { background: royalblue; border-color: #2a4fb8; color: #fff; }
.rate-badge.offpeak { background: #2e9e44; border-color: #237a34; color: #fff; }
.rate-badge:disabled { cursor: default; opacity: .7; }

/* ---------- save indicator ---------- */
.save-ind {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 0;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  cursor: default; user-select: none;
}
.save-ind-dot { font-size: 13px; line-height: 1; }
.save-ind.saved { border-color: #a9dfa9; background: var(--green-bg); color: #237a34; }
.save-ind.saving { border-color: #ffd27a; background: #fff6e3; color: #9a6b00; }
.save-ind.error, .save-ind.memory { border-color: var(--red); background: var(--red-bg); color: var(--red); animation: attnGlow 1.4s ease-in-out infinite; }
.save-ind.auth { border-color: var(--red); background: var(--red-bg); color: var(--red); cursor: pointer; animation: attnGlow 1.4s ease-in-out infinite; }

/* ---------- presence: who is logged in (top bar) ---------- */
.who-ind { display: flex; align-items: center; gap: 5px; max-width: 40vw; flex-wrap: wrap; }
.who-lab {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted);
}
/* solid colour tiles, same language as every name on the roster: a manager
   login wears that person's roster colour, Root is a black box, and the
   shared Admin account is neutral grey */
.who-chip {
  padding: 3px 8px; border: 1px solid rgba(0,0,0,.15); background: #fff;
  font-weight: 600; font-size: 11.5px; line-height: 1.35; white-space: nowrap;
  cursor: default; user-select: none;
}
.who-chip.root { background: #000; color: #fff; border-color: #000; }
.who-chip.generic { background: #555; color: #fff; border-color: #555; }

/* shared attention pulse - same language as the unconfirmed-changes card */
@keyframes attnGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 0, 0, 0); }
  50% { box-shadow: 0 0 0 5px rgba(224, 0, 0, .35); }
}

/* sync toast - "someone else updated the roster" / logout warnings */
.sync-toast {
  display: none; position: fixed; top: 54px; left: 50%; transform: translateX(-50%);
  z-index: 60; background: #fff; border: 2px solid var(--red); color: #7a1010;
  padding: 10px 18px; font-size: 13px; font-weight: 700;
  max-width: 80vw;
  animation: attnGlow 1.4s ease-in-out infinite;
}
.sync-toast.show { display: block; }

/* ---------- counters ---------- */
.counter-bar {
  display: flex; gap: 10px; align-items: center;
  border: 1px solid var(--border-strong); border-bottom: none;
  padding: 8px 14px; flex-wrap: wrap;
}
.counter {
  width: 72px; height: 72px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  border: 1px solid var(--border); border-radius: 0; background: #fff;
}
.counter.bad { background: var(--red-bg); border-color: #f5b5b5; }
.counter-bar .now-divider { align-self: stretch; width: 1px; background: var(--border-strong); margin: 0 4px; }
.counter.live { border-color: royalblue; position: relative; }
.counter.live .counter-val { color: royalblue; }
.counter.live .free-tip { display: none; position: absolute; top: 100%; left: 0; z-index: 40; background: #fff; border: 1px solid var(--border-strong); border-radius: 0; padding: 6px; min-width: 130px; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.counter.live:hover .free-tip { display: block; }
.free-tip-head { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding-bottom: 4px; text-align: left; }
.free-tip-empty { font-size: 12px; color: var(--muted); text-align: left; }
.free-tip-name { font-size: 12px; font-weight: 700; padding: 3px 8px; margin-top: 2px; text-align: left; white-space: nowrap; }
.counter.good { background: var(--green-bg); border-color: #a9dfa9; }
.counter-val { font-size: 22px; font-weight: 800; line-height: 1.1; }
.counter-lab { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 0 4px; }
.mgr-box { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bigtile {
  width: 130px; height: 88px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  border: 1px solid rgba(0,0,0,.2); border-radius: 0;
}
.bigtile-name { font-size: 19px; font-weight: 800; }
.bigtile-lab { font-size: 9.5px; font-weight: 700; letter-spacing: 1px; opacity: .85; }
.bigtile.none { background: var(--red-bg); color: var(--red); border-color: #f5b5b5; }
/* UNDO tile (roster header) - quiet until there is something to undo */
.bigtile.undotile { background: #fff; color: var(--fg); border-color: var(--border-strong); }
.bigtile.undotile.click { cursor: pointer; user-select: none; }
.bigtile.undotile.click:hover { outline: 2px solid currentColor; outline-offset: -4px; }
.bigtile.undotile.empty { background: var(--lock-bg); color: #aaa; border-color: var(--border); }

/* AUTO / MANUAL toggle tile (roster header, left of Daily Checks) */
.bigtile.modetile.click { cursor: pointer; user-select: none; }
.bigtile.modetile.is-auto { background: var(--green-bg); color: #237a34; border-color: #a9dfa9; }
/* MANUAL is a standing state the whole room should notice, not a nicety */
.bigtile.modetile.is-manual {
  background: #ffe08a; color: #4a3200; border-color: #c79400;
  box-shadow: inset 0 0 0 2px #c79400;
}
.bigtile.modetile.click:hover { outline: 2px solid currentColor; outline-offset: -4px; }
.modename { display: flex; align-items: center; gap: 6px; }
.lock-ico { width: 17px; height: 17px; flex: none; }

/* AUTO/MANUAL confirmation - the UNCONFIRMED CHANGES card language (white
   card, red border, red block title) at the size of a plain "are you sure":
   one line of copy, no pulse - it is a transient prompt, not a standing alarm */
.popover.mode-pop {
  width: 300px; max-width: calc(100vw - 40px);
  border: 2px solid var(--red); padding: 13px 15px;
}
.popover.mode-pop .pop-header {
  font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--red);
  padding: 0; border-bottom: 0; margin: 0 0 7px;
  text-transform: uppercase;
}
.mode-warn { padding: 0; }
.mode-warn-line { font-weight: 600; font-size: 12px; color: #333; line-height: 1.5; }
.mode-warn-line .shout { color: var(--red); font-weight: 800; }
.popover.mode-pop .pop-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 0 0; margin: 0;
}
.bad-text { color: var(--red); font-weight: 700; }
.warn-text { color: #9a6b00; font-weight: 700; }

/* ---------- warnings ---------- */
.warnings { border: 1px solid #f0d0a0; background: #fff8ec; padding: 6px 12px; margin: 0; }
.warnings summary { cursor: pointer; font-weight: 600; font-size: 12.5px; }
.warn-item { font-size: 12px; padding: 2px 0 2px 16px; }
.warn-item.error { color: var(--red); }
.warn-item.warn { color: #8a6d00; }

/* ---------- grid tables ---------- */
.grid-wrap { overflow-x: auto; border: 1px solid var(--border-strong); background: #fff; position: relative; }
/* live time indicator (today's roster) */
.now-line {
  position: absolute; left: 0; right: 0; height: 3px;
  background: royalblue; z-index: 4; pointer-events: none;
}
.now-line-label {
  position: absolute; left: 2px; top: -15px;
  background: royalblue; color: #fff;
  font-size: 9.5px; font-weight: 800; letter-spacing: .5px; padding: 1px 6px;
}
table.grid { border-collapse: collapse; font-size: 12px; }
table.grid th, table.grid td {
  border: 1px solid var(--border);
  padding: 2px 6px;
  white-space: nowrap;
  text-align: center;
  height: 24px;
}
table.grid thead th { background: var(--head-bg); position: sticky; top: 0; z-index: 5; }
.h-spacer { background: #fff !important; border: none !important; }
.h-assist { background: #e2f3e2 !important; font-weight: 600; }
th.h-staff { padding: 0; min-width: 58px; width: 58px; text-align: center; }
.h-staff .vert {
  writing-mode: vertical-rl; transform: rotate(180deg);
  display: inline-flex; align-items: center; justify-content: center;
  height: 88px; overflow: hidden; margin: 0;
  font-weight: 700; font-size: 11.5px; letter-spacing: .5px;
}

td.time { font-weight: 600; background: var(--head-bg); min-width: 46px; }
td.time.hour { background: #ececec; }
td.band { width: 14px; padding: 0; }
.band-orange { background: #ffb066; }
.band-blue { background: #7fb2f0; }
.band-yellow { background: #ffe94d; }
.band-green { background: #7ed07e; }

td.jobcell { min-width: 84px; }
td.jobcell.mustrun { box-shadow: inset 4px 0 0 #2e9e44; }
td.jobcell.manualopen { box-shadow: inset 4px 0 0 royalblue; }
td.dim { background: #f7f7f7; }
td.blockout { background: #000; padding: 3px 6px; }
.bo-label {
  display: inline-block; background: transparent; color: #ff2d20;
  font-weight: 800; letter-spacing: 1.5px; font-size: 11.5px;
  padding: 2px 10px; border-radius: 0;
}
td.checksband { background: #b8860b; color: #fff; padding: 3px 6px; vertical-align: middle; }
.cb-label {
  display: inline-block; color: inherit; font-weight: 800;
  letter-spacing: 1.5px; font-size: 11.5px;
}
td.click, th.click { cursor: pointer; }
td.click:hover, th.click:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.lock-ic { font-size: 10px; margin-left: 3px; }

.chip {
  display: inline-block; padding: 1px 8px; border-radius: 0;
  font-weight: 600; font-size: 11.5px; border: 1px solid rgba(0,0,0,.15);
}
/* full-cell staff tile (excel style) */
td.fillcell { padding: 0 4px; font-weight: 700; font-size: 11.5px; }
td.fillcell .fill-text { display: inline-block; }
td.fillcell .lock-ic { margin-left: 4px; }

.chip.mini { padding: 0 6px; font-size: 10.5px; }
.ghost { color: #bbb; font-weight: 700; }

/* staff activity cells */
td.act { font-size: 10px; font-weight: 600; color: #444; padding: 1px 3px; min-width: 58px; }
td.freecell, td.nosh { min-width: 58px; }
.act-brief { background: #dcebff; }
.act-inst { background: #2f6fd0; color: #fff; }
.act-deg { background: #dcebff; }
.act-drive { background: #e3d2f7; }
.act-hr { background: #ffe94d; }
.act-cbrief, .act-cdeb { background: #d9f2d9; }
.act-coach { background: #2e9e44; color: #fff; }
.act-coach-inst { background: #145c28; color: #fff; }
.act-break { background: var(--red); color: #fff; }
.act-desk { background: #b7e5ee; }
.act-bdesk { background: #7ec7d6; }
td.jobcell.nohr {
  background: #d33; color: #fff; text-align: center;
  font-weight: 800; letter-spacing: 1px; font-size: 11.5px;
}
/* Status column - bookings indicator only */
td.sess-status {
  font-size: 9.5px; font-weight: 800; text-align: center;
  letter-spacing: .5px; min-width: 56px; white-space: nowrap;
}
td.sess-status.st-open { background: #e6f6ea; color: #1d7a35; }
td.sess-status.st-count { background: #fff3d6; color: #8a6100; }
td.sess-status.st-count.st-flash { animation: stFlash 1s steps(1) infinite; }
td.sess-status.st-training { background: #2e9e44; color: #fff; }
td.sess-status.st-running { background: #4169e1; color: #fff; }
td.sess-status.st-closed { background: #d33; color: #fff; }
td.sess-status.st-done { background: #f2f2f2; color: #999; }
@keyframes stFlash {
  0%, 100% { background: #d33; color: #fff; }
  50% { background: #fff3d6; color: #d33; }
}
/* an FD 1 GAP is critical - same flash language as NO MORE BOOKING */
td.fd-cell.fd-gap-flash { animation: stFlash 1s steps(1) infinite; }
td.fd-cell.fd-gap-flash .bad-text { color: inherit; }

/* booked tick column */
td.booked-tick { text-align: center; width: 26px; }
td.booked-tick.on { background: #dff3df; box-shadow: inset 0 0 0 1px #2e9e44; }

/* session notes column - purple note tiles */
td.sess-note { min-width: 92px; }
td.sess-note.set {
  background: #7c3aed; color: #fff; text-align: center;
  font-weight: 700; font-size: 11px; letter-spacing: .5px;
}
.act-checks { background: #b8860b; color: #fff; }
.act-free { background: #dff2df; color: #1d5c2f; }
.act-office { background: #e8eef7; color: #2a4a73; }
.act-leave { background: #d33; color: #fff; font-weight: 700; }
.act-prayer { background: #146b3a; color: #fff; font-weight: 700; }
.prayer-sym { margin-left: 4px; font-weight: 700; color: #146b3a; }
.og-cell.work .prayer-sym { color: #146b3a; }
.st-prayer { border: 1px solid var(--border-strong); border-radius: 0; padding: 3px 6px; font-size: 12px; }
.pop-note.note-offshift { color: #000; font-weight: 800; }

/* ---------- Ramadan page (Root) ---------- */
.ram-period { display: flex; align-items: center; gap: 18px; margin: 4px 0 14px; }
.ram-datewrap { display: inline-flex; align-items: center; gap: 8px; }
.ram-status { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--muted); }
.ram-status.on { background: #146b3a; color: #fff; padding: 3px 10px; }
table.ram-table th, table.ram-table td { padding: 5px 12px; }

/* ---------- Leave page (public) ---------- */
.lv-note { color: var(--muted); font-size: 12px; margin: 4px 0 12px; max-width: 720px; }
table.leave-table th, table.leave-table td { padding: 5px 12px; text-align: center; }
table.leave-table td.lv-asof { font-weight: 600; }
table.leave-table td.lv-none { color: var(--muted); }
table.leave-table td.lv-rem { font-weight: 800; }
table.leave-table td.lv-rem.neg { background: #d33; color: #fff; }
.act-training { background: #2e9e44; color: #fff; font-weight: 700; }
.act-event { background: #ffb300; color: #000; font-weight: 700; }
td.freecell { background: #fff; }
td.nosh {
  background: repeating-linear-gradient(45deg, #fafafa 0 6px, #f0f0f0 6px 12px);
}
td.offcol { background: #000; color: #fff; vertical-align: middle; text-align: center; width: 58px; min-width: 58px; }
td.offcol.absent { background: #c22; }
/* the off/rest column spans the whole day - never mute it as "past" */
tr.locked td.offcol { filter: none; opacity: 1; }
.vert-label {
  writing-mode: vertical-rl; transform: rotate(180deg);
  display: inline-block;
  font-weight: 700; letter-spacing: 2px; margin: 0; color: inherit;
}

/* ---------- change preview: floating card, follows the scroll ---------- */
@keyframes previewGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 0, 0, 0), 0 10px 30px rgba(0, 0, 0, .3); }
  50% { box-shadow: 0 0 0 7px rgba(224, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .3); }
}
.preview-bar {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  width: 360px; max-width: calc(100vw - 40px);
  background: #fff; border: 2px solid var(--red); border-radius: 0;
  padding: 14px 16px;
  animation: previewGlow 1.4s ease-in-out infinite;
}
.preview-title {
  font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--red);
}
.preview-lab { font-weight: 600; font-size: 12px; color: #333; margin: 6px 0 10px; line-height: 1.5; }
.preview-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: flex; }
.seg-btn { border-color: var(--border-strong); color: var(--muted); background: #fff; }
.seg-btn.active { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
/* proposed (unconfirmed) cells render faded in the After view */
#page:not(.before-view) td.ghost { opacity: 0.55; }
/* while inspecting the original plan, the grid is read-only */
.before-view .grid-wrap, .before-view .panels { pointer-events: none; }
td.ghost, th.ghost {
  outline: 2px dashed #ff8c00 !important; outline-offset: -2px;
  position: relative;
}

/* locked (past) rows/cells - muted colours, not greyscale */
tr.locked td, td.locked, th.locked {
  filter: saturate(0.35) contrast(0.92);
  opacity: 0.7;
  cursor: default !important;
}
tr.locked td.click:hover, td.locked.click:hover { outline: none; }
/* Root correcting the past: locked look, but hover shows it IS editable */
td.og-cell.locked.rootedit { cursor: pointer; }
td.og-cell.locked.rootedit:hover { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* coach & spot cells */
td.coach-cell { min-width: 70px; background: #eef7ee; }
td.spot-cell { min-width: 70px; background: #f0edf9; }
.act-spot { background: #b9a8e8; color: #241a4d; }
td.splitcell { padding: 0; }
.split-wrap { display: flex; width: 100%; height: 100%; min-height: 24px; align-items: stretch; }
.split-seg {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 10.5px; overflow: hidden;
  border-left: 1px solid rgba(0,0,0,.3);
}
.split-seg:first-child { border-left: none; }

/* front desk */
.fd-wrap { max-width: 620px; } /* no extra top margin - panels align at the same height */
table.fd { width: 100%; }
.fd-cell { min-width: 110px; }

/* ---------- popover ---------- */
.popover {
  position: absolute; z-index: 350; /* above the tutorial shade so guided menus stay usable */
  background: #fff; border: 1px solid var(--border-strong); border-radius: 0;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  min-width: 220px; max-height: 340px; overflow-y: auto; padding: 4px;
}
.pop-header {
  font-weight: 700; font-size: 12px; padding: 6px 10px 4px; color: var(--muted);
  border-bottom: 1px solid var(--border); margin-bottom: 3px;
}
.pop-item {
  display: flex; align-items: center; gap: 7px; width: 100%;
  background: none; border: none; text-align: left; padding: 5px 10px;
  border-radius: 0; cursor: pointer; font-size: 12.5px;
}
.pop-item:hover { background: var(--head-bg); }
.pick-tile {
  display: inline-block; width: 100px; padding: 4px 0; text-align: center;
  font-weight: 700; font-size: 11.5px; border-radius: 0;
  border: 1px solid rgba(0,0,0,.25); flex-shrink: 0;
}
.pop-item.danger { color: var(--red); }
.pop-item .tick { color: var(--accent); font-weight: 700; }
.pop-label { flex: 1; }
.pop-note { color: var(--muted); font-size: 11px; }
.pop-form { display: flex; gap: 6px; align-items: center; padding: 8px 10px; }
.pop-form input { border: 1px solid var(--border-strong); border-radius: 0; padding: 4px 6px; }
.pop-form input[type="number"] { width: 72px; }
.pop-form-lab { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.pop-note-line { padding: 0 10px 4px; color: var(--muted); font-size: 11px; }
.pop-actions { display: flex; gap: 6px; padding: 6px 10px 8px; }

/* ---------- ongoing ---------- */
table.ongoing th, table.ongoing td { min-width: 72px; }
.og-corner, .og-counterlab, .og-name { background: var(--head-bg); text-align: left !important; position: sticky; left: 0; z-index: 6; }
.og-name { text-align: center !important; font-weight: 700; min-width: 84px; }
/* rate colour coding: blue = PEAK, green = OFF PEAK */
th.og-day.rate-peak { background: #dbe5ff !important; }
th.og-day.rate-offpeak { background: #dcf2dc !important; }
.og-month { cursor: pointer; letter-spacing: 1px; font-weight: 700; }
.og-month.rate-peak { background: #b9ccff !important; }
.og-month.rate-offpeak { background: #b6dfb6 !important; }
.og-month.rate-peak:hover { background: #a3bcfa !important; }
.og-month.rate-offpeak:hover { background: #a2cfa2 !important; }
/* today's column wears a royal-blue wash over its normal colours */
table.ongoing .today { position: relative; }
table.ongoing .today::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(65, 105, 225, 0.18);
  pointer-events: none;
}
.og-counter { font-weight: 700; }
.og-counter.bad { background: var(--red-bg); }
.og-counter.good { background: var(--green-bg); }
.og-group th { background: #111; color: #fff; text-align: center !important; letter-spacing: 1.5px; font-weight: 700; }
table.grid .group-gap td {
  height: 18px; background: #fff; border: none; padding: 0;
}
.og-cell.off { background: #000; color: #fff; font-size: 10px; font-weight: 700; }
.og-cell.absent { background: #d33; color: #fff; font-weight: 700; }
.og-cell.ph { background: #d33; color: #fff; font-weight: 700; }
.og-cell.work { background: #fff; }
.og-cell.partial {
  background: linear-gradient(135deg, #fff 55%, #f8caca 55%);
  font-weight: 700; white-space: nowrap;
}
/* saving: whole top bar turns amber; a transparent shield blocks input
   until the write is confirmed (admin/root only) */
header.topbar.saving { background: #ffb300; border-bottom-color: #c78900; }
header.topbar.saving .save-ind { background: #fff; }
.save-lock {
  position: fixed; inset: 0; z-index: 900;
  background: transparent; cursor: wait;
}

/* root name-check: clicked Ongoing names go black/white for 3 minutes */
th.og-name.namecheck { background: #000 !important; color: #fff !important; }

/* adjusted shift (this date only) - peach so the changed hours stand out */
.og-cell.work.adjusted { background: #ffd9a8; color: #6b4300; font-weight: 700; }
.og-cell.training { background: #2e9e44; color: #fff; font-weight: 700; }
.og-cell.event { background: #ffb300; color: #000; font-weight: 700; }
tr.og-group.training-head th { background: #2e9e44; }
tr.og-group.event-head th { background: #ffb300; color: #000; }
.ds-trainlab { font-size: 10px; color: var(--muted); }
.mgr-star { color: #d4a500; font-size: 11px; }

/* ---------- shifts ---------- */
table.shifts td.sh-cell { min-width: 96px; }
.sh-times { font-weight: 600; }
.sh-total { font-size: 10px; color: var(--muted); }
td.sh-cell.off { color: #bbb; background: #fafafa; }
td.sh-days { font-weight: 700; }
td.sh-days.bad { background: var(--red-bg); color: var(--red); }

/* ---------- bottom panels (roster) ---------- */
.panels { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; margin-top: 18px; }
.panels .sec-title { margin-top: 0; white-space: nowrap; } /* panel titles all one line, tables aligned */

/* day change log (audit trail; logged-in only) - wide, one line per entry */
.audit-wrap { flex: 1 1 520px; min-width: 420px; max-width: 100%; }
.audit-list { border: 1px solid var(--border-strong); background: #fff; max-height: 480px; overflow-y: auto; }
.audit-row {
  display: flex; gap: 10px; align-items: baseline;
  border-bottom: 1px solid var(--border); padding: 5px 10px; white-space: nowrap;
}
.audit-row:last-child { border-bottom: none; }
.audit-when { color: var(--muted); font-size: 10.5px; flex-shrink: 0; }
.audit-who { font-weight: 800; font-size: 12px; flex-shrink: 0; min-width: 56px; }
.audit-what { font-size: 11.5px; color: #333; overflow: hidden; text-overflow: ellipsis; }
.audit-empty { color: var(--muted); font-size: 12px; padding: 8px 10px; margin: 0; }

/* manager login inputs (staff page) */
td.st-login input { width: 86px; border: 1px solid var(--border-strong); border-radius: 0; padding: 3px 6px; font-size: 11.5px; }
td.st-login input + input { margin-left: 4px; }
.shifts-panel table.dayshifts { min-width: 360px; }
.ds-name { min-width: 90px; }
.ds-status.absent { background: #d33; color: #fff; font-weight: 700; }
td.ds-ot.has-ot { background: #ffe08a; font-weight: 800; }
td.ds-ut.has-ut { background: var(--red-bg); color: var(--red); font-weight: 800; }
td.ds-bang.unusual { background: var(--red); color: #fff; font-weight: 800; text-align: center; }
/* per-person note for the date ("Late - here at 14:15") - amber so it reads
   as an advisory, not an alarm; wraps rather than stretching the panel */
td.ds-note { min-width: 120px; max-width: 190px; }
td.ds-note.set {
  background: #ffe08a; color: #4a3200; font-weight: 700;
  font-size: 11px; white-space: normal; line-height: 1.25;
}
.ds-status.off { background: #000; color: #fff; font-size: 10px; font-weight: 700; }

/* ---------- ongoing toolbar ---------- */
.og-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.og-range { color: var(--muted); font-size: 12.5px; margin-left: 8px; }
.og-cell.na { background: repeating-linear-gradient(45deg, #fafafa 0 6px, #f0f0f0 6px 12px); }
td.og-phflag { text-align: center; background: #fff; }
td.og-phflag input { margin: 0; }
.og-note-cell { padding: 0 !important; vertical-align: top; position: relative; }
.og-note {
  min-width: 70px; max-width: 180px; min-height: 20px; width: 100%;
  border: none; background: transparent;
  font-size: 10px; text-align: center; padding: 4px;
  white-space: normal; overflow-wrap: break-word;
}
/* notes open the shared note box, so the whole cell is the click target */
.og-note-cell.click { cursor: pointer; }
.og-note-cell.click:hover .og-note { outline: 1px dashed var(--border-strong); outline-offset: -3px; }
.og-notecolor {
  position: absolute; top: 2px; right: 2px; width: 8px; height: 8px;
  border: 1px solid #999; padding: 0; cursor: pointer; opacity: 0;
}
.og-note-cell:hover .og-notecolor { opacity: 1; }
td.og-ph {
  font-size: 9.5px; white-space: nowrap; vertical-align: top;
  background: #f2f7ff; color: #12315c; font-weight: 600; line-height: 1.25;
  padding: 2px 4px;
}
.og-ph-name { display: block; text-align: center; }
.ph-tick { display: inline-block; width: 14px; }
.pop-done { margin: 6px 10px 6px; }

/* ---------- analytics ---------- */
.an-stats { border: 1px solid var(--border-strong); margin-bottom: 12px; }
.counter.an-stat { width: auto; min-width: 96px; padding: 0 14px; }
.counter.an-stat.wide { min-width: 140px; }
.an-topname { font-size: 15px; padding: 2px 10px; border: 1px solid rgba(0,0,0,.2); }
/* masonry columns - short panels pack without leaving row gaps */
.an-grid { columns: 340px; column-gap: 12px; }
.an-panel {
  border: 1px solid var(--border-strong); background: #fff; padding: 10px 14px 12px;
  break-inside: avoid; margin: 0 0 12px;
}
/* top row: heatmap + peak table share a line, wrap on narrow screens */
.an-toprow { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; margin-bottom: 12px; }
.an-toprow .an-panel { margin-bottom: 0; }
.an-heatpanel { flex: 0 1 auto; min-width: 0; }
.an-peakpanel { flex: 1 1 300px; }
.an-heatwrap { overflow-x: auto; }
.an-title { margin: 0 0 8px; }
.an-empty, .an-note { color: var(--muted); font-size: 11px; margin: 4px 0 0; }
.an-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.an-name {
  width: 88px; flex-shrink: 0; text-align: center; font-weight: 700;
  font-size: 10.5px; border: 1px solid rgba(0,0,0,.2); padding: 2px 0;
}
.an-track { flex: 1; background: #f4f4f4; height: 16px; }
.an-bar { height: 100%; border: 1px solid rgba(0,0,0,.18); }
.an-val { min-width: 64px; font-weight: 700; font-size: 11px; text-align: left; white-space: nowrap; }
/* blockout heatmap */
table.an-heat { border-collapse: collapse; }
table.an-heat th, table.an-heat td {
  border: 1px solid var(--border); font-size: 9.5px; text-align: center;
  min-width: 34px; height: 17px; padding: 0 3px; font-weight: 700;
}
table.an-heat th { background: var(--head-bg); color: var(--muted); font-weight: 600; }
/* utilisation stacked bars */
.an-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 8px; }
.an-legitem { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.an-legswatch { width: 10px; height: 10px; display: inline-block; border: 1px solid rgba(0,0,0,.25); }
.an-track.an-stack { display: flex; }
.an-seg { height: 100%; border-right: 2px solid #fff; box-sizing: border-box; }
.an-seg:last-child { border-right: none; }
/* peak vs off-peak table */
table.an-peak { border-collapse: collapse; width: 100%; }
table.an-peak th, table.an-peak td {
  border: 1px solid var(--border); padding: 4px 10px; font-size: 12px; text-align: center;
}
table.an-peak th:first-child { text-align: left; background: var(--head-bg); font-weight: 600; }
.an-peakhead.peak { background: royalblue; color: #fff; letter-spacing: 1px; }
.an-peakhead.offpeak { background: #2e9e44; color: #fff; letter-spacing: 1px; }
/* MC per-staff table */
table.an-mc { border-collapse: collapse; width: 100%; }
table.an-mc th, table.an-mc td {
  border: 1px solid var(--border); padding: 3px 8px; font-size: 11.5px; text-align: center;
}
table.an-mc th { background: var(--head-bg); font-weight: 600; color: var(--muted); }
td.an-mcname { font-weight: 700; }
td.an-mcflag.bad { background: #d33; color: #fff; font-weight: 800; letter-spacing: 1px; }
.og-ph-name.everyone { font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }

/* marked cell - bright magenta "action needed" flag (visual only) */
.og-cell.marked { background: #ff00cc; color: #fff; font-weight: 800; }

/* ---------- tutorial ---------- */
.nav-btn.tut-launch { margin-left: 10px; color: #2a4fb8; border-color: #b9ccff; }
.save-ind.tutorial { border-color: #b9ccff; background: #eef2ff; color: #2a4fb8; }
.save-ind.viewonly { border-color: var(--border-strong); background: #f4f4f5; color: var(--muted); }
.nav-btn.auth-btn { margin-left: 10px; }
/* small version tag at the far right of the top bar */
.app-ver { font-size: 10px; color: var(--muted); white-space: nowrap; user-select: none; }
.tut-spot {
  position: fixed; z-index: 300; pointer-events: none;
  border: 2px solid royalblue; border-radius: 0;
  box-shadow: 0 0 0 200vmax rgba(10, 10, 20, .62);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
}
.tut-spot.tut-center { border: none; }
.tut-box {
  position: fixed; z-index: 301; width: 380px; max-width: calc(100vw - 20px);
  background: #fff; border: 1px solid var(--border-strong); border-top: 4px solid royalblue;
  padding: 14px 16px; box-shadow: 0 10px 34px rgba(0, 0, 0, .4);
}
.tut-sec { font-size: 9.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.tut-title { font-size: 15px; font-weight: 800; margin-top: 2px; }
.tut-body { font-size: 12.5px; line-height: 1.55; margin: 8px 0 10px; }
.tut-wait { font-size: 11px; font-weight: 700; color: #2a4fb8; margin-bottom: 8px; }
.tut-actions { display: flex; gap: 6px; align-items: center; }
.tut-actions .tut-select { border: 1px solid var(--border-strong); border-radius: 0; padding: 4px 6px; font-size: 12px; margin-left: auto; }
.tut-actions .tut-exit { color: var(--red); }

/* clear-shifts (Shifts page) */
.date-tabs .tab.clear-shifts { margin-left: auto; color: var(--red); border-color: #f5b5b5; }
.pop-err { color: var(--red); font-size: 12px; font-weight: 600; padding: 0 10px 8px; min-height: 14px; }

/* blockouts-per-day hover tooltip */
.an-trend { position: relative; }
.an-tip {
  display: none; position: absolute; bottom: calc(100% + 6px); z-index: 20;
  background: #141414; color: #fff; padding: 6px 10px; border-radius: 0;
  font-size: 11px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
.an-tip-date { font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.an-tip-count { color: #ffb3b3; font-weight: 700; margin-top: 2px; }
.an-tip-times { color: #ddd; margin-top: 1px; }

/* flagged day - roster needs attention: pulsing red column + red tabs */
@keyframes flagPulse { 0%, 100% { opacity: .22; } 50% { opacity: .5; } }
.og-flagcol {
  display: block; position: absolute; pointer-events: none; z-index: 5;
  background: #d33; animation: flagPulse 1.5s ease-in-out infinite;
}
@keyframes tabFlagPulse { 50% { background: #ff7070; } }
.date-tabs .tab.flagged {
  background: var(--red); border-color: #b02020; color: #fff; font-weight: 800;
  animation: tabFlagPulse 1.5s ease-in-out infinite;
}

/* ongoing hover crosshairs */
.xhair-col, .xhair-row {
  display: none; position: absolute; pointer-events: none; z-index: 6;
  background: rgba(65, 105, 225, .12);
}
.pop-label.ph-everyone { font-weight: 800; }
.an-trend { display: flex; align-items: flex-end; gap: 2px; height: 90px; border-bottom: 1px solid var(--border-strong); }
.an-colwrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 1px; height: 100%;
}
.an-colval { font-size: 9px; font-weight: 700; color: var(--fg); line-height: 1; }
.an-col { width: 100%; background: var(--accent); }
.an-col.zero { background: #d8d8d8; }
.an-col.today { outline: 2px solid royalblue; outline-offset: -2px; }
.an-axis { display: flex; gap: 2px; margin-top: 2px; }
.an-axislab { flex: 1; text-align: center; font-size: 9px; color: var(--muted); overflow: hidden; }

/* ---------- staff page ---------- */
.st-date { border: 1px solid var(--border-strong); border-radius: 0; padding: 3px 6px; font-size: 12px; }
.add-form { display: flex; gap: 8px; margin: 8px 0 14px; }
.add-form input, .add-form select { border: 1px solid var(--border-strong); border-radius: 0; padding: 6px 10px; font-size: 13px; }
table.staff-table th, table.staff-table td { padding: 5px 12px; }
.st-name { text-align: center !important; min-width: 90px; }
.st-priority { width: 58px; border: 1px solid var(--border-strong); border-radius: 0; padding: 3px 6px; text-align: center; }
