/* Tavex Scheduler — clean ops chrome. Brand colours via CSS variables (white-label). */

:root {
  /* Tavex PRO admin tokens (pixel reference) */
  --navy: #3A1658;
  --navy-dark: #2A0F42;
  --navy-light: #7B4FB0;
  --admin-accent: #7B4FB0;

  --bg: #f8f9fb;
  --bg-accent: #e9edf3;
  --paper: #ffffff;
  --ink: #0f0f10;
  --ink-2: #3d3648;
  --ink-3: #55565a;
  --ink-muted: #6b6575;
  --rule: #e6e1ec;
  --rule-strong: #d0c8d8;

  --purple: #3A1658;
  --purple-deep: #2A0F42;
  --purple-mid: #7B4FB0;
  --purple-soft: #f0e8f6;
  --gold: #c9a227;
  --gold-deep: #8a6f33;
  --gold-soft: #faf4e8;

  --red: #9c2b1f;
  --red-bg: #f8e9e6;
  --success: #2f7d3a;
  --success-bg: #e5f3e7;
  --warn: #8a6f33;
  --warn-bg: #faf4e8;
  --danger: #9c2b1f;
  --danger-bg: #f8e9e6;

  --radius: 10px;
  --radius-lg: 14px;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--admin-accent) 28%, transparent);

  --shadow-xs: 0 1px 2px rgba(26, 18, 36, 0.05);
  --shadow-sm: 0 1px 3px rgba(26, 18, 36, 0.07), 0 1px 2px rgba(26, 18, 36, 0.04);
  --shadow-md: 0 4px 14px -6px rgba(26, 18, 36, 0.12);
  --shadow-lg: 0 18px 48px -24px rgba(26, 18, 36, 0.24);

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;

  --fs-xs: 0.75rem;
  --fs-sm: 0.84rem;
  --fs-base: 0.9rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.75rem;

  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --display: "IBM Plex Serif", Georgia, serif;
  --brand: "IBM Plex Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --sidebar-w: 200px; /* md:w-[200px] — FIXED */

  --sidebar-bg: var(--navy-dark);
  --side-border: rgba(255, 255, 255, 0.10);
  --side-ink: rgba(255, 255, 255, 0.65);
  --side-ink-muted: rgba(255, 255, 255, 0.35);
  --side-active-bg: var(--admin-accent);
  --side-hover-bg: rgba(255, 255, 255, 0.10);

  --grid-band: #2A0F42;
  --grid-band-ink: #ffffff;
  --grid-subband: #f0ecf4;
  --grid-subband-ink: #3d3648;
  --grid-empty: #faf9fc;
  --grid-empty-hover: #f0ebf6;
  --grid-weekend: #eef1f4;
  --grid-weekend-hover: #e2e7ec;
  --grid-bankhol: #2f78c7;
  --grid-bankhol-soft: #cfe1f5;
  --grid-off: #d7ebd0;
  --grid-holiday: #d9d6d2;
  --grid-ok: #d7ebd0;
  --grid-ok-ink: #1e3d10;
  --grid-notok: #c0453a;
  --grid-notok-ink: #ffffff;

  --surface-1: #ffffff;
  --surface-2: #f7f5fa;
  --bg-2: #ebe7f0;
  --purple-50: #f6eef9;
  --purple-100: #e5d2ee;
  --purple-600: #6a2c91;
  --purple-700: #2d114d;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-pill: 999px;
  --shadow: var(--shadow-md);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
/* App shell fills the visible viewport — avoid 100vh (taller than the window on
   macOS/Chrome) which clipped Log out and left a dark strip under the footer. */
body:has(#app-shell:not([hidden])) {
  height: 100dvh;
  overflow: hidden;
}

h1, h2 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
h3, h4 {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.hint { color: var(--ink-3); font-size: 0.85em; }

.login-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade-in 280ms ease-out;
}
.login-card {
  position: relative;
  width: min(400px, 100%);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin: 0 0 4px;
  padding: 8px 8px 4px;
}
.login-logo {
  display: block;
  width: auto;
  max-width: 180px;
  height: auto;
  max-height: 72px;
  object-fit: contain;
  object-position: center;
  align-self: center;
  margin: 0 auto;
}
.login-product {
  margin: 0;
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-transform: none;
  line-height: 1.15;
  color: var(--purple);
}
.login-form-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 {
  font-family: var(--display);
  margin-top: 0;
  color: var(--purple);
}
.login-sub { margin: -4px 0 0; color: var(--ink-3); font-size: 0.95rem; }
.login-card label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.8rem; font-weight: 600; color: var(--ink-2);
}
.login-card input {
  padding: 11px 12px; border: 1px solid var(--rule-strong);
  border-radius: var(--radius); font: inherit; background: var(--paper);
}
.login-error { color: var(--danger); margin: 0; font-size: 0.9rem; }
.login-hint {
  margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--rule);
  font-size: 0.78rem; color: var(--ink-muted); line-height: 1.4;
}

#app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  animation: fade-in 220ms ease-out;
}
#app-shell > .workspace {
  grid-column: 2;
  min-height: 0;
  height: 100%;
}

/* ==========================================================================
   SIDEBAR — pixel match to TavexPRO Admin Shell reference
   md:w-[200px] md:h-screen bg-navy-dark (#2A0F42)
   ========================================================================== */
.mobile-topbar { display: none; }
.sidebar-scrim { display: none; }
.sidebar-close { display: none; }

.sidebar {
  width: var(--sidebar-w);             /* FIXED 200px */
  background: var(--navy-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100dvh;
  position: sticky;
  top: 0;
  z-index: 40;
  overflow: hidden;                    /* md:overflow-hidden */
  min-height: 0;
  font-family: var(--sans);
}

/* 1. Brand header — px-3 pt-3 pb-2.5 border-b border-white/10 */
.sb-brand {
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  flex-shrink: 0;
}
.sb-brand-row {
  display: flex;
  align-items: center;
  gap: 8px;                            /* gap-2 */
  min-width: 0;
}
.sb-logo {
  height: 28px; width: 28px;           /* h-7 w-7 */
  flex-shrink: 0;
  border-radius: 0.5rem;               /* rounded-sm = 8px */
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sb-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}
/* Custom branch logos are often dark wordmarks — light chip keeps them readable on navy. */
.sb-logo.is-custom {
  width: auto;
  height: auto;
  max-width: 118px;
  padding: 4px 6px;
  background: #fff;
  border-radius: 0.5rem;
}
.sb-logo.is-custom .sb-logo-img {
  width: auto;
  height: 18px;
  max-width: 106px;
}
.sb-brand-text { min-width: 0; }
.sb-title {
  font-size: 13px;                     /* text-[13px] */
  font-weight: 500;                    /* font-medium */
  color: #fff;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-role {
  font-size: 9px;                      /* text-[9px] */
  text-transform: uppercase;
  letter-spacing: 0.14em;              /* tracking-[0.14em] */
  color: rgba(255, 255, 255, 0.45);    /* text-white/45 */
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-role:empty { display: none; }

.login-logo {
  display: block;
  width: auto;
  max-width: 140px;
  height: auto;
  max-height: 52px;
  object-fit: contain;
  object-position: center;
  align-self: center;
  margin: 0 auto;
}
.brand-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}

/* Office switch (Wizard-only; sits under brand) */
.sa-office-switch-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 6px 0;
  flex-shrink: 0;
}
.sa-office-switch-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  padding: 0 8px;
}
#sa-office-switch {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 26px 4px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  background-color: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 0.5rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.75 4.5L6 7.75L9.25 4.5' stroke='%23ffffff' stroke-opacity='0.55' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.7rem;
}
#sa-office-switch:hover { background-color: rgba(255, 255, 255, 0.14); }
#sa-office-switch:focus { outline: none; box-shadow: 0 0 0 2px rgba(255,255,255,0.25); }
#sa-office-switch option { color: var(--ink); background: #fff; }

.oa-sa-note {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--purple) 28%, var(--rule));
  background: var(--purple-soft);
  font-size: 0.88rem;
  color: var(--ink-2);
  line-height: 1.4;
  max-width: 40rem;
}
.oa-sa-note a { font-weight: 650; }
.sa-user-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.sa-user-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  font-size: 0.78rem;
  color: var(--ink-2);
  font-weight: 600;
}
.sa-user-chip strong {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-size: 0.88rem;
}

/* 2. Primary nav — flex-1 px-1.5 py-2 space-y-2 overflow-y-auto */
.sb-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 8px 6px;                    /* py-2 px-1.5 */
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;                            /* space-y-2 */
}
.nav-group { display: flex; flex-direction: column; }
.sb-group-label,
.nav-label {
  padding: 0 8px;                      /* px-2 */
  margin-bottom: 2px;                  /* mb-0.5 */
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.35);    /* text-white/35 */
}
.sb-group-items { display: flex; flex-direction: column; gap: 1px; }

/* Nav link — px-2 py-1 rounded-sm text-[13px] leading-snug */
.sb-link,
.sb-nav .tab {
  appearance: none;
  border: none;
  display: block;
  width: 100%;
  text-align: left;
  padding: 4px 8px;                    /* py-1 px-2 */
  border-radius: 0.5rem;               /* rounded-sm */
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.375;                  /* leading-snug */
  color: rgba(255, 255, 255, 0.65);    /* IDLE text-white/65 */
  background: transparent;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.sb-link:hover,
.sb-nav .tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
}
.sb-link.active,
.sb-link.is-active,
.sb-nav .tab.active {
  background: var(--admin-accent);     /* solid purple = current page */
  color: #fff;
  font-weight: 500;
}
.sb-link:focus-visible,
.sb-nav .tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45);
}

/* 3. Tools footer — pinned, border-t white/10 (scoped to sidebar) */
.sidebar .sb-tools {
  flex-shrink: 0;
  width: 100%;
  margin-left: 0;
  padding: 6px 6px 10px;               /* pt-1.5 px-1.5 pb-2.5 */
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;                            /* space-y-0.5 */
  position: relative;
  z-index: 45;
  overflow: visible;
  text-align: left;
}
.sidebar .sb-tool {
  appearance: none;
  border: none;
  display: block;
  width: 100%;
  text-align: left;
  padding: 4px 8px;
  border-radius: 0.5rem;
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.375;
  color: rgba(255, 255, 255, 0.65);
  background: none;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
  box-sizing: border-box;
}
.sidebar .sb-tool:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
}
.sidebar .sb-tool.active {
  background: var(--admin-accent);
  color: #fff;
  font-weight: 500;
}
.sidebar .sb-tool-muted {
  color: rgba(255, 255, 255, 0.45);    /* text-white/45 */
}
.sidebar .sb-tool-muted:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
}
.sidebar .sb-tools .user-chip-wrap { width: 100%; }
.sidebar .sb-tools #user-chip-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}
.sidebar .sb-tools .sb-group-label {
  text-align: left;
  width: 100%;
}
.sb-tool-user {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.user-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role {
  display: block;
  font-size: 9px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.2;
}
.notif-badge {
  background: var(--gold); color: var(--ink); font-size: 0.65rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px;
  flex-shrink: 0;
}
.meta-clock { font-family: var(--mono); font-size: 0.7rem; color: rgba(255,255,255,0.45); padding: 0 8px; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.workspace-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); padding: var(--sp-4) var(--sp-7);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 15;
}
.page-crumbs {
  font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500;
  margin-bottom: 2px;
}
.page-title h1 {
  font-family: var(--display);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.15;
}
.page-title p { margin: 4px 0 0; color: var(--ink-3); font-size: var(--fs-base); max-width: 40rem; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

main#app { padding: var(--sp-6) var(--sp-7) var(--sp-7); max-width: 1600px; width: 100%; flex: 1; }
.panel { display: block; animation: rise-in 220ms ease-out; }
.panel-head { margin: 0 0 16px; }
.panel-head h2 { font-size: 1.15rem; }
.panel-sub { font-size: 0.9rem; color: var(--ink-3); margin-top: 4px; max-width: 52rem; }
/* Workspace title already covers these */
.panel > .panel-head { display: none; }

/* ---------- Help (role-gated guide) ---------- */
.help-doc {
  max-width: 46rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 22px 28px;
}
.help-role-badge {
  display: inline-block;
  margin: 0 0 14px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.help-body h1 {
  font-size: 1.35rem;
  margin: 0 0 12px;
  line-height: 1.25;
}
.help-body h2 {
  font-size: 1.05rem;
  margin: 22px 0 8px;
  padding-top: 4px;
  border-top: 1px solid var(--rule);
}
.help-body h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.help-body h3 {
  font-size: 0.95rem;
  margin: 16px 0 6px;
  color: var(--ink-2);
}
.help-body p {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: none;
}
.help-body ul, .help-body ol {
  margin: 0 0 12px;
  padding-left: 1.25rem;
  color: var(--ink-2);
  font-size: 0.92rem;
  line-height: 1.45;
}
.help-body li { margin-bottom: 4px; }
.help-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 18px 0;
}
.help-body code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}
.help-body .help-table { font-size: 0.85rem; margin: 0 0 14px; }
.help-body .help-table th {
  font-weight: 650;
  background: var(--surface-2);
  text-align: left;
}

/* ---------- Team (staff) panel ---------- */
#panel-staff .person-add,
#panel-staff .person-list > .person-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: none;
}
#panel-staff .person-add { margin-bottom: 14px; padding: 12px 14px; }
#panel-staff .person-add-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px 10px;
  margin-bottom: 10px;
  align-items: end;
}
#panel-staff .person-add-grid label,
#panel-staff .person-hours label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  min-width: 0;
}
#panel-staff .person-add-grid .person-add-notes {
  grid-column: 1 / -1;
}
#panel-staff .person-add-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
}
#panel-staff .person-add-roles { margin-bottom: 10px; }
#panel-staff .field-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-3);
  margin-bottom: 4px;
}
#panel-staff .check-label {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem !important;
  font-weight: 550 !important;
  color: var(--ink-2) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  padding: 0;
  margin: 0;
  white-space: nowrap;
  min-height: 28px;
}
#panel-staff .check-label.subtle {
  font-size: 0.74rem !important;
  font-weight: 550 !important;
  color: var(--ink-2) !important;
}
#panel-staff .check-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  flex: 0 0 auto;
}
#panel-staff .person-toolbar {
  margin-top: 2px;
}

#panel-staff .role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
#panel-staff .role-chip {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  user-select: none;
  position: relative;
}
#panel-staff .role-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
#panel-staff .role-chip span {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
#panel-staff .role-chip:hover span { border-color: var(--ink-3); }
#panel-staff .role-chip:has(input:checked) span,
#panel-staff .role-chip input:checked + span {
  background: var(--purple-soft);
  border-color: var(--purple);
  color: var(--purple);
}

#panel-staff .person-joker-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* Roles on the left, working days on the right of the same row. */
#panel-staff .person-roles-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
#panel-staff .person-roles-row .person-roles { margin-bottom: 0; }

/* Per-person working days (Mon–Sun chips; unticked = never auto-rostered) */
#panel-staff .person-workdays {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
#panel-staff .workdays-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#panel-staff .workdays-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
#panel-staff .workday-chip span { min-width: 2.4em; text-align: center; }
#panel-staff .workday-closed span {
  opacity: 0.45;
  text-decoration: line-through;
  cursor: not-allowed;
}

#panel-staff .person-list-sep {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 8px 2px 0;
}
#panel-staff .person-list-sep.dept-sep {
  color: var(--ink-2);
  margin-top: 12px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--rule);
}
#panel-staff .person-reorder {
  display: inline-flex;
  gap: 1px;
}
#panel-staff .person-reorder .btn-tiny {
  min-width: 24px;
  padding: 1px 5px;
}
#panel-staff .person-empty {
  padding: 22px;
  text-align: center;
  color: var(--ink-3);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}
#panel-staff .person-card {
  transition: border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}
#panel-staff .person-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#panel-staff .person-card.is-inactive { opacity: 0.62; }
/* Saved feedback: one quick green blink of the border ring. */
@keyframes saved-pulse {
  0%, 70% {
    border-color: var(--success);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 45%, transparent);
  }
  100% {
    border-color: var(--rule-strong);
    box-shadow: 0 0 0 1px transparent;
  }
}
#panel-staff .person-card.row-saved {
  animation: saved-pulse 220ms ease-out;
}
/* Neutral login-state chip in the meta line: "Has login" / "Login off" as
   plain labels, "Invite" as the same shape but clickable. */
#panel-staff .login-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  user-select: none;
}
#panel-staff .login-chip-off { text-decoration: line-through; }
#panel-staff button.login-chip-btn {
  cursor: pointer;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
}
#panel-staff button.login-chip-btn:hover {
  border-color: var(--ink-3);
  background: var(--paper);
}
#panel-staff .person-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 6px;
}
#panel-staff .person-identity { flex: 1; min-width: 0; }
#panel-staff .person-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#panel-staff .person-name {
  font-size: 0.95rem !important;
  font-weight: 650 !important;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
  flex: 1;
  min-width: 120px;
  border-radius: 0 !important;
  line-height: 1.3;
}
#panel-staff .person-name:focus {
  outline: none;
  border-bottom: 1px solid var(--purple) !important;
}
#panel-staff .person-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  margin-top: 4px;
}
#panel-staff .person-meta select {
  min-width: 110px;
  padding: 3px 6px;
  font-size: 0.8rem;
}
#panel-staff .person-meta .hol-chip {
  padding: 1px 6px;
  font-size: 0.68rem;
}
#panel-staff .person-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  flex: 0 1 auto;
  align-items: center;
}
#panel-staff .person-actions .btn-tiny {
  padding: 2px 7px;
  font-size: 0.72rem;
  line-height: 1.3;
}
#panel-staff .person-more {
  position: relative;
}
#panel-staff .person-more > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
#panel-staff .person-more > summary::-webkit-details-marker { display: none; }
#panel-staff .person-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm, 0 4px 14px rgba(0, 0, 0, 0.08));
}
#panel-staff .person-roles { margin-bottom: 6px; }
#panel-staff .person-hours {
  display: grid;
  grid-template-columns: 52px 52px 48px minmax(88px, 1fr) minmax(120px, 1.4fr) 52px minmax(140px, 2fr);
  gap: 6px 8px;
  align-items: end;
  padding-top: 6px;
  border-top: 1px solid var(--rule);
}
#panel-staff .person-hours .span-notes { grid-column: auto; }
#panel-staff .person-hours .person-home { min-width: 0; }
#panel-staff .person-hours input,
#panel-staff .person-hours select {
  padding: 4px 6px;
  font-size: 0.8rem;
}
#panel-staff .person-hours input[type="number"] {
  width: 100%;
  max-width: none;
}

@media (max-width: 1100px) {
  #panel-staff .person-hours {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
  }
  #panel-staff .person-hours .person-home,
  #panel-staff .person-hours .span-notes { grid-column: span 2; }
  #panel-staff .person-add-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  #panel-staff .person-title-row { flex-direction: column; align-items: stretch; }
  #panel-staff .person-actions { justify-content: flex-start; }
  #panel-staff .person-hours { grid-template-columns: 1fr 1fr; }
  #panel-staff .person-hours .person-home,
  #panel-staff .person-hours .span-notes { grid-column: 1 / -1; }
  #panel-staff .person-add-grid {
    grid-template-columns: 1fr 1fr;
  }
  #panel-staff .person-add-grid .person-add-notes { grid-column: 1 / -1; }
}

input, select, textarea {
  font: inherit; color: var(--ink); border: 1px solid var(--rule-strong);
  background-color: var(--paper); border-radius: var(--radius); padding: 8px 10px;
}
/* Custom chevron inset from the edge (native arrows sit too flush-right). */
select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.1rem;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.75 4.5L6 7.75L9.25 4.5' stroke='%236b6570' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 0.75rem;
}
input::placeholder, textarea::placeholder { color: var(--ink-muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--purple); box-shadow: var(--focus-ring);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--purple); }
/* Colour pickers: the global input padding/background crushes the native
   swatch to a sliver — make the chosen colour fill the control. */
input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  padding: 3px;
  min-width: 44px;
  height: 34px;
  cursor: pointer;
  background-color: var(--paper);
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--rule);
  border-radius: calc(var(--radius) - 2px);
}
input[type="color"]::-moz-color-swatch {
  border: 1px solid var(--rule);
  border-radius: calc(var(--radius) - 2px);
}

.btn, .btn-primary, .btn-ghost {
  appearance: none; border: 1px solid var(--rule-strong); background: var(--paper);
  color: var(--ink-2); font: inherit; font-size: var(--fs-base); font-weight: 600;
  padding: 9px 16px; border-radius: var(--radius-pill); cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 100ms ease;
}
.btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; }
.btn:active, .btn-primary:active, .btn-ghost:active { transform: translateY(1px); }
.btn:focus-visible, .btn-primary:focus-visible, .btn-ghost:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 9px 18px;
}
.btn-primary:hover { background: var(--purple-deep); border-color: var(--purple-deep); color: #fff; }
.btn-primary:disabled, .btn:disabled, .btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-tiny {
  font-size: 0.8rem; padding: 6px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--rule-strong); background: var(--paper); color: var(--ink-2);
  cursor: pointer; font-weight: 600;
  min-height: 28px;
}
.btn-tiny.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--rule)); }
.btn-tiny:hover { background: var(--surface-2); }
.btn-tiny.danger:hover { background: var(--red-bg); }

.menu { position: relative; display: inline-block; vertical-align: middle; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 6px; z-index: 30;
  display: flex; flex-direction: column; gap: 2px;
}
.menu-panel[hidden] { display: none !important; }
.menu-panel button {
  appearance: none; border: none; background: transparent; text-align: left;
  padding: 9px 10px; border-radius: 6px; font: inherit; font-size: 0.88rem;
  color: var(--ink-2); cursor: pointer;
}
.menu-panel button:hover { background: var(--purple-soft); color: var(--ink); }
.menu-panel button.danger { color: var(--red); }

.table-wrap {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  overflow: auto; box-shadow: var(--shadow-xs);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--paper); border-radius: var(--radius-lg); overflow: hidden; }
.status-badge, .badge-active, .pill-active {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--purple-soft); color: var(--purple);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.data-table th {
  text-align: left; font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0;
  color: var(--ink-3); padding: 12px 14px;
  border-bottom: 1px solid var(--rule); background: var(--surface-2); white-space: nowrap;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--purple-soft) 45%, transparent); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tfoot td { background: var(--surface-2); border-top: 1px solid var(--rule-strong); border-bottom: none; }
.data-table tr.inactive { opacity: 0.55; }
.data-table.mono td { font-family: var(--sans); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.data-table input, .data-table select { width: 100%; min-width: 0; padding: 6px 8px; font-size: 0.88rem; }
.data-table select:not([multiple]) { padding-right: 1.9rem; }
.data-table input[type="number"] { width: 64px; font-variant-numeric: tabular-nums; }
.data-table input[type="time"] { width: 96px; font-variant-numeric: tabular-nums; }
.data-table input[type="color"] { width: 36px; height: 28px; padding: 2px; }
.data-table label { display: inline-flex; gap: 4px; align-items: center; margin-right: 8px; font-size: 0.8rem; color: var(--ink-2); }

.role-pill {
  display: inline-block; font-size: 0.72rem; font-weight: 650; padding: 2px 8px;
  border-radius: 6px; border: 1px solid var(--rule-strong); background: var(--surface-2);
  color: var(--ink-2); margin-right: 4px;
}
.role-pill.director { border-color: var(--purple); color: var(--purple); background: var(--purple-soft); }
.role-pill.dealer { border-color: var(--gold-deep); color: var(--gold-deep); background: var(--gold-soft); }
.role-pill.manager { border-color: var(--purple); color: var(--purple); }
.role-pill.dealer-manager {
  border-color: #7eb8d9;
  color: #3a7ea3;
  background: #d6eef8;
}

.schedule-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-4);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.sb-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.sb-roster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 240px;
}
/* Schedule toolbar tools (NOT the sidebar Tools footer — class name collision). */
.schedule-bar .sb-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.sb-dealer-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
#schedule-select {
  flex: 1 1 auto;
  min-width: 160px;
  max-width: 320px;
  font-weight: 650;
  font-size: 0.95rem;
  padding: 9px 2.1rem 9px 12px;
  border-color: var(--rule-strong);
  background-color: var(--paper);
}
.status-pill {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.status-pill.draft {
  color: #6a4a12;
  background: #f3e4b8;
  border-color: #d4b56a;
}
.status-pill.final {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple-deep);
}
.sb-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 4px;
  padding-top: 2px;
  border-top: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  font-size: 0.88rem;
}
.sb-metric { white-space: nowrap; }
.sb-metric strong {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
}
.sb-sep {
  width: 4px;
  height: 4px;
  margin: 0 8px;
  border-radius: 50%;
  background: var(--ink-muted);
  opacity: 0.55;
  align-self: center;
}
.sb-meta:empty,
.sb-meta[data-empty="1"] { display: none; }

.seg {
  display: inline-flex;
  padding: 2px;
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  gap: 0;
}
.seg-btn {
  background: transparent;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-2);
}
.seg-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.seg-btn.active {
  background: var(--purple-soft);
  color: var(--purple);
}
.seg-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

#btn-finalize:disabled {
  opacity: 1;
  color: var(--success);
  background: var(--success-bg);
  border-color: color-mix(in srgb, var(--success) 35%, var(--rule));
  cursor: default;
}

.unmet-banner {
  background: var(--red-bg); border: 1px solid color-mix(in srgb, var(--red) 35%, var(--rule));
  border-radius: var(--radius); padding: 8px 12px; margin-bottom: 12px; font-size: 0.88rem; color: #5a1d15;
  flex: 0 0 auto;
}
/* Collapsible header (the whole row is the toggle) */
.unmet-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; padding: 2px 0; cursor: pointer;
  font: inherit; text-align: left; color: var(--red);
}
.unmet-caret { font-size: 0.7rem; line-height: 1; color: var(--red); }
.unmet-title { font-size: var(--fs-sm); font-weight: 700; color: var(--red); }
.unmet-body { margin-top: 8px; }
.unmet-banner.collapsed .unmet-body { display: none; }
.unmet-banner .unmet-summary { margin: 0 0 8px; color: var(--ink); }
/* Cap the list height so many gaps scroll internally instead of pushing the
   roster grid off-screen. */
.unmet-banner ul { margin: 0; padding-left: 18px; max-height: 22vh; overflow: auto; }
.unmet-banner li { cursor: pointer; margin-bottom: 4px; }
.unmet-banner li:hover { text-decoration: underline; }

.impromptu-panel {
  margin-bottom: 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  flex: 0 0 auto;
}
.impromptu-day-control {
  --impromptu-control-h: 36px;
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  height: var(--impromptu-control-h);
}
.impromptu-day-control input[type="date"] {
  flex: 0 1 11.5rem;
  width: 11.5rem;
  max-width: 100%;
  height: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0 10px;
  line-height: 1.2;
}
.impromptu-day-chip {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex: 0 0 auto;
  box-sizing: border-box;
  height: 100%;
  line-height: 1;
}
.impromptu-day-chip.is-ok { color: #2f7d3a; border-color: color-mix(in srgb, #2f7d3a 35%, var(--rule)); }
.impromptu-day-chip.is-notok { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--rule)); background: var(--red-bg); }
.impromptu-body { padding: 0 14px 14px; }
/* Overtime: compact solid chip — no hatch, quieter than main shifts */
.shift-pill.ot {
  --pill-accent: #8a6f33;
  background: #f4efe4 !important;
  color: #3d3218 !important;
  border: 1px solid #d2c4a4 !important;
  border-left: 3px solid #b8954a !important;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.03em;
  padding: 2px 6px 2px 7px;
  line-height: 1.25;
}
.shift-pill.ot.locked {
  box-shadow: none;
}
.shift-pill.ot.locked::after {
  display: none;
}

/* Main shift + OT side-by-side in the day cell (not stacked). */
.cell-shift-bundle {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
}
.cell-shift-bundle .shift-pill {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-shift-bundle .shift-pill:not(.ot) {
  flex: 1 1 auto;
  min-width: 0;
}
.cell-shift-bundle .shift-pill.ot {
  flex: 0 0 auto;
  padding: 2px 5px;
  font-size: 9px;
  max-width: none;
}
.annual-hours-cell { vertical-align: top; }
.annual-h-cap { font-variant-numeric: tabular-nums; }
.annual-h-ot {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #6a5a30;
  margin-top: 2px;
}
.annual-hours-cell.has-ot { background: color-mix(in srgb, #b8954a 8%, transparent); }
.annual-hours-total td { font-weight: 700; border-top: 1px solid var(--rule); }
#annual-mode-seg { margin-bottom: 12px; }
.ot-row td { background: color-mix(in srgb, #d4a017 8%, transparent); }
.sat-row td { background: color-mix(in srgb, var(--purple) 5%, transparent); }
.overview-report { max-width: 72rem; }
.hours-tot-ot { color: #6a5a30 !important; }
.overview-report-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 12px 0 16px;
}
.overview-report-bar .field { margin: 0; }
.overview-report-bar input[type="month"] { min-width: 11rem; }
.impromptu-toolbar {
  --impromptu-control-h: 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding-top: 12px;
  margin-bottom: 12px;
}
.impromptu-toolbar .field {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.impromptu-toolbar .field-roster {
  flex: 1 1 16rem;
  max-width: 22rem;
}
.impromptu-toolbar .field-day {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
}
.impromptu-toolbar .field-roster select,
.impromptu-toolbar .field-day input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  height: var(--impromptu-control-h);
  min-height: var(--impromptu-control-h);
  padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.2;
}
.impromptu-toolbar .field-day .impromptu-day-control input {
  width: 11.5rem;
}
.impromptu-toolbar .field-roster select {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.impromptu-hint { margin: 0; font-size: var(--fs-sm); flex: 1 1 12rem; }
.impromptu-actions {
  --impromptu-control-h: 36px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
  align-items: stretch;
}
@media (max-width: 980px) {
  .impromptu-actions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .impromptu-actions { grid-template-columns: 1fr; }
}
.impromptu-card {
  --impromptu-control-h: 36px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 14px 16px;
  display: grid;
  grid-template-rows: auto auto auto minmax(2.25rem, 1fr) auto;
  gap: 10px;
  min-height: 100%;
  align-content: stretch;
}
.impromptu-card h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  line-height: 1.25;
  min-height: 1.25em;
}
.impromptu-card-hint {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink-3);
  line-height: 1.4;
  min-height: calc(1.4em * 2);
}
.impromptu-card-fields {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
}
.impromptu-card-fields .field {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.impromptu-card-fields .field-narrow { flex: 0 0 5.5rem; }
.impromptu-card-fields select,
.impromptu-card-fields .staff-search-input {
  width: 100%;
  box-sizing: border-box;
  height: var(--impromptu-control-h);
  min-height: var(--impromptu-control-h);
  padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.2;
}
.impromptu-card-extra {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: var(--impromptu-control-h);
}
.impromptu-ot-adjust {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.impromptu-ot-adjust .seg.seg-compact {
  flex: 1 1 11rem;
  min-width: 0;
  height: var(--impromptu-control-h);
  box-sizing: border-box;
  display: inline-flex;
  align-items: stretch;
}
.impromptu-ot-adjust .impromptu-ot-stepper {
  height: var(--impromptu-control-h);
}
.seg.seg-compact .seg-btn {
  flex: 1 1 0;
  padding: 0 8px;
  font-size: 0.78rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.impromptu-ot-stepper {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 0;
  height: var(--impromptu-control-h);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
  box-sizing: border-box;
}
.impromptu-ot-nudge {
  width: 2rem;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.impromptu-ot-nudge:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}
.impromptu-ot-nudge:disabled {
  opacity: 0.35;
  cursor: default;
}
.impromptu-ot-nudge:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  position: relative;
  z-index: 1;
}
.impromptu-ot-display {
  min-width: 2.75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 0.9rem;
  color: var(--ink);
  padding: 0 4px;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.staff-search {
  position: relative;
  width: 100%;
  min-width: 0;
}
.staff-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  font: inherit;
  background: var(--paper);
  color: var(--ink);
}
.staff-search-input:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: color-mix(in srgb, var(--purple) 45%, var(--rule-strong));
}
.staff-search-menu {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 220px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}
.staff-search-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
}
.staff-search-option:hover,
.staff-search-option:focus {
  background: var(--purple-soft);
  outline: none;
}
.staff-search-empty {
  padding: 10px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.impromptu-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  min-height: calc(10px + 28px);
}
.impromptu-card-actions .btn-tiny { margin: 0; }
/* Legacy class kept if any JS still emits it */
.impromptu-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.impromptu-card-row .field { margin: 0; flex: 1 1 8rem; min-width: 0; }
.impromptu-card-row .field-narrow { flex: 0 0 6.5rem; }
.impromptu-card-row .btn-tiny { margin-bottom: 1px; }
.impromptu-dayboard {
  border-top: 1px solid var(--rule);
  padding-top: 14px;
}
.impromptu-dayboard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 10px;
}
.impromptu-dayboard-head h4 {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.impromptu-health-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.impromptu-dayboard-body {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 960px) {
  .impromptu-dayboard-body { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .impromptu-dayboard-body { grid-template-columns: 1fr; }
}
.impromptu-daycol {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 10px 12px;
  min-height: 5.5rem;
}
.impromptu-daycol h5 {
  margin: 0 0 8px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.impromptu-day-empty { margin: 0; font-size: var(--fs-sm); }
.impromptu-day-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.impromptu-day-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  font-size: var(--fs-sm);
  padding-bottom: 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
}
.impromptu-day-list li:last-child { border-bottom: none; padding-bottom: 0; }
.impromptu-day-person { font-weight: 600; grid-column: 1; }
.impromptu-day-shift { color: var(--ink-2); grid-column: 1; font-size: var(--fs-xs); }
.impromptu-day-time {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs);
  color: var(--ink-3);
}
.impromptu-day-list li .btn-tiny {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}
.impromptu-daycol-leave { background: color-mix(in srgb, #b8b8b8 12%, var(--paper)); }
.impromptu-daycol-ot { background: color-mix(in srgb, #d4a017 10%, var(--paper)); }
.impromptu-daycol-gap { background: color-mix(in srgb, var(--red) 8%, var(--paper)); }
.impromptu-day-list li.is-leave .impromptu-day-shift { color: #6a6a6a; }
.impromptu-day-list li.is-ot .impromptu-day-shift { color: #8a6a10; font-weight: 700; }
.impromptu-day-list li.is-gap .impromptu-day-person { color: var(--red); }
.impromptu-health {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
}
.impromptu-health h4 {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.impromptu-health-status {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.impromptu-health-status.is-ok { color: #2f7d3a; }
.impromptu-health-status.is-notok { color: var(--red); }
.impromptu-issues {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-sm);
}
.impromptu-issues li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--rule);
}
.impromptu-issues li:last-child { border-bottom: none; }
.impromptu-issues .muted { color: var(--ink-3); font-style: italic; }
.impromptu-health-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }

.empty-state {
  background: var(--paper); border: 1px dashed var(--rule-strong); border-radius: var(--radius-lg);
  padding: 48px 28px; text-align: center; margin-top: 8px;
}
.empty-state h2 { font-size: 1.4rem; margin-bottom: 6px; }
.empty-state p { color: var(--ink-2); margin-bottom: 22px; }
.empty-steps { list-style: none; padding: 0; margin: 0 auto; max-width: 520px; display: flex; flex-direction: column; gap: 10px; }
.empty-steps li {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: var(--radius); text-align: left;
}
.empty-steps .step-num {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%;
  background: var(--paper); border: 1.5px solid var(--gold); color: var(--purple); font-weight: 700;
}

/* ---------- Settings ---------- */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: none;
}
.settings-section {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  box-shadow: var(--shadow-xs);
}
.settings-section-head { margin-bottom: 14px; }
.settings-section-head h3 {
  margin: 0 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.settings-section-head .panel-sub { margin: 0; max-width: 40rem; }
.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
/* Roles + Departments: one column stack (side-by-side was too cramped). */
.settings-split {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.settings-table {
  border: none;
  box-shadow: none;
  border-radius: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
  overflow-x: auto;
}
.settings-table .data-table {
  width: 100%;
  table-layout: fixed;
}
.settings-table .data-table td,
.settings-table .data-table th {
  vertical-align: middle;
}
.settings-table .data-table input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.settings-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}
/* Roles: Name | Label | In use | actions */
#roles-table th:nth-child(1),
#roles-table td:nth-child(1),
#roles-table th:nth-child(2),
#roles-table td:nth-child(2) {
  width: auto;
}
#roles-table th:nth-child(3),
#roles-table td:nth-child(3) {
  width: 5rem;
  text-align: center;
  white-space: nowrap;
}
/* Roster row order: # | Name | Staff | actions */
#depts-table th:nth-child(1),
#depts-table td:nth-child(1) {
  width: 3rem;
  text-align: center;
  white-space: nowrap;
}
#depts-table th:nth-child(2),
#depts-table td:nth-child(2) {
  width: auto;
}
#depts-table th:nth-child(3),
#depts-table td:nth-child(3) {
  width: 5rem;
  text-align: center;
  white-space: nowrap;
}
#roles-table th:last-child,
#roles-table td:last-child,
#depts-table th:last-child,
#depts-table td:last-child {
  width: 12rem;
  white-space: nowrap;
  text-align: right;
}

@media (max-width: 720px) {
  .rules-checks { grid-template-columns: 1fr; }
  .pay-form { grid-template-columns: 1fr; }
  #roles-table th:last-child,
  #roles-table td:last-child,
  #depts-table th:last-child,
  #depts-table td:last-child {
    width: 9rem;
  }
}

/* Shared field chrome inside settings */
#panel-settings .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-3);
  min-width: 0;
}
#panel-settings .field input:not([type="checkbox"]):not([type="color"]),
#panel-settings .field select {
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  padding: 8px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background-color: var(--paper);
}
#panel-settings .field select:not([multiple]) {
  padding-right: 2.1rem;
}
#panel-settings .field .hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.brand-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 14px;
  align-items: end;
  margin: 0;
  padding: 0;
  background: transparent;
}
.brand-form .field-grow { grid-column: 1; }
.brand-form .field-span { grid-column: 1 / -1; }
.brand-logo-preview-wrap {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brand-logo-preview-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}
.brand-logo-preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.brand-logo-preview {
  max-height: 40px;
  max-width: min(280px, 100%);
  width: auto;
  height: auto;
  object-fit: contain;
}
.brand-logo-preview-fallback {
  font-size: 0.85rem;
  color: var(--ink-3);
}
.brand-logo-preview-err {
  margin: 0;
  font-size: 0.82rem;
  color: var(--danger);
  line-height: 1.35;
}

.rules-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  background: transparent;
}
.rules-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 18px;
}
.rules-form .check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-2);
  min-width: 0;
  line-height: 1.35;
}
.rules-form .check-row input { margin-top: 2px; flex-shrink: 0; }
.rules-nums {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  gap: 12px 16px;
}
.rules-nums input[type="number"] { max-width: 100%; width: 100%; }

.pay-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 0;
}
.pay-form input[type="number"],
.pay-form input[type="time"] { max-width: none; width: 100%; }

/* Legacy aliases (keep selectors used elsewhere working) */
.settings-grid { display: contents; }
.settings-block, .settings-card { display: contents; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }

.requests-stack { display: flex; flex-direction: column; gap: 16px; }
.request-section {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4); box-shadow: var(--shadow-xs);
}
.request-section h3 { margin: 0 0 2px; font-size: 1rem; }
.request-section .panel-sub { margin: 0; font-size: 0.82rem; }
.request-section.compact .request-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 10px 16px; margin-bottom: 12px;
}
.request-inline {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px;
  margin: 0; padding: 0; background: transparent;
}
.request-inline label {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 0.72rem; font-weight: 650; color: var(--ink-3);
}
.request-inline input, .request-inline select {
  min-width: 0; width: auto; padding: 6px 8px; font-size: 0.88rem;
}
.request-inline input[type="date"] { width: 9.5rem; }
.request-inline input[type="number"] { width: 6.5rem; }
.request-inline #leave-note, .request-inline #swap-note { width: 8rem; }
.request-inline .btn-primary { padding: 7px 12px; font-size: 0.84rem; white-space: nowrap; }

.panel-hint {
  margin: 0 0 14px; font-size: 0.88rem; color: var(--ink-3); max-width: 48rem;
}

.person-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 14px;
}
.person-toolbar input[type="search"] { min-width: 160px; flex: 1; max-width: 240px; }
.person-toolbar select { min-width: 130px; }
.person-filter-count {
  font-size: 0.8rem; color: var(--ink-muted); margin-left: auto;
}

/* Shifts cards */
#panel-shifts .shift-add,
#panel-shifts .shift-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
}
#panel-shifts .shift-add { margin-bottom: 14px; }
#panel-shifts .person-toolbar { margin-top: 4px; }
#panel-shifts .person-toolbar input[type="search"] { max-width: 280px; }
#panel-shifts .shift-add-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px 12px;
  margin-bottom: 10px;
}
#panel-shifts .shift-add-grid label,
#panel-shifts .shift-fields label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.75rem; font-weight: 650; color: var(--ink-3);
}
/* Label caption + info icon on one line so the icon doesn't push the input down. */
#panel-shifts .shift-add-grid .lab-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
}
#panel-shifts .shift-add-grid .span-2 { grid-column: span 2; }
#panel-shifts .shift-add-depts { margin-bottom: 10px; }
#panel-shifts .shift-list-cards { display: flex; flex-direction: column; gap: 10px; }
#panel-shifts .shift-card { transition: border-color 140ms ease, box-shadow 140ms ease; }
#panel-shifts .shift-card.row-saved {
  animation: saved-pulse 220ms ease-out;
}
#panel-shifts .shift-top {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: start;
  margin-bottom: 12px;
}
#panel-shifts .shift-swatch {
  width: 8px; align-self: stretch; min-height: 36px;
  border-radius: 4px;
}
#panel-shifts .shift-identity { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
#panel-shifts .shift-title-row {
  display: flex; align-items: baseline; gap: 10px; min-width: 0;
}
#panel-shifts .shift-code {
  flex: 1; min-width: 0;
  font-size: 1.02rem !important; font-weight: 650 !important;
  border: none !important; background: transparent !important;
  padding: 0 !important; box-shadow: none !important; border-radius: 0 !important;
}
#panel-shifts .shift-code:focus { outline: none; border-bottom: 1px solid var(--purple) !important; }
#panel-shifts .shift-hours {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#panel-shifts .shift-fields {
  display: grid;
  grid-template-columns: repeat(8, minmax(72px, 1fr));
  gap: 10px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  margin-bottom: 10px;
}
#panel-shifts .shift-fields input[type="number"] {
  width: 100%; max-width: 88px; font-variant-numeric: tabular-nums;
}
#panel-shifts .shift-fields input[type="color"] {
  width: 44px; height: 34px; padding: 2px;
}
#panel-shifts .shift-depts .field-label { margin-bottom: 6px; }
#panel-shifts .dept-chips,
#panel-staff .dept-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
#panel-shifts .dept-chip {
  display: inline-flex; align-items: center; margin: 0; cursor: pointer; position: relative;
}
#panel-shifts .dept-chip input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
#panel-shifts .dept-chip span {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: var(--surface-2);
  color: var(--ink-2); font-size: 0.78rem; font-weight: 600;
}
#panel-shifts .dept-chip:has(input:checked) span,
#panel-shifts .dept-chip input:checked + span {
  background: var(--gold-soft); border-color: var(--gold); color: var(--gold-deep);
}

@media (max-width: 900px) {
  #panel-shifts .shift-top { grid-template-columns: 8px 1fr; }
  #panel-shifts .person-actions { grid-column: 2; }
  #panel-shifts .shift-fields { grid-template-columns: repeat(2, 1fr); }
  #panel-shifts .shift-add-grid .span-2 { grid-column: span 1; }
  .request-section.compact .request-head { flex-direction: column; align-items: stretch; }
}

.annual-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.annual-bar strong { font-size: 1.15rem; min-width: 4ch; text-align: center; }
.annual-table th, .annual-table td { text-align: center; font-size: 0.8rem; }
.annual-table td:first-child, .annual-table th:first-child { text-align: left; }
.annual-hit { background: var(--purple-soft); cursor: pointer; font-weight: 650; }
.annual-empty { color: var(--ink-muted); }

.annual-staff-view {
  max-width: 42rem;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.annual-staff-section h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}
.annual-staff-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.annual-staff-bal {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.annual-staff-bal > div {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 10px 8px;
  text-align: center;
}
.annual-staff-bal span {
  display: block;
  font-size: 0.7rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.annual-staff-bal strong {
  display: block;
  margin-top: 2px;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.annual-staff-month {
  margin: 14px 0 4px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.annual-staff-section > .annual-staff-month:first-of-type { margin-top: 0; }
.annual-staff-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.annual-staff-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--rule);
}
.annual-staff-list li:last-child { border-bottom: 0; }
.annual-staff-tag { color: var(--ink-muted); }
@media (max-width: 520px) {
  .annual-staff-bal { grid-template-columns: 1fr; }
  .annual-staff-list li { flex-direction: column; align-items: flex-start; gap: 2px; }
}

.logbook-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 8px;
}
.logbook-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1 1 220px;
  justify-content: flex-end;
}
.logbook-controls input { flex: 1; min-width: 140px; max-width: 280px; }
.logbook-meta { margin: 0 0 10px; }
.logbook-detail {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  color: var(--ink-2);
}
.logbook-more-row {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.request-list-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.request-list-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-3);
}
.request-list-foot .btn[hidden] { display: none; }
#log-range-seg { flex: 0 0 auto; }

.workspace > .footer-rule, .footer-rule {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: auto;
  padding: 10px 28px 14px;
  border-top: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-muted);
  position: static;
  left: auto; right: auto; bottom: auto;
  z-index: auto;
  box-shadow: none;
}
.footer-brand-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.footer-easter {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.85;
  flex-shrink: 0;
}
.login-mascot {
  position: absolute;
  left: -8px;
  top: -8px;
  z-index: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}
.login-mascot-video {
  display: block;
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 0;
  border: none;
  background: transparent;
  opacity: 0.9;
  /* Soft dissolve into the white card (box, not circle) */
  -webkit-mask-image: linear-gradient(135deg, #000 48%, transparent 88%);
  mask-image: linear-gradient(135deg, #000 48%, transparent 88%);
  filter: saturate(0.95) contrast(0.98);
}
.login-card > *:not(.login-mascot) {
  position: relative;
  z-index: 1;
}
@media (max-width: 520px) {
  .login-mascot-video { width: 100px; height: 76px; }
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 960px) {
  body:has(#app-shell:not([hidden])) {
    height: auto;
    overflow: auto;
  }
  #app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  /* Mobile top bar — sticky bg-navy-dark px-4 py-2.5 */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--navy-dark);
    color: #fff;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(42, 15, 66, 0.40);
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .mobile-burger {
    appearance: none; border: none; background: none;
    color: rgba(255, 255, 255, 0.9);
    display: flex; padding: 0; cursor: pointer;
  }
  .mobile-top-title { font-size: 14px; font-weight: 500; }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 16, 0.50);
    z-index: 55;
  }
  .sidebar-scrim[hidden] { display: none !important; }

  /* Off-canvas drawer — w-[200px] max-w-[85vw] */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(200px, 85vw);
    height: 100dvh;
    max-height: 100dvh;
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.4);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-close {
    display: block;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    appearance: none;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
  }
  .sidebar-close:hover { color: #fff; }

  #app-shell > .workspace { grid-column: 1; height: auto; }
  .workspace { height: auto; max-height: none; overflow: visible; }
  main#app { padding: 14px 14px 36px; overflow-y: visible; min-height: 0; }
  #panel-schedule { display: block; height: auto; }
  #panel-schedule > #view-grid { display: block; }
  #panel-schedule > #view-grid .grid-scroll { max-height: 72dvh; }
  .workspace-top { padding: 14px 14px 0; flex-direction: column; align-items: stretch; position: static; }
  .settings-split { /* already stacked */ }
  .rules-checks { grid-template-columns: 1fr; }
  .pay-form { grid-template-columns: 1fr; }
  .brand-form { grid-template-columns: 1fr 1fr; }
  .brand-form .field-grow { grid-column: 1 / -1; }
  .schedule-bar { padding: 12px; }
  .schedule-bar .sb-tools { margin-left: 0; width: 100%; justify-content: space-between; }
  #schedule-select { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
:root { color-scheme: light; }

/* ---------- Monthly grid view ---------- */
.view { margin-top: 14px; }
.grid-scroll {
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
/* App-shell: sidebar + top bar + footer stay fixed; the active panel fills the
   remaining viewport and scrolls internally. This lets the roster grid keep its
   header pinned at the top and the Status bar pinned at the bottom — both always
   fully visible instead of the whole page growing too long. */
.workspace { height: 100%; max-height: 100dvh; overflow: hidden; }
main#app { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
#panel-schedule { display: flex; flex-direction: column; height: 100%; min-height: 0; }
#panel-schedule > .view { flex: 1 1 auto; min-height: 0; margin-top: 14px; }
#panel-schedule > #view-grid { display: flex; }
#panel-schedule > #view-grid .grid-scroll { flex: 1 1 auto; min-height: 0; }
#panel-schedule > #view-person,
#panel-schedule > #view-hours,
#panel-schedule > #view-day { overflow-y: auto; }
/* Status ("OK") row pinned to the bottom of the scroll area — a bold, always-
   visible coverage bar. */
table.month-grid tbody tr.status-row td {
  position: sticky;
  bottom: 0;
  z-index: 6;
  min-height: 40px;
  height: auto;
  padding-top: 6px;
  padding-bottom: 6px;
  border-top: 2px solid var(--purple);
  box-shadow: 0 -6px 16px -6px rgba(26, 21, 32, 0.35);
}
/* Left "Status" label cell: pin to both bottom and left (corner); make it read
   as a clear bar label. */
table.month-grid tbody tr.status-row td.staff-cell {
  z-index: 8;
  background: var(--purple);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
/* Hours column cell in the status row keeps a solid bg while pinned. */
table.month-grid tbody tr.status-row td.totals-col {
  background: var(--purple);
}
table.month-grid {
  /* separate + spacing 0 keeps the grid look but makes sticky Name reliable */
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 12px;
  --staff-col-w: 190px;
  --hours-col-w: 88px;
}
table.month-grid th, table.month-grid td {
  border: 1px solid var(--rule);
  padding: 4px 6px;
  vertical-align: top;
}
table.month-grid thead th {
  background: var(--grid-subband);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grid-subband-ink);
  text-align: center;
  padding: 6px 4px;
  position: sticky;
  top: 0;
  z-index: 5;
  border-color: var(--rule-strong);
}
/* Date header sits under the purple period band when both are sticky. */
table.month-grid thead tr.date-head-row th {
  top: var(--period-band-h, 36px);
  z-index: 6;
}
table.month-grid thead th.dom {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--grid-subband-ink);
  letter-spacing: 0;
  text-transform: none;
  padding: 8px 4px;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1.2;
}
table.month-grid thead th.dom .dom-date {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.month-grid thead th.dom .dom-dow {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
table.month-grid thead th.dom .dom-hol {
  display: block;
  margin-top: 3px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--grid-bankhol);
  line-height: 1.15;
  max-width: 5.5rem;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Top-of-grid brand period band */
table.month-grid thead tr.period-band th {
  background: var(--grid-band);
  color: var(--grid-band-ink);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: none;
  text-align: left;
  padding: 0;
  border-color: var(--grid-band);
  position: sticky;
  top: 0;
  z-index: 9;
  overflow: visible;
}
/* Stick to the left edge of the scrollport and span its width so the title
   stays centred in the visible purple bar while scrolling horizontally. */
table.month-grid thead tr.period-band th .period-band-label {
  position: sticky;
  left: 0;
  display: block;
  box-sizing: border-box;
  width: var(--grid-viewport-w, 100%);
  max-width: 100%;
  padding: 9px 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--grid-band);
  color: var(--grid-band-ink);
}
table.month-grid thead th.weekend { background: var(--grid-weekend); }
table.month-grid th.staff-col,
table.month-grid thead th.totals-col {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 7;
  background: var(--grid-subband);
  color: var(--grid-subband-ink);
  width: var(--staff-col-w);
  min-width: var(--staff-col-w);
  max-width: var(--staff-col-w);
  border-right: 1px solid var(--rule-strong);
  box-shadow: 4px 0 8px -4px rgba(0, 0, 0, 0.14);
  white-space: nowrap;
  line-height: 1.25;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10.5px;
  font-weight: 600;
  vertical-align: middle;
  padding: 8px 10px;
}
table.month-grid thead th.totals-col {
  left: auto;
  right: 0;
  text-align: right;
  width: var(--hours-col-w);
  min-width: var(--hours-col-w);
  max-width: var(--hours-col-w);
  border-right: 1px solid var(--rule);
  border-left: 1px solid var(--rule-strong);
  box-shadow: -4px 0 8px -4px rgba(0, 0, 0, 0.14);
}
table.month-grid td.staff-cell {
  position: sticky; left: 0; background: var(--paper);
  font-family: var(--sans); font-weight: 500; padding: 8px 10px;
  border-right: 1px solid var(--rule-strong);
  box-shadow: 4px 0 8px -4px rgba(0, 0, 0, 0.14);
  width: var(--staff-col-w);
  min-width: var(--staff-col-w);
  max-width: var(--staff-col-w);
  z-index: 4;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
table.month-grid td.staff-cell .staff-name {
  display: block;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}
table.month-grid td.staff-cell .staff-meta {
  font-variant-numeric: tabular-nums; font-size: 11px; color: var(--ink-muted); display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
  font-weight: 400;
}
table.month-grid td.staff-cell .staff-week-hours {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 6px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  line-height: 1.2;
  color: var(--ink-2);
}
table.month-grid td.staff-cell .wh-chip {
  white-space: nowrap;
}
table.month-grid td.staff-cell .wh-chip.wh-under {
  color: #a15c00;
  font-weight: 650;
}
table.month-grid td.staff-cell .wh-chip.wh-over {
  color: #a12b2b;
  font-weight: 650;
}
.status-pill.amended {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--purple) 40%, transparent);
}
table.month-grid td.cell {
  width: 96px; min-width: 96px; height: 44px;
  text-align: center; cursor: pointer;
  font-variant-numeric: tabular-nums; font-size: 11px;
  background: var(--grid-empty);
  position: relative;
  padding: 5px 4px;
  vertical-align: middle;
}
table.month-grid thead th.dom { min-width: 96px; }
table.month-grid td.cell:hover {
  background: var(--grid-empty-hover);
  outline: 1px solid color-mix(in srgb, var(--purple) 35%, var(--rule));
  outline-offset: -1px;
}
table.month-grid td.cell:focus-visible {
  outline: 2px solid var(--purple-mid);
  outline-offset: -2px;
  z-index: 2;
}
table.month-grid td.cell.has-shift { background: var(--paper); }
table.month-grid td.cell.has-shift:hover { background: var(--grid-empty-hover); }
table.month-grid td.cell.weekend { background: var(--grid-weekend); }
table.month-grid td.cell.weekend:hover { background: var(--grid-weekend-hover); }
table.month-grid td.cell.weekend.has-shift { background: color-mix(in srgb, var(--grid-weekend) 55%, var(--paper)); }
table.month-grid td.cell.unavail { background: repeating-linear-gradient(135deg, var(--grid-holiday) 0 6px, var(--grid-empty) 6px 12px); }
table.month-grid td.cell.unfilled { background: var(--red-bg); }
/* Rest day: whisper tint + small soft chip (not a filled box stamp). */
table.month-grid td.cell.is-rest {
  background: color-mix(in srgb, var(--grid-off) 22%, var(--paper));
  text-align: center;
  vertical-align: middle;
}
table.month-grid td.cell.is-rest:hover {
  background: color-mix(in srgb, var(--grid-off) 34%, var(--paper));
}
table.month-grid td.cell.weekend.is-rest {
  background: color-mix(in srgb, var(--grid-off) 18%, var(--grid-weekend));
}
table.month-grid td.cell.closed-day:not(.has-shift):not(.is-rest):not(.unavail):not(.bankhol) {
  background: color-mix(in srgb, var(--grid-weekend) 70%, var(--bg-2));
  opacity: 0.85;
}
.cell-rest-label {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--grid-ok-ink) 16%, var(--rule));
  background: color-mix(in srgb, var(--grid-off) 40%, var(--paper));
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: color-mix(in srgb, var(--ink-3) 55%, var(--grid-ok-ink));
  line-height: 1.35;
  user-select: none;
  opacity: 0.9;
}
/* Day outside the person's working pattern (e.g. Marketing on a Saturday):
   muted dash, no "off" pill — it's not a rest day, they just never work it. */
table.month-grid td.cell.cell-nonwork {
  background: color-mix(in srgb, var(--grid-weekend) 55%, var(--bg-2));
}
.cell-nonwork-label {
  display: inline-block;
  color: var(--ink-muted);
  font-size: 0.7rem;
  opacity: 0.55;
  user-select: none;
}
/* Bank holiday: tint the column blue, no per-row text. The header tells you
   what it is; repeating "Bank Holiday" in every cell is just visual noise. */
table.month-grid td.cell.bankhol {
  background: var(--grid-bankhol-soft);
  color: transparent;
  cursor: default;
}
table.month-grid td.cell.bankhol:hover {
  background: #c4d6e8;
  outline: none;
}
/* Header cell for a bank holiday date: soft blue strip, dark text, normal
   weight, no uppercase, generous wrapping. */
table.month-grid thead th.bankhol-label,
table.month-grid thead th.dom.bankhol-label {
  background: var(--grid-bankhol-soft);
  color: var(--grid-bankhol);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
  font-family: var(--sans);
  white-space: normal;
  line-height: 1.2;
  padding: 6px 4px;
  border-color: #b6cce0;
}
.cell-unavail-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--ink-3);
  line-height: 1.2;
  padding: 2px 1px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shift-pill.leave-code.leave-off {
  --pill-accent: #8a3a3a;
  background: #f0d8d8 !important;
  color: #5a2020 !important;
  border-color: #c48a8a !important;
  border-left-color: #8a3a3a !important;
}
.shift-pill.leave-code.leave-sick {
  --pill-accent: #a05a5a;
  background: #f3e0e0 !important;
  color: #5a2828 !important;
}
.shift-pill.leave-code.leave-holiday,
.shift-pill.leave-code.leave-half-day,
.shift-pill.leave-code.leave-unpaid {
  --pill-accent: #8a8680;
  background: var(--grid-holiday) !important;
  color: #2a2a2a !important;
  border-color: #b0aca6 !important;
  border-left-color: #8a8680 !important;
}
.day-status-ok    { background: #3f9d4f !important; color: #ffffff !important; font-weight: 700; letter-spacing: 0.04em; font-family: var(--sans); font-size: 12px; }
.day-status-notok { background: var(--grid-notok) !important; color: var(--grid-notok-ink) !important; font-weight: 700; letter-spacing: 0.04em; font-family: var(--sans); font-size: 12px; }
.day-status-overridden {
  box-shadow: inset 0 0 0 2px #6b8f3a;
  font-style: italic;
}
table.month-grid tbody tr.status-row td.status-has-gaps {
  vertical-align: top;
  padding: 4px 3px 5px;
  height: auto;
  min-height: 40px;
}
table.month-grid tbody tr.status-row .status-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
}
table.month-grid tbody tr.status-row .status-gaps {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 3px;
  align-items: stretch;
}
table.month-grid tbody tr.status-row .status-gap-pill {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  line-height: 1.2;
  min-height: 24px;
}
table.month-grid tbody tr.status-row .status-gap-pill:hover {
  background: #fff;
  outline: 1px solid var(--purple);
}
table.month-grid tbody tr.status-row .status-gap-text {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.95;
  line-height: 1.2;
}
.shift-pill {
  --pill-accent: var(--ink-3);
  display: inline-block;
  padding: 4px 7px 4px 8px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
  /* Stronger fill than the muted pass — still keeps dark text readable */
  background: color-mix(in srgb, var(--pill-accent) 42%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--pill-accent) 55%, var(--rule));
  border-left: 4px solid var(--pill-accent);
  border-radius: 3px;
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
  line-height: 1.2;
  text-align: center;
}
.shift-pill.muted { background: var(--bg-2); color: var(--ink-3); border-color: var(--rule); }
.shift-pill[draggable="true"] { cursor: grab; }
.shift-pill.dragging { opacity: 0.4; cursor: grabbing; }
.shift-pill.locked {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  position: relative;
}
.shift-pill.locked::after {
  content: "\2022";
  position: absolute;
  top: -1px;
  right: 2px;
  font-size: 9px;
  color: rgba(0, 0, 0, 0.45);
  line-height: 1;
}
.lock-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
  color: transparent;
  font-size: 0;
  line-height: 0;
}
table.month-grid td.cell.drop-ok {
  background: var(--purple-soft) !important;
  outline: 2px dashed var(--purple);
  outline-offset: -2px;
}
.totals-col {
  background: var(--paper); font-variant-numeric: tabular-nums; font-size: 11px;
  text-align: right; padding-right: 10px !important;
  color: var(--ink); font-weight: 600;
  width: var(--hours-col-w); min-width: var(--hours-col-w); max-width: var(--hours-col-w);
  white-space: nowrap;
}
.totals-col.totals-cmp {
  font-weight: 500;
  letter-spacing: 0;
}
.totals-col .totals-actual { font-weight: 700; color: var(--ink); }
.totals-col .totals-sep { color: var(--ink-muted); font-weight: 400; }
.totals-col .totals-expected { font-weight: 500; color: var(--ink-2); }
.totals-col.totals-under .totals-actual { color: var(--gold); }
.totals-col.totals-soft-under .totals-actual { color: #8a6a20; }
.totals-col.totals-over .totals-actual { color: var(--red); }
.totals-col.totals-ok .totals-actual { color: var(--ink); }
table.month-grid thead th.totals-col {
  background: var(--grid-subband);
  color: var(--grid-subband-ink);
  text-align: right;
  letter-spacing: 0.06em;
  white-space: nowrap;
  line-height: 1.25;
  vertical-align: middle;
}
.month-grid tr.divider td { border-top: 2px solid var(--rule-strong); }
.month-grid tr.totals { font-weight: 600; }
.month-grid tr.dept-group-row td {
  background: var(--grid-subband);
  border-top: 2px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  padding: 7px 12px;
}
.month-grid tr.dept-group-row td.staff-cell.dept-group-label {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  z-index: 5;
  background: var(--grid-subband);
  box-shadow: 4px 0 8px -4px rgba(0, 0, 0, 0.14);
}
.month-grid tr.dept-group-row td.dept-group-band {
  padding: 0;
}
.week-divider { border-left: 2px solid var(--rule-strong) !important; }

/* ---------- Per-person view (schedule) ---------- */
.pv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 0 12px;
}
.pv-toolbar-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  max-width: 42rem;
}
.pv-toolbar-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  align-items: start;
}
.person-grid.person-grid-mine {
  grid-template-columns: minmax(0, 720px);
}
.person-grid .person-list-sep.dept-sep {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 8px 0 2px;
  border-bottom: 1px solid var(--rule);
  margin-top: 4px;
}
.person-grid .person-card,
.person-grid .pv-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 12px 14px 10px;
  box-shadow: 0 1px 0 rgba(40, 28, 48, 0.04);
  min-width: 0;
}
.person-grid .pv-card-head { margin-bottom: 6px; }
.person-grid .person-card h3,
.person-grid .pv-card h3 {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--ink);
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}
.person-grid .person-meta {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-3);
  margin: 0;
  line-height: 1.35;
}
.hours-bar {
  position: relative;
  height: 10px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  margin: 4px 0 8px;
}
.hours-bar .min-mark, .hours-bar .max-mark {
  position: absolute; top: -3px; bottom: -3px;
  width: 1px; background: var(--ink-2);
}
.hours-bar .fill { position: absolute; top: 0; bottom: 0; background: var(--purple); }
.hours-bar .fill.over { background: var(--red); }
.hours-bar .fill.under { background: var(--gold); }
.shift-list { font-variant-numeric: tabular-nums; font-size: 12px; }
.shift-list li { padding: 2px 0; border-bottom: 1px dotted var(--rule); display: flex; justify-content: space-between; }
.shift-list li:last-child { border-bottom: none; }

.pv-weeks { display: flex; flex-direction: column; gap: 4px; }
.pv-week-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "chev range meta"
    "summary summary summary";
  gap: 2px 8px;
  align-items: baseline;
  width: 100%;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.pv-week-head:hover {
  border-color: color-mix(in srgb, var(--purple) 35%, var(--rule));
  background: color-mix(in srgb, var(--purple-50) 55%, var(--surface-2));
}
.pv-week.is-open .pv-week-head {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}
.pv-week-chevron {
  grid-area: chev;
  font-size: 11px;
  color: var(--ink-3);
  width: 1em;
}
.pv-week-range {
  grid-area: range;
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  min-width: 0;
}
.pv-week-meta {
  grid-area: meta;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}
.pv-week-summary {
  grid-area: summary;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-week-summary.is-rest { font-style: italic; }
.pv-week.is-open .pv-week-summary { white-space: normal; }
.pv-days {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--rule);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.pv-days[hidden] { display: none !important; }
.pv-day {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 8px;
  align-items: center;
  padding: 5px 10px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.pv-day:last-child { border-bottom: none; }
.pv-day.is-weekend { background: color-mix(in srgb, var(--grid-weekend) 55%, var(--paper)); }
.pv-day.is-rest { background: color-mix(in srgb, var(--grid-off) 18%, var(--paper)); }
.pv-day-date {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.pv-dow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.pv-dom {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.pv-day-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.pv-shift {
  --pill-accent: var(--ink-3);
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid color-mix(in srgb, var(--pill-accent) 45%, var(--rule));
  border-left: 3px solid var(--pill-accent);
  background: color-mix(in srgb, var(--pill-accent) 22%, var(--paper));
  max-width: 100%;
}
.pv-shift-name {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
}
.pv-shift-time {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-2);
}
.pv-shift.is-leave {
  background: var(--grid-holiday);
  border-color: #b0aca6;
  border-left-color: #8a8680;
}
.pv-shift.is-ot {
  background: #fff3d1;
  border-color: #e0c46a;
  border-left-color: #d4a017;
}
.pv-rest {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--grid-ok-ink) 16%, var(--rule));
  background: color-mix(in srgb, var(--grid-off) 40%, var(--paper));
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: color-mix(in srgb, var(--ink-3) 55%, var(--grid-ok-ink));
}
.pv-empty {
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}
.pv-hours-card .pv-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}
.pv-stat {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.pv-stat-cum {
  background: color-mix(in srgb, var(--purple-50) 80%, var(--paper));
  border-color: color-mix(in srgb, var(--purple) 22%, var(--rule));
}
.pv-stat-expected.is-under .pv-stat-value { color: var(--gold); }
.pv-stat-expected.is-soft-under .pv-stat-value { color: #8a6a20; }
.pv-stat-expected.is-over .pv-stat-value { color: var(--red); }
.pv-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.pv-stat-value {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.1;
}
.pv-stat-hint {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.3;
}
.pv-week-table-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.pv-week-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.pv-week-table th,
.pv-week-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
}
.pv-week-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
}
.pv-week-table td.num,
.pv-week-table th:not(:first-child) { text-align: right; }
.pv-week-table tbody tr:last-child td { border-bottom: none; }
@media (max-width: 640px) {
  .person-grid,
  .person-grid.person-grid-mine { grid-template-columns: 1fr; }
  .pv-day { grid-template-columns: 5.5rem 1fr; padding: 8px 10px; }
  .pv-hours-card .pv-stat-row { grid-template-columns: 1fr; }
}

/* ---------- Daily view ---------- */
.day-strips { display: flex; flex-direction: column; gap: 8px; }
.day-strip {
  display: grid;
  grid-template-columns: 140px 1fr;
  background: var(--paper);
  border: 1px solid var(--rule);
}
.day-strip .day-label {
  padding: 12px 14px;
  border-right: 1px solid var(--rule-strong);
  background: var(--bg-2);
}
.day-strip .day-label .dom { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 28px; line-height: 1; }
.day-strip .day-label .dow { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }
.day-strip .day-label .dmy {
  margin-top: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  line-height: 1.2;
}
.day-strip.saturday .day-label { background: var(--purple-soft); color: var(--purple); }
.day-shifts { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; }
.day-block {
  --pill-accent: var(--ink-3);
  border: 1px solid color-mix(in srgb, var(--pill-accent) 55%, var(--rule));
  border-left: 4px solid var(--pill-accent);
  background: color-mix(in srgb, var(--pill-accent) 38%, var(--paper));
  padding: 6px 10px;
  min-width: 140px;
  max-width: 220px;
  color: var(--ink);
  font-size: 12px;
  border-radius: 3px;
}
.day-block .head {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--ink);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.day-block .time { font-variant-numeric: tabular-nums; font-size: 10px; color: var(--ink-3); }
.day-block ul { margin: 4px 0 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; font-size: 11.5px; }
.day-block ul li { padding: 1px 0; }
.day-block ul li.unfilled { font-style: italic; color: var(--ink-3); }

/* ---------- Logbook ---------- */
.logbook-controls { display: flex; gap: 8px; margin-bottom: 10px; }
.logbook-controls input { flex: 1; padding: 8px 10px; border: 1px solid var(--rule); background: var(--paper); font: inherit; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(26, 21, 32, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
  animation: modalFade 160ms ease-out;
}
.modal-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(26, 21, 32, 0.18);
  width: min(960px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalRise 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.modal-card.narrow { width: min(520px, 94vw); }
.modal-card.gen-modal-card { width: min(840px, 94vw); }
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: none;
  background: transparent;
}
.modal-head h2 { font-size: 1.25rem; color: var(--ink); margin: 0; letter-spacing: -0.02em; }
.modal-sub { margin: 4px 0 0; font-size: 0.88rem; color: var(--ink-3); }
.modal-x {
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-3);
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.modal-x span {
  display: block;
  font-family: var(--sans);
  font-size: 1.45rem;
  font-weight: 300;
  line-height: 1;
  margin-top: -1px;
}
.modal-x:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--rule);
}
.modal-x:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--purple);
}
.modal-body { padding: 8px 22px 20px; overflow: auto; flex: 1; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--rule);
  background: color-mix(in srgb, var(--surface-2) 70%, var(--paper));
  display: flex; justify-content: flex-end; gap: 8px;
}
@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalRise {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.stepper {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 22px 16px;
  margin: 0;
}
.stepper li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  background: var(--surface-2);
  border-radius: 12px;
  color: var(--ink-3);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.stepper .step-num {
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--rule-strong);
  font-variant-numeric: tabular-nums; font-size: 0.72rem; font-weight: 700;
  color: var(--ink-3); flex-shrink: 0;
}
.stepper .step-label { letter-spacing: -0.01em; }
.stepper li.active {
  background: var(--purple-soft);
  border-color: color-mix(in srgb, var(--purple) 35%, var(--rule));
  color: var(--purple);
}
.stepper li.active .step-num {
  background: var(--purple); border-color: var(--purple); color: #fff;
}
.stepper li.done {
  background: var(--paper);
  border-color: color-mix(in srgb, var(--success) 35%, var(--rule));
  color: var(--ink-2);
}
.stepper li.done .step-num {
  background: var(--success-bg); border-color: var(--success); color: var(--success);
}

.gen-fields {
  display: grid;
  grid-template-columns: 1.4fr 1.4fr 0.7fr;
  gap: 12px 14px;
  margin-bottom: 18px;
}
.gen-field-wide { grid-column: 1 / -1; }
.gen-field #gen-period-mode-seg { margin-top: 2px; }
.gen-field {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-muted);
}
.gen-field input {
  font: inherit; font-size: 0.95rem; font-weight: 500; letter-spacing: 0;
  text-transform: none; color: var(--ink);
  padding: 9px 11px; border-radius: var(--radius);
}
.gen-field .hint {
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0;
  text-transform: none; color: var(--ink-3); margin-top: 2px;
}
.gen-block {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper);
  overflow: hidden;
}
.gen-block-head {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.gen-block-head h3 {
  margin: 0; font-size: 0.95rem; font-weight: 650; color: var(--ink);
}
.gen-block-head p {
  margin: 4px 0 0; font-size: 0.82rem; color: var(--ink-3); line-height: 1.4;
}

.form-row { display: grid; grid-template-columns: 220px 1fr; gap: 12px; margin-bottom: 12px; align-items: center; }
.form-row label { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.form-row input, .form-row select {
  font: inherit; padding: 7px 10px;
  background-color: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}
.form-row select:not([multiple]) {
  padding-right: 2.1rem;
}
.hint { font-size: 11px; color: var(--ink-3); }

.prereq-head {
  font-family: var(--sans); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3); margin: 18px 0 4px;
}
.prereq-sub { color: var(--ink-3); font-size: 12px; margin: 0 0 8px; }
.prereq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
  padding: 12px;
}
.prereq-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.88rem;
  flex-wrap: wrap;
}
.prereq-label { display: none; }
.prereq-row input[type="number"] {
  width: 48px; font-variant-numeric: tabular-nums; font-weight: 600;
  padding: 6px 6px; text-align: center;
  border: 1px solid var(--rule-strong); background: var(--paper); border-radius: 8px;
}
.prereq-tag { margin: 0; }
.prereq-mins {
  display: flex; align-items: center; gap: 6px; margin-left: auto;
  font-size: 0.72rem; color: var(--ink-muted); font-weight: 600;
  letter-spacing: 0.02em;
}
.prereq-mins span { white-space: nowrap; }

.req-helpers {
  display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 12px;
}
.req-helpers .helper-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted);
}
.req-helpers select {
  font: inherit; padding: 6px 2rem 6px 10px; border: 1px solid var(--rule-strong);
  background-color: var(--paper); min-width: 200px; border-radius: 8px;
}
.req-helpers .helper-spacer { flex: 1 1 auto; }

/* ---------- Weekly pattern editor ---------- */
.pattern-editor {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}
.pat-help {
  background: var(--purple-soft);
  border: 1px solid color-mix(in srgb, var(--purple) 18%, var(--rule));
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.84rem;
  color: var(--ink-2);
}
.pat-help strong { color: var(--purple); font-size: 0.88rem; }
.pat-help p { margin: 4px 0 0; line-height: 1.45; }
.pat-help em { font-style: italic; color: var(--ink); }

.pat-list {
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
}
.pat-list-head,
.pat-list .pat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 88px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
}
.pat-list-head {
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.pat-h-count { text-align: center; }
.pat-h-count.sat { color: var(--gold-deep); }

.pat-list .pat-row {
  border-bottom: 1px solid var(--rule);
  transition: opacity 120ms ease, background 120ms ease;
}
.pat-list .pat-row:last-child { border-bottom: none; }
.pat-list .pat-row:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.pat-list .pat-row.is-zero { opacity: 0.42; }
.pat-list .pat-row.is-zero:hover,
.pat-list .pat-row.is-zero:focus-within { opacity: 1; }

.pat-shift-info {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.pat-color-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.pat-shift-text {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.pat-name {
  font-size: 0.92rem; font-weight: 650; color: var(--ink);
  overflow-wrap: anywhere; line-height: 1.25;
}
.pat-time {
  font-variant-numeric: tabular-nums; font-size: 0.74rem; color: var(--ink-muted);
}
.pat-count-wrap {
  display: flex; justify-content: center;
}
.pat-count-wrap.sat {
  padding: 4px 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--gold-soft) 55%, transparent);
}
.pat-count-input {
  width: 56px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  padding: 7px 6px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  text-align: center;
  font-size: 0.92rem;
  border-radius: 8px;
}
.pat-foot { font-size: 0.8rem; color: var(--ink-3); margin-top: 12px; line-height: 1.5; }
.pat-foot a { color: var(--purple); text-decoration: underline; font-weight: 600; }

@media (max-width: 560px) {
  .pat-list-head,
  .pat-list .pat-row { grid-template-columns: minmax(0, 1fr) 72px 72px; gap: 6px; padding-left: 10px; padding-right: 10px; }
  .pat-count-input { width: 48px; }
}

/* Per-day editor — day cards, not a spreadsheet */
.req-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: none;
  border-radius: 0;
  overflow: visible;
  max-height: min(52vh, 520px);
  overflow-y: auto;
  padding-right: 2px;
}
.req-help {
  background: var(--purple-soft);
  border: 1px solid color-mix(in srgb, var(--purple) 18%, var(--rule));
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.84rem;
  color: var(--ink-2);
  position: sticky; top: 0; z-index: 2;
}
.req-help strong { color: var(--purple); font-size: 0.88rem; }
.req-help p { margin: 4px 0 0; line-height: 1.45; }
.req-week-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-muted);
  padding: 6px 2px 0;
}
.req-day {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
}
.req-day.is-saturday {
  border-color: color-mix(in srgb, var(--gold) 40%, var(--rule));
  background: color-mix(in srgb, var(--gold-soft) 35%, var(--paper));
}
.req-day-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.req-day.is-saturday .req-day-head {
  background: color-mix(in srgb, var(--gold-soft) 70%, var(--surface-2));
}
.req-day-title { display: flex; align-items: center; gap: 8px; }
.req-day-title strong { font-size: 0.95rem; letter-spacing: -0.01em; }
.req-day-badge {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold-deep);
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--rule));
}
.req-day-meta { font-size: 0.78rem; color: var(--ink-muted); }
.req-day-shifts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
}
.req-shift-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  transition: opacity 120ms ease;
}
.req-shift-row.is-zero { opacity: 0.45; }
.req-shift-row.is-zero:focus-within,
.req-shift-row.is-zero:hover { opacity: 1; }
.req-shift-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.req-shift-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.req-shift-name {
  font-size: 0.86rem; font-weight: 600; color: var(--ink);
  overflow-wrap: anywhere; line-height: 1.25;
}
.req-shift-time {
  font-variant-numeric: tabular-nums; font-size: 0.72rem; color: var(--ink-muted);
}
.req-count {
  width: 52px; flex-shrink: 0;
  font-variant-numeric: tabular-nums; font-weight: 650; text-align: center;
  padding: 6px 6px; border-radius: 8px;
  border: 1px solid var(--rule-strong); background: var(--paper);
}
.req-day.is-saturday .req-count { background: var(--paper); }

.review-summary { display: flex; flex-direction: column; gap: 14px; }
.review-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.review-stat {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 12px 14px;
}
.review-stat .k {
  display: block; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted);
  margin-bottom: 4px;
}
.review-stat .v {
  font-size: 1.15rem; font-weight: 650; color: var(--ink); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.review-meta {
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
}
.review-meta table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.review-meta td { padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.review-meta tr:last-child td { border-bottom: none; }
.review-meta td:first-child { color: var(--ink-3); width: 42%; }
.review-meta td:last-child { font-weight: 600; color: var(--ink); }
.review-summary .warn {
  color: var(--red); padding: 12px 14px; background: var(--red-bg);
  border: 1px solid color-mix(in srgb, var(--red) 30%, var(--rule));
  border-radius: 12px; font-size: 0.88rem; line-height: 1.4;
}

.pattern-grid { display: grid; gap: 10px; }
.pattern-grid .pat-row { display: grid; grid-template-columns: 1fr 80px 100px; gap: 8px; align-items: center; }
.pattern-grid .pat-row label { font-size: 12px; }
.pattern-grid h3 { font-family: var(--sans); font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; color: var(--ink-3); margin-top: 8px; }

@media (max-width: 720px) {
  .gen-fields { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: 1fr; }
  .modal-card.gen-modal-card { width: min(960px, 94vw); }
}

/* ---------- Drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 30, 0.28);
  z-index: 79;
  animation: backdropFade 160ms ease-out;
}
.drawer-backdrop[hidden] { display: none !important; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 400px;
  background: var(--paper);
  border-left: 1px solid var(--rule-strong);
  box-shadow: var(--shadow-lg);
  z-index: 80;
  display: flex; flex-direction: column;
  animation: drawerSlide 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.drawer.drawer-wide { width: min(440px, 96vw); }
.drawer.drawer-unavail { width: min(560px, 96vw); }
.drawer-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 22px;
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
}
.hol-chip {
  display: inline-block;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  padding: 2px 7px;
  border-radius: 3px;
}
.hol-chip.hol-over, .hol-over, td.hol-over { color: var(--red, #a12622); font-weight: 600; }
.staff-avatar {
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: color-mix(in srgb, var(--purple) 14%, var(--surface-2));
  color: var(--purple);
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
}
.staff-avatar.size-sm { width: 32px; height: 32px; }
.staff-avatar.size-md { width: 44px; height: 44px; }
.staff-avatar.size-lg { width: 88px; height: 88px; }
.staff-avatar.size-sm .staff-avatar-fallback { font-size: 0.7rem; }
.staff-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.staff-avatar-fallback {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}
.staff-avatar.size-lg .staff-avatar-fallback { font-size: 1.35rem; }
.profile-photo-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin: 0 0 14px;
}
.profile-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.profile-section { margin-bottom: 18px; }
.profile-section h3 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-2);
}
.profile-dl { list-style: none; padding: 0; margin: 0; }
.profile-dl li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--rule);
  font-size: 0.85rem;
}
.profile-dl li span { color: var(--ink-muted); }
.profile-hol-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.profile-hol-summary > div {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px;
  text-align: center;
}
.profile-hol-summary span {
  display: block;
  font-size: 0.7rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.profile-hol-summary strong {
  display: block;
  margin-top: 2px;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.profile-leave-list {
  list-style: none; padding: 0; margin: 8px 0 0;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  max-height: 220px;
  overflow: auto;
}
.profile-leave-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--rule);
}
.profile-leave-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}
.profile-leave-actions {
  display: inline-flex; gap: 4px;
}
.profile-leave-list .muted, .profile-section .muted { color: var(--ink-muted); font-style: italic; }
.annual-leave-edit-list {
  list-style: none; padding: 0; margin: 8px 0 0;
  max-height: 280px; overflow: auto;
}
.annual-leave-edit-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dotted var(--rule);
  font-size: 0.875rem;
}
.annual-leave-edit-actions {
  display: inline-flex; gap: 4px; flex-shrink: 0;
}
.leave-change-prompt .field { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.leave-change-prompt select { max-width: 16rem; }

.profile-hol-cal-wrap { margin-top: 10px; }
.profile-hol-paint-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 10px;
}
.profile-hol-paint-row .field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}
.profile-hol-paint-row .hint {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--ink-muted);
}
.profile-hol-paint {
  min-width: 9.5rem;
  margin: 0;
  padding: 5px 8px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
}
.profile-hol-cal-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 2px 0 6px;
}
.profile-hol-month-lbl { font-size: 0.9rem; font-weight: 650; }
.profile-hol-cal {
  gap: 3px;
  margin: 0 0 10px;
}
.profile-hol-cal .mc-head {
  margin-bottom: 2px;
}
.profile-hol-cal .mc-day.hol-full {
  background: color-mix(in srgb, var(--purple) 82%, #1a1520);
  color: var(--paper);
  border-color: var(--purple-deep);
}
.profile-hol-cal .mc-day.hol-half {
  background: color-mix(in srgb, var(--gold, #c9a227) 55%, var(--paper));
  color: #3d3218;
  border-color: #b8954a;
  font-weight: 650;
}
.profile-hol-cal .mc-day.weekend:not(.marked) {
  background: color-mix(in srgb, var(--grid-weekend, #f3f0ea) 70%, var(--paper));
}
.profile-hol-range {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin: 0 0 8px;
  padding: 10px 12px;
  background: var(--surface-2, var(--bg-2));
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.profile-hol-range .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  flex: 1 1 7.5rem;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.profile-hol-range input[type="date"] {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  padding: 6px 8px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
}
.profile-hol-range .btn-tiny {
  margin-bottom: 1px;
}
#profile-notes {
  width: 100%;
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--rule);
  background: var(--paper);
  resize: vertical;
}
button.linkish {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--purple);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.linkish:hover { color: var(--ink); }
.annual-bal { white-space: nowrap; font-variant-numeric: tabular-nums; }
.profile-year-row label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--ink-2);
}
.profile-year-row select {
  font: inherit; padding: 4px 1.85rem 4px 8px;
  border: 1px solid var(--rule); background-color: var(--paper);
}
.profile-stats-summary { margin-bottom: 10px; }
.profile-highlights {
  margin: 0 0 12px; padding-left: 1.1rem;
  font-size: 0.82rem; color: var(--ink-2);
}
.profile-highlights li { margin: 3px 0; }
.profile-subh {
  margin: 12px 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}
.profile-bars { display: flex; flex-direction: column; gap: 3px; }
.profile-bar-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) 2.8rem;
  gap: 8px;
  align-items: center;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.profile-bar-row.is-empty { opacity: 0.45; }
.profile-bar-label {
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.profile-bar-track {
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
  min-width: 0;
}
.profile-bar-fill {
  height: 100%;
  background: var(--purple);
  min-width: 0;
}
.profile-bar-val { text-align: right; color: var(--ink); font-weight: 600; }
.office-defaults-line {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
}
.people-insights-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
}
.people-insights-toolbar .field { margin: 0; max-width: 10rem; }
.people-range-fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-4);
  align-items: flex-end;
}
.people-range-fields .field { max-width: 11rem; }
.people-range-fields input[type="date"] {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}
.people-insights-body { display: flex; flex-direction: column; gap: var(--sp-7); }
.people-section .settings-section-head { margin-bottom: var(--sp-3); }
.people-card {
  padding: var(--sp-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}
.people-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}
@media (max-width: 900px) {
  .people-summary { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .people-summary { grid-template-columns: repeat(2, 1fr); }
}
.people-stat-card {
  padding: var(--sp-3) var(--sp-4);
  border: none;
  border-right: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  min-height: 0;
}
.people-stat-card:last-child { border-right: none; }
@media (max-width: 900px) {
  .people-stat-card:nth-child(3n) { border-right: none; }
  .people-stat-card:nth-child(n+4) { border-top: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .people-stat-card:nth-child(3n) { border-right: 1px solid var(--rule); }
  .people-stat-card:nth-child(2n) { border-right: none; }
  .people-stat-card:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
.people-stat-val {
  font-family: var(--sans);
  font-size: var(--fs-xl, 1.35rem);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.people-stat-label {
  margin-top: 4px;
  font-size: var(--fs-xs, 0.75rem);
  color: var(--ink-2);
  letter-spacing: 0.01em;
}
.people-pulse-detail {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-top: var(--sp-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}
@media (max-width: 720px) {
  .people-pulse-detail { grid-template-columns: 1fr; }
}
.people-pulse-col {
  padding: var(--sp-3) var(--sp-4);
  border-right: 1px solid var(--rule);
}
.people-pulse-col:last-child { border-right: none; }
@media (max-width: 720px) {
  .people-pulse-col {
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }
  .people-pulse-col:last-child { border-bottom: none; }
}
.people-pulse-col-title {
  margin: 0 0 8px;
  font-size: var(--fs-xs, 0.72rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.people-pulse-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 3px 0;
  font-size: var(--fs-sm, 0.82rem);
}
.people-pulse-k { color: var(--ink-2); }
.people-pulse-v {
  font-family: var(--sans);
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.people-pay-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.people-pay-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-accent);
  font-size: var(--fs-sm, 0.85rem);
  color: var(--ink-2);
}
.people-pay-chip strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.people-pay-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: var(--sp-3);
}
.people-pay-metric .label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs, 0.75rem);
  color: var(--ink-2);
}
.people-pay-metric .val {
  font-size: var(--fs-lg, 1.1rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.info-tip {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--surface-2);
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  cursor: help;
  flex: 0 0 auto;
}
.info-tip:hover,
.info-tip:focus-visible {
  color: var(--ink);
  border-color: var(--purple);
  outline: none;
}
/* Floating tip is appended to body (see app.js) so it is never clipped by panels/sidebar */
.info-tip-float {
  position: fixed;
  z-index: 10050;
  max-width: min(18rem, calc(100vw - 24px));
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.info-tip-float[hidden] { display: none !important; }
.profile-gift-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.profile-gift-row .field { margin: 0; max-width: 8rem; }
.profile-gift-input {
  width: 100%;
  font-variant-numeric: tabular-nums;
}
.profile-gift-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.profile-section h3 .info-tip { margin-left: 4px; vertical-align: middle; }
.people-flags { display: flex; flex-direction: column; gap: var(--sp-2); }
.people-flag {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}
.people-flag-kind {
  font-size: var(--fs-xs, 0.75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--purple);
}
.people-flag-detail { font-size: var(--fs-sm, 0.85rem); color: var(--ink-2); }
@media (max-width: 700px) {
  .people-flag { grid-template-columns: 1fr; }
}
.hbar-chart { display: flex; flex-direction: column; gap: 8px; max-height: 28rem; overflow: auto; }
.hbar-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr 4.5rem;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 2px 0;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.hbar-row:hover .hbar-name { color: var(--purple); }
.hbar-name {
  font-size: var(--fs-sm, 0.85rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hbar-track {
  position: relative;
  height: 14px;
  background: var(--bg-accent);
  border-radius: 3px;
  overflow: hidden;
}
.hbar-fill-cap {
  position: absolute; inset: 0 auto 0 0;
  background: color-mix(in srgb, var(--purple) 22%, var(--bg-accent));
  border-radius: 3px;
}
.hbar-fill-eff {
  position: absolute; inset: 0 auto 0 0;
  background: var(--purple);
  border-radius: 3px;
  opacity: 0.85;
}
.hbar-val {
  font-size: var(--fs-xs, 0.75rem);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  text-align: right;
}
.people-coverage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
}
@media (max-width: 800px) {
  .people-coverage { grid-template-columns: 1fr; }
}
.people-chart-card h4,
.people-rank-card h4 {
  margin: 0 0 10px;
  font-size: var(--fs-md, 0.95rem);
  font-weight: 600;
}
.pie-chart {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
}
.pie-svg { flex: 0 0 auto; }
.pie-side { flex: 1 1 9rem; min-width: 8rem; }
.pie-hover-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 2rem;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: var(--fs-xs, 0.75rem);
  line-height: 1.3;
}
.pie-hover-tip[hidden] { display: none !important; }
.pie-hover-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  flex: 0 0 auto;
}
.pie-empty {
  min-height: 6rem;
  display: grid;
  place-items: center;
}
.pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-sm, 0.8rem);
}
.pie-legend li,
.pie-leg-item {
  display: grid;
  grid-template-columns: 0.7rem 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  cursor: default;
  border-radius: 4px;
  padding: 2px 4px;
}
.pie-leg-item:hover,
.pie-leg-item:focus-visible {
  background: var(--surface-2);
  outline: none;
}
.pie-slice { transition: opacity 0.12s ease; }
.pie-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  background: var(--purple);
}
.pie-leg-label { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pie-leg-val { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.people-rankings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
@media (max-width: 800px) {
  .people-rankings { grid-template-columns: 1fr; }
}
.people-rank-card { min-height: 12rem; }
.people-role-leaders { display: flex; flex-direction: column; gap: var(--sp-4); }
.people-role-block h5 {
  margin: 0 0 6px;
  font-size: var(--fs-xs, 0.75rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.people-rank-table td.mono,
#people-holidays-table td.mono {
  font-variant-numeric: tabular-nums;
}
.people-dept-table { width: 100%; font-size: var(--fs-sm, 0.85rem); }
.people-dept-table .people-dept-total td {
  font-weight: 700;
  border-top: 1px solid var(--rule);
  padding-top: 8px;
}
.hol-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: var(--fs-xs, 0.72rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.hol-status-ok { background: var(--success-bg); color: var(--success); }
.hol-status-tight { background: var(--warn-bg); color: var(--warn); }
.hol-status-use_soon { background: var(--gold-soft); color: var(--gold-deep); }
.hol-status-overdrawn { background: var(--danger-bg); color: var(--danger); }
.people-hol-note { margin-top: 6px !important; }
.people-empty {
  padding: var(--sp-6);
  text-align: center;
  color: var(--ink-2);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
}
.people-hours-detail {
  margin-top: var(--sp-2);
}
.people-hours-detail .person-hours-table {
  font-size: var(--fs-xs, 0.78rem);
  width: 100%;
}
.people-hours-detail .person-meta {
  margin: 4px 0 10px;
  font-size: var(--fs-sm, 0.85rem);
  color: var(--ink-2);
}
.people-hours-detail .person-hours-note {
  margin-top: 10px;
  font-size: var(--fs-xs, 0.75rem);
  color: var(--ink-3);
}
@keyframes drawerSlide {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.drawer-head h2 { font-size: 16px; color: var(--ink); }
.drawer-body { padding: 18px 22px; overflow: auto; flex: 1; }
.drawer-unavail .drawer-body { overflow-x: hidden; }
.mini-cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin: 12px 0;
  width: 100%;
  max-width: 100%;
}
.mini-cal .mc-day {
  aspect-ratio: 1 / 1;
  min-width: 0;
  display: grid; place-items: center;
  font-variant-numeric: tabular-nums; font-size: 12px;
  background: var(--bg); border: 1px solid var(--rule);
  cursor: pointer;
}
.mini-cal .mc-day.today { border-color: var(--gold); }
.mini-cal .mc-day.off { color: var(--ink-3); background: transparent; cursor: default; border-color: transparent; }
.mini-cal .mc-day.sun { color: var(--ink-3); cursor: not-allowed; background: repeating-linear-gradient(135deg, var(--bg-2) 0 4px, var(--bg) 4px 8px); }
.mini-cal .mc-day.marked { background: var(--purple); color: var(--paper); border-color: var(--purple-deep); }
.mini-cal .mc-head { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); text-align: center; }
.drawer-list h3 { font-family: var(--sans); font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; color: var(--ink-3); margin: 18px 0 6px; }
.range-form { background: var(--surface-2); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); padding: 12px; margin: 12px 0; }
.range-form h3 { font-family: var(--sans); font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0; color: var(--ink-2); margin: 0 0 8px; }
.range-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.range-row input[type="date"] { font: inherit; padding: 4px 6px; border: 1px solid var(--rule); background: var(--paper); flex: 1 1 7rem; min-width: 0; }
.range-row input[type="text"], .range-row #range-reason { font: inherit; padding: 4px 6px; border: 1px solid var(--rule); background: var(--paper); flex: 1 1 8rem; min-width: 0; }
.range-row select { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.range-arrow { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.range-hint { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.drawer-list ul { list-style: none; padding: 0; margin: 0; font-variant-numeric: tabular-nums; font-size: 12px; }
.drawer-list li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dotted var(--rule); }
.bankhol-list { list-style: none; padding: 0; margin: 8px 0 0; font-variant-numeric: tabular-nums; font-size: 13px; }
.bankhol-list li {
  display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center;
  padding: 6px 8px; border-bottom: 1px dotted var(--rule);
}
.bankhol-list li:last-child { border-bottom: none; }
.bankhol-list .bankhol-date { color: var(--grid-bankhol); font-weight: 600; }
.bankhol-list .bankhol-name { font-family: var(--sans); color: var(--ink-2); }
.bankhol-list .bankhol-empty { color: var(--ink-3); font-style: italic; padding: 6px 8px; }

/* ---------- Popover (cell editor) ---------- */
.popover {
  position: fixed; z-index: 90;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 260px;
  max-width: 320px;
  overflow: hidden;
  animation: modalRise 160ms ease-out;
}
/* Centered variant - used by the schedule grid editor so the popover always
   lands in a comfortable click target instead of floating off the bottom of
   the page when the user clicks a row near the page fold. */
.popover.popover-centered {
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%);
  min-width: 320px;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 95;
}
.popover-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 22, 30, 0.35);
  z-index: 94;
  display: none;
  animation: backdropFade 160ms ease-out;
}
@keyframes backdropFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.pop-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pop-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.pop-head .modal-x {
  flex: 0 0 auto;
  margin: -4px -6px -4px 0;
}
.pop-body { padding: 12px 14px; }
.pop-body select {
  width: 100%;
  padding: 7px 2.1rem 7px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background-color: var(--paper);
  font: inherit;
  margin-bottom: 10px;
}
.pop-body .row { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  z-index: 200;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: toastIn 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
  max-width: min(90vw, 560px);
}
.toast.success { background: var(--success); border-color: rgba(255, 255, 255, 0.18); }
.toast.warn { background: var(--warn); border-color: rgba(255, 255, 255, 0.18); }
.toast.error { background: var(--red); border-color: rgba(255, 255, 255, 0.18); }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Footer stays in-flow under .workspace — see .workspace > .footer-rule above. */

/* ---------- Print (wall-poster week sheets) ---------- */
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  html, body, body * {
    font-family: Helvetica, Arial, sans-serif !important;
    font-feature-settings: normal !important;
    font-variant-ligatures: none !important;
  }
  html, body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  #login-screen,
  .sidebar,
  .workspace-top,
  .schedule-bar,
  .tabs,
  .footer-rule,
  .toast,
  .panel-head,
  .seg,
  .modal,
  .drawer,
  .popover,
  .popover-backdrop,
  .empty-state,
  .unmet-banner,
  .unmet-banner button,
  #panel-staff,
  #panel-shifts,
  #panel-logbook,
  #panel-settings,
  #panel-admin,
  #panel-help,
  #panel-requests,
  #panel-leave,
  #panel-swaps,
  #panel-annual { display: none !important; }

  #app-shell {
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
    grid-template-columns: none !important;
  }
  #app-shell > .workspace,
  .workspace {
    display: block !important;
    grid-column: auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  main#app {
    display: block !important;
    overflow: visible !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  #panel-schedule,
  #panel-schedule > #view-grid {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }
  .panel { display: block !important; box-shadow: none !important; border: none !important; background: white !important; }
  .view { margin-top: 0 !important; }

  .table-wrap, .empty-state, .modal-card, .schedule-bar, .popover, .drawer,
  .btn, .btn-primary, .toast, .data-table, .status-pill, .role-pill {
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  .print-foot,
  .print-legend { display: none !important; }
  /* Banner carries week title — drop duplicate period band. */
  table.month-grid thead tr.period-band { display: none !important; }

  .grid-scroll {
    overflow: visible !important;
    max-height: none !important;
    border: none !important;
    background: white !important;
  }
  /* Do NOT use break-inside:avoid on the whole week sheet — if the table is
     taller than one page, browsers emit blank pages instead of splitting. */
  .print-week-wrap {
    break-after: page;
    page-break-after: always;
  }
  .print-week-wrap:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  #view-grid,
  #panel-schedule > #view-grid,
  #panel-schedule > #view-grid[hidden] {
    display: block !important;
    visibility: visible !important;
  }

  table.month-grid {
    width: 100% !important;
    table-layout: fixed !important;
    font-size: 10px !important;
    border-collapse: collapse !important;
    page-break-inside: auto;
    break-inside: auto;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  table.month-grid th,
  table.month-grid td {
    padding: 3px 4px !important;
    border: 0.6pt solid #999 !important;
    vertical-align: middle !important;
  }
  table.month-grid th.staff-col,
  table.month-grid td.staff-cell,
  table.month-grid thead th,
  .totals-col {
    position: static !important;
    box-shadow: none !important;
  }
  table.month-grid th.staff-col,
  table.month-grid td.staff-cell {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 130px !important;
    background: #f7f7f7 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  table.month-grid td.staff-cell .staff-name {
    font-size: 11px !important;
    font-weight: 700 !important;
    overflow-wrap: normal !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    color: #111 !important;
  }
  table.month-grid td.staff-cell .staff-meta { display: none !important; }
  table.month-grid td.staff-cell .staff-week-hours { display: none !important; }
  table.month-grid td.cell {
    height: auto !important;
    min-width: 0 !important;
    width: auto !important;
    text-align: center !important;
    padding: 2px 3px !important;
  }
  table.month-grid td.cell.weekend {
    background: #f3f3f3 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  table.month-grid td.cell.bankhol,
  table.month-grid thead th.bankhol-label {
    background: #d9e8f8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  table.month-grid thead th.dom {
    min-width: 0 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    padding: 5px 3px !important;
    color: #111 !important;
  }
  table.month-grid thead th.dom .dom-date {
    font-size: 11px !important;
    font-weight: 700 !important;
  }
  table.month-grid thead th.dom .dom-dow {
    font-size: 8px !important;
    color: #555 !important;
  }
  table.month-grid thead th.dom .dom-hol {
    font-size: 7px !important;
    max-width: none !important;
    white-space: normal !important;
  }
  table.month-grid thead th {
    font-size: 9px !important;
    padding: 4px 3px !important;
    color: #333 !important;
    background: #efefef !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .totals-col {
    width: 64px !important;
    padding-right: 4px !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    text-align: right !important;
  }

  table.month-grid tbody tr { page-break-inside: avoid; break-inside: avoid; }

  .cell-shift-bundle {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 2px !important;
    width: 100% !important;
  }
  .cell-shift-bundle .shift-pill:not(.ot) {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
  }
  .cell-shift-bundle .shift-pill.ot {
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 2px 4px !important;
    font-size: 8px !important;
  }

  /* Two-line shift cells: name + times */
  .shift-pill,
  .shift-pill.print-shift {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1px !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 3px 4px !important;
    margin: 0 !important;
    line-height: 1.15 !important;
    border: 1px solid color-mix(in srgb, var(--pill-accent) 55%, #888) !important;
    border-left: 4px solid var(--pill-accent) !important;
    border-radius: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    overflow-wrap: normal !important;
    word-break: keep-all !important;
    background: color-mix(in srgb, var(--pill-accent) 38%, #fff) !important;
    color: #111 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-shift-name {
    display: block !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
  }
  .print-shift-time {
    display: block !important;
    font-size: 8px !important;
    font-weight: 500 !important;
    color: #333 !important;
    font-variant-numeric: tabular-nums;
  }
  .shift-pill.locked::after { display: none !important; }
  .shift-pill.off,
  .shift-pill.holiday {
    border-left-color: #888 !important;
  }

  .month-grid tr.dept-group-row td {
    padding: 4px 6px !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #e8e8e8 !important;
    color: #222 !important;
    border-color: #999 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .month-grid tr.dept-group-row td.dept-group-band {
    background: #e8e8e8 !important;
  }
  .month-grid tr.divider td.staff-cell {
    font-size: 9px !important;
    font-style: italic;
  }

  .print-only { display: block !important; }
  .print-banner {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    gap: 14px !important;
    align-items: center !important;
    break-after: avoid;
    page-break-after: avoid;
    margin: 0 0 8px !important;
    padding: 0 0 6px !important;
    border-bottom: 1.5pt solid #222 !important;
  }
  .print-banner .brand-logo {
    height: 28px !important;
    max-width: 100px !important;
    width: auto !important;
  }
  .print-banner-text { text-align: center; }
  .print-banner h1 {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #111 !important;
    letter-spacing: 0.01em;
  }
  .print-banner-week {
    margin: 2px 0 0 !important;
    font-size: 10px !important;
    color: #333 !important;
  }
  .print-banner .meta {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #111 !important;
    font-variant-numeric: tabular-nums;
    min-width: 2.5em;
    text-align: right;
  }
}
.print-only { display: none; }
.print-legend { display: none; }
.print-banner {
  font-family: var(--sans);
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 4px; margin-bottom: 6px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
}
.print-banner .brand-logo { height: 36px; width: auto; max-width: 120px; object-fit: contain; }
.print-banner h1 { font-size: 13px; text-align: center; color: var(--ink); letter-spacing: 0.02em; font-weight: 600; }
.print-banner .meta { font-variant-numeric: tabular-nums; font-size: 9px; color: var(--ink-2); text-align: right; }
.print-banner-week { margin: 0; font-size: 11px; color: var(--ink-2); text-align: center; }
.print-foot {
  margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--rule-strong);
  font-variant-numeric: tabular-nums; font-size: 9pt; color: var(--ink-2);
  display: flex; justify-content: space-between;
}

/* ---- Auth / white-label / self-service ---- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 20% 10%, color-mix(in srgb, var(--purple) 18%, transparent), transparent 50%),
    radial-gradient(ellipse at 80% 90%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 45%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  padding: 24px;
}
.login-card {
  position: relative;
  width: min(400px, 100%);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 28px 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 18px 40px rgba(28, 19, 38, 0.08);
  overflow: hidden;
}
.login-card .login-brand { margin-bottom: 2px; }
.login-card .login-product { margin: 0; text-align: center; }
.login-card h1 { margin: 0; font-size: 1.45rem; color: var(--purple); }
.login-sub { margin: 0 0 2px; color: var(--ink-3); font-size: 0.92rem; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--ink-2); }
.login-card input { padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: 8px; font: inherit; }
.login-error { color: var(--danger); margin: 0; font-size: 0.85rem; }
.login-hint { margin: 4px 0 0; font-size: 0.75rem; color: var(--ink-muted); }
.user-meta { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-label { font-size: 0.8rem; color: var(--ink-2); overflow-wrap: anywhere; }
.notif-badge {
  background: var(--gold); color: var(--ink); font-size: 0.7rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px;
}
.sa-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
}
.sa-tab {
  border: 1px solid var(--rule);
  background: var(--surface-1);
  color: var(--ink-2);
  border-radius: 8px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.sa-tab:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface-2); }
.sa-tab.active {
  background: var(--purple-soft);
  color: var(--purple);
  border-color: color-mix(in srgb, var(--purple) 35%, var(--rule));
}
.sa-section {
  margin: 0 0 28px;
  padding-bottom: 22px;
}
.sa-heading {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 650;
  color: var(--ink);
}
.sa-sub {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
  max-width: 52rem;
}
.oa-rights-list {
  margin: 0 0 12px;
  padding-left: 1.2rem;
  font-size: 0.9rem;
  color: var(--ink-2);
  max-width: 40rem;
  line-height: 1.45;
}
.oa-rights-list li { margin: 0.25rem 0; }
#sa-users-table td {
  padding-top: 8px;
  padding-bottom: 8px;
  vertical-align: middle;
}
#sa-users-table .sa-email {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sa-users-table .sa-nowrap { white-space: nowrap; }
#sa-users-table .sa-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}
#sa-users-table .sa-user-action {
  min-width: 7rem;
  max-width: 11rem;
  margin: 0;
  /* keep right room for the global select chevron */
  padding: 5px 2.1rem 5px 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  /* background-color only — the shorthand would wipe the chevron image */
  background-color: var(--surface-1);
  border: 1px solid var(--rule);
  border-radius: 8px;
  vertical-align: middle;
  cursor: pointer;
}
#sa-users-table .sa-user-action:hover { border-color: var(--rule-strong); }
.sa-status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.sa-status-on {
  color: var(--success, #1f6b3a);
  background: color-mix(in srgb, var(--success, #1f6b3a) 14%, transparent);
}
.sa-status-off {
  color: var(--ink-3);
  background: var(--surface-2);
}
.sa-users-toolbar { margin: 16px 0 10px; }
#sa-users-table th .info-tip {
  margin-left: 4px;
  vertical-align: middle;
}
#sa-user-form label .info-tip {
  margin-left: 4px;
  vertical-align: middle;
}
.modal-card.sa-edit-card { width: min(440px, 94vw); }
#sa-edit-user-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.sa-edit-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
  padding-bottom: 8px;
}
.sa-edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  min-width: 0;
}
.sa-edit-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink-2);
}
.sa-edit-label .info-tip { margin: 0; }
.sa-edit-hint-inline {
  font-weight: 500;
  color: var(--ink-muted);
  font-size: 0.75rem;
}
.sa-edit-form input[type="email"],
.sa-edit-form input[type="text"],
.sa-edit-form input[type="password"],
.sa-edit-form select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background-color: var(--surface-1);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
}
.sa-edit-form select:not([multiple]) {
  padding-right: 2.1rem;
}
.sa-edit-form input:focus,
.sa-edit-form select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: var(--focus-ring);
}
.sa-edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sa-edit-active {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
}
.sa-edit-active input {
  margin-top: 2px;
  accent-color: var(--purple);
}
.sa-edit-active strong {
  display: block;
  font-size: 0.9rem;
  color: var(--ink);
}
.sa-edit-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--ink-3);
}
@media (max-width: 520px) {
  .sa-edit-row { grid-template-columns: 1fr; }
}
.sa-created {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink-2);
  font-size: 0.85rem;
}
.sa-system {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 0 0 16px;
  font-size: 0.9rem;
}
.sa-system dt { color: var(--ink-2); }
.sa-system dd { margin: 0; font-variant-numeric: tabular-nums; }
.sa-demo { margin-top: 8px; }

.user-chip-wrap { position: relative; z-index: 50; overflow: visible; }
.notif-panel {
  position: fixed;
  z-index: 220;
  width: min(320px, calc(100vw - 24px));
  max-height: min(420px, calc(100dvh - 24px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 0;
  overflow: hidden;
  /* left/top set in JS next to the user chip */
}
.notif-panel[hidden] { display: none !important; }
.notif-panel .muted {
  padding: 12px 14px;
  color: var(--ink-3);
  font-size: 0.88rem;
  white-space: normal;
}
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  flex-shrink: 0;
}
.notif-panel-head strong {
  font-size: 0.88rem;
  color: var(--ink);
}
.notif-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
}
.notif-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--ink);
}
.notif-item > strong {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.82rem;
  line-height: 1.25;
  color: var(--ink);
}
.notif-item > .notif-body {
  grid-column: 1 / -1;
  grid-row: 2;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
.notif-item > .btn-tiny {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  white-space: nowrap;
}
.notif-item.is-read { opacity: 0.72; }
.notif-list > .muted {
  padding: 12px 8px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.82rem;
}
#btn-my-profile {
  margin: 0;
  width: 100%;
  border-radius: 0 0 12px 12px;
  border: 0;
  border-top: 1px solid var(--rule);
  padding: 11px 14px;
  background: var(--surface-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
#btn-my-profile:hover {
  background: var(--purple-soft);
  color: var(--purple);
}
#btn-my-profile .my-profile-ico { flex: 0 0 auto; }
#btn-my-profile .my-profile-arrow {
  margin-left: auto;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--ink-muted);
  transition: transform 120ms ease, color 120ms ease;
}
#btn-my-profile:hover .my-profile-arrow {
  color: var(--purple);
  transform: translateX(2px);
}
.sidebar .user-label { color: #fff; }
.sidebar .user-role { color: var(--side-ink-muted); }

.leave-balance-chip {
  margin: 6px 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}
.leave-balance-chip.hol-over { color: var(--danger, #b33); }

.schedule-mine-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
}
.schedule-mine-toggle input { accent-color: var(--ink); }

.leave-form {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end;
  margin: 12px 0 18px; padding: 12px; background: var(--surface-2); border-radius: 8px;
}
.leave-form label {
  display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--ink-2);
}
/* Compact request forms override the padded leave-form look */
.request-inline.leave-form,
form.request-inline {
  margin: 0; padding: 0; background: transparent; gap: 8px 10px;
}
.annual-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.annual-table th, .annual-table td { text-align: center; font-size: 0.75rem; }
.annual-table td:first-child, .annual-table th:first-child { text-align: left; }
.annual-hit { background: var(--purple-soft); cursor: pointer; font-weight: 600; }
.annual-empty { color: var(--ink-muted); }

.office-days {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  margin-bottom: 12px;
}
.office-form .rules-nums { margin-bottom: 8px; }
#office-day-hours input[type="time"] {
  width: 100%; max-width: 9rem;
  padding: 4px 6px; font: inherit;
}

.hours-card-actions {
  display: flex;
  justify-content: flex-end;
  margin: 6px 0 0;
}
.hours-summary-grid {
  align-items: stretch;
}
.hours-card-selectable {
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.hours-card-selectable:hover {
  border-color: color-mix(in srgb, var(--purple) 40%, var(--rule));
}
.hours-card.is-selected {
  border-color: color-mix(in srgb, var(--purple) 55%, var(--rule));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--purple) 18%, transparent);
}
.hours-card .person-hours-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  margin: 8px 0 0;
}
.hours-card .person-hours-summary .info-tip,
.hours-card .person-hours-summary .tip-wrap {
  grid-column: 1 / -1;
}
.hours-detail-panel {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  min-width: 0;
}
.hours-detail-panel[hidden] { display: none !important; }
.hours-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.hours-detail-title h3 {
  margin: 0 0 2px;
  font-size: 1.1rem;
  font-weight: 650;
}
.hours-detail-body {
  overflow-x: auto;
  max-height: min(55vh, 520px);
  overflow-y: auto;
}

.hours-view-head {
  margin: 0 0 16px;
  max-width: 48rem;
}
.hours-view-head h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
}
.person-hours-note {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
  max-width: 48rem;
}
.hours-view-head .person-hours-note { margin: 0; }
.person-hours-summary {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  margin: 8px 0 10px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.person-hours-summary span { font-weight: 600; color: var(--ink); }
.person-hours-summary .hours-tot-avg { font-weight: 500; color: var(--ink-2); }
.person-hours-summary .hours-tot-cmp.is-under { color: var(--gold); }
.person-hours-summary .hours-tot-cmp.is-soft-under { color: #8a6a20; }
.person-hours-summary .hours-tot-cmp.is-over { color: var(--red); }
.pv-expected-cmp {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.pv-expected-cmp strong { color: var(--ink); }
.pv-expected-cmp.is-under strong { color: var(--gold); }
.pv-expected-cmp.is-soft-under strong { color: #8a6a20; }
.pv-expected-cmp.is-over strong { color: var(--red); }
.person-hours-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.person-hours-table th,
.person-hours-table td {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--rule);
}
.person-hours-table th { color: var(--ink-2); font-weight: 600; }
.person-hours-table td.num,
.person-hours-table th:nth-child(3),
.person-hours-table th:nth-child(4),
.person-hours-table th:nth-child(5),
.person-hours-table th:nth-child(7) { text-align: right; }
.person-hours-table tfoot .hours-total-row td {
  border-bottom: none;
  border-top: 2px solid var(--ink-2);
  font-weight: 700;
  padding-top: 8px;
  color: var(--ink);
}
.person-hours-table .person-empty {
  text-align: left;
  font-style: italic;
  color: var(--ink-muted);
}

.reason-prompt { display: flex; flex-direction: column; gap: 8px; }
.reason-intro { margin: 0; color: var(--ink-2); font-size: 0.9rem; }
.reason-violations { margin: 0; padding-left: 1.2rem; color: var(--ink); font-size: 0.88rem; }
.reason-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.reason-input {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px; border: 1px solid var(--rule-strong); border-radius: 8px; font: inherit;
}
.reason-err { margin: 0; color: var(--danger); font-size: 0.8rem; }
.history-empty { color: var(--ink-muted); font-style: italic; margin: 12px 0 0; }

@media (max-width: 900px) {
  .tabs { flex-wrap: wrap; width: 100%; order: 3; }
  .tab { font-size: 0.78rem; padding: 6px 10px; }
  .schedule-bar { flex-direction: column; align-items: stretch; }
  .schedule-bar .sb-tools { flex-wrap: wrap; }
  .data-table { font-size: 0.8rem; }
  .login-card { padding: 22px 18px; }
}

/* Body class added by app.js when ?print=1 */
body.print-mode .sidebar,
body.print-mode .workspace-top,
body.print-mode .schedule-bar,
body.print-mode .footer-rule,
body.print-mode .empty-state,
body.print-mode .unmet-banner,
body.print-mode .panel-head,
body.print-mode #panel-staff,
body.print-mode #panel-shifts,
body.print-mode #panel-logbook { display: none !important; }
body.print-mode { background: white; padding: 0; }
body.print-mode #app-shell {
  display: block;
  min-height: 0;
  grid-template-columns: none;
}
body.print-mode #app-shell > .workspace,
body.print-mode .workspace {
  height: auto;
  min-height: 0;
  overflow: visible;
  grid-column: auto;
}
body.print-mode main#app { overflow: visible; min-height: 0; }
body.print-mode main { padding: 0; margin: 0; }
body.print-mode #panel-schedule { display: block !important; height: auto; }
body.print-mode #panel-schedule > #view-grid,
body.print-mode #panel-schedule > #view-grid[hidden] {
  display: block !important;
  visibility: visible !important;
}
body.print-mode .print-only { display: block; }
body.print-mode .print-legend { display: none; }
body.print-mode .print-foot { display: none !important; }
body.print-mode .print-banner { display: grid; }
body.print-mode .grid-scroll { overflow: visible; max-height: none; border: none; }
body.print-mode table.month-grid tbody tr.status-row td { position: static; box-shadow: none; }

/* ---------- Global busy overlay (rota generation) ---------- */
.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  backdrop-filter: blur(2px);
}
.busy-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 26px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 18px 48px rgba(26, 21, 32, 0.25);
  max-width: 340px;
  text-align: center;
}
.busy-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--rule);
  border-top-color: var(--ink);
  animation: busy-spin 0.8s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
.busy-text { font-weight: 700; color: var(--ink); }
.busy-sub { font-size: var(--fs-sm); color: var(--ink-3); }

/* ---------- Same-day absences overview ---------- */
.impromptu-absences { margin-top: 16px; }
.absence-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.absence-chip {
  font-size: var(--fs-sm);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--ink-2);
  background: var(--paper);
}
.absence-chip[data-type="Sick"] { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--rule)); background: var(--red-bg); }
.absence-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.absence-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-sm);
}
.absence-row:last-child { border-bottom: 0; }
.absence-row.is-past { opacity: 0.55; }
.absence-clear-btn { color: var(--success); border-color: color-mix(in srgb, var(--success) 35%, var(--rule)); }
.absence-clear-btn:hover { background: var(--success-bg); }
.absence-row.is-today { background: color-mix(in srgb, var(--red-bg) 55%, var(--paper)); }
.absence-date { min-width: 150px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.absence-person { font-weight: 600; flex: 1; }
.absence-type {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 1px 9px;
  color: var(--ink-2);
  background: var(--paper);
}
.absence-type[data-type="Sick"] { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--rule)); background: var(--red-bg); }

/* Light-themed only. We intentionally do NOT respond to
   prefers-color-scheme: dark - the schedule grid and shift colours are
   tuned for a bright shell. */
:root { color-scheme: light; }
