/*
 * TaskBook design system layer.
 * Tokens live in tokens.css (mirroring design-tokens.js); this file maps the
 * legacy variable names onto them and styles the shared shell and components.
 * Loaded after the legacy stylesheet so the whole product, Boards included,
 * shares one palette, one face and one shell.
 */

/* ---------------------------------------------------------------- tokens */

:root,
body,
body.theme-light {
  /* Legacy names used across styles.css, people-access.css and hr-requests.css. */
  --font-family: var(--tb-font);
  --font-family-display: var(--tb-font);
  --app-bg: var(--tb-canvas);
  --surface: var(--tb-canvas);
  --surface-elevated: var(--tb-surface);
  --surface-card: var(--tb-surface);
  --surface-muted: var(--tb-surface-muted);
  --surface-1: var(--tb-surface);
  --surface-2: var(--tb-surface-muted);
  --text-primary: var(--tb-text);
  --text-secondary: var(--tb-text-secondary);
  --text-muted: var(--tb-text-secondary);
  --text: var(--tb-text);
  --ink: var(--tb-text);
  --muted: var(--tb-text-secondary);
  --border: var(--tb-border);
  --border-color: var(--tb-border);
  --line: var(--tb-border);
  --panel-border: var(--tb-border);
  --shell-border: var(--tb-border);
  --accent: var(--tb-accent);
  --accent-strong: var(--tb-accent-hover);
  --accent-soft: var(--tb-accent-soft);
  --brand-blue: var(--tb-accent);
  --brand-blue-dark: var(--tb-accent-hover);
  --primary-ink: var(--tb-on-accent);
  --button-primary-text: var(--tb-on-accent);
  --success: var(--tb-success);
  --warning: var(--tb-warning);
  --danger: var(--tb-danger);
  --success-bg: var(--tb-success-soft);
  --error-bg: var(--tb-danger-soft);
  --warning-text: var(--tb-warning);
  --table-header-bg: var(--tb-surface-muted);
  --table-header-bg-opaque: var(--tb-surface-muted);
  --table-row-hover: var(--tb-row-hover);
  --table-row-selected: var(--tb-row-selected);
  --dropzone-bg: var(--tb-surface-muted);
  --dropzone-border: var(--tb-border-strong);
  --toast-bg: var(--tb-toast-bg);
  --toast-text: var(--tb-toast-text);
  --logo-bg: var(--tb-logo-bg);
  --toggle-track-bg: var(--tb-nav-line);
  --toggle-thumb-bg: var(--tb-nav-text-strong);
  --offers-sent-bg: var(--tb-success-soft);
  --offers-preview-border: var(--tb-border);
  --radius-xl: var(--tb-radius-card);
  --radius-lg: var(--tb-radius-card);
  --radius-md: var(--tb-radius-control);
  --radius-sm: 6px;
  --radius-pill: 999px;
  --fw-radius-control: var(--tb-radius-control);
  --fw-radius-card: var(--tb-radius-card);
  --shadow-elevated: var(--tb-shadow-card);
  --shadow-shell: none;
  --focus-ring: color-mix(in srgb, var(--tb-focus) 45%, transparent);
  --control-border: var(--tb-border-control);
  --control-disabled-text: var(--tb-text-disabled);
  --nav-bg: var(--tb-nav-bg);
  --nav-text: var(--tb-nav-text);
  --nav-muted: var(--tb-nav-muted);
  --nav-hover: var(--tb-nav-hover);
  --nav-selected: var(--tb-nav-active);
  --nav-active-bg: var(--tb-nav-active);
  --nav-active-line: var(--tb-nav-indicator);
  --sidebar-text: var(--tb-nav-text);
  --sidebar-active-text: var(--tb-nav-text-strong);
  --atmo-one: transparent;
  --atmo-two: transparent;
  --signout-bg: var(--tb-danger);
  --signout-bg-hover: var(--tb-danger-hover);
  --transition-duration: 160ms;
  --ease-standard: var(--tb-ease);
}

/* ------------------------------------------------ base and browser surfaces */

body {
  font-family: var(--tb-font);
  font-size: 1rem;
  line-height: 1.5;
  background: var(--tb-canvas);
  color: var(--tb-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  accent-color: var(--tb-accent);
  caret-color: var(--tb-accent);
}
body::before { background: var(--tb-canvas); }
:is(h1, h2, h3, h4, h5, h6) { font-family: var(--tb-font); text-wrap: balance; }
:is(button, input, select, textarea, optgroup) { font-family: inherit; }
::selection { background: color-mix(in srgb, var(--tb-accent) 26%, transparent); color: var(--tb-text); }
:is(input, textarea)::placeholder { color: var(--tb-text-placeholder); opacity: 1; }
html { scrollbar-color: color-mix(in srgb, var(--tb-border-strong) 55%, transparent) transparent; }
:where(table, .MuiTable-root, [class*="table"]) { font-variant-numeric: tabular-nums; }
a { text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

/* ------------------------------------------------------------------ shell */

.sideNav {
  background: var(--tb-nav-bg);
  border-right: 1px solid var(--tb-nav-edge);
  color: var(--tb-nav-text);
  font-family: var(--tb-font);
}
.sideNav .brand-text h1 { color: var(--tb-nav-text-strong); font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.sideNav .brand-text p { font-size: 0.71875rem; line-height: 1.3; white-space: nowrap; letter-spacing: 0; }
.sideNav .brand-text p,
.sideNav .brand-kicker { color: var(--tb-nav-muted); }
.sideNav .brand-kicker { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.1em; }
.sideNav .brand-icon { background: var(--logo-bg); border-color: var(--tb-nav-line); box-shadow: none; }
.sideNav .nav-group-label {
  color: var(--tb-nav-muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  margin-top: 6px;
}
.sideNav .nav-group-label:has(+ :is(.nav-group-label, :empty)),
.sideNav .nav-group:not(:has(.nav-tab:not([hidden]))) { display: none; }
.sideNav .sidebar-toggle { background: transparent; color: var(--tb-nav-text); border-color: var(--tb-nav-line); }
.sideNav .sidebar-toggle:hover { background: var(--tb-nav-hover); color: var(--tb-nav-text-strong); }
.sideNav .nav-tab {
  color: var(--tb-nav-text);
  font-family: var(--tb-font);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 7px;
  min-height: 38px;
  transition: background-color 140ms var(--tb-ease), color 140ms var(--tb-ease);
}
.sideNav .nav-tab:hover:not(:disabled) { background: var(--tb-nav-hover); color: var(--tb-nav-text-strong); transform: none; }
.sideNav .nav-tab--active,
.sideNav .nav-tab--active:hover:not(:disabled) { background: var(--tb-nav-active); color: var(--tb-nav-text-strong); font-weight: 650; }
.sideNav .nav-tab--active::before { background: var(--tb-nav-indicator); width: 3px; border-radius: 0 2px 2px 0; }
.sideNav .nav-tab__icon { opacity: 0.8; }
.sideNav .nav-tab--active .nav-tab__icon { color: var(--tb-nav-indicator); opacity: 1; }
/* Go to Fieldwork, the one sidebar link that leaves TaskBook: an outlined nav button in the sidebar's own tokens
   (Navy Frame Rule; Sky Indicator is the Fieldwork accent). The page-token fill from styles.css put pale nav ink
   on near-white in light mode (Matthew, Oct 24). */
.sideNav .nav-tab--fieldwork {
  background: color-mix(in srgb, var(--tb-nav-indicator) 8%, transparent);
  border-color: var(--tb-nav-line-strong);
  color: var(--tb-nav-text-strong);
}
.sideNav .nav-tab--fieldwork .nav-tab__icon { color: var(--tb-nav-indicator); opacity: 1; }
.sideNav .nav-tab--fieldwork:hover:not(:disabled) {
  background: color-mix(in srgb, var(--tb-nav-indicator) 16%, transparent);
  border-color: var(--tb-nav-indicator);
  color: var(--tb-nav-text-strong);
}
.sideNav .nav-tab__tooltip { background: var(--tb-text); color: var(--tb-surface); border: 0; box-shadow: var(--tb-shadow-popover); font-size: 0.8125rem; }
.sideNav :is(button, a, [role="button"]):focus-visible { outline: 2px solid var(--tb-nav-indicator); outline-offset: 2px; }
.sideNav .account-card { border-top-color: var(--tb-nav-line); }

/* Pages sit on the canvas; panels are the one card surface. */
.page-content { background: transparent; }
.panel {
  background: var(--tb-surface);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius-card);
  box-shadow: var(--tb-shadow-card);
  gap: 28px;
}
.panel h3 { font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; }
.panel h4 { font-size: 0.9375rem; font-weight: 650; }

/* One page header: title, one-line purpose, actions on the right, tabs beneath. */
.panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 24px;
  row-gap: 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--tb-border);
}
.panel-header > * { grid-column: 1; min-width: 0; }
.panel-header > :is(button, .ghost-button, .primary-button, [class*="actions"]) {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
}
.panel-header h2,
.ec-workspace__header h2 {
  margin: 0;
  color: var(--tb-text);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.panel-header p,
.ec-workspace__header p { margin: 6px 0 0; color: var(--tb-text-secondary); font-size: 0.9375rem; line-height: 1.5; max-width: 70ch; }

/* ---------------------------------------------------------------- buttons */

:is(.primary-button, .ghost-button, .actions button, .admin-control-button, .icon-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tb-button-height);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--tb-radius-control);
  font: 600 0.875rem/1.2 var(--tb-font);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transform: none;
  transition: background-color 140ms var(--tb-ease), border-color 140ms var(--tb-ease), color 140ms var(--tb-ease), box-shadow 140ms var(--tb-ease);
}
:is(.primary-button, .actions button):not(.ghost-button):not(.icon-button):not(:disabled):not([aria-disabled="true"]) {
  background: var(--tb-accent);
  border-color: var(--tb-accent);
  color: var(--tb-on-accent);
  box-shadow: var(--tb-shadow-button);
}
:is(.primary-button, .actions button):not(.ghost-button):not(.icon-button):hover:not(:disabled) {
  background: var(--tb-accent-hover);
  border-color: var(--tb-accent-hover);
  color: var(--tb-on-accent);
  transform: none;
}
:is(.ghost-button, .icon-button):not(:disabled):not([aria-disabled="true"]) {
  background: var(--tb-surface);
  border-color: var(--tb-border-control);
  color: var(--tb-text);
}
:is(.ghost-button, .icon-button):hover:not(:disabled) {
  background: var(--tb-accent-soft);
  border-color: color-mix(in srgb, var(--tb-accent) 45%, var(--tb-border));
  color: var(--tb-text);
  transform: none;
}
.icon-button { width: var(--tb-button-height); padding: 0; }
:is(.primary-button, .ghost-button, .actions button, .admin-control-button, .icon-button):active:not(:disabled) {
  box-shadow: var(--tb-shadow-pressed);
}
:is(.primary-button, .ghost-button, .actions button, .admin-control-button, .icon-button):disabled,
:is(.primary-button, .ghost-button, .actions button, .admin-control-button, .icon-button)[aria-disabled="true"] {
  background: var(--tb-surface-sunken);
  border-color: transparent;
  color: var(--tb-text-disabled);
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
}
/* Restyled controls keep honouring the hidden attribute. */
:is(.primary-button, .ghost-button, .actions button, .admin-control-button, .icon-button, .drop-zone__icon, .panel-header > *)[hidden] { display: none !important; }
:is(button, a, summary, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid var(--tb-focus);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------- fields */

:is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not(.MuiInputBase-input):not([class*="kanban"]) {
  min-height: var(--tb-button-height);
  box-sizing: border-box;
  border: 1px solid var(--tb-border-control);
  border-radius: var(--tb-radius-control);
  background-color: var(--tb-surface);
  color: var(--tb-text);
  font-size: 0.9375rem;
  transition: border-color 140ms var(--tb-ease), box-shadow 140ms var(--tb-ease);
}
:is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not(.MuiInputBase-input):hover:not(:disabled) {
  border-color: var(--tb-border-strong);
}
:is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not(.MuiInputBase-input):focus-visible {
  border-color: var(--tb-accent);
  outline: 0;
  box-shadow: 0 0 0 3px var(--focus-ring);
}
:is(input, select, textarea):disabled { background-color: var(--tb-surface-sunken); color: var(--tb-text-disabled); cursor: not-allowed; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { opacity: 0.7; cursor: pointer; }
body.theme-dark input[type="date"]::-webkit-calendar-picker-indicator,
body.theme-dark input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(0.85); }

/* Field labels: sentence case, readable, secondary ink. */
:is(.filter-field label, .filter-field > span, .hr-directory-toolbar label, .admin-filter-field label,
    .admin-fieldwork-role-field > label, .admin-installer-resource-field label, .ec-search label,
    .hr-local-editor-fields label > span, .dry-run-preview__field-filter, .ec-mention-panel > label) {
  color: var(--tb-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* ----------------------------------------------------------------- tables */

:is(thead th, table th, .ec-queue-table thead th, .rforce-queue-table th) {
  background: var(--tb-surface-muted);
  color: var(--tb-text-secondary);
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}
:is(.table-container, .offers-table-container) { border-color: var(--tb-border); border-radius: var(--tb-radius-control); box-shadow: none; }
tbody tr:hover > td { background-color: var(--tb-row-hover); }

/* ----------------------------------------------------- drop zones and tabs */

.drop-zone {
  background: var(--tb-surface-muted);
  border: 1px dashed var(--tb-border-strong);
  border-radius: var(--tb-radius-card);
  box-shadow: none;
}
.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.drop-zone--active,
.drop-zone.is-dragover { background: var(--tb-accent-soft); border-color: var(--tb-accent); }
.drop-zone::before,
.drop-zone::after { box-shadow: none; filter: none; }
.drop-zone-icon,
.drop-zone__icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--tb-surface);
  border: 1px solid var(--tb-border);
  color: var(--tb-accent);
  font-size: 0 !important;
  filter: none;
  text-shadow: none;
}
.drop-zone-icon::before,
.drop-zone__icon::before {
  content: "";
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3Cpath d='M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3Cpath d='M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3'/%3E%3C/svg%3E") center / contain no-repeat;
}

:is(.calendar-subtabs, .analytics-subtabs, .people-access-views) {
  background: transparent;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--tb-border);
  border-radius: 0;
  gap: 4px;
}
:is(.calendar-subtab, .analytics-subtab) {
  background: transparent;
  color: var(--tb-text-secondary);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  min-height: 44px;
  margin-bottom: -1px;
  padding: 10px 14px;
  box-shadow: none;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
:is(.calendar-subtab, .analytics-subtab):hover { color: var(--tb-text); background: transparent; }
:is(.calendar-subtab--active, .analytics-subtab--active) { color: var(--tb-text); border-bottom-color: var(--tb-accent); background: transparent; box-shadow: none; }

/* ------------------------------------------------- dialogs, toasts, badges */

:is(.modal-content, dialog) {
  border: 1px solid var(--tb-border);
  background: var(--tb-surface);
  color: var(--tb-text);
  border-radius: var(--tb-radius-dialog);
  box-shadow: var(--tb-shadow-dialog);
}
dialog::backdrop { background: var(--tb-backdrop); }

/* "TaskBook has been updated" prompt: toast styling, but it stays until Refresh or Later. */
.update-banner {
  position: fixed;
  left: calc(var(--navigation-drawer-width, 264px) + 24px);
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: min(520px, calc(100vw - var(--navigation-drawer-width, 264px) - 48px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--tb-radius-control);
  background: var(--tb-toast-bg);
  color: var(--tb-toast-text);
  box-shadow: var(--tb-shadow-popover);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  z-index: 10061;
}
.update-banner[hidden] { display: none; }
.update-banner__text { flex: 1 1 auto; }
.update-banner button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--tb-radius-control);
  font: inherit;
  cursor: pointer;
}
.update-banner__later { border: 1px solid currentColor; background: transparent; color: inherit; opacity: 0.85; }
.update-banner__refresh { border: 1px solid var(--tb-accent); background: var(--tb-accent); color: var(--tb-on-accent); }
.update-banner__refresh:hover { background: var(--tb-accent-hover); border-color: var(--tb-accent-hover); }
.update-banner button:focus-visible { outline: 2px solid var(--tb-accent); outline-offset: 2px; }
@media (max-width: 900px) {
  .update-banner { left: 16px; right: 16px; max-width: none; flex-wrap: wrap; }
  .update-banner__text { flex-basis: 100%; }
}

/* Toasts sit bottom-left of the work area, clear of right-aligned actions. */
.toast {
  left: calc(var(--navigation-drawer-width, 264px) + 24px);
  right: auto;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateY(calc(100% + 32px));
  max-width: min(440px, calc(100vw - var(--navigation-drawer-width, 264px) - 48px));
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 16px 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--tb-radius-control);
  background: var(--tb-toast-bg);
  color: var(--tb-toast-text);
  box-shadow: var(--tb-shadow-popover);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  pointer-events: none;
  z-index: 10060;
}
.toast::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--tb-nav-indicator); }
/* Each tone sets background and text together so legacy styles.css tone colours never leak through. */
.toast[data-tone="success"] { background: var(--tb-toast-bg); color: var(--tb-toast-text); }
.toast[data-tone="success"]::before { background: var(--tb-toast-success); }
.toast[data-tone="error"] { background: var(--tb-toast-error-bg); color: var(--tb-toast-error-text); border-color: var(--tb-toast-error-border); }
.toast[data-tone="error"]::before { background: var(--tb-toast-error-text); }
.toast.toast--visible,
.toast.visible,
.toast[data-visible="true"],
.toast.show { transform: translateY(0); }
.appShell[data-sidebar-collapsed="true"] ~ .toast,
.appShell[data-sidebar-collapsed="true"] .toast { left: 96px; }
@media (max-width: 900px) {
  .toast { left: 16px; right: 16px; max-width: none; }
}

/* Scheduling failure pop-ups: bottom-left like toasts, raised clear of the toast lane, as popover cards that stay
   until dismissed or opened. */
.scheduling-failure-notices {
  --scheduling-failure-toast-clearance: 88px;
  position: fixed;
  left: calc(var(--navigation-drawer-width, 264px) + 24px);
  bottom: calc(var(--scheduling-failure-toast-clearance) + env(safe-area-inset-bottom));
  z-index: 10059;
  width: min(440px, calc(100vw - var(--navigation-drawer-width, 264px) - 48px));
  max-height: calc(100dvh - var(--scheduling-failure-toast-clearance) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.scheduling-failure-notices[hidden] { display: none; }
.appShell[data-sidebar-collapsed="true"] ~ .scheduling-failure-notices { left: 96px; }
.scheduling-failure-notices__stack { display: flex; flex-direction: column; gap: 8px; }
.scheduling-failure-notice {
  padding: 14px 16px;
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius-control);
  background: var(--tb-surface);
  color: var(--tb-text);
  box-shadow: var(--tb-shadow-popover);
  font-size: 0.875rem;
  line-height: 1.45;
}
.scheduling-failure-notice__title { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 0.9375rem; font-weight: 650; line-height: 1.35; letter-spacing: normal; }
.scheduling-failure-notice__title::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--tb-danger); }
.scheduling-failure-notice__hint { margin: 0 0 8px; color: var(--tb-text-secondary); }
.scheduling-failure-notice__details { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; }
.scheduling-failure-notice__detail { display: contents; }
.scheduling-failure-notice__detail dt { color: var(--tb-text-secondary); }
.scheduling-failure-notice__detail dd { margin: 0; overflow-wrap: anywhere; }
.scheduling-failure-notice__list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--tb-border-subtle); }
.scheduling-failure-notice__item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--tb-border-subtle); }
.scheduling-failure-notice__item-text { display: flex; flex: 1; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.scheduling-failure-notice__item-text span { color: var(--tb-text-secondary); }
.scheduling-failure-notice__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.scheduling-failure-notice__dismiss {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--tb-radius-control);
  background: transparent;
  color: var(--tb-text-secondary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.scheduling-failure-notice__dismiss:hover { background: var(--tb-surface-muted); color: var(--tb-text); }
.scheduling-failure-notice :is(button):focus-visible { outline: 2px solid var(--tb-focus); outline-offset: 2px; }
.rforce-queue-table tbody tr.is-focused-attempt > td { background-color: var(--tb-row-selected); }
.rforce-queue-table tbody tr:focus-visible { outline: 2px solid var(--tb-focus); outline-offset: -2px; }
@media (max-width: 900px) {
  .scheduling-failure-notices { left: 16px; right: 16px; width: auto; }
}
@media (pointer: coarse) {
  .scheduling-failure-notice__dismiss { min-height: var(--tb-touch-target); }
}

/* ============================ content components (Boards keeps its own) */
@scope (body:not(:has([data-section="kanban"].panel--active))) {
  :scope .option-block,
  :scope .service-offerings-options .option-block { background: var(--tb-surface-muted); border-color: var(--tb-border); box-shadow: none; }
  :scope .service-offerings-options .option-block h3 { color: var(--tb-text); }
  :scope .service-offerings-options .option-block input { background: var(--tb-surface); color: var(--tb-text); border-color: var(--tb-border-control); box-shadow: none; }
  :scope .service-offerings-options .option-block[data-service-option]::before,
  :scope .option-block::before { display: none; }
  :scope .ec-overview-table tbody tr:hover td,
  :scope .ec-overview-table tbody tr:focus-within td { background: var(--tb-row-hover); }
  :scope .ec-workspace {
    --ec-board-line: var(--tb-border);
    --ec-board-surface: var(--tb-surface);
    --ec-board-muted: var(--tb-surface-muted);
    --ec-board-shadow: none;
    background: transparent; border: 0; box-shadow: none; padding: 0; gap: 24px;
  }
  :scope .ec-workspace__header { background: transparent; color: var(--tb-text); border: 0; box-shadow: none; padding: 0 0 20px; border-bottom: 1px solid var(--tb-border); border-radius: 0; }
  :scope .ec-workspace__eyebrow { display: none; }
  :scope .ec-page-nav { gap: 4px; padding: 0 0 16px; border-color: var(--tb-border); }
  :scope .ec-page-nav button { min-height: 44px; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--tb-text-secondary); box-shadow: none; padding: 10px 16px; border-radius: 0; font-weight: 600; }
  :scope .ec-page-nav button:hover { background: transparent; color: var(--tb-text); }
  :scope .ec-page-nav [aria-current="page"] { background: transparent; color: var(--tb-text); border-bottom-color: var(--tb-accent); box-shadow: none; }
  :scope .ec-page-nav #ec-refresh { border: 1px solid var(--tb-border-control); border-radius: var(--tb-radius-control); background: var(--tb-surface); color: var(--tb-text); }
  :scope #ec-overview { background: transparent; border: 0; padding: 0; box-shadow: none; }
  :scope .ec-pane { background: var(--tb-surface); border: 1px solid var(--tb-border); border-radius: var(--tb-radius-card); box-shadow: var(--tb-shadow-card); }
  :scope .ec-pane__header { background: transparent; border-bottom-color: var(--tb-border); }
  :scope .ec-status-card::before { display: none; }
  :scope .ec-metric { background: var(--tb-surface); border-color: var(--tb-border); border-radius: var(--tb-radius-card); padding: 18px; }
  :scope .ec-metric strong { font-variant-numeric: tabular-nums; font-size: 2rem; font-weight: 650; letter-spacing: -0.03em; color: var(--tb-text); }
  :scope .ec-metric span { font-weight: 600; }
  :scope .ec-metric small { opacity: 1; color: var(--tb-text-secondary); }
  :scope .ec-metric:hover { background: var(--tb-surface); border-color: var(--tb-accent); box-shadow: var(--tb-shadow-card); }
  :scope .ec-metric--urgent { background: var(--tb-warning-soft); border-color: color-mix(in srgb, var(--tb-warning) 40%, var(--tb-border)); }
  :scope .ec-overview-alert { border-radius: var(--tb-radius-control); background: var(--tb-warning-soft); }
  :scope .ec-overview-table { background: var(--tb-surface); width: 100%; min-width: 680px; table-layout: fixed; }
  :scope .ec-overview-table :is(th, td) { white-space: normal; overflow-wrap: anywhere; }
  :scope .ec-overview-table details p { min-width: 0; }
  :scope .ec-overview-table td { padding-block: 16px; }
  :scope .ec-overview-table small { color: var(--tb-text-secondary); opacity: 1; margin-top: 4px; }
  :scope .ec-overview-table summary { color: var(--tb-accent); }
  :scope .ec-create-form, :scope .ec-connect-form, :scope .ec-template-editor { background: var(--tb-surface); border-color: var(--tb-border); box-shadow: none; }
  :scope .ec-record-search, :scope .ec-record-context { background: var(--tb-surface-muted); border-color: var(--tb-border); }
  :scope .panel[data-section="admin"] { --admin-surface: var(--tb-surface); --admin-panel: var(--tb-surface); background: transparent; border: 0; box-shadow: none; padding: 0; }
  :scope .admin-access-toolbar { background: transparent; border-color: var(--tb-border); box-shadow: none; }
  :scope .admin-users-list-panel, :scope .admin-user-detail { border-color: var(--tb-border); border-radius: var(--tb-radius-card); background: var(--tb-surface); box-shadow: var(--tb-shadow-card); }
  :scope .admin-user-detail-section { background: transparent; border: 0; border-bottom: 1px solid var(--tb-border); border-radius: 0; box-shadow: none; }
  :scope .admin-user-card { box-shadow: none; }
  :scope .hr-workspace, :scope .hr-directory-panel, :scope .hr-profile-panel { background: var(--tb-surface); border-color: var(--tb-border); box-shadow: none; }
  :scope .hr-profile-section { padding: 16px 0 24px; border: 0; border-bottom: 1px solid var(--tb-border); border-radius: 0; }
  :scope .hr-directory-toolbar :is(input, select) { min-height: var(--tb-button-height); width: 100%; box-sizing: border-box; padding: 8px 12px; }
  :scope .hr-directory-summary > * { text-align: left; }
  :scope .hr-status-badge { background: var(--tb-success-soft); color: var(--tb-success); border-color: color-mix(in srgb, var(--tb-success) 28%, var(--tb-border)); }
  :scope .hr-status-badge:is([data-status="on leave"],[data-status="planned"],[data-status="requested"],[data-status="unknown"]) { color: var(--tb-warning); background: var(--tb-warning-soft); border-color: color-mix(in srgb, var(--tb-warning) 35%, var(--tb-border)); }
  :scope .hr-status-badge:is([data-status="inactive"],[data-status="disabled"],[data-status="cancelled"]) { color: var(--tb-danger); background: var(--tb-danger-soft); border-color: color-mix(in srgb, var(--tb-danger) 30%, var(--tb-border)); }
  :scope .hr-status-badge[hidden] { display: none; }
  :scope .hr-data-scope__badge[data-status="production"] { color: var(--tb-success); }
  :scope .hr-data-scope__badge { color: var(--tb-accent); background: var(--tb-accent-soft); border-color: var(--tb-border); }
  :scope .hr-profile-section, :scope .calendar-workflow-panel { background: var(--tb-surface); border-color: var(--tb-border); box-shadow: none; }
  :scope .panel[data-section="service-intake"] { background: transparent; border: 0; box-shadow: none; padding: 0; }
  :scope .panel[data-section="labor-bills"], :scope .panel[data-section="labor-tracker"] { padding: 0; overflow: hidden; }
  :scope .calendar-batch-panel[data-has-selection] { box-shadow: none; border-color: color-mix(in srgb, var(--tb-accent) 45%, var(--tb-border)); }
  @media (max-width: 720px) {
    :scope .account-card__body:has(#user-info:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
    :scope .account-card__body:has(#user-info:not([hidden])) .auth-button { width: auto; padding: 10px; min-width: 92px; }
    :scope .account-card__body .impersonation-banner, :scope .account-card__body .dev-login { grid-column: 1 / -1; }
    :scope .hr-directory-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    :scope .hr-directory-actions { align-items: stretch; }
    :scope .hr-directory-actions button { height: 100%; }
    :scope .page-content { padding-inline: 12px; }
    :scope .panel { padding: 20px 16px; }
    :scope .panel-header h2 { font-size: 1.3125rem; }
    :scope .ec-workspace, :scope .panel[data-section="admin"], :scope .panel[data-section="team-performance"], :scope .panel[data-section="labor-bills"], :scope .panel[data-section="labor-tracker"] { padding: 0; }
    :scope .ec-page-nav button { padding-inline: 12px; }
    :scope .ec-metric { padding: 14px; }
    :scope .ec-overview-filters .filter-field:first-child { min-width: 0; flex-basis: 100%; }
    :scope .ec-overview-pagination { flex-wrap: wrap; }
    :scope .ec-overview-pagination button { flex: 1; }
    :scope .actions { flex-wrap: wrap; justify-content: stretch; }
    :scope .actions > button { flex: 1 1 100%; }
  }
}

/* Touch screens (technicians' phones and tablets): 44px targets everywhere. */
@media (pointer: coarse) {
  :is(.primary-button, .ghost-button, .actions button, .admin-control-button, .icon-button),
  :is(input, select):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.MuiInputBase-input) { min-height: var(--tb-touch-target); }
  .icon-button { width: var(--tb-touch-target); }
  input:not([type="checkbox"]):not([type="radio"]):not(.MuiInputBase-input), select, textarea { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------ Boards: shared palette */

#kanban-app[data-theme="kanbanLight"] {
  --board-header-start: var(--tb-nav-bg);
  --board-header-end: var(--tb-nav-bg);
  --board-ink: var(--tb-text);
  --board-muted: var(--tb-text-secondary);
  --kanban-art-base: var(--tb-canvas);
  --kanban-art-heading: var(--tb-text);
  --kanban-art-copy: var(--tb-text-secondary);
}
#kanban-app[data-theme="kanbanDark"] {
  --board-header-start: var(--tb-nav-bg);
  --board-header-end: var(--tb-nav-bg);
  --board-ink: var(--tb-text);
  --board-muted: var(--tb-text-secondary);
  --kanban-art-base: var(--tb-canvas);
}
html body #kanban-app[data-theme] .kanban-topbar {
  background: var(--tb-nav-bg);
  border-bottom: 1px solid var(--tb-nav-edge);
  box-shadow: none;
}
html body #kanban-app[data-theme] .kanban-topbar :is(.MuiButton-root, .MuiIconButton-root, a, button):not(.Mui-disabled) { color: var(--tb-nav-text); }
html body #kanban-app[data-theme] .kanban-topbar :is(.MuiButton-root, .MuiIconButton-root, button):hover { color: var(--tb-nav-text-strong); background-color: var(--tb-nav-hover); }
html body #kanban-app .MuiButton-root { text-transform: none; letter-spacing: 0; font-family: var(--tb-font); }

/* ------------------------------------------------ account card (sidebar) */
.sideNav .account-card__body { display: grid; gap: 10px; min-width: 0; }
.sideNav .account-card .user-info { display: flex; align-items: center; gap: 12px; padding: 8px 6px; min-width: 0; }
.sideNav .account-card [hidden] { display: none !important; }
.sideNav .account-card__avatar { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; background: var(--tb-nav-indicator); color: var(--tb-on-indicator); font-size: 0.9375rem; font-weight: 700; }
.sideNav .account-card .user-meta { display: grid; gap: 2px; min-width: 0; }
.sideNav .account-card #user-name { border: 0; border-radius: 4px; padding: 0; background: transparent; color: var(--tb-nav-text-strong); font-size: 0.875rem; font-weight: 650; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.sideNav .account-card #user-name:hover { background: transparent; color: var(--tb-nav-text-strong); text-decoration: underline; }
.sideNav .account-card #user-email { display: block; color: var(--tb-nav-muted); font-size: 0.8125rem; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.sideNav .account-card__rforce { padding: 8px; min-height: 36px; width: 100%; border: 1px solid var(--tb-nav-line); border-radius: var(--tb-radius-control); background: transparent; color: var(--tb-nav-indicator); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.sideNav .account-card__rforce:hover:not(:disabled) { background: var(--tb-nav-hover); color: var(--tb-nav-text-strong); }
.sideNav .account-card__rforce:is([data-rforce-state="connected"], [data-rforce-state="checking"]) { display: flex; align-items: center; justify-content: center; gap: 8px; border-color: transparent; color: var(--tb-nav-text); font-weight: 500; }
.sideNav .account-card__rforce[data-rforce-state="connected"]::before { content: ""; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--tb-nav-success); }
.sideNav .account-card__rforce[data-rforce-state="checking"] { color: var(--tb-nav-muted); }
.sideNav .account-card__rforce[data-rforce-state="reconnect"] { border-color: var(--tb-nav-warning); color: var(--tb-nav-warning); }
.sideNav .account-card__actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sideNav .account-card .account-card__actions > button { display: grid; place-items: center; justify-content: center; width: 100%; min-width: 0; height: 36px; min-height: 36px; padding: 6px; border: 1px solid var(--tb-nav-line); border-radius: var(--tb-radius-control); background: transparent; color: var(--tb-nav-text); cursor: pointer; }
.sideNav .account-card .account-card__actions > button:hover { background: var(--tb-nav-hover); border-color: var(--tb-nav-indicator); color: var(--tb-nav-text-strong); }
.sideNav .account-card .auth-button[data-auth-mode="signout"] { background: transparent; border: 1px solid var(--tb-nav-line); color: var(--tb-nav-text); }
.sideNav .account-card .auth-button[data-auth-mode="signout"]:hover { background: var(--tb-nav-hover); border-color: var(--tb-nav-line-strong); color: var(--tb-nav-text-strong); }
.sideNav .account-card__actions svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sideNav .account-card__actions .auth-button__label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sideNav .account-card__sun { display: none; }
.sideNav .theme-toggle--dark .account-card__sun { display: block; }
.sideNav .theme-toggle--dark .account-card__moon { display: none; }
.sideNav .account-card .theme-toggle { --toggle-track-bg: var(--tb-nav-line); }
@media (min-width: 901px) {
  .appShell[data-sidebar-collapsed="true"] .sideNav .account-card .user-info { position: static; opacity: 1; pointer-events: auto; transform: none; padding: 0; justify-content: center; }
  .appShell[data-sidebar-collapsed="true"] .sideNav .account-card .user-meta { display: none; }
  .appShell[data-sidebar-collapsed="true"] .sideNav .account-card__actions { grid-template-columns: 1fr; }
  .appShell[data-sidebar-collapsed="true"] .sideNav .account-card__rforce { font-size: 0.6875rem; padding: 4px 0; }
  .appShell[data-sidebar-collapsed="true"] .brand-slot { min-height: 84px; flex-shrink: 0; }
}

/* Compact touch layouts: account controls only occupy space when requested. */
.account-menu-toggle { display: none; }
@media (max-width: 1100px), (max-width: 1366px) and (pointer: coarse) {
  .sideNav .brand-slot { padding-right: 60px; }
  .sideNav .account-card { position: absolute; top: 14px; right: 14px; width: auto; margin: 0; padding: 0; border: 0; }
  .sideNav .account-menu-toggle { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid var(--tb-nav-line-strong); border-radius: 50%; background: var(--tb-nav-indicator); color: var(--tb-on-indicator); font: inherit; font-weight: 700; cursor: pointer; }
  .sideNav .account-menu-toggle:hover, .sideNav .account-menu-toggle[aria-expanded="true"] { background: var(--tb-nav-indicator-hover); }
  .sideNav .account-card__body { display: none; position: absolute; top: 54px; right: 0; width: min(320px, calc(100vw - 28px)); max-height: calc(100dvh - 100px); overflow-y: auto; padding: 16px; border: 1px solid var(--tb-nav-line); border-radius: var(--tb-radius-card); background: var(--tb-nav-bg); box-shadow: var(--tb-shadow-dialog); z-index: 30; }
  .sideNav .account-menu-toggle[aria-expanded="true"] + .account-card__body { display: grid; grid-template-columns: minmax(0, 1fr); }
  .sideNav .account-card .account-card__actions > button { min-height: 44px; height: 44px; }
  .sideNav .account-card__rforce { min-height: 44px; }
}

/* People & Access: account types are categories, not statuses. Owners carry the
   accent; every other type stays neutral so amber and red keep meaning "attention". */
body .panel[data-section="admin"],
body.theme-dark .panel[data-section="admin"] {
  --admin-role-admin: var(--tb-accent);
  --admin-role-installer: var(--tb-text-secondary);
  --admin-role-user: var(--tb-text-secondary);
  --admin-role-fieldwork: var(--tb-text-secondary);
}

/* Service Date Offerings: the three date options are plain sub-panels on the page surface. */
body:is(.theme-light, .theme-dark) .service-offerings-options .option-block {
  background: var(--tb-surface-muted);
  border: 1px solid var(--tb-border);
  box-shadow: none;
}
body:is(.theme-light, .theme-dark) .service-offerings-options .option-block::before { display: none; }
body:is(.theme-light, .theme-dark) .service-offerings-options .option-block h3 {
  background: transparent;
  border-bottom: 1px solid var(--tb-border);
  color: var(--tb-text);
  font-size: 1rem;
  font-weight: 650;
}
body:is(.theme-light, .theme-dark) .service-offerings-options .option-block h3::before {
  background: var(--tb-accent-soft);
  border-color: transparent;
  color: var(--tb-accent);
}
body:is(.theme-light, .theme-dark) .service-offerings-options .option-block :is(input[type="date"], input[type="time"]) {
  background: var(--tb-surface);
  border-color: var(--tb-border-control);
  color: var(--tb-text);
  box-shadow: none;
}

/* HR summary tiles: numbers on one baseline, labels beneath, room before the filters. */

.hr-directory-summary .hr-directory-metric {
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  background: var(--tb-surface);
  border-color: var(--tb-border);
}
.hr-directory-summary .hr-directory-metric strong { font-size: 1.5rem; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.hr-directory-summary .hr-directory-metric span { color: var(--tb-text-secondary); font-size: 0.875rem; }

/* Links styled as buttons (e.g. RForce record links) read as buttons, not underlined text. */
a:is(.ghost-button, .primary-button) { text-decoration: none; }

/* Account-type group headings in People & Access: no coloured side stripe. */
body .panel[data-section="admin"] .admin-user-role-group__heading { border-left: 0; box-shadow: none; }

/* Escalated Comms: its board canvas and header follow the page palette like every other tab. */
body:is(.theme-light, .theme-dark) .ec-workspace {
  --ec-board-canvas: var(--tb-canvas);
  --ec-board-line: var(--tb-border);
  --ec-board-topbar: var(--tb-surface);
  --ec-board-topbar-strong: var(--tb-surface);
  --ec-board-topbar-text: var(--tb-text);
  --ec-board-surface: var(--tb-surface);
  --ec-board-muted: var(--tb-surface-muted);
  --ec-board-shadow: none;
}
body:is(.theme-light, .theme-dark) .ec-workspace__header { box-shadow: none; }

/* Inside the navy sidebar, secondary and body ink come from the nav palette. */
.sideNav {
  --text-secondary: var(--tb-nav-muted);
  --text-primary: var(--tb-nav-text-strong);
}
.sideNav .nav-tab__tooltip { border: 0; box-shadow: var(--tb-shadow-tooltip); }

/* Dialogs: one defined edge (a ring) plus soft elevation, no hairline border. */
:is(.modal-content, dialog) { border: 0; box-shadow: 0 0 0 1px var(--tb-border), var(--tb-shadow-dialog); }

/* Small table headers and labels that the legacy sheet set below 11px. */
.ec-queue-table thead th,
.impersonation-banner__label { font-size: 0.75rem; }
@media (max-width: 720px) { .ec-queue-table tbody td::before { font-size: 0.75rem; } }
.sideNav :is(input, select, textarea) { color: var(--tb-text); background-color: var(--tb-surface); }

/* ---------------------------------------------- finish-review fixes (Sep 29) */

/* Every nav group fits a 900px-tall window again. */
.sideNav .nav-tab { min-height: 34px; padding-block: 5px; }
.sideNav .nav-group-label { margin-top: 2px; margin-bottom: 0; }
.sideNav .nav-group { gap: 1px; }

/* Brand subtitle: beat the legacy secondary-ink rule inside the navy sidebar. */
.sideNav .brand-slot .brand-text p:not(.brand-kicker) { color: var(--tb-nav-muted); font-size: 0.71875rem; letter-spacing: 0; white-space: nowrap; }

/* Environment label reads as a badge under the product name, not a kicker above it. */
.sideNav .brand-text { display: flex; flex-direction: column; align-items: flex-start; }
.sideNav .brand-text .brand-kicker {
  order: 3;
  margin: 4px 0 0;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tb-nav-badge);
  color: var(--tb-nav-text);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.sideNav .brand-text .brand-kicker[hidden] { display: none; }

/* Buttons that message a customer: a tonal accent style, distinct from utilities. */
.MuiButton-root.tb-customer-send:not(.Mui-disabled) {
  background: var(--tb-accent-soft);
  border-color: color-mix(in srgb, var(--tb-accent) 40%, var(--tb-border));
  color: var(--tb-accent-hover);
}
body.theme-dark .MuiButton-root.tb-customer-send:not(.Mui-disabled) { color: var(--tb-accent); }
.MuiButton-root.tb-customer-send:not(.Mui-disabled):hover {
  background: color-mix(in srgb, var(--tb-accent) 18%, var(--tb-surface));
  border-color: var(--tb-accent);
}

/* People & Access account types: one chip style, sentence case. */
body .admin-role-badge { font-size: 0.75rem; font-weight: 650; letter-spacing: 0; text-transform: none; padding: 2px 9px; }

/* Selected rows: tint and weight, no coloured side stripe. */
body .admin-user-row,
body .hr-staff-list-item { border-left-width: 0; }
body .admin-user-row[data-selected="true"],
body .hr-staff-list-item[data-active="true"] { background: var(--tb-row-selected); box-shadow: none; }
body .admin-user-row[data-selected="true"] :is(strong, .admin-user-row__name),
body .hr-staff-list-item[data-active="true"] strong { font-weight: 700; }
body .admin-user-role-group__heading { box-shadow: none; }
.hr-request-row.is-selected { box-shadow: none; }

/* HR: space between the summary tiles and the directory filters. */
.panel[data-section="hr-management"] .hr-directory-summary { margin-bottom: 16px; }

/* Boot (Oct 23): one finished render instead of Uploads, then the signed-out shell, then the real shell.
   taskbook-boot.js may draw the last signed-in person's sidebar; app.js drops `taskbook-booting` once auth and
   access are known. The loading card fades in only after a short delay, so a quick start shows no card at all. */
.boot-shell { display: none; }
body.taskbook-booting .boot-shell { display: block; width: 100%; }
body.taskbook-booting .page-content > .panel { display: none !important; }
body.taskbook-booting:not(.taskbook-boot-snapshot) .sideNav :is(.nav-tabs, .account-card) { visibility: hidden; }
body.taskbook-booting .sideNav :is(.nav-tabs, .account-card) { pointer-events: none; }
body.taskbook-booting #account-rforce { display: none; }
.boot-shell__card {
  display: grid;
  gap: 14px;
  padding: clamp(24px, 4vw, 40px);
  background: var(--tb-surface);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius-card);
  box-shadow: var(--tb-shadow-card);
  opacity: 0;
  animation: boot-shell-appear 200ms var(--tb-ease, ease-out) 250ms forwards;
}
.boot-shell__line,
.boot-shell__block {
  display: block;
  height: 12px;
  width: 64%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--tb-surface-muted) 0%, var(--tb-surface-sunken) 50%, var(--tb-surface-muted) 100%);
  background-size: 200% 100%;
  animation: boot-shell-shimmer 1.4s ease-in-out infinite;
}
.boot-shell__line--title { height: 22px; width: 38%; }
.boot-shell__line--subtitle { width: 52%; margin-bottom: 14px; }
.boot-shell__block { height: 132px; width: 100%; border-radius: var(--tb-radius-control); margin-bottom: 6px; }
.boot-shell__line--short { width: 36%; }
@keyframes boot-shell-appear { to { opacity: 1; } }
@keyframes boot-shell-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) {
  /* Keep the delay (a quick start still shows no card), drop the fade and the shimmer. */
  .boot-shell__card { animation: boot-shell-appear 1ms linear 250ms forwards; }
  .boot-shell__line, .boot-shell__block { animation: none; }
}

/* Shown instead of any tab while signed out, on the wrong account, while access loads, or with no tabs granted:
   one centred card on the canvas (Matthew, Oct 28). Signed out, the sidebar has nothing to offer, so it goes and the
   card centres in the whole window; the other gates keep the sidebar for Sign out. */
.appShell:has(.account-gate.panel--active[data-kind="signed-out"]:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
.appShell:has(.account-gate.panel--active[data-kind="signed-out"]:not([hidden])) .sideNav { display: none; }
/* Grid only while the gate is the page: the base `.panel` rule hides every inactive panel, and this one must hide
   with them (Oct 28: a plain `.panel.account-gate { display: grid }` kept "Loading your access" over every tab). */
.panel.account-gate.panel--active:not([hidden]) { display: grid; }
.panel.account-gate[hidden] { display: none; }
.panel.account-gate {
  place-items: center;
  min-height: calc(100dvh - 96px);
  padding: 24px 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.account-gate__card {
  display: grid;
  width: min(100%, 416px);
  box-sizing: border-box;
  padding: 36px 32px 32px;
  background: var(--tb-surface);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-radius-dialog);
  box-shadow: var(--tb-shadow-card);
}
/* The logo tile keeps the mark on white in the dark theme too, as the Fieldwork sign-in does. */
.account-gate__logo {
  justify-self: center;
  margin-bottom: 28px;
  padding: 8px 14px;
  background: var(--tb-logo-bg);
  border-radius: var(--tb-radius-control);
}
.account-gate__logo img { display: block; width: 184px; height: auto; }
.account-gate__header { display: grid; gap: 8px; margin-bottom: 24px; text-align: center; }
.account-gate__header h2 {
  margin: 0;
  color: var(--tb-text);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
}
.account-gate__header p { margin: 0; color: var(--tb-text-secondary); font-size: 0.9375rem; line-height: 1.5; text-wrap: pretty; }
.account-gate__actions { display: grid; gap: 8px; }
.account-gate__actions .primary-button,
.account-gate__password button { width: 100%; min-height: var(--tb-touch-target); justify-content: center; }
/* Email and password beside Google: the same sign-in for everyone (rust/crates/tb-people-access/src/temporary_passwords.rs). */
.account-gate__password { display: grid; gap: 6px; }
.account-gate__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 10px;
  color: var(--tb-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
}
.account-gate__divider::before,
.account-gate__divider::after { content: ""; flex: 1; height: 1px; background: var(--tb-border); }
.account-gate__password label { color: var(--tb-text); font-size: 0.875rem; font-weight: 600; }
.account-gate__password label + input { margin-bottom: 8px; }
.account-gate__password input { width: 100%; min-height: var(--tb-touch-target); box-sizing: border-box; }
.account-gate__password button { margin-top: 8px; }
.account-gate__error { margin: 0; color: var(--tb-danger); font-size: 0.875rem; }
/* The grid and button display rules above would otherwise override the hidden attribute the gate states rely on. */
.account-gate [hidden] { display: none !important; }
@media (max-width: 520px) {
  .panel.account-gate { place-items: start center; min-height: 0; padding: 12px 0; }
  .account-gate__card { padding: 28px 20px 24px; border-radius: var(--tb-radius-card); }
}
/* Looks like the sign-in card: the logo, a centred heading, a full-width primary button and a text Sign out. */
.own-password-dialog { max-width: 420px; }
.own-password-dialog__logo { text-align: center; padding: 4px 0 8px; }
.own-password-dialog__logo img { width: 180px; height: auto; }
.own-password-dialog h3, .own-password-dialog #own-password-body { text-align: center; }
.own-password-dialog__actions { display: grid; gap: 8px; margin-top: 12px; }
.own-password-dialog__sign-out { background: none; border: 0; color: var(--accent, currentColor); font: inherit; font-weight: 600; padding: 8px; cursor: pointer; }
/* Owners only: under Add person and Refresh, as wide as both. */
.admin-toolbar-actions .admin-temporary-password-button { grid-column: 1 / -1; width: 100%; }
.temporary-password-audience { display: grid; gap: 6px; border: 0; margin: 4px 0 8px; padding: 0; }
.temporary-password-field { display: flex; gap: 8px; align-items: center; }
.temporary-password-field input { flex: 1; }
.temporary-password-result ul { margin: 6px 0 0; padding-left: 18px; }
