/* ================================================================
   MustrHQ — a staff time clock for kitchens.
   Kiosk: dark graphite equipment panel, big touch targets (fluid via clamp).
   Admin: daylight operating instrument — cool steel neutrals, graphite ink,
          green only for state; the working clock is the hero. Flat, ruled,
          quiet, so the time reads first.
   Type: Space Grotesk (display) · IBM Plex Sans (body) · IBM Plex Mono (time)
   ================================================================ */

:root {
  --font-display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* kiosk (dark equipment) */
  --k-bg: #14171c;
  --k-surface: #1e232b;
  --k-surface2: #262d37;
  --k-ink: #f3f4f2;
  --k-muted: #97a0ad;
  --k-line: #333c47;
  --k-on: #12b981;
  --k-on-deep: #0c8f63;
  --k-off: #3a434f;
  --k-warn: #e0a021;
  --k-danger: #e0574f;

  /* admin (daylight instrument) */
  --paper: #edf0f2;
  --surface: #ffffff;
  --ink: #16191d;
  --ink-2: #59626e;
  --ink-3: #8a929c;
  --rule: #dce1e4;
  --rule-2: #e9edef;
  --brand: #01216c;
  --amber: #b7770f;
  --amber-accent: #fca311;
  --brand-deep: #011a56;
  --brand-tint: #e8edf6;
  --green: #0d9c66;
  --green-deep: #0a7a50;
  --green-tint: #e4f3ec;
  --amber: #b7770f;
  --amber-tint: #f5eeda;
  --red: #cf4640;
  --red-tint: #f7e4e3;
}

* { box-sizing: border-box; }

html:lang(zh-CN) {
  --font-display: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans CJK SC', system-ui, sans-serif;
  --font-body: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans CJK SC', system-ui, sans-serif;
  --font-mono: Consolas, 'SFMono-Regular', 'Microsoft YaHei', 'PingFang SC', ui-monospace, monospace;
}

.auth-art small a { color: inherit; text-decoration: underline; }

/* Safety net: our logo SVGs are ~1500x407 by nature, so an unstyled one would
   fill the screen. Use max-* only — never `height`, which would beat the
   class rules below on specificity and undo their sizing. */
img[src*="logo-"] { max-width: 100%; max-height: 48px; }

/* ============================ KIOSK ============================ */

body.kiosk {
  margin: 0;
  min-height: 100vh;
  background: var(--k-bg);
  color: var(--k-ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.k-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(14px, 2.6vw, 22px) clamp(18px, 4vw, 34px);
  border-bottom: 1px solid var(--k-line);
}
.k-ident { display: flex; align-items: center; gap: 14px; min-width: 0; }
/* The logo is a wide SVG: it MUST be height-constrained or it fills the screen. */
.k-logo {
  display: block;
  height: clamp(22px, 3vw, 34px);
  width: auto;
  max-width: min(46vw, 300px);
  object-fit: contain;
  flex: 0 1 auto;
}
.k-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 3.4vw, 24px);
  letter-spacing: -0.02em;
}
.k-place {
  font-size: clamp(13px, 2.4vw, 15px);
  color: var(--k-muted);
  padding-left: 14px;
  border-left: 1px solid var(--k-line);
  line-height: 1.2;
}
.k-now { text-align: right; }
.k-clock {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(30px, 7vw, 46px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--k-ink);
  white-space: nowrap;
}
.k-meta {
  display: flex; justify-content: flex-end; align-items: center; gap: 14px;
  margin-top: 7px; font-size: clamp(12px, 2.2vw, 14px); color: var(--k-muted);
}
.k-onnow { display: inline-flex; align-items: center; gap: 7px; }
.k-date { padding-right: 14px; border-right: 1px solid var(--k-line); }
.k-onnow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--k-off); }
.k-onnow.live { color: var(--k-on); }
.k-onnow.live .dot { background: var(--k-on); box-shadow: 0 0 0 4px rgba(18,185,129,0.16); }

/* Centre the crew in the available space so the screen never looks half-empty. */
.k-main {
  min-height: calc(100vh - 108px);
  display: flex; flex-direction: column; justify-content: center;
  padding-bottom: clamp(20px, 5vh, 60px);
}
.k-hint {
  text-align: center;
  color: var(--k-muted);
  font-size: clamp(14px, 3.6vw, 16px);
  margin: 0 0 clamp(16px, 3vh, 28px);
}

.k-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 20vw, 230px), 1fr));
  gap: clamp(12px, 1.8vw, 20px);
  padding: 0 clamp(16px, 4vw, 34px);
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.4vw, 16px);
  padding: clamp(20px, 2.6vw, 30px) 16px clamp(18px, 2.2vw, 24px);
  background: var(--k-surface);
  border: 1px solid var(--k-line);
  border-radius: clamp(14px, 1.6vw, 20px);
  color: var(--k-ink);
  font-family: var(--font-body);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.06s ease, border-color 0.12s ease, background 0.12s ease;
}
.tile:hover { background: #232933; }
.tile:active { transform: scale(0.98); }

/* On shift: unmistakable from across the kitchen. */
.tile.on {
  background: linear-gradient(180deg, rgba(18,185,129,0.10), rgba(18,185,129,0.02));
  border-color: rgba(18,185,129,0.55);
}
.tile.on::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--k-on);
}

.tile-face {
  width: clamp(66px, 7.5vw, 96px);
  height: clamp(66px, 7.5vw, 96px);
  border-radius: 50%;
  background: var(--k-surface2);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.12s ease;
}
.tile.on .tile-face { border-color: var(--k-on); }
.tile-face img { width: 100%; height: 100%; object-fit: cover; }
.tile-initials {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(24px, 3vw, 34px); color: #6d7885;
}
.tile.on .tile-initials { color: var(--k-on); }

.tile-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(17px, 1.9vw, 23px);
  text-align: center;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.tile-state {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(13px, 1.2vw, 15px);
  color: var(--k-muted);
}
.tile-state .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--k-off); }
.tile.on .tile-state .dot { background: var(--k-on); box-shadow: 0 0 0 4px rgba(18,185,129,0.16); }
.tile.on .tile-state-text { color: var(--k-on); font-weight: 500; }
.tile-elapsed {
  font-family: var(--font-mono); color: var(--k-on);
  font-variant-numeric: tabular-nums; font-size: clamp(13px, 1.2vw, 15px);
}

.k-devlink {
  position: fixed; right: 14px; bottom: 12px;
  color: #3f4855; font-size: 12px; text-decoration: none;
  padding: 6px 10px; border-radius: 8px;
}
.k-devlink:hover { color: var(--k-muted); }

.k-empty { text-align: center; color: var(--k-muted); padding: 40px 20px; }
.k-empty h2 { font-family: var(--font-display); color: var(--k-ink); }

/* overlays */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 15, 0.74);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}
.overlay[hidden] { display: none; }

.sheet {
  position: relative;
  width: min(430px, 100%);
  background: var(--k-surface);
  border: 1px solid var(--k-line);
  border-radius: 20px;
  padding: clamp(22px, 5vw, 30px) clamp(18px, 4vw, 26px) clamp(20px, 4vw, 26px);
  text-align: center;
}
.sheet-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--k-surface2);
  border: 1px solid var(--k-line);
  color: var(--k-muted);
  font-size: 18px;
  cursor: pointer;
}
.sheet-name { font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 5.5vw, 26px); }
.sheet-sub { color: var(--k-muted); margin: 6px 0 18px; }

.dots { display: flex; justify-content: center; gap: 16px; margin-bottom: 14px; }
.dots span {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--k-line); background: transparent;
  transition: background 0.1s ease, border-color 0.1s ease;
}
.dots span.filled { background: var(--k-on); border-color: var(--k-on); }
.pin-msg { color: var(--k-danger); min-height: 22px; font-size: 15px; margin-bottom: 10px; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(8px, 2vw, 12px); }
.keypad button {
  font-family: var(--font-mono);
  font-size: clamp(22px, 6vw, 26px);
  min-height: clamp(52px, 12vw, 66px);
  background: var(--k-surface2);
  border: 1px solid var(--k-line);
  border-radius: 14px;
  color: var(--k-ink);
  cursor: pointer;
  transition: transform 0.05s ease, background 0.1s ease;
}
.keypad button:active { transform: scale(0.97); background: #2f3743; }
.keypad .key-blank { visibility: hidden; }
.keypad .key-back { font-size: 22px; color: var(--k-muted); }

.brand-choices { display: grid; gap: 12px; }
.brand-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(18px, 4.6vw, 20px);
  padding: clamp(16px, 4vw, 20px);
  background: var(--k-surface2);
  border: 1px solid var(--k-line);
  border-radius: 14px;
  color: var(--k-ink);
  cursor: pointer;
}
.brand-btn:active { transform: scale(0.99); }

.overlay.result .result-inner { text-align: center; }
.result-mark {
  width: clamp(84px, 22vw, 104px); height: clamp(84px, 22vw, 104px); border-radius: 50%;
  display: grid; place-items: center;
  font-size: clamp(42px, 11vw, 54px); color: #fff;
  margin: 0 auto 20px;
  background: var(--k-off);
}
.overlay.is-in .result-mark { background: var(--k-on); }
.overlay.is-out .result-mark { background: var(--k-warn); }
.result-big { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 9vw, 42px); }
.result-sub { color: var(--k-muted); font-size: clamp(15px, 4vw, 18px); margin-top: 8px; }

.shake { animation: shake 0.32s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}

/* ============================ ADMIN ============================ */
/* Shell: navy sidebar + light workspace, matching MustrHQ Station. */

body.admin {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.admin.has-side { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.navtog-input { display: none; }

/* ---- sidebar ---- */
.side {
  background: linear-gradient(180deg, #01216c 0%, #01174d 100%);
  color: #fff; padding: 20px 12px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30;
}
.side-brand { display: block; padding: 2px 10px 22px; }
.side-brand img { display: block; height: 26px; width: auto; }
.sidenav { display: flex; flex-direction: column; }
.side .grp {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: #7c8bb0; margin: 16px 12px 7px;
}
.sidenav a {
  display: flex; align-items: center; gap: 11px;
  color: #ccd4e6; text-decoration: none;
  padding: 9px 12px; border-radius: 10px; margin-bottom: 2px;
  font-weight: 500; font-size: 14.5px;
  transition: background .12s, color .12s;
}
.sidenav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidenav a.on { background: var(--amber-accent); color: #16191d; font-weight: 600; box-shadow: 0 4px 14px rgba(252,163,17,.28); }
.sidenav a .ic { flex: none; }

.side-foot { margin-top: auto; padding-top: 14px; }
.side-kiosk {
  display: flex; align-items: center; gap: 10px;
  color: #aab5cf; text-decoration: none; font-size: 13.5px;
  padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14);
  margin-bottom: 12px;
}
.side-kiosk:hover { color: #fff; border-color: rgba(255,255,255,.3); }
.who { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
.who .av {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--amber-accent); color: #16191d;
  display: grid; place-items: center; font-weight: 700; font-family: var(--font-display); font-size: 13px;
}
.who b { display: block; font-size: 14px; font-weight: 600; color: #fff; }
.who a { display: inline-flex; align-items: center; gap: 6px; color: #9fabc6; font-size: 12.5px; text-decoration: none; }
.who a:hover { color: #fff; }
.who a .ic { width: 14px; height: 14px; }
.scrim { display: none; }

/* ---- workspace ---- */
.main { padding: 0 clamp(16px, 3vw, 32px) 40px; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  margin: 0 clamp(-32px, -3vw, -16px) 22px;
  padding: 16px clamp(16px, 3vw, 32px);
  background: rgba(237,240,242,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar-title { min-width: 0; }
.topbar h1 { margin: 0; font-family: var(--font-display); font-size: clamp(20px, 3vw, 25px); font-weight: 600; letter-spacing: -.02em; }
.topbar .sub { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.burger {
  display: none; width: 42px; height: 42px; flex: none;
  border: 1px solid var(--rule); background: #fff; border-radius: 10px;
  cursor: pointer; place-items: center; color: var(--brand);
}

.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 24px; }
.auth-card { width: min(400px, 100%); }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 20px 22px; margin-bottom: 18px; }
.panel > h2 { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.01em; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--rule-2); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--rule-2); flex-wrap: wrap; }
.panel-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.01em; margin: 0; }
.panel-head .actions { margin-left: auto; }
.foot { margin-top: 30px; color: var(--ink-3); font-size: 12.5px; }
.foot a { color: var(--ink-2); }

/* ---- the working clock ---- */
.daybar {
  display: flex; align-items: center; gap: clamp(20px, 5vw, 44px); flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px;
  padding: clamp(18px, 3vw, 24px) clamp(20px, 4vw, 28px); margin-bottom: 18px;
}
.daybar-time { display: flex; flex-direction: column; gap: 3px; }
.daybar-clock {
  font-family: var(--font-mono); font-weight: 500;
  font-size: clamp(40px, 8vw, 58px); line-height: 1; letter-spacing: .01em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.daybar-date { font-size: 14px; color: var(--ink-2); }
.daybar-figs {
  display: flex; align-items: center; gap: clamp(18px, 4vw, 36px); flex-wrap: wrap;
  border-left: 1px solid var(--rule-2); padding-left: clamp(18px, 4vw, 36px); margin-left: auto;
}
.dfig { display: flex; flex-direction: column; gap: 4px; }
.dfig-n { font-family: var(--font-mono); font-weight: 500; font-size: 24px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.dfig-l { font-size: 13px; color: var(--ink-2); }
a.dfig { text-decoration: none; }
a.dfig:hover .dfig-l { color: var(--ink); }
.dfig-n .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 9px; vertical-align: middle; }
.dfig-n .dot.bad { background: var(--red); }
.dfig-n .dot.warn { background: var(--amber); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-2);
  padding: 0 12px 10px; white-space: nowrap; border-bottom: 1px solid var(--rule);
}
table.grid td { padding: 11px 12px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover td { background: #f6f8f9; }
td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tr.total td { border-top: 1px solid var(--rule); border-bottom: none; font-weight: 600; }
.empty-row td { color: var(--ink-2); text-align: center; padding: 34px 20px; font-size: 14.5px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand);
  display: inline-grid; place-items: center; overflow: hidden;
  font-size: 12px; font-weight: 600; font-family: var(--font-display);
  vertical-align: middle; object-fit: cover;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- state chips ---- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 500; line-height: 1.65; }
.badge.on, .badge.ontime { background: var(--green-tint); color: var(--green-deep); }
.badge.off { background: #eceff1; color: var(--ink-2); }
.badge.late { background: var(--amber-tint); color: var(--amber); }
.badge.noshow { background: var(--red-tint); color: var(--red); }
.badge.unscheduled { background: #e8edf1; color: var(--ink-2); }
.pinbox { display: inline-flex; align-items: baseline; gap: 9px; }
.pinbox .val { letter-spacing: .18em; font-weight: 600; }
.pinbox .dots { letter-spacing: .12em; color: var(--ink-2); }

.tag { display: inline-block; background: #eceff1; color: var(--ink-2); border-radius: 5px; padding: 2px 8px; font-size: 12.5px; margin: 0 3px 3px 0; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 9px;
  padding: 9px 15px; font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: filter .12s, transform .04s;
}
.btn:hover { filter: brightness(1.25); }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.ghost { background: #fff; border-color: var(--rule); color: var(--ink); }
.btn.ghost:hover { filter: none; background: #f5f7f8; border-color: var(--ink-3); }
.btn.amber { background: var(--amber-accent); border-color: var(--amber-accent); color: #16191d; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 14px; padding: 0; text-decoration: none; font-family: var(--font-body); }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--red); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }

/* ---- forms ---- */
label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 14px; color: var(--ink); }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=datetime-local], select, textarea {
  display: block; width: 100%; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: 9px;
  font-family: var(--font-body); font-size: 15px; margin-top: 6px;
  background: #fff; color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 22px; }
.filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.filters label { margin-bottom: 0; }
.filters .field { min-width: 150px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; margin-top: 8px; }
.check-grid label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14.5px; font-weight: 400; }
.check-grid input { width: auto; margin: 0; }
.hint { color: var(--ink-2); font-size: 13px; margin-top: 6px; }

/* ---- flashes ---- */
.flash { padding: 12px 15px; border-radius: 9px; margin-bottom: 18px; font-size: 14.5px; border: 1px solid transparent; }
.flash.ok { background: var(--green-tint); color: var(--green-deep); border-color: #c7e6d5; }
.flash.err { background: var(--red-tint); color: #a5352f; border-color: #f0cfcd; }
.flash.warn { background: var(--amber-tint); color: var(--amber); border-color: #ecdcb8; }

.muted { color: var(--ink-2); }
.right { text-align: right; }
code { font-family: var(--font-mono); background: #eceff1; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ======================= HOME · TILES · PLANNER ======================= */

/* sidebar colour runs the full page height, even on long pages */
body.admin.has-side { background: linear-gradient(90deg, #01174d 0 250px, var(--paper) 250px); }

.t-bad { color: var(--red) !important; }
.t-warn { color: var(--amber) !important; }
.t-ok { color: var(--green-deep) !important; }

/* welcome banner */
.welcome {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: radial-gradient(700px 260px at 100% 0%, #173f9e 0%, transparent 70%), linear-gradient(120deg, #01216c, #01174d);
  color: #fff; border-radius: 16px; padding: 26px 30px; margin-bottom: 20px;
}
.welcome-id { display: flex; align-items: center; gap: 18px; }
.welcome-av {
  width: 62px; height: 62px; border-radius: 50%; flex: none;
  background: #f3dcd3; color: #6a2f1f; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 23px;
}
.welcome h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: clamp(21px, 2.6vw, 27px); letter-spacing: -.02em; }
.welcome p { margin: 4px 0 0; color: #b9c4dd; font-size: 14.5px; }
.welcome-clock { font-family: var(--font-mono); font-size: clamp(30px, 4.4vw, 46px); font-weight: 500; letter-spacing: .02em; font-variant-numeric: tabular-nums; }

/* tile grid */
.tiles { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; align-items: stretch; }
.tile-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 14px;
  padding: 18px 18px 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 14px rgba(16,24,40,.04);
  min-height: 300px; display: flex; flex-direction: column;
}
.tc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tc-head h3 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.tc-go { color: var(--brand); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; }
.tc-go:hover { background: var(--brand-tint); }
.tc-empty { color: var(--ink-2); margin: auto 0; text-align: center; }
.tc-more { color: var(--ink-2); font-size: 13px; margin: 8px 0 0; }

/* segmented period control */
.seg { display: inline-flex; background: #e9edf1; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 11px; border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.seg a:hover { color: var(--ink); }
.seg a.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(16,24,40,.12); font-weight: 600; }
.seg .ic { width: 16px; height: 16px; }
.tc-period { margin: -4px 0 4px; }
.tc-period label { font-size: 12.5px; color: var(--ink-2); font-weight: 400; margin: 0; }
.tc-period select { margin-top: 3px; padding: 7px 30px 7px 10px; font-size: 14.5px; font-weight: 500; color: var(--ink); width: auto; max-width: 100%; }
.tc-body span { white-space: nowrap; }

/* timecard rows */
.tc-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 2px;
  border-bottom: 1px solid var(--rule-2); text-decoration: none; color: inherit;
}
.tc-row:last-child { border-bottom: 0; }
.tc-row:hover .tc-body b { color: var(--brand); }
.ring {
  width: 64px; height: 64px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 500; font-size: 26px; letter-spacing: -.03em;
}
.ring.bad { background: #fbe3e1; color: #d0342c; }
.ring.ok { background: var(--green-tint); color: var(--green-deep); }
.ring.neutral { background: #e7ebf1; color: #4a5a78; }
.ring .ic { width: 28px; height: 28px; }
.tc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 14px; color: var(--ink-2); }
.tc-body b { font-family: var(--font-display); font-size: 16.5px; color: var(--ink); font-weight: 600; }
.tc-body em { font-style: normal; font-weight: 700; color: var(--ink); margin-right: 5px; font-family: var(--font-mono); }
.chev { color: var(--brand); flex: none; }

/* on shift list */
.onlist { list-style: none; margin: 0; padding: 0; }
.onlist li { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--rule-2); }
.onlist li:last-child { border-bottom: 0; }
.on-name { flex: 1; min-width: 0; font-weight: 500; font-size: 14.5px; line-height: 1.25; }
.on-name small { display: block; color: var(--ink-2); font-weight: 400; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.on-el { color: var(--green-deep); font-size: 13.5px; font-weight: 600; }
.avatar.sm { width: 32px; height: 32px; font-size: 11.5px; flex: none; }
.avatar.live { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--green); }
.who-cell { display: inline-flex; align-items: center; gap: 10px; }

/* today */
.today-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.today-grid div { background: #f5f7f9; border-radius: 10px; padding: 12px 13px; }
.today-grid b { display: block; font-size: 23px; font-weight: 500; line-height: 1.1; }
.today-grid b small { font-size: 14px; color: var(--ink-3); }
.today-grid span { font-size: 12.5px; color: var(--ink-2); }
.today-cost { margin-top: auto; padding-top: 14px; display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--rule-2); font-size: 13.5px; color: var(--ink-2); }
.today-cost b { font-size: 18px; color: var(--ink); }

/* quick links */
.qlinks { list-style: none; margin: 0; padding: 0; }
.qlinks a { display: flex; gap: 12px; align-items: flex-start; padding: 11px 6px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-size: 13px; line-height: 1.35; }
.qlinks a:hover { background: #f4f6fa; }
.qlinks .ic { color: var(--brand); flex: none; margin-top: 2px; }
.qlinks b { display: block; color: var(--brand); font-size: 14.5px; font-weight: 600; margin-bottom: 2px; }

/* page toolbar + kpis */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tb-filter select { margin: 0; width: auto; padding: 8px 12px; font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 14px 16px;
  text-decoration: none; color: var(--ink-2); font-size: 13px; transition: border-color .12s;
}
.kpi b { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 500; color: var(--ink); letter-spacing: -.02em; line-height: 1.15; }
.kpi:hover { border-color: var(--ink-3); }
.kpi.on { border-color: var(--brand); box-shadow: inset 0 -3px 0 var(--brand); }
.allclear { display: flex; align-items: center; gap: 18px; padding: 10px 4px; }
.allclear b { font-size: 17px; }
.allclear p { margin: 2px 0 0; }

/* ---------- schedule planner ---------- */
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-left: auto; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 18px; height: 9px; border-radius: 3px; }
.lg.plan { border: 1.5px dashed #7d8cb3; background: #eef1f8; }
.lg.done { background: var(--brand); }
.lg.live { background: var(--green); }
.lg.late { background: var(--brand); box-shadow: inset 4px 0 0 var(--amber-accent); }
.lg.noshow { background: #fbe1df; }

.planner-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; margin-bottom: 14px; }
.planner { display: grid; grid-template-columns: 200px repeat(7, minmax(112px, 1fr)) 84px; min-width: 1050px; }
.planner > div { border-bottom: 1px solid var(--rule-2); }
.pl-head { padding: 12px 10px 6px; background: #f7f9fb; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--rule) !important; }
.pl-head.pl-name { display: flex; align-items: flex-end; font-weight: 600; color: var(--ink); font-size: 14px; }
.pl-head.pl-name small { color: var(--ink-3); font-weight: 400; margin-left: 5px; }
.pl-day { border-left: 1px solid var(--rule); text-align: center; }
.pl-day b { display: block; color: var(--ink); font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.pl-day.is-today b { color: var(--brand); }
.pl-day.is-today b::before { content: ''; display: inline-block; width: 8px; height: 8px; background: var(--amber-accent); border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); }
.ticks i { font-style: normal; }
.pl-tot { border-left: 1px solid var(--rule); text-align: right; padding: 0 12px; }
.pl-head.pl-tot { display: flex; align-items: flex-end; justify-content: flex-end; font-weight: 600; color: var(--ink); }

.pl-cov { padding: 8px 10px; background: #fbfcfd; border-left: 1px solid var(--rule); text-align: center; font-size: 12px; color: var(--ink-3); }
.pl-cov.pl-name { border-left: 0; text-align: left; font-weight: 600; color: #c24a3c; display: flex; align-items: center; font-size: 13px; }
.covn { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border: 1.5px solid #e08a80; color: #c24a3c; border-radius: 5px; font-weight: 700; font-family: var(--font-mono); font-size: 12.5px; }
.pl-cov small { display: block; margin-top: 3px; }

.pl-person { display: flex; align-items: center; gap: 10px; padding: 0 10px; min-height: 56px; font-weight: 500; font-size: 14px; }
.pl-person span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-cell { position: relative; border-left: 1px solid var(--rule); min-height: 56px;
  background-image: linear-gradient(90deg, transparent calc(25% - .5px), var(--rule-2) 25%, transparent calc(25% + .5px), transparent calc(50% - .5px), var(--rule-2) 50%, transparent calc(50% + .5px), transparent calc(75% - .5px), var(--rule-2) 75%, transparent calc(75% + .5px)); }
.pl-cell.is-today, .pl-cov.is-today { background-color: #f5f8ff; }
.pl-cell.is-noshow { background-color: #fdeceb; }
.pl-hours { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.pl-hours b { font-size: 15px; font-weight: 600; }
.pl-hours small { color: var(--ink-3); font-size: 11.5px; }
.pl-empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--ink-2); }

.bar { position: absolute; display: block; border-radius: 5px; }
.bar.plan { top: 7px; height: 21px; border: 1.5px dashed #7d8cb3; background: #eef1f8; overflow: hidden; }
.bar.plan em { font-style: normal; font-size: 10.5px; font-family: var(--font-mono); color: #3d4d75; padding: 0 4px; line-height: 18px; white-space: nowrap; }
.bar.plan.cont { border-right-style: solid; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bar.plan.tail { border-left-style: solid; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.act { top: 31px; height: 15px; background: var(--brand); }
.bar.act:hover { filter: brightness(1.35); }
.bar.act.live { background: var(--green); background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px); }
.bar.act.missed { background: var(--red); }
.bar.act.late { box-shadow: inset 4px 0 0 var(--amber-accent); }
.ns-tag { position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; font-weight: 700; color: #c24a3c; letter-spacing: .02em; }
.nowline { position: absolute; top: 0; bottom: -1px; width: 2px; background: #b5791b; z-index: 2; pointer-events: none; }
.nowline::before { content: ''; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: #b5791b; }

@media (max-width: 1280px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1040px) {
  body.admin.has-side { background: var(--paper); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* attendance on phones: one tidy line per person instead of a labelled card */
@media (max-width: 760px) {
  .compact-list table.grid tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 13px; }
  .compact-list table.grid td { display: block; padding: 0; border: 0; text-align: left; }
  .compact-list table.grid td::before { content: none; }
  .compact-list table.grid td[data-label="Status"] { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; }
  .compact-list table.grid td[data-label="Status"] .muted { display: block; font-size: 12px; margin-top: 3px; }
  .compact-list table.grid td[data-label="Rota"] { font-size: 12.5px; color: var(--ink-2); padding-left: 42px; }
}
@media (max-width: 760px) {
  .tiles { grid-template-columns: 1fr; gap: 12px; }
  .tile-card { min-height: 0; }
  .welcome { padding: 18px; border-radius: 14px; }
  .welcome-av { width: 48px; height: 48px; font-size: 18px; }
  .welcome-clock { font-size: 30px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi:first-child { grid-column: 1 / -1; }
  .legend { margin-left: 0; }
  .ring { width: 54px; height: 54px; font-size: 22px; }
}

/* standalone pages (first-admin setup) */
body.admin.centered { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.brand-logo { display: block; height: 26px; width: auto; }
.check-inline { display: flex; align-items: flex-start; gap: 9px; font-weight: 400; }
.check-inline input { width: auto; margin-top: 3px; }

/* ============================ SIGN IN ============================ */

body.auth-body { margin: 0; font-family: var(--font-body); color: var(--ink); background: var(--paper); }
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-art {
  background:
    radial-gradient(1100px 600px at -10% 110%, #123b9c 0%, transparent 60%),
    linear-gradient(160deg, #01216c 0%, #01123c 100%);
  color: #fff; padding: clamp(32px, 5vw, 56px); display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.auth-logo { display: block; height: 30px; width: auto; }
.auth-art h2 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(28px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -.03em;
  margin: auto 0 14px; max-width: 16ch;
}
.auth-art h2 span { color: var(--amber-accent); }
.auth-art p { color: #b9c4dd; font-size: 17px; max-width: 46ch; margin: 0 0 30px; }
.auth-art ul { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: 13px; }
.auth-art li { display: flex; gap: 12px; align-items: center; color: #dce3f0; font-size: 15px; }
.auth-art li i {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: rgba(252,163,17,.16); color: var(--amber-accent);
  display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 14px;
  font-family: var(--font-mono);
}
.auth-art small { color: #7c8bb0; margin-top: 32px; font-size: 12.5px; }

.auth-form { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h1 { font-family: var(--font-display); font-weight: 600; font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.auth-form .lead { color: var(--ink-2); margin: 0 0 26px; }
.auth-form input { padding: 13px 14px; font-size: 16px; }
.auth-form .btn { width: 100%; justify-content: center; padding: 14px; font-size: 16px; margin-top: 6px; }
.auth-form .fine { color: var(--ink-3); font-size: 13px; text-align: center; margin-top: 22px; }
.pw { position: relative; }
.pw button {
  position: absolute; right: 8px; top: 13px;
  border: 0; background: #f1f3f7; border-radius: 7px; padding: 5px 10px;
  font: inherit; font-size: 13px; cursor: pointer; color: var(--brand);
}

/* ========================= RESPONSIVE ========================= */

@media (max-width: 1040px) {
  /* sidebar slides in over the page */
  body.admin.has-side { display: block; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 268px; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 12px 0 40px rgba(1,18,60,.28);
  }
  .navtog-input:checked ~ .side { transform: none; }
  .navtog-input:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(1,18,60,.45); z-index: 25; }
  .burger { display: grid; }
  .main { padding: 0 16px 36px; }
  .topbar { margin: 0 -16px 18px; padding: 12px 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .main { padding: 0 12px 32px; }
  .topbar { margin: 0 -12px 14px; padding: 10px 12px; gap: 10px; }
  .panel { padding: 16px 15px; margin-bottom: 14px; }
  .panel-head { margin-bottom: 12px; padding-bottom: 10px; }

  .daybar { padding: 16px 16px 18px; gap: 14px; }
  .daybar-clock { font-size: 44px; }
  .daybar-figs { border-left: none; padding-left: 0; width: 100%; justify-content: space-between; gap: 14px; margin-left: 0; }

  /* tables become records, not sideways scrolling */
  .table-wrap { overflow-x: visible; }
  table.grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; width: auto; }
  table.grid tr {
    border: 1px solid var(--rule); border-radius: 11px;
    padding: 4px 13px; margin-bottom: 10px; background: var(--surface);
  }
  table.grid tbody tr:hover td { background: transparent; }
  table.grid td {
    padding: 9px 0; border-bottom: 1px solid var(--rule-2);
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    text-align: right; white-space: normal;
  }
  table.grid tr td:last-child { border-bottom: none; }
  table.grid td::before {
    content: attr(data-label);
    flex: 0 0 auto; text-align: left;
    color: var(--ink-2); font-size: 12.5px; font-weight: 500;
  }
  table.grid td[data-label=""] { justify-content: flex-end; }
  table.grid td[data-label=""]::before { content: none; }
  table.grid tr.total { background: var(--brand-tint); border-color: transparent; }
  table.grid .empty-row { border: none; background: transparent; padding: 0; }
  table.grid .empty-row td { display: block; text-align: center; border: none; }
  table.grid .empty-row td::before { content: none; }
  table.grid td .actions, table.grid td form.actions { justify-content: flex-end; }
  table.grid td { flex-wrap: wrap; }
  table.grid td form.actions { flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 4px; }
  table.grid td form.actions input, table.grid td form.actions select { width: 100% !important; min-width: 0 !important; margin: 0 !important; }
  table.grid td form.actions .btn-link { align-self: flex-end; }

  /* the rota grid stays a matrix */
  .rota-scroll { overflow-x: auto; }
  .rota-scroll table.grid, .rota-scroll table.grid tbody,
  .rota-scroll table.grid tr, .rota-scroll table.grid td { display: revert; }
  .rota-scroll table.grid thead { position: static; width: auto; height: auto; clip: auto; }
  .rota-scroll table.grid td::before { content: none; }
  .rota-scroll table.grid tr { border: none; padding: 0; margin: 0; }

  .filters { flex-direction: column; align-items: stretch; gap: 10px; }
  .filters .field { min-width: 0; }
  .btn { padding: 11px 15px; }
  .btn.small { padding: 8px 12px; }

  input[type=text], input[type=password], input[type=number], input[type=date],
  input[type=time], input[type=datetime-local], select, textarea { font-size: 16px; }

  /* sign-in stacks: brand panel on top, form below */
  .auth { grid-template-columns: 1fr; min-height: 0; }
  .auth-art { padding: 28px 22px 26px; }
  .auth-art h2 { margin: 22px 0 12px; font-size: 27px; }
  .auth-art ul, .auth-art small { display: none; }
  .auth-art p { margin-bottom: 4px; font-size: 15.5px; }
  .auth-form { padding: 28px 22px 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
