:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --line: #d9dee8;
  --line-strong: #b8c2d0;
  --text: #172033;
  --muted: #617089;
  --blue: #2563eb;
  --teal: #0f766e;
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --purple: #7c3aed;
  --ink: #1f2937;
  --shadow: 0 18px 38px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Sheet-first layout: top module tabs, no left navigation rail. */
.app-shell {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  background: #f6f7f9;
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 70;
  grid-column: 1;
  grid-row: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  height: auto;
  min-height: 64px;
  padding: 10px 18px 0;
  overflow: visible;
  background: #ffffff;
  color: var(--text);
  border-bottom: 1px solid #cfd8e6;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.sidebar-brand {
  min-height: 44px;
  padding-bottom: 10px;
  color: var(--text);
}

.brand-mark {
  width: 36px;
  height: 36px;
  box-shadow: none;
}

.brand-mark::before {
  font-size: 29px;
}

.sidebar-brand-copy strong {
  font-size: 18px;
}

.sidebar-brand-copy span {
  color: #64748b;
  font-size: 10px;
  line-height: 1.15;
}

.sidebar-quick-filters {
  display: flex;
  align-items: end;
  gap: 0;
  min-width: 0;
}

.sidebar-section-label {
  display: none;
}

.sidebar-filter-list {
  display: flex;
  align-items: end;
  gap: 3px;
  min-width: 0;
}

.sidebar-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 132px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #cfd8e6;
  border-bottom-color: #cfd8e6;
  border-radius: 8px 8px 0 0;
  background: #eef3f8;
  color: #334155;
  box-shadow: none;
  text-align: center;
}

.sidebar-filter .sidebar-icon,
.sidebar-link[data-main-view="staff"] .sidebar-icon {
  display: none;
}

.sidebar-filter-copy,
.sidebar-filter-copy strong {
  display: block;
  color: inherit;
}

.sidebar-filter-copy strong {
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.sidebar-filter:not(.active) {
  opacity: 1;
}

.sidebar-filter:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  color: var(--text);
}

.sidebar-filter.active {
  border-color: #0f766e;
  border-bottom-color: #ffffff;
  background: #ffffff;
  color: #0f3f3b;
  box-shadow: inset 0 -3px 0 #0f766e;
}

.sidebar-nav {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 0;
  min-width: 0;
}

.sidebar-nav > button[data-main-view="schedule"],
.sidebar-subnav,
.sidebar-footer {
  display: none;
}

.sidebar-link[data-main-view="staff"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 124px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #cfd8e6;
  border-radius: 8px 8px 0 0;
  background: #eef3f8;
  color: #334155;
  text-align: center;
}

.sidebar-link[data-main-view="staff"]:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  color: var(--text);
}

.sidebar-link[data-main-view="staff"].active {
  border-color: #f97316;
  border-bottom-color: #ffffff;
  background: #ffffff;
  color: #7c2d12;
  box-shadow: inset 0 -3px 0 #f97316;
}

.topbar {
  top: 64px;
  z-index: 60;
  grid-column: 1;
  min-height: 58px;
  padding: 10px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.topbar .eyebrow {
  margin-bottom: 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.topbar h1 {
  font-size: 20px;
}

.topbar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.today-indicator {
  min-width: 150px;
  min-height: 36px;
  padding: 5px 10px;
}

.month-label {
  min-width: 162px;
  padding: 8px 12px;
}

.schedule-mode-switch {
  display: inline-flex;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
}

.schedule-mode-button {
  min-width: 72px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.schedule-mode-button:last-child {
  border-right: 0;
}

.schedule-mode-button.active {
  background: #0f766e;
  color: #ffffff;
}

.workspace {
  grid-column: 1;
  gap: 8px;
  padding: 10px 18px 28px;
}

body[data-main-view="staff"] .topbar-actions {
  visibility: hidden;
}

.matrix-panel,
.staff-directory {
  border-radius: 4px;
  box-shadow: none;
}

.section-heading {
  min-height: 70px;
  padding: 12px 14px;
  background: #ffffff;
}

.matrix-month-banner {
  min-width: 190px;
  font-size: 30px;
}

.matrix-filter-stack {
  display: none;
}

.horizontal-scrollbar {
  left: 0;
}

.schedule-table th,
.staff-table th {
  top: 122px;
}

@media (max-width: 900px) {
  .app-sidebar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px 0;
  }

  .app-sidebar > .sidebar-brand {
    min-height: 36px;
    padding-bottom: 0;
  }

  .sidebar-nav {
    justify-content: stretch;
  }

  .sidebar-filter-list,
  .sidebar-link[data-main-view="staff"] {
    width: 100%;
  }

  .sidebar-filter-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-filter,
  .sidebar-link[data-main-view="staff"] {
    min-width: 0;
    min-height: 40px;
    padding: 0 8px;
  }

  .topbar {
    position: static;
    padding: 10px;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .schedule-mode-switch,
  .month-label,
  .today-indicator {
    flex: 1 1 auto;
    min-width: 0;
  }

  .workspace {
    padding: 8px 8px 28px;
  }

  .schedule-table th,
  .staff-table th {
    top: 0;
  }
}

/* Desktop fidelity fixes after browser QA. */
.schedule-table th,
.staff-table th {
  top: 0 !important;
}

@media (min-width: 1280px) and (max-width: 1419px) {
  .app-shell {
    grid-template-rows: 72px 56px minmax(0, 1fr) !important;
  }

  .topbar {
    top: 72px !important;
    z-index: 94 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    padding-left: 16px !important;
    border-bottom: 1px solid #d9dee8 !important;
    background: #ffffff !important;
    pointer-events: auto !important;
  }

  .sidebar-quick-filters {
    padding-right: 0 !important;
  }

  .workspace {
    grid-row: 3 !important;
  }
}

@media (min-width: 1420px) {
  .app-sidebar {
    grid-template-columns: auto auto auto !important;
    justify-content: start !important;
  }

  .sidebar-nav {
    justify-content: flex-start !important;
  }

  .sidebar-quick-filters {
    padding-right: 0 !important;
  }

  .topbar {
    z-index: 96 !important;
  }
}

/* Final visual polish for the single-row desktop header. */
.topbar {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

@media (min-width: 1420px) {
  .sidebar-brand {
    min-width: 190px !important;
  }

  .sidebar-filter {
    min-width: 108px !important;
    padding: 0 14px !important;
  }

  .sidebar-link[data-main-view="staff"] {
    min-width: 105px !important;
    padding: 0 14px !important;
  }

  .topbar {
    justify-self: end !important;
    align-self: start !important;
    width: auto !important;
    min-width: 620px !important;
    max-width: 640px !important;
    padding-right: 16px !important;
    background: transparent !important;
    border-bottom: 0 !important;
  }

  .topbar-actions {
    width: auto !important;
  }

  .month-label {
    min-width: 170px !important;
    padding-right: 14px !important;
    padding-left: 14px !important;
  }

  .schedule-mode-switch {
    margin-left: 6px !important;
  }

  .schedule-mode-button {
    min-width: 62px !important;
  }

  .today-indicator {
    padding-left: 4px !important;
    font-size: 12px !important;
  }

  .today-indicator span {
    display: none !important;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 24px 18px;
  overflow-y: auto;
  background: linear-gradient(180deg, #0e2845 0%, #071d34 55%, #06172b 100%);
  color: #dbe6f3;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  color: #ffffff;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: var(--radius);
  background: #f97316;
  box-shadow: 0 14px 24px rgba(249, 115, 22, 0.22);
}

.brand-mark::before {
  content: "+";
  color: #ffffff;
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
}

.sidebar-brand-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.sidebar-brand-copy strong {
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
}

.sidebar-brand-copy span {
  color: #93c5fd;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  text-transform: uppercase;
}

.sidebar-section-label {
  color: #8fb7dc;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-quick-filters {
  display: grid;
  gap: 8px;
}

.sidebar-filter-list {
  display: grid;
  gap: 10px;
}

.sidebar-filter {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius);
  background: rgba(15, 36, 61, 0.72);
  color: #cbd5e1;
  padding: 8px 12px;
  text-align: left;
}

.sidebar-filter-copy {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.sidebar-filter-copy strong {
  flex: 0 0 auto;
  color: #ffffff;
  font-size: 16px;
  font-weight: 950;
  line-height: 1;
}

.sidebar-filter-copy small {
  min-width: 0;
  overflow: hidden;
  color: #b6c7da;
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-filter:hover {
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-filter.active {
  border-color: rgba(94, 234, 212, 0.58);
  background: rgba(20, 54, 83, 0.82);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #5eead4;
}

.sidebar-filter.active .sidebar-icon {
  border-color: rgba(94, 234, 212, 0.65);
  background: rgba(20, 184, 166, 0.14);
  color: #99f6e4;
}

.sidebar-filter:not(.active) {
  opacity: 0.66;
}

.sidebar-filter.active .sidebar-filter-copy small {
  color: #dbeafe;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-link,
.sidebar-subitem,
.sidebar-utility {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius);
  background: rgba(15, 36, 61, 0.72);
  color: #cbd5e1;
  font-weight: 800;
  text-align: left;
}

.sidebar-link,
.sidebar-subitem,
.sidebar-utility {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  overflow: hidden;
}

.sidebar-link span:last-child,
.sidebar-subitem span:last-child,
.sidebar-utility span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-icon {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(203, 213, 225, 0.28);
  border-radius: var(--radius);
  color: #9fb1c8;
}

.sidebar-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sidebar-link:hover,
.sidebar-subitem:hover,
.sidebar-utility:hover {
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-link.active {
  border-color: rgba(96, 165, 250, 0.38);
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.sidebar-link.active .sidebar-icon {
  border-color: #f97316;
  background: #fff7ed;
  color: #9a3412;
}

.sidebar-subnav {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-left: 0;
}

.sidebar-subitem {
  min-height: 50px;
  font-size: 14px;
}

.sidebar-subitem.active {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.17);
  color: #ffffff;
}

.sidebar-subitem.active .sidebar-icon {
  border-color: rgba(249, 115, 22, 0.62);
  color: #fed7aa;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.24);
}

.sidebar-utility {
  min-height: 44px;
  border-color: transparent;
  background: transparent;
}

.sidebar-utility:disabled {
  cursor: default;
  opacity: 0.72;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 4px;
  font-size: 16px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-indicator {
  display: grid;
  align-items: center;
  min-height: 38px;
  min-width: 176px;
  padding: 6px 12px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fff7ed;
  color: #9a3412;
  line-height: 1.1;
}

.today-indicator span {
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.today-indicator strong {
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-label {
  min-width: 180px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover,
.ghost-button:hover,
.seg-btn:hover {
  border-color: var(--line-strong);
  background: #eef2f7;
}

.workspace {
  grid-column: 2;
  display: grid;
  gap: 10px;
  padding: 10px 10px 28px;
}

body[data-main-view="staff"] .topbar-actions {
  visibility: hidden;
}

body[data-main-view="staff"] .horizontal-scrollbar {
  display: none;
}

.band,
.code-legend,
.matrix-panel,
.side-panel > section,
.requests-band {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 12px;
  overflow-x: auto;
}

.control-group,
.absence-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-width: 150px;
}

select,
input[type="date"],
input[type="number"],
textarea {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.segmented {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.seg-btn {
  min-width: 58px;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.seg-btn:last-child {
  border-right: 0;
}

.seg-btn.active {
  background: var(--ink);
  color: #ffffff;
}

.code-legend {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
}

.code-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.code-legend h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1;
}

.code-legend-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.code-legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.code-chip {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 11px;
  line-height: 1;
}

.code-chip strong {
  font-size: 12px;
  font-weight: 950;
}

.code-chip span {
  overflow: hidden;
  color: #334155;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-chip em {
  min-width: 18px;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: #334155;
  font-style: normal;
  font-weight: 950;
  text-align: center;
}

.primary-button,
.ghost-button {
  min-height: 38px;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
}

.secondary-surface {
  display: none !important;
}

.metric {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.matrix-panel {
  min-width: 0;
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  min-height: 88px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.section-heading.compact {
  align-items: center;
}

.matrix-month-banner {
  flex: 1;
  align-self: stretch;
  display: grid;
  min-width: 260px;
  place-items: center;
  color: var(--text);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.matrix-filter-stack {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin-top: 10px;
  width: fit-content;
  padding: 7px;
  border: 1px solid #dbe3ef;
  border-radius: var(--radius);
  background: #f8fafc;
}

.matrix-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.matrix-filter {
  min-width: 56px;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.matrix-turn-filter {
  min-width: 44px;
  background: #f8fafc;
}

.matrix-filter.active {
  border-color: #0f766e;
  background: #ccfbf1;
  color: #134e4a;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.28);
}

.cat-badge,
.shift-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.table-wrap {
  min-height: 0;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.table-wrap::-webkit-scrollbar {
  display: none;
}

.horizontal-scrollbar {
  position: fixed;
  left: 252px;
  right: 0;
  bottom: 0;
  z-index: 55;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.08);
}

.horizontal-scrollbar-inner {
  height: 1px;
}

.schedule-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
  height: 42px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
}

.schedule-table tfoot td {
  height: 34px;
  border-top: 1px solid #d6deea;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 900;
}

.schedule-table th {
  position: sticky;
  top: 0;
  z-index: 7;
  height: 46px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.schedule-table .sticky-name,
.schedule-table .sticky-cat,
.schedule-table .sticky-team {
  position: sticky;
  z-index: 8;
  text-align: left;
}

.schedule-table th.sticky-name,
.schedule-table th.sticky-cat,
.schedule-table th.sticky-team {
  z-index: 12;
}

.schedule-table tfoot .sticky-name,
.schedule-table tfoot .sticky-cat,
.schedule-table tfoot .sticky-team {
  z-index: 10;
}

.sticky-name {
  left: 0;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  padding: 0 12px;
}

.sticky-cat {
  left: 220px;
  width: 74px;
  min-width: 74px;
  max-width: 74px;
  padding: 0 8px;
}

.sticky-team {
  left: 294px;
  width: 74px;
  min-width: 74px;
  max-width: 74px;
  padding: 0 8px;
}

.day-head,
.day-cell {
  width: 46px;
  min-width: 46px;
  max-width: 46px;
}

.schedule-table th.day-head.nonworkday,
.schedule-table th.day-head.nonworkday span {
  color: var(--red);
}

.schedule-table .month-start {
  border-left: 2px solid #94a3b8;
}

.employee-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  height: 100%;
}

.employee-cell:hover .employee-name,
.employee-cell:focus-visible .employee-name {
  color: var(--blue);
}

.employee-name {
  max-width: 190px;
  overflow: hidden;
  color: var(--text);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.cat-badge {
  min-width: 46px;
  height: 22px;
  padding: 0 8px;
}

.cat-EU {
  background: #dbeafe;
  color: #1d4ed8;
}

.cat-TENS {
  background: #dcfce7;
  color: #166534;
}

.cat-AUX {
  background: #fae8ff;
  color: #86198f;
}

.day-cell {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.cell-button {
  display: grid;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  place-items: center;
  min-width: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
}

.cell-button.code-compact {
  font-size: 12px;
  font-weight: 900;
}

.cell-button.code-extra-compact {
  font-size: 10.5px;
  font-weight: 900;
}

.exception-cell {
  box-shadow: inset 0 -3px 0 rgba(185, 28, 28, 0.48);
}

.cell-button:hover,
.cell-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.shift-L,
.shift-N,
.shift-LN,
.shift-D,
.shift-V,
.shift-M,
.shift-Cap,
.shift-EX,
.shift-CT,
.shift-OFF {
  color: #0f172a;
}

.shift-L {
  background: #bfdbfe;
}

.shift-N {
  background: #c7d2fe;
}

.shift-LN {
  background: #bae6fd;
}

.shift-D {
  background: #bbf7d0;
}

.shift-V {
  background: #fde68a;
}

.shift-M {
  background: #fecaca;
}

.shift-Cap {
  background: #e9d5ff;
}

.shift-EX {
  background: #fed7aa;
}

.shift-CT {
  background: #ccfbf1;
}

.shift-OFF {
  background: #f8fafc;
  color: #cbd5e1;
}

.schedule-table td.day-cell.nonworkday,
.schedule-table td.day-cell.nonworkday .cell-button {
  color: var(--red);
}

.totals-row .sticky-name,
.totals-row .sticky-cat,
.totals-row .sticky-team {
  background: #f8fafc;
}

.schedule-table tfoot .totals-group-start td {
  border-top: 2px solid #94a3b8;
}

.total-group {
  color: #334155;
  font-size: 12px;
  letter-spacing: 0;
  text-align: right !important;
}

.total-code {
  color: #334155;
  text-align: center !important;
}

.total-label {
  color: #475569;
  font-size: 11px;
  line-height: 1.1;
  text-transform: uppercase;
}

.total-count-cell {
  color: var(--text);
  background: #f8fafc;
}

.totals-EU .total-group {
  border-left: 4px solid #60a5fa;
}

.totals-TENS .total-group {
  border-left: 4px solid #34d399;
}

.totals-AUX .total-group {
  border-left: 4px solid #d946ef;
}

.totals-EU .total-count-cell {
  background: #eff6ff;
}

.totals-TENS .total-count-cell {
  background: #ecfdf5;
}

.totals-AUX .total-count-cell {
  background: #fdf4ff;
}

.total-zero {
  color: #94a3b8;
}

.schedule-table tfoot .total-count-cell.nonworkday {
  color: var(--red);
  background: #fff7ed;
}

.staff-directory {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.directory-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.directory-header h2 {
  margin-bottom: 6px;
  font-size: 28px;
  line-height: 1.1;
}

.directory-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.directory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.staff-search-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.staff-search-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.staff-search-field input {
  width: 100%;
  min-height: 42px;
  border-color: #cbd5e1;
  background: #ffffff;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  text-transform: none;
}

.staff-clear-search {
  min-height: 42px;
}

.staff-clear-search:disabled {
  cursor: default;
  opacity: 0.48;
}

.staff-empty-row td {
  height: 120px;
  min-width: 0;
  color: var(--muted);
  text-align: center;
}

.staff-empty-row strong,
.staff-empty-row span {
  display: block;
}

.staff-empty-row strong {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 16px;
}

.staff-table-wrap {
  overflow: auto;
}

.staff-table {
  width: 100%;
  min-width: 840px;
  border-collapse: separate;
  border-spacing: 0;
}

.staff-table th,
.staff-table td {
  height: 48px;
  padding: 0 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  text-align: left;
}

.staff-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.staff-table tr:hover td {
  background: #f8fafc;
}

.staff-name-button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.staff-name-button:hover,
.staff-name-button:focus-visible {
  color: var(--blue);
  outline: none;
}

.contract-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.contract-planta {
  background: #dbeafe;
  color: #1e40af;
}

.contract-contrata {
  background: #dcfce7;
  color: #166534;
}

.contract-transitorio {
  background: #fef3c7;
  color: #92400e;
}

.contract-empresa_externa {
  background: #fae8ff;
  color: #86198f;
}

.selected-column {
  background-image: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(14, 165, 233, 0.04));
  box-shadow: inset 3px 0 0 rgba(14, 116, 144, 0.78);
}

.schedule-table th.current-day-column,
.schedule-table td.current-day-column {
  background: #fff7ed;
  box-shadow: inset 2px 0 0 #f97316;
}

.schedule-table th.current-day-column {
  position: sticky;
  top: 0;
}

.schedule-table td.current-day-column {
  position: relative;
}

.schedule-table th.selected-column.current-day-column,
.schedule-table td.selected-column.current-day-column {
  background-image: linear-gradient(90deg, rgba(249, 115, 22, 0.16), rgba(14, 165, 233, 0.06));
  box-shadow: inset 3px 0 0 #f97316;
}

.current-day-number {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #f97316;
  color: #ffffff;
  font-weight: 950;
  line-height: 1;
}

.schedule-table th.current-day-column span:not(.current-day-number) {
  color: #9a3412;
}

.selected-row td,
.selected-row .sticky-name,
.selected-row .sticky-cat,
.selected-row .sticky-team {
  background: #fff7ed;
}

.side-panel {
  display: grid;
  gap: 14px;
}

.side-panel > section {
  padding: 14px;
}

.profile-name {
  margin-bottom: 4px;
  font-size: 18px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.field {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.field span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.field strong,
.field a {
  color: var(--text);
  font-weight: 800;
  word-break: break-word;
}

.personal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selected-shift {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding: 10px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fff7ed;
}

.selected-shift strong {
  color: #9a3412;
}

.selected-shift span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.shift-pill {
  min-height: 24px;
  padding: 0 8px;
  background: #eef2ff;
  color: #3730a3;
}

.coverage-row {
  display: grid;
  grid-template-columns: 78px 1fr 54px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.coverage-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.coverage-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.coverage-fill.warn {
  background: var(--amber);
}

.coverage-fill.danger {
  background: var(--red);
}

.absence-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  min-width: 0 !important;
}

.absence-list,
.request-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.absence-item,
.request-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.item-sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-pill {
  min-height: 22px;
  padding: 0 8px;
  background: #e0f2fe;
  color: #075985;
}

.requests-band {
  overflow: hidden;
}

.request-list {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  padding: 14px;
  margin-top: 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111827;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.exception-modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.employee-modal {
  width: min(940px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-context {
  margin: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.exception-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.exception-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.form-wide,
.modal-actions {
  grid-column: 1 / -1;
}

.dialog-day-preview {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #dbe3ef;
  border-radius: var(--radius);
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.employee-dialog-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.contact-card {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.contact-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.contact-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.contact-action:hover,
.contact-action:focus-visible {
  border-color: var(--line-strong);
  background: #eef2f7;
}

.contact-action.whatsapp {
  border-color: #16a34a;
  background: #16a34a;
  color: #ffffff;
}

.contact-action.ghost-link {
  border-color: var(--blue);
  color: var(--blue);
}

.contact-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.metric.compact {
  padding: 10px;
  box-shadow: none;
}

.metric.compact strong {
  font-size: 18px;
}

.employee-history h3 {
  margin-bottom: 10px;
}

.history-table-wrap {
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th,
.history-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.history-table th {
  position: sticky;
  top: 0;
  background: #eef2f7;
  color: #334155;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .app-sidebar {
    padding: 18px 12px;
  }

  .horizontal-scrollbar {
    left: 220px;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .app-sidebar {
    position: sticky;
    height: 100vh;
    gap: 12px;
    padding: 10px 7px;
  }

  .sidebar-brand {
    gap: 8px;
    min-height: 36px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-mark::before {
    font-size: 27px;
  }

  .sidebar-brand-copy strong {
    font-size: 14px;
  }

  .sidebar-brand-copy span,
  .sidebar-section-label,
  .sidebar-filter-copy small {
    display: none;
  }

  .sidebar-filter {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 6px;
    min-height: 42px;
    padding: 6px;
  }

  .sidebar-filter-copy {
    display: block;
  }

  .sidebar-filter-copy strong {
    font-size: 12px;
  }

  .sidebar-nav {
    display: grid;
    gap: 6px;
    overflow: visible;
  }

  .sidebar-link,
  .sidebar-subitem,
  .sidebar-utility {
    grid-template-columns: 28px minmax(0, 1fr);
    min-width: 0;
    gap: 6px;
    min-height: 42px;
    padding: 6px;
    font-size: 11px;
    text-align: left;
  }

  .sidebar-icon {
    width: 26px;
    height: 26px;
  }

  .sidebar-icon svg {
    width: 15px;
    height: 15px;
  }

  .sidebar-subnav {
    display: grid;
    width: 100%;
    min-width: 0;
    margin-left: 0;
    padding-left: 0;
  }

  .sidebar-subitem {
    min-width: 0;
    font-size: 11px;
  }

  .sidebar-footer {
    padding-top: 10px;
  }

  .sidebar-utility span:last-child {
    display: none;
  }

  .topbar {
    position: static;
    display: grid;
    padding: 14px;
  }

  .horizontal-scrollbar {
    left: 118px;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .today-indicator {
    flex: 1 1 calc(100% - 92px);
    min-width: 0;
  }

  .month-label {
    order: 4;
    flex: 1;
    flex-basis: 100%;
    min-width: 0;
  }

  .workspace {
    padding: 8px 8px 28px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
  }

  .seg-btn {
    flex: 1;
    min-width: 0;
  }

  .side-panel,
  .request-list {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .directory-header {
    display: grid;
  }

  .directory-filters {
    justify-content: flex-start;
  }

  .staff-search-panel {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  .metric {
    min-width: 168px;
  }

  .section-heading {
    display: grid;
  }

  .matrix-month-banner {
    min-width: 0;
    font-size: 28px;
  }

  .sticky-name {
    width: 168px;
    min-width: 168px;
    max-width: 168px;
  }

  .sticky-cat {
    left: 168px;
    width: 62px;
    min-width: 62px;
    max-width: 62px;
  }

  .sticky-team {
    left: 230px;
    width: 58px;
    min-width: 58px;
    max-width: 58px;
  }

  .employee-name {
    max-width: 140px;
  }

  .exception-form {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    display: grid;
  }

  .contact-card,
  .contact-fields,
  .history-summary {
    grid-template-columns: 1fr;
  }
}

/* Reference sheet layout override: the accepted view is a top-tab spreadsheet,
   so this final layer wins over the original left-rail rules above. */
:root {
  --sheet-top-offset: 128px;
}

.app-shell {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: 72px 56px minmax(0, 1fr) !important;
  min-height: 100vh;
  background: #ffffff;
}

.app-sidebar {
  position: sticky !important;
  top: 0 !important;
  z-index: 90 !important;
  grid-column: 1 !important;
  grid-row: 1 !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-items: end !important;
  gap: 20px !important;
  width: 100% !important;
  height: 72px !important;
  min-height: 72px !important;
  padding: 0 16px !important;
  overflow: visible !important;
  background: #ffffff !important;
  color: var(--text) !important;
  border-right: 0 !important;
  border-bottom: 1px solid #d9dee8 !important;
  box-shadow: none !important;
}

.sidebar-brand {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  min-width: 220px !important;
  min-height: 72px !important;
  padding: 0 !important;
  color: var(--text) !important;
}

.brand-mark {
  display: none !important;
}

.sidebar-brand-copy {
  display: grid !important;
  grid-template-columns: auto auto !important;
  align-items: center !important;
  gap: 12px !important;
}

.sidebar-brand-copy strong {
  color: #078077 !important;
  font-size: 24px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

.sidebar-brand-copy span {
  max-width: 128px !important;
  padding-left: 12px !important;
  border-left: 1px solid #cbd5e1 !important;
  color: #172033 !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1.12 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.sidebar-quick-filters {
  display: flex !important;
  align-items: end !important;
  justify-content: flex-start !important;
  min-width: 0 !important;
  height: 72px !important;
}

.sidebar-section-label,
.sidebar-filter .sidebar-icon,
.sidebar-link[data-main-view="staff"] .sidebar-icon,
.sidebar-nav > button[data-main-view="schedule"],
.sidebar-subnav,
.sidebar-footer {
  display: none !important;
}

.sidebar-filter-list {
  display: flex !important;
  align-items: end !important;
  gap: 4px !important;
  min-width: 0 !important;
  height: 100% !important;
}

.sidebar-filter,
.sidebar-link[data-main-view="staff"] {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 124px !important;
  min-height: 56px !important;
  height: 56px !important;
  margin: 0 !important;
  padding: 0 20px !important;
  border: 1px solid transparent !important;
  border-bottom: 0 !important;
  border-radius: 8px 8px 0 0 !important;
  background: transparent !important;
  color: #343b4a !important;
  box-shadow: none !important;
  opacity: 1 !important;
  text-align: center !important;
}

.sidebar-filter-copy,
.sidebar-filter-copy strong {
  display: block !important;
  color: inherit !important;
}

.sidebar-filter-copy strong,
.sidebar-link[data-main-view="staff"] span:last-child {
  color: inherit !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.sidebar-filter:hover,
.sidebar-link[data-main-view="staff"]:hover {
  background: #f8fafc !important;
  color: #0f766e !important;
}

.sidebar-filter.active,
.sidebar-link[data-main-view="staff"].active {
  border-color: #d9dee8 !important;
  background: #ffffff !important;
  color: #0f766e !important;
  box-shadow: inset 0 -4px 0 #0f766e !important;
}

.sidebar-nav {
  display: flex !important;
  align-items: end !important;
  justify-content: flex-end !important;
  min-width: 0 !important;
  height: 72px !important;
  gap: 0 !important;
  overflow: visible !important;
}

.topbar {
  position: sticky !important;
  top: 72px !important;
  z-index: 88 !important;
  grid-column: 1 !important;
  grid-row: 2 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: 100% !important;
  min-height: 56px !important;
  padding: 0 16px !important;
  background: #ffffff !important;
  border-bottom: 1px solid #d9dee8 !important;
  box-shadow: none !important;
}

.topbar > div:first-child {
  display: none !important;
}

.topbar-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  width: auto !important;
  flex-wrap: nowrap !important;
}

.icon-button {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  border-color: #d9dee8 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #172033 !important;
  font-size: 28px !important;
  line-height: 1 !important;
}

#prevMonth {
  order: 1;
}

.month-label {
  order: 2;
  min-width: 190px !important;
  min-height: 42px !important;
  padding: 10px 18px !important;
  border: 1px solid #d9dee8 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #172033 !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

#nextMonth {
  order: 3;
}

.schedule-mode-switch {
  order: 4;
  display: inline-flex !important;
  min-height: 42px !important;
  margin-left: 10px !important;
  overflow: hidden !important;
  border: 1px solid #d9dee8 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
}

.schedule-mode-button {
  min-width: 78px !important;
  border: 0 !important;
  border-right: 1px solid #d9dee8 !important;
  background: #ffffff !important;
  color: #172033 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.schedule-mode-button:last-child {
  border-right: 0 !important;
}

.schedule-mode-button.active {
  background: #e6fffb !important;
  color: #0f766e !important;
  box-shadow: inset 0 0 0 2px #0f766e !important;
}

.today-indicator {
  order: 5;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  min-width: 0 !important;
  min-height: 42px !important;
  padding: 0 0 0 8px !important;
  border: 0 !important;
  background: transparent !important;
  color: #617089 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  text-transform: none !important;
}

.today-indicator::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid #0f766e;
  border-radius: 3px;
  box-shadow: inset 0 4px 0 rgba(15, 118, 110, 0.16);
}

.today-indicator span,
.today-indicator strong {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  text-transform: none !important;
}

body[data-main-view="staff"] .topbar-actions {
  visibility: hidden !important;
}

.workspace {
  grid-column: 1 !important;
  grid-row: 3 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  min-width: 0 !important;
  padding: 24px 20px 46px !important;
  background: #ffffff !important;
}

.toolbar,
.summary-strip {
  display: none !important;
}

.main-grid {
  order: 1 !important;
  display: block !important;
  min-width: 0 !important;
}

.side-panel {
  display: none !important;
}

.matrix-panel,
.staff-directory {
  border: 0 !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.section-heading {
  display: block !important;
  min-height: auto !important;
  padding: 0 12px 22px !important;
  border: 0 !important;
  background: #ffffff !important;
}

.section-heading h2,
.directory-header h2 {
  color: #172033 !important;
  font-size: 28px !important;
  font-weight: 950 !important;
  line-height: 1.1 !important;
  letter-spacing: 0 !important;
}

.section-heading p,
.directory-header p {
  margin-top: 8px !important;
  color: #617089 !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
}

.matrix-filter-stack,
.matrix-month-banner {
  display: none !important;
}

.table-wrap {
  min-height: 0 !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  border: 1px solid #d9dee8 !important;
  border-radius: 7px !important;
  background: #ffffff !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.table-wrap::-webkit-scrollbar {
  display: none !important;
}

.schedule-table {
  width: max-content !important;
  min-width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.schedule-table th,
.staff-table th {
  top: var(--sheet-top-offset) !important;
}

.schedule-table th,
.schedule-table td,
.staff-table th,
.staff-table td {
  border-color: #d9dee8 !important;
}

.schedule-table th {
  height: 56px !important;
  background: #fbfcfe !important;
  color: #172033 !important;
  font-size: 14px !important;
  font-weight: 900 !important;
}

.schedule-table td {
  height: 54px !important;
  background: #ffffff !important;
}

.schedule-table .sticky-name,
.schedule-table .sticky-team {
  position: sticky !important;
  z-index: 8 !important;
  background: #ffffff !important;
  text-align: left !important;
}

.schedule-table th.sticky-name,
.schedule-table th.sticky-team {
  z-index: 12 !important;
  background: #fbfcfe !important;
}

.schedule-table tfoot .sticky-name,
.schedule-table tfoot .sticky-team {
  z-index: 10 !important;
}

.sticky-name {
  left: 0 !important;
  width: 240px !important;
  min-width: 240px !important;
  max-width: 240px !important;
  padding: 0 16px !important;
}

.sticky-team {
  left: 240px !important;
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  padding: 0 18px !important;
}

.day-head,
.day-cell {
  width: 58px !important;
  min-width: 58px !important;
  max-width: 58px !important;
}

.employee-name {
  max-width: 205px !important;
  color: #0f172a !important;
  font-size: 15px !important;
  font-weight: 900 !important;
}

.cell-button {
  font-size: 15px !important;
  font-weight: 900 !important;
}

.shift-OFF {
  color: #aab4c2 !important;
}

.horizontal-scrollbar {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 95 !important;
  height: 18px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  border-top: 1px solid #d9dee8 !important;
  background: #ffffff !important;
  box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.08) !important;
}

.code-legend {
  order: 2 !important;
  margin: 12px 0 0 !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.code-legend-header {
  display: none !important;
}

.code-legend-list {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 14px 22px !important;
  align-items: center !important;
}

.code-chip {
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 7px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #617089 !important;
  font-size: 12px !important;
}

.code-chip strong {
  color: #172033 !important;
  font-size: 13px !important;
  font-weight: 950 !important;
}

.code-chip em {
  display: none !important;
}

body[data-main-view="staff"] .code-legend,
body[data-main-view="staff"] .horizontal-scrollbar {
  display: none !important;
}

.staff-directory {
  max-width: none !important;
}

.directory-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: start !important;
  gap: 18px !important;
  padding: 0 12px 20px !important;
  border-bottom: 0 !important;
  background: #ffffff !important;
}

.staff-search-panel {
  margin: 0 0 14px !important;
  border: 1px solid #d9dee8 !important;
  border-radius: 7px !important;
  background: #ffffff !important;
}

.staff-table-wrap {
  border: 1px solid #d9dee8 !important;
  border-radius: 7px !important;
}

@media (min-width: 1280px) {
  :root {
    --sheet-top-offset: 72px;
  }

  .app-shell {
    grid-template-rows: 72px minmax(0, 1fr) !important;
  }

  .topbar {
    top: 0 !important;
    grid-row: 1 !important;
    width: auto !important;
    min-width: 690px !important;
    padding-left: 0 !important;
    border-bottom: 0 !important;
    background: transparent !important;
    pointer-events: none !important;
  }

  .topbar-actions {
    pointer-events: auto !important;
  }

  .sidebar-quick-filters {
    padding-right: 690px !important;
  }

  .workspace {
    grid-row: 2 !important;
  }
}

@media (max-width: 900px) {
  :root {
    --sheet-top-offset: 0px;
  }

  .app-shell {
    display: block !important;
  }

  .app-sidebar {
    position: static !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 8px !important;
    padding: 12px 10px 0 !important;
  }

  .sidebar-brand {
    min-width: 0 !important;
    min-height: 36px !important;
  }

  .sidebar-quick-filters,
  .sidebar-nav {
    height: auto !important;
  }

  .sidebar-filter-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
  }

  .sidebar-filter,
  .sidebar-link[data-main-view="staff"] {
    min-width: 0 !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 8px !important;
  }

  .sidebar-filter-copy strong,
  .sidebar-link[data-main-view="staff"] span:last-child {
    font-size: 14px !important;
  }

  .topbar {
    position: static !important;
    min-height: auto !important;
    padding: 8px 10px !important;
  }

  .topbar-actions {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    width: 100% !important;
  }

  .month-label,
  .schedule-mode-switch,
  .today-indicator {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .workspace {
    display: block !important;
    padding: 18px 10px 44px !important;
  }

  .section-heading h2,
  .directory-header h2 {
    font-size: 24px !important;
  }

  .sticky-name {
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
  }

  .sticky-team {
    left: 180px !important;
    width: 76px !important;
    min-width: 76px !important;
    max-width: 76px !important;
  }

  .day-head,
  .day-cell {
    width: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
  }
}

/* Final cascade guard: keep sticky table headers below the top controls. */
.schedule-table th,
.staff-table th {
  top: var(--sheet-top-offset) !important;
}

@media (min-width: 1280px) and (max-width: 1419px) {
  .app-shell {
    grid-template-rows: 72px 56px minmax(0, 1fr) !important;
  }

  .topbar {
    top: 72px !important;
    z-index: 96 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    padding-left: 16px !important;
    border-bottom: 1px solid #d9dee8 !important;
    background: #ffffff !important;
    pointer-events: auto !important;
  }

  .topbar-actions {
    pointer-events: auto !important;
  }

  .sidebar-quick-filters {
    padding-right: 0 !important;
  }

  .workspace {
    grid-row: 3 !important;
  }
}

@media (min-width: 1420px) {
  .app-sidebar {
    grid-template-columns: auto auto auto !important;
    justify-content: start !important;
  }

  .sidebar-nav {
    justify-content: flex-start !important;
  }

  .sidebar-quick-filters {
    padding-right: 0 !important;
  }

  .topbar {
    z-index: 96 !important;
  }
}

/* Final desktop header fit. This must stay after the guard above. */
.topbar {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

@media (min-width: 1420px) {
  .app-sidebar > .sidebar-brand {
    min-width: 190px !important;
    width: 190px !important;
  }

  .app-sidebar .sidebar-filter {
    min-width: 108px !important;
    padding: 0 14px !important;
  }

  .app-sidebar .sidebar-link[data-main-view="staff"] {
    min-width: 118px !important;
    width: 118px !important;
    padding: 0 14px !important;
  }

  .topbar {
    justify-self: end !important;
    align-self: start !important;
    width: auto !important;
    min-width: 620px !important;
    max-width: 640px !important;
    padding-right: 16px !important;
    background: transparent !important;
    border-bottom: 0 !important;
  }

  .topbar-actions {
    width: auto !important;
  }

  .month-label {
    min-width: 170px !important;
    padding-right: 14px !important;
    padding-left: 14px !important;
  }

  .schedule-mode-switch {
    margin-left: 6px !important;
  }

  .schedule-mode-button {
    min-width: 62px !important;
  }

  .today-indicator {
    padding-left: 4px !important;
    font-size: 12px !important;
  }

  .today-indicator span {
    display: none !important;
  }
}

/* Final view isolation guard. Personal is its own screen, not a continuation
   below the staffing sheet. Keep this after all display overrides. */
[hidden],
.app-shell [hidden] {
  display: none !important;
}

body[data-main-view="staff"] #scheduleView,
body[data-main-view="staff"] .requests-band,
body[data-main-view="staff"] #codeLegend,
body[data-main-view="staff"] .summary-strip,
body[data-main-view="staff"] .toolbar,
body[data-main-view="staff"] .horizontal-scrollbar {
  display: none !important;
}

body[data-main-view="schedule"] #staffDirectory {
  display: none !important;
}

/* The real header remains the first table row. The fixed mirror below handles
   the Google Sheets-like frozen reference while the page scrolls. */
body[data-main-view="schedule"] .schedule-table thead th {
  position: static !important;
  top: auto !important;
  z-index: 7 !important;
  background: #fbfcfe !important;
  box-shadow: none !important;
}

body[data-main-view="schedule"] .schedule-table thead th.sticky-name,
body[data-main-view="schedule"] .schedule-table thead th.sticky-team {
  position: sticky !important;
  top: auto !important;
  z-index: 14 !important;
}

.sticky-schedule-header {
  position: fixed;
  top: var(--sheet-top-offset);
  left: 0;
  z-index: 84;
  display: none;
  height: 56px;
  overflow: hidden;
  pointer-events: none;
  border: 1px solid #d9dee8;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: #fbfcfe;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.sticky-schedule-header.visible {
  display: flex;
}

body[data-main-view="staff"] .sticky-schedule-header {
  display: none !important;
}

.sticky-header-locked {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  background: #fbfcfe;
}

.sticky-header-scroll {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  background: #fbfcfe;
}

.sticky-header-days {
  display: flex;
  will-change: transform;
}

.sticky-header-cell {
  display: grid;
  flex: 0 0 auto;
  height: 56px;
  place-items: center;
  padding: 0 10px;
  border-right: 1px solid #d9dee8;
  border-bottom: 1px solid #d9dee8;
  background: #fbfcfe;
  color: #172033;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
}

.sticky-header-cell.sticky-name {
  justify-items: start;
  text-align: left;
}

.sticky-header-cell.nonworkday,
.sticky-header-cell.nonworkday span {
  color: var(--red);
}

.sticky-header-cell.selected-column {
  background-image: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(14, 165, 233, 0.04));
  box-shadow: inset 3px 0 0 rgba(14, 116, 144, 0.78), inset 0 -2px 0 rgba(14, 116, 144, 0.22);
}

.sticky-header-cell.current-day-column {
  box-shadow: inset 3px 0 0 #d97706;
}

.sticky-header-cell.selected-column.current-day-column {
  background-image: linear-gradient(90deg, rgba(249, 115, 22, 0.16), rgba(14, 165, 233, 0.06));
  box-shadow: inset 3px 0 0 #d97706, inset 0 -2px 0 rgba(217, 119, 6, 0.22);
}

/* Current date is informational text, not an action. Avoid checkbox-like affordance. */
.today-indicator {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0 !important;
  min-width: 0 !important;
  min-height: 42px !important;
  padding: 0 10px !important;
  border: 1px solid #d9dee8 !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  color: #172033 !important;
  cursor: default !important;
  line-height: 1 !important;
  box-shadow: inset 0 1px 0 #ffffff !important;
  text-transform: none !important;
  white-space: nowrap !important;
}

.today-indicator::before {
  display: none !important;
  content: none !important;
}

.today-indicator span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 22px !important;
  padding: 0 7px !important;
  border-radius: 6px !important;
  background: #e6fffb !important;
  color: #0f766e !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  text-transform: uppercase !important;
}

.today-indicator span::after {
  content: none !important;
}

.today-indicator strong {
  display: inline !important;
  margin-left: 8px !important;
  padding-left: 8px !important;
  border-left: 1px solid #d9dee8 !important;
  color: #172033 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

/* Personal uses the same frozen-row model as the shift sheet: real header in
   normal table flow, fixed mirror only after scrolling past it. */
body[data-main-view="staff"] .staff-table th {
  position: static !important;
  top: auto !important;
  z-index: 4 !important;
}

.sticky-staff-header {
  position: fixed;
  top: var(--sheet-top-offset);
  left: 0;
  z-index: 84;
  display: none;
  height: 48px;
  overflow: hidden;
  pointer-events: none;
  border: 1px solid #d9dee8;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: #eef2f7;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.sticky-staff-header.visible {
  display: block;
}

body[data-main-view="schedule"] .sticky-staff-header {
  display: none !important;
}

.sticky-staff-scroll {
  min-width: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.sticky-staff-row {
  display: flex;
  height: 100%;
  will-change: transform;
}

.sticky-staff-cell {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  height: 48px;
  padding: 0 14px;
  border-right: 1px solid #d9dee8;
  border-bottom: 1px solid #d9dee8;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: left;
  text-transform: uppercase;
}

/* Personal is an administrative view, visually separated from the clinical
   staffing tabs. */
.app-sidebar .sidebar-nav {
  position: relative !important;
  align-items: end !important;
  margin-left: clamp(18px, 3vw, 56px) !important;
  padding-left: clamp(16px, 2vw, 28px) !important;
}

.app-sidebar .sidebar-nav::before {
  content: "";
  width: 1px;
  height: 34px;
  margin: 0 18px 14px 0;
  flex: 0 0 auto;
  background: #cbd5e1;
}

.app-sidebar .sidebar-link[data-main-view="staff"] {
  gap: 10px !important;
  min-width: 154px !important;
  width: auto !important;
  min-height: 44px !important;
  height: 44px !important;
  margin-bottom: 14px !important;
  padding: 0 16px 0 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 999px !important;
  background: #f8fafc !important;
  color: #334155 !important;
  box-shadow: none !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"] .sidebar-icon {
  display: inline-grid !important;
  width: 28px !important;
  height: 28px !important;
  flex: 0 0 28px !important;
  place-items: center !important;
  border: 1px solid #99f6e4 !important;
  border-radius: 999px !important;
  background: #ccfbf1 !important;
  color: #0f766e !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"] .sidebar-icon svg {
  width: 16px !important;
  height: 16px !important;
  stroke: currentColor !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"]:hover {
  border-color: #64748b !important;
  background: #f1f5f9 !important;
  color: #172033 !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"].active {
  border-color: #172033 !important;
  background: #172033 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"].active .sidebar-icon {
  border-color: #99f6e4 !important;
  background: #ccfbf1 !important;
  color: #0f766e !important;
}

@media (max-width: 900px) {
  .app-sidebar .sidebar-nav {
    margin-left: 0 !important;
    padding-left: 0 !important;
  }

  .app-sidebar .sidebar-nav::before {
    display: none !important;
  }

  .app-sidebar .sidebar-link[data-main-view="staff"] {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px !important;
    height: 42px !important;
    margin-bottom: 0 !important;
    justify-content: center !important;
  }
}

/* Density and color polish for the main shift sheet. */
:root {
  --bg: #f4f7fb;
  --surface-soft: #eef6f7;
  --line: #cfd9e6;
  --line-strong: #9fb1c7;
  --text: #111827;
  --muted: #58677e;
  --blue: #2563eb;
  --teal: #0f766e;
  --amber: #d97706;
}

.app-shell,
.workspace {
  background: #f8fafc !important;
}

.app-sidebar {
  background: #ffffff !important;
  border-bottom-color: #cbd7e6 !important;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04) !important;
}

.sidebar-brand-copy strong {
  color: #08756f !important;
}

.sidebar-filter,
.app-sidebar .sidebar-link[data-main-view="staff"] {
  color: #2d3748 !important;
}

.sidebar-filter:hover {
  background: #f1f8f8 !important;
}

.sidebar-filter.active {
  border-color: #b8d9d5 !important;
  background: #eefdfa !important;
  color: #0f665f !important;
  box-shadow: inset 0 -4px 0 #0f766e, inset 0 1px 0 #ffffff !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"] {
  border-color: #cbd7e6 !important;
  background: #f6f8fb !important;
}

.topbar {
  background: #f8fbfd !important;
  border-bottom-color: #cbd7e6 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035) !important;
}

.icon-button {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  border-color: #cbd7e6 !important;
  background: #ffffff !important;
  color: #0f766e !important;
  font-size: 24px !important;
}

.icon-button:hover {
  border-color: #0f766e !important;
  background: #eefdfa !important;
}

.month-label {
  min-width: 170px !important;
  min-height: 38px !important;
  padding: 8px 14px !important;
  border-color: #b8d9d5 !important;
  background: #ffffff !important;
  color: #0f3f3b !important;
  font-size: 15px !important;
  box-shadow: inset 4px 0 0 #0f766e !important;
}

.schedule-mode-switch {
  min-height: 38px !important;
  border-color: #cbd7e6 !important;
}

.schedule-mode-button {
  min-width: 72px !important;
  border-right-color: #cbd7e6 !important;
  color: #334155 !important;
  font-size: 12px !important;
}

.schedule-mode-button.active {
  background: #0f766e !important;
  color: #ffffff !important;
  box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.32) !important;
}

.today-indicator {
  min-height: 38px !important;
  border-color: #fed7aa !important;
  background: #fff7ed !important;
  color: #7c2d12 !important;
}

.today-indicator span {
  background: #ffedd5 !important;
  color: #9a3412 !important;
}

.today-indicator strong {
  border-left-color: #fed7aa !important;
  color: #7c2d12 !important;
}

.workspace {
  padding-top: 18px !important;
}

.section-heading {
  padding: 0 12px 16px !important;
}

.section-heading h2,
.directory-header h2 {
  position: relative;
  padding-left: 12px !important;
  color: #111827 !important;
  font-size: 24px !important;
}

.section-heading h2::before,
.directory-header h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 999px;
  background: #0f766e;
}

.section-heading p,
.directory-header p {
  margin-top: 6px !important;
  font-size: 14px !important;
  color: #58677e !important;
}

.table-wrap {
  border-color: #cbd7e6 !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.055) !important;
}

.schedule-table th,
.schedule-table td,
.staff-table th,
.staff-table td {
  border-color: #d7e0ea !important;
}

.schedule-table th {
  height: 48px !important;
  background: #edf7f7 !important;
  color: #182337 !important;
  font-size: 12px !important;
  line-height: 1.05 !important;
}

.schedule-table td {
  height: 44px !important;
}

.schedule-table tr:hover td {
  background: #f8fbfd !important;
}

.schedule-table .sticky-name,
.schedule-table .sticky-team {
  background: #ffffff !important;
}

.schedule-table th.sticky-name,
.schedule-table th.sticky-team {
  background: #edf7f7 !important;
}

.sticky-name {
  width: 224px !important;
  min-width: 224px !important;
  max-width: 224px !important;
  padding: 0 12px !important;
}

.sticky-team {
  left: 224px !important;
  width: 76px !important;
  min-width: 76px !important;
  max-width: 76px !important;
  padding: 0 10px !important;
}

.day-head,
.day-cell {
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
}

.employee-name {
  max-width: 196px !important;
  font-size: 13px !important;
}

.sticky-team,
.schedule-table td {
  font-size: 13px !important;
}

.cell-button {
  font-size: 13px !important;
}

.cell-button.code-compact {
  font-size: 11px !important;
}

.cell-button.code-extra-compact {
  font-size: 9.5px !important;
}

.schedule-table th.day-head.nonworkday,
.schedule-table th.day-head.nonworkday span,
.schedule-table td.day-cell.nonworkday,
.schedule-table td.day-cell.nonworkday .cell-button {
  color: #b42318 !important;
}

.schedule-table td.day-cell.nonworkday {
  background: #fff8f8 !important;
}

.schedule-table .month-start {
  border-left-color: #8fb7dc !important;
}

.selected-column {
  background-image: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(14, 165, 233, 0.04)) !important;
  box-shadow: inset 3px 0 0 rgba(14, 116, 144, 0.78) !important;
}

.selected-row td,
.selected-row .sticky-name,
.selected-row .sticky-team {
  background: #fff8ed !important;
}

.current-day-number {
  width: 22px !important;
  height: 22px !important;
  background: #d97706 !important;
}

.schedule-table th.current-day-column,
.schedule-table td.current-day-column {
  background: #fff7ed !important;
  box-shadow: inset 2px 0 0 #d97706 !important;
}

.schedule-table th.selected-column.current-day-column,
.schedule-table td.selected-column.current-day-column {
  background-image: linear-gradient(90deg, rgba(217, 119, 6, 0.16), rgba(14, 165, 233, 0.06)) !important;
  box-shadow: inset 3px 0 0 #d97706 !important;
}

.shift-L {
  background: #d7eaff !important;
}

.shift-N {
  background: #e2ddff !important;
}

.shift-LN {
  background: #c9f0ff !important;
}

.shift-D {
  background: #d7f8df !important;
}

.shift-V {
  background: #ffecb5 !important;
}

.shift-M {
  background: #ffd6d6 !important;
}

.shift-Cap {
  background: #eadcff !important;
}

.shift-EX {
  background: #ffd9b6 !important;
}

.shift-CT {
  background: #c9f7ef !important;
}

.shift-OFF {
  color: #a0adbc !important;
}

body[data-main-view="schedule"] .schedule-table thead th.selected-column,
.schedule-table td.day-cell.selected-column,
.schedule-table tfoot td.selected-column {
  background-image: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(14, 165, 233, 0.04)) !important;
  box-shadow: inset 3px 0 0 rgba(14, 116, 144, 0.78) !important;
}

body[data-main-view="schedule"] .schedule-table thead th.selected-column {
  box-shadow: inset 3px 0 0 rgba(14, 116, 144, 0.78), inset 0 -2px 0 rgba(14, 116, 144, 0.22) !important;
}

.schedule-table th.selected-column.current-day-column,
.schedule-table td.selected-column.current-day-column,
.schedule-table tfoot td.selected-column.current-day-column {
  background-image: linear-gradient(90deg, rgba(217, 119, 6, 0.16), rgba(14, 165, 233, 0.06)) !important;
  box-shadow: inset 3px 0 0 #d97706 !important;
}

.sticky-schedule-header {
  height: 48px !important;
  border-color: #cbd7e6 !important;
  background: #edf7f7 !important;
}

.sticky-header-locked,
.sticky-header-scroll,
.sticky-header-cell {
  background: #edf7f7 !important;
}

.sticky-header-cell {
  height: 48px !important;
  padding: 0 6px !important;
  border-color: #d7e0ea !important;
  color: #182337 !important;
  font-size: 12px !important;
  line-height: 1.05 !important;
}

.sticky-header-cell.selected-column {
  background-image: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(14, 165, 233, 0.04)) !important;
  box-shadow: inset 3px 0 0 rgba(14, 116, 144, 0.78), inset 0 -2px 0 rgba(14, 116, 144, 0.22) !important;
}

.sticky-header-cell.current-day-column {
  box-shadow: inset 3px 0 0 #d97706 !important;
}

.sticky-header-cell.selected-column.current-day-column {
  background-image: linear-gradient(90deg, rgba(217, 119, 6, 0.16), rgba(14, 165, 233, 0.06)) !important;
  box-shadow: inset 3px 0 0 #d97706, inset 0 -2px 0 rgba(217, 119, 6, 0.22) !important;
}

@media (max-width: 900px) {
  .month-label,
  .today-indicator,
  .schedule-mode-switch {
    min-height: 36px !important;
  }

  .section-heading h2,
  .directory-header h2 {
    font-size: 22px !important;
  }

  .sticky-name {
    width: 174px !important;
    min-width: 174px !important;
    max-width: 174px !important;
  }

  .sticky-team {
    left: 174px !important;
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
  }

  .day-head,
  .day-cell {
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
  }
}

body[data-main-view="schedule"] .schedule-table thead th,
body[data-main-view="schedule"] .schedule-table thead th.sticky-name,
body[data-main-view="schedule"] .schedule-table thead th.sticky-team {
  background: #edf7f7 !important;
  color: #182337 !important;
}

body[data-main-view="schedule"] .schedule-table thead th.nonworkday,
body[data-main-view="schedule"] .schedule-table thead th.nonworkday span {
  color: #b42318 !important;
}

/* Clinical color lift: keep the spreadsheet layout, but give priority areas a
   stronger professional color system. */
:root {
  --clinical-bg: #edf6f8;
  --clinical-band: #e2f3f4;
  --clinical-panel: #f6fbfc;
  --clinical-teal: #0f766e;
  --clinical-teal-dark: #0b5f59;
  --clinical-blue: #2563eb;
  --clinical-sky: #0284c7;
  --clinical-indigo: #5b5fc7;
  --clinical-violet: #7c3aed;
  --clinical-amber: #d97706;
  --clinical-line: #b8d9df;
  --clinical-line-strong: #75b9c3;
}

body,
.app-shell,
.workspace {
  background: var(--clinical-bg) !important;
}

.app-sidebar {
  background: #e8f6f5 !important;
  border-bottom: 1px solid #9fd2d0 !important;
  box-shadow: 0 8px 18px rgba(15, 76, 94, 0.08) !important;
}

.sidebar-brand-copy strong {
  color: #006d68 !important;
}

.sidebar-brand-copy span {
  border-left-color: #8fc9c5 !important;
  color: #17324d !important;
}

.sidebar-filter[data-category-filter="EU"] {
  --tab-accent: #0f766e;
  --tab-soft: #dcf8f2;
  --tab-border: #76cfc3;
}

.sidebar-filter[data-category-filter="TENS"] {
  --tab-accent: #2563eb;
  --tab-soft: #e0ecff;
  --tab-border: #93b6ff;
}

.sidebar-filter[data-category-filter="AUX"] {
  --tab-accent: #7c3aed;
  --tab-soft: #eee7ff;
  --tab-border: #c4b5fd;
}

.sidebar-filter {
  border-color: transparent !important;
  background: rgba(255, 255, 255, 0.54) !important;
  color: #243247 !important;
}

.sidebar-filter:hover {
  background: var(--tab-soft) !important;
  color: var(--tab-accent) !important;
}

.sidebar-filter.active {
  border-color: var(--tab-border) !important;
  background: var(--tab-soft) !important;
  color: var(--tab-accent) !important;
  box-shadow: inset 0 -4px 0 var(--tab-accent), inset 0 1px 0 rgba(255, 255, 255, 0.86) !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"] {
  border-color: #a7c6d6 !important;
  background: #f0f7fb !important;
  color: #17324d !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"] .sidebar-icon {
  border-color: #7dd3fc !important;
  background: #e0f2fe !important;
  color: #0369a1 !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"]:hover {
  border-color: #0284c7 !important;
  background: #e0f2fe !important;
  color: #075985 !important;
}

.topbar {
  background: #f0f8fb !important;
  border-bottom: 1px solid #acd5df !important;
  box-shadow: 0 6px 16px rgba(15, 76, 94, 0.08) !important;
}

.icon-button {
  border-color: #9ccfd2 !important;
  background: #ffffff !important;
  color: var(--clinical-teal) !important;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--clinical-teal) !important;
  background: #dff8f2 !important;
  color: var(--clinical-teal-dark) !important;
}

.month-label {
  border-color: #72c7bd !important;
  background: #e6fbf7 !important;
  color: #064e49 !important;
  box-shadow: inset 4px 0 0 var(--clinical-teal), 0 1px 0 rgba(255, 255, 255, 0.86) !important;
}

.schedule-mode-switch {
  border-color: #a9c9d4 !important;
  background: #f7fbfd !important;
}

.schedule-mode-button {
  background: #f7fbfd !important;
  color: #29415c !important;
}

.schedule-mode-button.active {
  background: var(--clinical-teal) !important;
  color: #ffffff !important;
}

.today-indicator {
  border-color: #f2bd70 !important;
  background: #fff4df !important;
  color: #7c3d04 !important;
  box-shadow: inset 4px 0 0 var(--clinical-amber), inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;
}

.today-indicator span {
  background: #fed7aa !important;
  color: #8a3b05 !important;
}

.section-heading {
  margin-bottom: 0 !important;
  padding: 14px 14px 16px !important;
  border: 1px solid var(--clinical-line) !important;
  border-bottom: 0 !important;
  border-radius: 8px 8px 0 0 !important;
  background: var(--clinical-panel) !important;
  box-shadow: inset 0 4px 0 #74c9c2 !important;
}

.section-heading h2,
.directory-header h2 {
  color: #10243f !important;
}

.section-heading h2::before,
.directory-header h2::before {
  background: var(--clinical-teal) !important;
}

.section-heading p,
.directory-header p {
  color: #426278 !important;
}

.table-wrap {
  border-color: var(--clinical-line) !important;
  background: #ffffff !important;
  box-shadow: 0 14px 30px rgba(15, 76, 94, 0.11) !important;
}

body[data-main-view="schedule"] .schedule-table thead th,
body[data-main-view="schedule"] .schedule-table thead th.sticky-name,
body[data-main-view="schedule"] .schedule-table thead th.sticky-team,
.sticky-header-locked,
.sticky-header-scroll,
.sticky-header-cell {
  background: #dff1f4 !important;
  color: #10243f !important;
}

.schedule-table th,
.schedule-table td,
.staff-table th,
.staff-table td,
.sticky-header-cell {
  border-color: #cbdde4 !important;
}

.schedule-table .sticky-name,
.schedule-table .sticky-team {
  background: #fbfdfd !important;
}

.schedule-table tbody tr:nth-child(4n + 1) td:not(.day-cell),
.schedule-table tbody tr:nth-child(4n + 1) .sticky-name,
.schedule-table tbody tr:nth-child(4n + 1) .sticky-team {
  background: #f8fbfd !important;
}

.schedule-table tr:hover td,
.schedule-table tr:hover .sticky-name,
.schedule-table tr:hover .sticky-team {
  background: #edf9fb !important;
}

.schedule-table td.day-cell.nonworkday,
.schedule-table tfoot .total-count-cell.nonworkday {
  background: #fff1f0 !important;
}

body[data-main-view="schedule"] .schedule-table thead th.nonworkday,
body[data-main-view="schedule"] .schedule-table thead th.nonworkday span,
.sticky-header-cell.nonworkday,
.sticky-header-cell.nonworkday span {
  color: #b42318 !important;
}

.schedule-table .month-start {
  border-left-color: #65a9c7 !important;
}

body[data-main-view="schedule"] .schedule-table thead th.selected-column,
.schedule-table td.day-cell.selected-column,
.schedule-table tfoot td.selected-column,
.sticky-header-cell.selected-column {
  background-image: linear-gradient(90deg, rgba(14, 116, 144, 0.2), rgba(14, 165, 233, 0.07)) !important;
  box-shadow: inset 3px 0 0 #0e7490, inset 0 -2px 0 rgba(14, 116, 144, 0.22) !important;
}

.current-day-number {
  background: var(--clinical-amber) !important;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.16) !important;
}

.schedule-table th.current-day-column,
.schedule-table td.current-day-column,
.sticky-header-cell.current-day-column {
  background: #fff2dc !important;
  box-shadow: inset 3px 0 0 var(--clinical-amber) !important;
}

.schedule-table th.selected-column.current-day-column,
.schedule-table td.selected-column.current-day-column,
.schedule-table tfoot td.selected-column.current-day-column,
.sticky-header-cell.selected-column.current-day-column {
  background-image: linear-gradient(90deg, rgba(217, 119, 6, 0.24), rgba(14, 116, 144, 0.08)) !important;
  box-shadow: inset 3px 0 0 var(--clinical-amber), inset 0 -2px 0 rgba(217, 119, 6, 0.24) !important;
}

.shift-L {
  background: #cfe7ff !important;
  color: #0b2545 !important;
}

.shift-N {
  background: #dad8ff !important;
  color: #171947 !important;
}

.shift-LN {
  background: #bfefff !important;
  color: #07364a !important;
}

.shift-D {
  background: #c9f7dc !important;
  color: #073b25 !important;
}

.shift-V {
  background: #ffe6a3 !important;
  color: #563400 !important;
}

.shift-M {
  background: #ffcfcf !important;
  color: #651b1b !important;
}

.shift-Cap {
  background: #e3d3ff !important;
  color: #34136b !important;
}

.shift-EX {
  background: #ffd1ab !important;
  color: #5f2c04 !important;
}

.shift-CT {
  background: #bff4eb !important;
  color: #073b36 !important;
}

.shift-OFF {
  color: #8aa0b4 !important;
}

.horizontal-scrollbar {
  border-top-color: var(--clinical-line) !important;
  background: #f5fbfc !important;
}

.sticky-schedule-totals {
  position: fixed;
  left: 0;
  bottom: 18px;
  z-index: 83;
  display: none;
  overflow: hidden;
  pointer-events: none;
  border: 1px solid var(--clinical-line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #f8fcfd;
  box-shadow: 0 -10px 24px rgba(15, 76, 94, 0.16);
}

.sticky-schedule-totals.visible {
  display: flex;
}

body[data-main-view="staff"] .sticky-schedule-totals {
  display: none !important;
}

.sticky-totals-locked {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  background: #f8fcfd;
}

.sticky-totals-scroll {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  background: #f8fcfd;
}

.sticky-totals-days {
  will-change: transform;
}

.sticky-totals-row {
  display: flex;
}

.sticky-totals-cell {
  display: grid;
  flex: 0 0 auto;
  height: 34px;
  place-items: center;
  border-right: 1px solid #cbdde4;
  border-bottom: 1px solid #cbdde4;
  background: #f8fcfd;
  color: #10243f;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
}

.sticky-totals-row.totals-group-start .sticky-totals-cell {
  border-top: 2px solid #75b9c3;
}

.sticky-totals-cell.sticky-name {
  justify-items: end;
  text-align: right;
}

.sticky-totals-cell.total-label {
  color: #426278;
  font-size: 11px;
  text-transform: uppercase;
}

.sticky-totals-cell.total-count-cell {
  color: #10243f;
}

.sticky-totals-row.totals-EU .sticky-totals-cell.total-count-cell {
  background: #e7f4ff;
}

.sticky-totals-row.totals-TENS .sticky-totals-cell.total-count-cell {
  background: #e8fbf2;
}

.sticky-totals-row.totals-AUX .sticky-totals-cell.total-count-cell {
  background: #f4ecff;
}

.sticky-totals-cell.total-zero {
  color: #8aa0b4;
}

.sticky-totals-cell.nonworkday {
  background: #fff1f0 !important;
  color: #b42318 !important;
}

.sticky-totals-cell.selected-column {
  background-image: linear-gradient(90deg, rgba(14, 116, 144, 0.2), rgba(14, 165, 233, 0.07)) !important;
  box-shadow: inset 3px 0 0 #0e7490, inset 0 -2px 0 rgba(14, 116, 144, 0.22) !important;
}

.sticky-totals-cell.current-day-column {
  background: #fff2dc !important;
  box-shadow: inset 3px 0 0 var(--clinical-amber) !important;
}

.sticky-totals-cell.selected-column.current-day-column {
  background-image: linear-gradient(90deg, rgba(217, 119, 6, 0.24), rgba(14, 116, 144, 0.08)) !important;
  box-shadow: inset 3px 0 0 var(--clinical-amber), inset 0 -2px 0 rgba(217, 119, 6, 0.24) !important;
}

@media (max-width: 900px) {
  .section-heading {
    padding: 12px 12px 14px !important;
  }

  .sticky-totals-cell {
    height: 32px;
    font-size: 11px;
  }

  .app-sidebar,
  .topbar {
    background: #f2faf9 !important;
  }
}

/* Header clarity fix: keep tabs and temporal controls in one desktop row. */
@media (min-width: 901px) {
  :root {
    --sheet-top-offset: 72px;
  }

  .app-shell {
    grid-template-rows: 72px minmax(0, 1fr) !important;
  }

  .app-sidebar {
    grid-row: 1 !important;
    grid-template-columns: 160px auto auto !important;
    gap: 8px !important;
    padding: 0 clamp(650px, 52vw, 700px) 0 12px !important;
  }

  .sidebar-brand {
    min-width: 160px !important;
    width: 160px !important;
  }

  .sidebar-brand-copy strong {
    font-size: 22px !important;
  }

  .sidebar-brand-copy span {
    max-width: 94px !important;
    font-size: 11px !important;
  }

  .sidebar-quick-filters {
    padding-right: 0 !important;
  }

  .sidebar-filter-list {
    gap: 2px !important;
  }

  .sidebar-filter {
    min-width: 96px !important;
    padding: 0 10px !important;
  }

  .sidebar-filter[data-category-filter="EU"] {
    min-width: 116px !important;
  }

  .sidebar-filter[data-category-filter="AUX"] {
    min-width: 106px !important;
  }

  .sidebar-filter-copy strong {
    font-size: 15px !important;
  }

  .app-sidebar .sidebar-nav {
    margin-left: 4px !important;
    padding-left: 4px !important;
  }

  .app-sidebar .sidebar-nav::before {
    height: 32px !important;
    margin: 0 4px 16px 0 !important;
  }

  .app-sidebar .sidebar-link[data-main-view="staff"] {
    justify-content: center !important;
    gap: 0 !important;
    min-width: 84px !important;
    width: 84px !important;
    padding: 0 10px !important;
  }

  .app-sidebar .sidebar-link[data-main-view="staff"] .sidebar-icon {
    display: none !important;
  }

  .app-sidebar .sidebar-link[data-main-view="staff"] span:last-child {
    font-size: 13px !important;
  }

  .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 96 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: start !important;
    width: clamp(650px, 52vw, 700px) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 16px) !important;
    min-height: 72px !important;
    padding: 0 12px 0 0 !important;
    overflow: visible !important;
    background: transparent !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
    pointer-events: auto !important;
  }

  .topbar-actions {
    width: 100% !important;
    max-width: none !important;
    min-height: 72px !important;
    justify-content: flex-end !important;
    gap: 5px !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }

  .icon-button {
    width: 34px !important;
    min-width: 34px !important;
    height: 38px !important;
    font-size: 22px !important;
  }

  .month-label {
    min-width: clamp(210px, 18vw, 260px) !important;
    min-height: 38px !important;
    padding: 8px 8px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  .schedule-mode-switch {
    min-height: 38px !important;
    margin-left: 2px !important;
    flex: 0 0 auto !important;
  }

  .schedule-mode-button {
    min-width: 44px !important;
    padding: 0 5px !important;
    font-size: 10.5px !important;
  }

  .today-indicator {
    flex: 0 0 auto !important;
    min-width: 86px !important;
    min-height: 38px !important;
    padding: 0 6px !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
  }

  .today-indicator span {
    display: none !important;
  }

  .today-indicator strong {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
  }

  .workspace {
    grid-row: 2 !important;
  }
}

@media (min-width: 901px) and (max-width: 1199px) {
  .app-sidebar {
    grid-template-columns: 54px auto auto !important;
    gap: 4px !important;
    padding: 0 574px 0 8px !important;
  }

  .sidebar-brand {
    min-width: 54px !important;
    width: 54px !important;
    padding: 0 !important;
  }

  .sidebar-brand .brand-mark,
  .sidebar-brand-copy span {
    display: none !important;
  }

  .sidebar-brand-copy strong {
    font-size: 18px !important;
  }

  .sidebar-filter-list {
    gap: 1px !important;
  }

  .sidebar-filter {
    min-width: 60px !important;
    padding: 0 3px !important;
  }

  .sidebar-filter[data-category-filter="EU"] {
    min-width: 68px !important;
  }

  .sidebar-filter[data-category-filter="TENS"] {
    min-width: 50px !important;
  }

  .sidebar-filter[data-category-filter="AUX"] {
    min-width: 62px !important;
  }

  .sidebar-filter-copy strong {
    font-size: 10.5px !important;
  }

  .app-sidebar .sidebar-nav {
    margin-left: 0 !important;
    padding-left: 0 !important;
  }

  .app-sidebar .sidebar-nav::before {
    display: none !important;
  }

  .app-sidebar .sidebar-link[data-main-view="staff"] {
    min-width: 52px !important;
    width: 52px !important;
    padding: 0 4px !important;
  }

  .app-sidebar .sidebar-link[data-main-view="staff"] span:last-child {
    font-size: 10.5px !important;
  }

  .topbar {
    width: 574px !important;
  }

  .topbar-actions {
    gap: 4px !important;
  }

  .icon-button {
    width: 32px !important;
    min-width: 32px !important;
  }

  .month-label {
    min-width: 210px !important;
    padding-right: 6px !important;
    padding-left: 6px !important;
    font-size: 11.5px !important;
  }

  .schedule-mode-button {
    padding: 0 4px !important;
    font-size: 10px !important;
  }

  .today-indicator {
    min-width: 80px !important;
    padding: 0 5px !important;
    font-size: 10.5px !important;
  }
}

@media (min-width: 1200px) {
  .app-sidebar > .sidebar-brand {
    min-width: 160px !important;
    width: 160px !important;
  }
}

/* Month band for 3-month horizontal navigation, mirroring the Google Sheets cue. */
:root {
  --schedule-month-band-height: 30px;
  --schedule-day-header-height: 48px;
}

.schedule-table thead .month-band-row th {
  height: var(--schedule-month-band-height) !important;
  padding: 0 12px !important;
  border-bottom: 2px solid #0f2f44 !important;
  background: #0f4f68 !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  text-align: left !important;
  text-transform: uppercase !important;
}

.schedule-table thead .month-band-row th.month-band-left {
  background: #10384d !important;
  color: #ffffff !important;
}

.schedule-table thead .month-band-row th.sticky-team {
  color: transparent !important;
}

.schedule-table thead .month-band {
  border-left: 3px solid #f97316 !important;
  overflow: hidden !important;
}

.month-band-label {
  display: inline-flex;
  align-items: center;
  height: 100%;
  min-width: max-content;
  will-change: transform;
}

.schedule-table thead .date-header-row th {
  height: var(--schedule-day-header-height) !important;
}

.sticky-schedule-header {
  height: calc(var(--schedule-month-band-height) + var(--schedule-day-header-height)) !important;
}

.sticky-header-locked,
.sticky-header-days {
  display: grid !important;
}

.sticky-header-row {
  display: flex;
}

.sticky-header-month-row .sticky-header-cell {
  height: var(--schedule-month-band-height) !important;
  place-items: center start !important;
  padding: 0 12px !important;
  border-bottom: 2px solid #0f2f44 !important;
  background: #0f4f68 !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  text-align: left !important;
  text-transform: uppercase !important;
}

.sticky-header-month-row .sticky-header-cell.month-band-left {
  background: #10384d !important;
}

.sticky-header-month-row .sticky-header-cell.sticky-team {
  color: transparent !important;
}

.sticky-header-month-row .sticky-header-cell.month-band {
  border-left: 3px solid #f97316 !important;
  overflow: hidden !important;
}

.sticky-header-day-row .sticky-header-cell {
  height: var(--schedule-day-header-height) !important;
}

/* Approved July 2026 desktop workbench: clinical blue palette and compact
   schedule controls. This final layer intentionally preserves the existing
   spreadsheet mechanics while replacing only presentation and affordances. */
:root {
  --clinical-blue-canvas: #f5f7fa;
  --clinical-blue-surface: #ffffff;
  --clinical-blue-navy: #17324d;
  --clinical-blue-navy-strong: #0f2942;
  --clinical-blue-cobalt: #2f6fed;
  --clinical-blue-cobalt-dark: #245aa8;
  --clinical-blue-ink: #142235;
  --clinical-blue-muted: #5b6878;
  --clinical-blue-line: #d9e0e8;
  --clinical-blue-header: #edf3f8;
  --clinical-blue-header-line: #cbd7e2;
  --clinical-blue-weekend: #faf4f2;
  --clinical-blue-weekend-text: #b34a3c;
  --clinical-blue-amber: #d98212;
  --clinical-blue-amber-soft: #fff3dd;
  --sheet-top-offset: 76px;
  --schedule-month-band-height: 30px;
  --schedule-day-header-height: 46px;
}

body,
.app-shell,
.workspace {
  background: var(--clinical-blue-canvas) !important;
  color: var(--clinical-blue-ink) !important;
}

.app-shell {
  grid-template-rows: 76px minmax(0, 1fr) !important;
}

.app-sidebar {
  min-height: 76px !important;
  height: 76px !important;
  padding: 0 14px !important;
  border-bottom: 1px solid var(--clinical-blue-line) !important;
  background: #ffffff !important;
  box-shadow: 0 1px 0 rgba(20, 34, 53, 0.04) !important;
}

.sidebar-brand {
  min-height: 60px !important;
  padding: 0 18px 10px 0 !important;
}

.sidebar-brand-copy strong {
  color: var(--clinical-blue-navy) !important;
}

.sidebar-brand-copy span {
  color: #33475f !important;
  border-left-color: #b8c6d5 !important;
}

.sidebar-filter,
.app-sidebar .sidebar-link[data-main-view="staff"] {
  min-height: 58px !important;
  height: 58px !important;
  margin: 0 !important;
  padding: 0 20px !important;
  border: 1px solid var(--clinical-blue-line) !important;
  border-bottom: 0 !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  color: #1f2f43 !important;
  box-shadow: none !important;
}

.sidebar-filter:hover,
.app-sidebar .sidebar-link[data-main-view="staff"]:hover {
  border-color: #b9c8d8 !important;
  background: #f6f9fc !important;
  color: var(--clinical-blue-navy) !important;
}

.sidebar-filter.active,
.app-sidebar .sidebar-link[data-main-view="staff"].active {
  border-color: var(--clinical-blue-cobalt) !important;
  background: var(--clinical-blue-cobalt) !important;
  color: #ffffff !important;
  box-shadow: inset 0 -4px 0 rgba(255, 255, 255, 0.2) !important;
}

.app-sidebar .sidebar-nav {
  margin-left: 0 !important;
  padding-left: 0 !important;
}

.app-sidebar .sidebar-nav::before {
  display: none !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"] {
  min-width: 118px !important;
  width: auto !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"] .sidebar-icon {
  display: none !important;
}

.topbar {
  top: 0 !important;
  z-index: 98 !important;
  min-height: 76px !important;
  height: 76px !important;
  padding: 0 12px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.topbar > div:first-child {
  display: none !important;
}

.topbar-actions {
  flex-wrap: nowrap !important;
  gap: 7px !important;
}

#prevMonth { order: 1; }
.month-label { order: 2; }
#nextMonth { order: 3; }
.schedule-mode-switch { order: 4; }
.today-indicator { order: 5; }

.icon-button {
  width: 42px !important;
  min-width: 42px !important;
  height: 42px !important;
  border: 1px solid #cdd7e2 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  color: var(--clinical-blue-cobalt-dark) !important;
  box-shadow: none !important;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--clinical-blue-cobalt) !important;
  background: #f1f6ff !important;
}

.month-label {
  min-width: 260px !important;
  min-height: 42px !important;
  padding: 10px 18px !important;
  border: 1px solid #9fb9d3 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  color: var(--clinical-blue-navy) !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  box-shadow: inset 0 -2px 0 rgba(47, 111, 237, 0.08) !important;
}

.schedule-mode-switch {
  min-height: 42px !important;
  margin-left: 8px !important;
  border-color: #cdd7e2 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
}

.schedule-mode-button {
  min-width: 76px !important;
  border-right-color: #d5dee7 !important;
  background: #ffffff !important;
  color: #27384d !important;
}

.schedule-mode-button.active {
  background: var(--clinical-blue-cobalt) !important;
  color: #ffffff !important;
  box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.2) !important;
}

.today-indicator {
  min-height: 42px !important;
  padding: 0 13px !important;
  border: 1px solid #e3a451 !important;
  border-radius: 6px !important;
  background: #fffaf2 !important;
  color: #9a4f06 !important;
  box-shadow: none !important;
}

.today-indicator span {
  height: auto !important;
  padding: 0 !important;
  background: transparent !important;
  color: #a95807 !important;
  font-size: 12px !important;
  text-transform: none !important;
}

.today-indicator strong {
  border-left-color: #edc58f !important;
  color: #9a4f06 !important;
}

.workspace {
  gap: 0 !important;
  padding: 0 4px 28px !important;
}

.matrix-panel {
  position: relative !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.section-heading {
  display: grid !important;
  grid-template-columns: 350px minmax(760px, 1fr) !important;
  align-items: center !important;
  gap: 18px !important;
  min-height: 114px !important;
  margin: 0 !important;
  padding: 14px 22px 20px !important;
  border: 0 !important;
  border-bottom: 1px solid #e4e9ef !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.matrix-title-block {
  min-width: 0;
}

.section-heading h2 {
  margin: 0 !important;
  padding: 0 !important;
  color: var(--clinical-blue-ink) !important;
  font-size: 27px !important;
  font-weight: 900 !important;
  letter-spacing: -0.02em !important;
}

.section-heading h2::before {
  display: none !important;
  content: none !important;
}

.section-heading p {
  margin: 7px 0 0 !important;
  color: var(--clinical-blue-muted) !important;
  font-size: 14px !important;
}

.matrix-workbench-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.matrix-search {
  min-width: 210px;
  width: 235px;
  flex: 0 1 235px;
}

.matrix-search input {
  width: 100%;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #cfd8e2;
  border-radius: 6px;
  background: #ffffff;
  color: var(--clinical-blue-ink);
  font-size: 13px;
  font-weight: 700;
}

.matrix-search input::placeholder {
  color: #7a8795;
}

.turn-filter-menu {
  position: relative;
  flex: 0 0 auto;
}

.turn-filter-menu summary,
.workbench-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #cfd8e2;
  border-radius: 6px;
  background: #ffffff;
  color: #2b3b50;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.turn-filter-menu summary {
  min-width: 132px;
  cursor: pointer;
  list-style: none;
}

.turn-filter-menu summary::-webkit-details-marker {
  display: none;
}

.turn-filter-menu[open] summary {
  border-color: var(--clinical-blue-cobalt);
  box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.12);
}

.turn-filter-menu .matrix-filter-stack {
  position: absolute !important;
  top: calc(100% + 6px);
  right: 0;
  z-index: 120;
  display: block !important;
  width: max-content;
  margin: 0 !important;
  padding: 8px !important;
  border: 1px solid #cfd8e2 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  box-shadow: 0 10px 24px rgba(20, 34, 53, 0.12) !important;
}

.matrix-filter {
  border-color: #cfd8e2 !important;
  border-radius: 5px !important;
  color: #415166 !important;
}

.matrix-filter.active {
  border-color: var(--clinical-blue-cobalt) !important;
  background: #e8f1ff !important;
  color: #194d96 !important;
  box-shadow: inset 0 0 0 1px rgba(47, 111, 237, 0.16) !important;
}

.density-switch {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 40px;
  overflow: hidden;
  border: 1px solid #cfd8e2;
  border-radius: 6px;
  background: #ffffff;
}

.density-button {
  min-width: 80px;
  border: 0;
  border-right: 1px solid #d9e0e8;
  background: #ffffff;
  color: #3f4f63;
  font-size: 13px;
  font-weight: 850;
}

.density-button:last-child {
  border-right: 0;
}

.density-button.active {
  background: var(--clinical-blue-cobalt) !important;
  color: #ffffff !important;
}

.coverage-alert-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #c8d7e5;
  border-radius: 6px;
  background: #f1f6fb;
  color: #365f82;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.coverage-alert-chip.has-alerts {
  border-color: #edc58f;
  background: var(--clinical-blue-amber-soft);
  color: #99510b;
}

.inline-code-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  color: #687587;
  font-size: 11px;
  white-space: nowrap;
}

.inline-code-legend strong:first-child {
  color: var(--clinical-blue-cobalt-dark);
}

.inline-code-legend strong:nth-of-type(2) {
  color: #35358a;
}

.inline-code-legend i {
  color: #a1acb8;
  font-style: normal;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.selection-action-bar {
  position: absolute;
  top: 85px;
  left: 50%;
  z-index: 125;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 4px 5px 4px 13px;
  border: 1px solid #b9c8d8;
  border-radius: 6px;
  background: #ffffff;
  color: #314256;
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 6px 16px rgba(20, 34, 53, 0.14);
  transform: translateX(-50%);
  white-space: nowrap;
}

.selection-action-bar[hidden] {
  display: none !important;
}

.selection-action-bar button {
  min-height: 30px;
  margin-left: 12px;
  padding: 0 12px;
  border: 1px solid var(--clinical-blue-cobalt);
  border-radius: 5px;
  background: var(--clinical-blue-cobalt);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.table-wrap {
  border: 0 !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.schedule-table {
  background: #ffffff !important;
}

body[data-main-view="schedule"] .schedule-table thead .month-band-row th,
.sticky-header-month-row .sticky-header-cell {
  height: 30px !important;
  padding: 0 14px !important;
  border-color: var(--clinical-blue-navy-strong) !important;
  background: var(--clinical-blue-navy) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  letter-spacing: 0.01em !important;
}

body[data-main-view="schedule"] .schedule-table thead .month-band-row th.month-band-left,
.sticky-header-month-row .sticky-header-cell.month-band-left {
  background: var(--clinical-blue-navy-strong) !important;
}

body[data-main-view="schedule"] .schedule-table thead .month-band,
.sticky-header-month-row .sticky-header-cell.month-band {
  border-left: 2px solid var(--clinical-blue-cobalt) !important;
}

body[data-main-view="schedule"] .schedule-table thead .date-header-row th,
.sticky-header-day-row .sticky-header-cell {
  height: 46px !important;
  border-color: var(--clinical-blue-line) !important;
  border-bottom-color: var(--clinical-blue-header-line) !important;
  background: var(--clinical-blue-header) !important;
  color: #28384c !important;
  font-size: 11px !important;
}

.schedule-table th,
.schedule-table td,
.sticky-header-cell,
.sticky-totals-cell {
  border-color: var(--clinical-blue-line) !important;
}

.sticky-name {
  width: 196px !important;
  min-width: 196px !important;
  max-width: 196px !important;
  padding: 0 12px !important;
}

.sticky-team {
  left: 196px !important;
  width: 76px !important;
  min-width: 76px !important;
  max-width: 76px !important;
  padding: 0 10px !important;
}

.day-head,
.day-cell {
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
}

.schedule-table td {
  height: 38px !important;
  background: #ffffff !important;
  color: var(--clinical-blue-ink) !important;
  font-size: 12px !important;
}

.schedule-table .sticky-name,
.schedule-table .sticky-team {
  background: #fbfcfd !important;
}

.schedule-table th.sticky-name,
.schedule-table th.sticky-team {
  background: #f8fafc !important;
}

.schedule-table .employee-cell {
  display: flex !important;
  align-items: flex-start !important;
  text-align: left !important;
  padding-left: 0 !important;
}

.schedule-table .employee-name {
  display: block !important;
  width: 100% !important;
  max-width: 168px !important;
  text-align: left !important;
  color: var(--clinical-blue-ink) !important;
  font-size: 12px !important;
  font-weight: 850 !important;
}

.cell-button {
  color: inherit !important;
  font-size: 12px !important;
}

.schedule-table td.day-cell.shift-L,
.schedule-table td.day-cell.shift-LN {
  background: #f6f9fd !important;
  color: var(--clinical-blue-cobalt-dark) !important;
}

.schedule-table td.day-cell.shift-N {
  background: #f8f7fd !important;
  color: #35358a !important;
}

.schedule-table td.day-cell.shift-OFF {
  background: #ffffff !important;
  color: #9aa8b7 !important;
}

.schedule-table td.day-cell.nonworkday,
.schedule-table tfoot .total-count-cell.nonworkday {
  background: var(--clinical-blue-weekend) !important;
}

body[data-main-view="schedule"] .schedule-table thead th.nonworkday,
body[data-main-view="schedule"] .schedule-table thead th.nonworkday span,
.sticky-header-cell.nonworkday,
.sticky-header-cell.nonworkday span {
  color: var(--clinical-blue-weekend-text) !important;
}

.schedule-table td.day-cell.nonworkday .cell-button {
  color: inherit !important;
}

.schedule-table td.day-cell.nonworkday.shift-L,
.schedule-table td.day-cell.nonworkday.shift-LN {
  color: var(--clinical-blue-cobalt-dark) !important;
}

.schedule-table td.day-cell.nonworkday.shift-N {
  color: #35358a !important;
}

.schedule-table tbody tr:nth-child(4n + 1) td:not(.day-cell),
.schedule-table tbody tr:nth-child(4n + 1) .sticky-name,
.schedule-table tbody tr:nth-child(4n + 1) .sticky-team {
  background: #f9fbfd !important;
}

.schedule-table tr:hover td,
.schedule-table tr:hover .sticky-name,
.schedule-table tr:hover .sticky-team {
  background: #f2f7fc !important;
}

.selected-row td,
.selected-row .sticky-name,
.selected-row .sticky-team {
  background: #f1f6fc !important;
}

body[data-main-view="schedule"] .schedule-table thead th.selected-column,
.schedule-table td.day-cell.selected-column,
.schedule-table tfoot td.selected-column,
.sticky-header-cell.selected-column {
  background-image: none !important;
  background-color: #f3f7fd !important;
  box-shadow: inset 2px 0 0 rgba(47, 111, 237, 0.72) !important;
}

body[data-selection-active="true"] .selected-row td.day-cell.selected-column .cell-button {
  outline: 2px solid var(--clinical-blue-cobalt) !important;
  outline-offset: -2px !important;
}

.current-day-number {
  background: var(--clinical-blue-amber) !important;
  box-shadow: 0 0 0 2px rgba(217, 130, 18, 0.16) !important;
}

.schedule-table th.current-day-column,
.schedule-table td.current-day-column,
.sticky-header-cell.current-day-column {
  background: var(--clinical-blue-amber-soft) !important;
  box-shadow: inset 2px 0 0 var(--clinical-blue-amber) !important;
}

.schedule-table th.selected-column.current-day-column,
.schedule-table td.selected-column.current-day-column,
.schedule-table tfoot td.selected-column.current-day-column,
.sticky-header-cell.selected-column.current-day-column {
  background-image: none !important;
  background-color: var(--clinical-blue-amber-soft) !important;
  box-shadow: inset 2px 0 0 var(--clinical-blue-amber) !important;
}

.exception-cell {
  box-shadow: inset 0 -3px 0 #b34a3c !important;
}

.schedule-table tfoot td,
.sticky-totals-cell {
  height: 38px !important;
  background: #fbfcfd !important;
  color: #245aa8 !important;
  font-size: 12px !important;
}

.schedule-table tfoot .total-group,
.schedule-table tfoot .total-label,
.sticky-totals-cell.total-group,
.sticky-totals-cell.total-label {
  color: #24364c !important;
}

.schedule-table tfoot .total-group,
.sticky-totals-cell.total-group {
  text-align: left !important;
}

.sticky-schedule-header {
  border-color: var(--clinical-blue-line) !important;
  border-radius: 0 !important;
  background: #ffffff !important;
  box-shadow: 0 4px 12px rgba(20, 34, 53, 0.08) !important;
}

.sticky-schedule-totals {
  border-color: var(--clinical-blue-line) !important;
  border-radius: 0 !important;
  background: #fbfcfd !important;
  box-shadow: 0 -8px 18px rgba(20, 34, 53, 0.1) !important;
}

.horizontal-scrollbar {
  height: 18px !important;
  border-top-color: var(--clinical-blue-line) !important;
  background: #f7f9fb !important;
  box-shadow: none !important;
}

.matrix-search input:focus-visible,
.turn-filter-menu summary:focus-visible,
.workbench-button:focus-visible,
.density-button:focus-visible,
.selection-action-bar button:focus-visible,
.matrix-filter:focus-visible,
.schedule-table .cell-button:focus-visible,
.sidebar-filter:focus-visible,
.schedule-mode-button:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid var(--clinical-blue-cobalt) !important;
  outline-offset: 2px !important;
}

body[data-schedule-density="comfortable"] .schedule-table td {
  height: 44px !important;
}

body[data-schedule-density="comfortable"] .day-head,
body[data-schedule-density="comfortable"] .day-cell {
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
}

body[data-schedule-density="comfortable"] .employee-name,
body[data-schedule-density="comfortable"] .cell-button {
  font-size: 13px !important;
}

@media (min-width: 1420px) {
  .app-sidebar > .sidebar-brand {
    min-width: 198px !important;
    width: 198px !important;
  }

  .app-sidebar .sidebar-filter {
    min-width: 122px !important;
  }

  .topbar {
    min-width: 790px !important;
    max-width: 820px !important;
    padding-right: 10px !important;
  }

  .today-indicator span {
    display: inline-flex !important;
  }
}

@media (max-width: 1419px) {
  :root {
    --sheet-top-offset: 132px;
  }

  .app-shell {
    grid-template-rows: 76px 56px minmax(0, 1fr) !important;
  }

  .topbar {
    top: 76px !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 56px !important;
    min-height: 56px !important;
    padding: 7px 12px !important;
    border-bottom: 1px solid var(--clinical-blue-line) !important;
    background: #ffffff !important;
  }

  .topbar-actions {
    justify-content: flex-end !important;
  }

  .workspace {
    grid-row: 3 !important;
  }

  .section-heading {
    grid-template-columns: 1fr !important;
    min-height: 148px !important;
    gap: 10px !important;
  }

  .matrix-workbench-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .selection-action-bar {
    top: 121px;
  }
}

@media (max-width: 900px) {
  :root {
    --sheet-top-offset: 0px;
  }

  .app-shell {
    grid-template-rows: auto auto minmax(0, 1fr) !important;
  }

  .app-sidebar {
    height: auto !important;
    min-height: 0 !important;
    padding: 8px !important;
  }

  .topbar {
    position: static !important;
    grid-row: 2 !important;
    height: auto !important;
    min-height: 56px !important;
  }

  .topbar-actions {
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
  }

  .month-label {
    min-width: 180px !important;
  }

  .today-indicator {
    flex: 0 0 auto !important;
  }

  .section-heading {
    min-height: 196px !important;
    padding: 14px 10px 20px !important;
  }

  .matrix-search {
    flex-basis: 100%;
  }

  .inline-code-legend {
    width: 100%;
  }

  .selection-action-bar {
    top: 168px;
    max-width: calc(100vw - 20px);
    overflow: hidden;
  }

  .sticky-name {
    width: 174px !important;
    min-width: 174px !important;
    max-width: 174px !important;
  }

  .sticky-team {
    left: 174px !important;
  }
}

/* Selected header concept 2: a clinical-blue navigation ribbon, a raised
   active service tab and a lighter, icon-led workbench. */
:root {
  --ribbon-blue: #2869e8;
  --ribbon-blue-deep: #215ed4;
  --ribbon-blue-soft: #eaf2ff;
  --ribbon-ink: #102745;
  --ribbon-line: #ccd8e8;
  --ribbon-toolbar: #f4f8fc;
  --ribbon-orange: #d86f10;
  --ribbon-orange-soft: #fff9f2;
  --sheet-top-offset: 88px;
}

.app-shell {
  grid-template-rows: 88px minmax(0, 1fr) !important;
}

.app-sidebar {
  grid-row: 1 !important;
  grid-template-columns: 176px auto minmax(112px, 1fr) !important;
  align-items: end !important;
  gap: 0 !important;
  height: 88px !important;
  min-height: 88px !important;
  padding: 0 22px !important;
  border-bottom: 0 !important;
  background: linear-gradient(105deg, var(--ribbon-blue-deep) 0%, #3277f3 58%, var(--ribbon-blue) 100%) !important;
  box-shadow: 0 5px 15px rgba(16, 39, 69, 0.13) !important;
}

.sidebar-brand {
  min-width: 0 !important;
  min-height: 88px !important;
  padding: 0 18px 0 0 !important;
}

.sidebar-brand-copy {
  gap: 10px !important;
}

.sidebar-brand-copy strong,
.sidebar-brand-copy span {
  color: #ffffff !important;
}

.sidebar-brand-copy span {
  max-width: 100px !important;
  border-left-color: rgba(255, 255, 255, 0.42) !important;
  font-size: 10px !important;
  line-height: 1.08 !important;
}

.sidebar-quick-filters,
.sidebar-filter-list,
.sidebar-nav {
  height: 88px !important;
}

.sidebar-filter-list {
  gap: 0 !important;
}

.sidebar-filter,
.app-sidebar .sidebar-link[data-main-view="staff"] {
  flex-direction: column !important;
  gap: 7px !important;
  min-width: 116px !important;
  width: 116px !important;
  min-height: 76px !important;
  height: 76px !important;
  padding: 9px 10px 10px !important;
  border: 0 !important;
  border-radius: 16px 16px 0 0 !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.94) !important;
  box-shadow: none !important;
}

.app-sidebar .sidebar-nav {
  justify-content: flex-start !important;
}

.app-sidebar .sidebar-link[data-main-view="staff"] {
  display: inline-flex !important;
}

.header-tab-icon,
.header-tab-icon.lucide {
  display: block !important;
  width: 24px !important;
  height: 24px !important;
  flex: 0 0 24px !important;
  stroke: currentColor !important;
}

.sidebar-filter-copy strong,
.app-sidebar .sidebar-link[data-main-view="staff"] span:last-child {
  font-size: 14px !important;
  font-weight: 850 !important;
  line-height: 1 !important;
}

.sidebar-filter:hover,
.app-sidebar .sidebar-link[data-main-view="staff"]:hover {
  background: rgba(255, 255, 255, 0.11) !important;
  color: #ffffff !important;
}

.sidebar-filter.active,
.app-sidebar .sidebar-link[data-main-view="staff"].active {
  background: #ffffff !important;
  color: #174a9b !important;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.5), 0 4px 12px rgba(20, 48, 96, 0.14) !important;
}

.topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 98 !important;
  grid-row: 1 !important;
  justify-self: end !important;
  width: calc(100% - 758px) !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 88px !important;
  min-height: 88px !important;
  padding: 0 28px 0 38px !important;
  border: 0 !important;
  border-bottom: 1px solid #e0e7f0 !important;
  border-radius: 0 0 0 54px !important;
  background: #ffffff !important;
  box-shadow: 0 5px 15px rgba(16, 39, 69, 0.11) !important;
}

.topbar-actions {
  gap: 10px !important;
  width: 100% !important;
  justify-content: flex-end !important;
}

.topbar .lucide,
.matrix-workbench-tools .lucide {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke: currentColor;
}

.icon-button {
  width: 46px !important;
  min-width: 46px !important;
  height: 46px !important;
  border: 1px solid var(--ribbon-line) !important;
  border-radius: 9px !important;
  color: #174a9b !important;
  box-shadow: 0 1px 2px rgba(16, 39, 69, 0.04) !important;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: #8fb1e9 !important;
  background: #f5f8ff !important;
  color: var(--ribbon-blue) !important;
}

.month-label {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 14px !important;
  min-width: 244px !important;
  min-height: 46px !important;
  padding: 0 20px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ribbon-ink) !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  box-shadow: none !important;
}

.month-label .lucide {
  width: 23px;
  height: 23px;
}

.schedule-mode-switch {
  min-height: 46px !important;
  margin-left: 6px !important;
  border: 1px solid var(--ribbon-line) !important;
  border-radius: 9px !important;
  box-shadow: 0 1px 2px rgba(16, 39, 69, 0.04) !important;
}

.schedule-mode-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-width: 96px !important;
  padding: 0 14px !important;
  border-right: 1px solid var(--ribbon-line) !important;
  background: #ffffff !important;
  color: #273d5c !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

.schedule-mode-button.active {
  background: var(--ribbon-blue) !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

.today-indicator {
  gap: 9px !important;
  min-height: 46px !important;
  margin-left: 4px !important;
  padding: 0 13px !important;
  border-color: #efbc83 !important;
  border-radius: 9px !important;
  background: var(--ribbon-orange-soft) !important;
  color: #a85608 !important;
}

.today-indicator .lucide {
  color: var(--ribbon-orange) !important;
}

.today-indicator span {
  font-size: 13px !important;
  font-weight: 900 !important;
}

.today-indicator strong {
  padding-left: 12px !important;
  font-size: 14px !important;
}

.workspace {
  grid-row: 2 !important;
}

.section-heading {
  grid-template-columns: minmax(300px, 350px) minmax(0, 1fr) !important;
  min-height: 108px !important;
  padding: 14px 24px !important;
  border-bottom: 1px solid #dfe7f0 !important;
  background: var(--ribbon-toolbar) !important;
}

.section-heading h2 {
  color: var(--ribbon-ink) !important;
  font-size: 25px !important;
}

.section-heading p {
  color: #5a6b81 !important;
}

.matrix-workbench-tools {
  gap: 10px;
}

.matrix-search {
  position: relative;
  width: 252px;
  min-width: 210px;
  flex-basis: 252px;
}

.matrix-search > .lucide {
  position: absolute;
  top: 50%;
  left: 14px;
  z-index: 1;
  color: #31557d;
  transform: translateY(-50%);
  pointer-events: none;
}

.matrix-search input {
  min-height: 46px;
  padding: 0 14px 0 43px;
  border-color: var(--ribbon-line);
  border-radius: 9px;
  font-weight: 650;
}

.turn-filter-menu summary,
.workbench-button {
  gap: 9px;
  min-height: 46px;
  padding: 0 14px;
  border-color: var(--ribbon-line);
  border-radius: 9px;
  background: #ffffff;
  color: #273d5c;
}

.turn-filter-menu summary {
  min-width: 184px;
}

.turn-filter-menu summary .summary-chevron {
  margin-left: auto;
}

.density-switch {
  min-height: 46px;
  border-color: var(--ribbon-line);
  border-radius: 9px;
}

.density-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 98px;
  padding: 0 13px;
}

.density-button.active {
  background: #ffffff !important;
  color: #1759c3 !important;
  box-shadow: inset 0 -3px 0 var(--ribbon-blue) !important;
}

.workbench-button {
  min-width: 108px;
  justify-content: center;
}

.coverage-alert-chip {
  gap: 8px;
  min-height: 46px;
  padding: 0 14px;
  border-color: #bdd0e6;
  border-radius: 9px;
  background: #eef5fc;
  color: #235f9b;
  font-size: 12px;
}

.coverage-alert-chip.has-alerts {
  border-color: #efbc83;
  background: #fff6e7;
  color: #9a510b;
}

@media (max-width: 1740px) and (min-width: 1420px) {
  .topbar {
    width: calc(100% - 694px) !important;
    padding-right: 16px !important;
    padding-left: 30px !important;
  }

  .app-sidebar {
    grid-template-columns: 150px auto minmax(104px, 1fr) !important;
    padding-left: 14px !important;
  }

  .sidebar-brand-copy span {
    display: none !important;
  }

  .sidebar-filter,
  .app-sidebar .sidebar-link[data-main-view="staff"] {
    min-width: 106px !important;
    width: 106px !important;
  }

  .month-label {
    min-width: 205px !important;
  }

  .schedule-mode-button {
    min-width: 82px !important;
    padding: 0 10px !important;
  }
}

@media (max-width: 1419px) {
  :root {
    --sheet-top-offset: 146px;
  }

  .app-shell {
    grid-template-rows: 82px 64px minmax(0, 1fr) !important;
  }

  .app-sidebar {
    grid-row: 1 !important;
    grid-template-columns: 72px auto minmax(102px, 1fr) !important;
    height: 82px !important;
    min-height: 82px !important;
    padding: 0 10px !important;
  }

  .sidebar-brand {
    min-height: 82px !important;
    padding: 0 10px 0 2px !important;
  }

  .sidebar-brand-copy {
    display: block !important;
  }

  .sidebar-brand-copy strong {
    font-size: 18px !important;
  }

  .sidebar-brand-copy span {
    display: none !important;
  }

  .sidebar-quick-filters,
  .sidebar-filter-list,
  .sidebar-nav {
    height: 82px !important;
  }

  .sidebar-filter,
  .app-sidebar .sidebar-link[data-main-view="staff"] {
    min-width: 100px !important;
    width: 100px !important;
    min-height: 70px !important;
    height: 70px !important;
  }

  .topbar {
    top: 82px !important;
    grid-row: 2 !important;
    width: 100% !important;
    height: 64px !important;
    min-height: 64px !important;
    padding: 8px 16px !important;
    border-radius: 0 !important;
    background: #ffffff !important;
  }

  .topbar-actions {
    justify-content: center !important;
  }

  .today-indicator span {
    display: inline-flex !important;
  }

  .workspace {
    grid-row: 3 !important;
  }

  .section-heading {
    grid-template-columns: 1fr !important;
    min-height: 150px !important;
    gap: 10px !important;
  }

  .matrix-workbench-tools {
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
  }

  .matrix-search {
    flex: 1 1 220px;
  }

  .turn-filter-menu summary {
    min-width: 146px;
  }

  .density-button {
    min-width: 86px;
  }
}

@media (max-width: 1080px) {
  .coverage-alert-chip,
  .inline-code-legend {
    display: none !important;
  }

  .month-label {
    min-width: 188px !important;
  }

  .schedule-mode-button {
    min-width: 74px !important;
  }
}

/* Restore the original SEA identity corner: the brand stays on its familiar
   white surface while the new blue ribbon begins with the service tabs. */
@media (min-width: 1420px) {
  .sidebar-brand {
    align-self: stretch !important;
    justify-self: start !important;
    width: calc(100% + 22px) !important;
    min-width: calc(100% + 22px) !important;
    margin-left: -22px !important;
    padding: 0 18px 0 22px !important;
    border-bottom: 1px solid #dfe6ee !important;
    background: #ffffff !important;
  }

  .sidebar-brand-copy strong {
    color: #17324d !important;
  }

  .sidebar-brand-copy span {
    display: block !important;
    color: #33475f !important;
    border-left-color: #c8d2df !important;
  }
}

@media (min-width: 1420px) and (max-width: 1740px) {
  .app-sidebar {
    grid-template-columns: 176px auto minmax(104px, 1fr) !important;
  }

  .sidebar-brand {
    width: calc(100% + 14px) !important;
    min-width: calc(100% + 14px) !important;
    margin-left: -14px !important;
    padding-left: 14px !important;
  }
}

@media (min-width: 901px) and (max-width: 1419px) {
  .app-sidebar {
    grid-template-columns: 168px auto minmax(102px, 1fr) !important;
  }

  .sidebar-brand {
    align-self: stretch !important;
    justify-self: start !important;
    width: calc(100% + 10px) !important;
    min-width: calc(100% + 10px) !important;
    margin-left: -10px !important;
    padding: 0 14px 0 10px !important;
    border-bottom: 1px solid #dfe6ee !important;
    background: #ffffff !important;
  }

  .sidebar-brand-copy {
    display: grid !important;
    grid-template-columns: auto auto !important;
    gap: 9px !important;
  }

  .sidebar-brand-copy strong {
    color: #17324d !important;
    font-size: 20px !important;
  }

  .sidebar-brand-copy span {
    display: block !important;
    max-width: 92px !important;
    padding-left: 9px !important;
    border-left-color: #c8d2df !important;
    color: #33475f !important;
    font-size: 9px !important;
    line-height: 1.06 !important;
  }
}

/* User-directed single-row desktop header. The proportional grid keeps the
   SEA identity, four service tabs and month controls in distinct zones while
   preserving both month navigation directions. */
@media (min-width: 1420px) {
  :root {
    --header-brand-width: clamp(176px, 12.6vw, 252px);
    --header-tab-width: clamp(104px, 8.45vw, 170px);
    --header-nav-zone: clamp(592px, 46.4vw, 930px);
  }

  .app-sidebar {
    grid-template-columns: var(--header-brand-width) auto minmax(var(--header-tab-width), 1fr) !important;
    gap: 0 !important;
    padding: 0 !important;
  }

  .app-sidebar > .sidebar-brand {
    justify-self: stretch !important;
    width: var(--header-brand-width) !important;
    min-width: var(--header-brand-width) !important;
    margin-left: 0 !important;
    padding: 0 20px !important;
    border-right: 1px solid #dce4ed !important;
  }

  .sidebar-brand-copy {
    width: 100% !important;
    justify-content: center !important;
  }

  .sidebar-brand-copy strong {
    font-size: clamp(22px, 1.55vw, 29px) !important;
  }

  .sidebar-brand-copy span {
    max-width: 108px !important;
    font-size: clamp(9px, 0.62vw, 11px) !important;
  }

  .sidebar-quick-filters {
    padding-right: 0 !important;
  }

  .sidebar-filter,
  .app-sidebar .sidebar-link[data-main-view="staff"] {
    min-width: var(--header-tab-width) !important;
    width: var(--header-tab-width) !important;
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  .sidebar-filter.active,
  .app-sidebar .sidebar-link[data-main-view="staff"].active {
    border: 1px solid #9fbfff !important;
    border-bottom: 0 !important;
    box-shadow: 0 3px 12px rgba(22, 70, 150, 0.13), inset 0 0 0 1px #d8e5ff !important;
  }

  .app-sidebar .sidebar-nav {
    justify-content: flex-start !important;
  }

  .topbar {
    width: calc(100% - var(--header-nav-zone)) !important;
    min-width: 0 !important;
    padding-right: clamp(14px, 1.35vw, 28px) !important;
    padding-left: clamp(20px, 1.8vw, 38px) !important;
    border-radius: 0 0 0 32px !important;
  }

  .topbar-actions {
    justify-content: center !important;
    gap: clamp(6px, 0.55vw, 11px) !important;
  }

  .icon-button {
    width: clamp(42px, 2.8vw, 56px) !important;
    min-width: clamp(42px, 2.8vw, 56px) !important;
  }

  .month-label {
    min-width: clamp(190px, 12vw, 250px) !important;
    padding-right: clamp(10px, 1vw, 20px) !important;
    padding-left: clamp(10px, 1vw, 20px) !important;
  }

  .schedule-mode-switch {
    margin-left: 2px !important;
  }

  .schedule-mode-button {
    min-width: clamp(70px, 5.5vw, 112px) !important;
    padding-right: clamp(8px, 0.7vw, 14px) !important;
    padding-left: clamp(8px, 0.7vw, 14px) !important;
  }

  .today-indicator {
    min-width: clamp(150px, 11vw, 230px) !important;
    justify-content: center !important;
  }
}

/* Keep the same one-line composition at the lower desktop edge without
   sacrificing either month arrow or the Today context. */
@media (min-width: 1420px) and (max-width: 1599px) {
  .topbar {
    padding-right: 12px !important;
    padding-left: 18px !important;
  }

  .topbar-actions {
    gap: 4px !important;
  }

  .month-label {
    min-width: 178px !important;
  }

  .schedule-mode-button {
    width: 78px !important;
    min-width: 78px !important;
    gap: 4px !important;
    padding-right: 6px !important;
    padding-left: 6px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  .schedule-mode-button .lucide {
    width: 14px !important;
    height: 14px !important;
  }

  .today-indicator {
    width: 174px !important;
    min-width: 174px !important;
    padding-right: 10px !important;
    padding-left: 10px !important;
  }
}

/* Contextual programming dialog: the employee identity and safe actions lead
   the task; the complete form remains available for exceptional cases. */
.exception-modal {
  width: min(820px, 100%);
}

.modal-backdrop {
  z-index: 200;
}

.exception-identity {
  display: grid;
  gap: 5px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid #dbe4ef;
  background: linear-gradient(135deg, #f7fbff 0%, #eef6ff 100%);
}

.exception-employee-name {
  color: #112c4a;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 950;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.exception-identity .modal-context {
  padding: 0;
  border: 0;
  background: transparent;
  color: #53657a;
  font-size: 13px;
  line-height: 1.45;
}

.quick-shift-panel {
  display: grid;
  gap: 12px;
  padding: 18px 20px 20px;
  border-bottom: 1px solid #dbe4ef;
  background: #ffffff;
}

.quick-shift-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.quick-shift-heading h3 {
  margin: 3px 0 0;
  color: #172b43;
  font-size: 18px;
  line-height: 1.2;
}

.quick-shift-context {
  max-width: 360px;
  color: #5c6d80;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
  text-align: right;
}

.quick-shift-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-shift-button {
  display: grid;
  gap: 4px;
  min-height: 112px;
  padding: 14px 15px;
  border: 1px solid #b9cce1;
  border-radius: 12px;
  background: #f8fbff;
  color: #17324d;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.quick-shift-button:hover,
.quick-shift-button:focus-visible {
  border-color: #2f6fca;
  background: #f1f7ff;
  box-shadow: 0 8px 20px rgba(34, 82, 138, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.quick-shift-button.is-selected {
  border-color: #245ea8;
  background: #e8f2ff;
  box-shadow: inset 0 0 0 1px #245ea8;
}

.quick-shift-rank {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: #dcecff;
  color: #235d9f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.quick-shift-button strong {
  font-size: 16px;
  line-height: 1.2;
}

.quick-shift-button small {
  color: #5c6d80;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.quick-shift-empty {
  display: grid;
  grid-column: 1 / -1;
  gap: 3px;
  margin: 0;
  padding: 13px 14px;
  border: 1px dashed #b8c7d8;
  border-radius: 10px;
  background: #f8fafc;
  color: #52657b;
}

.quick-shift-empty strong {
  color: #283e56;
}

.exception-detail-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px 0;
  color: #263d56;
}

.exception-detail-heading strong {
  font-size: 15px;
}

.exception-detail-heading span {
  color: #6a7b8e;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.dialog-compatibility {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d7e0ea;
  border-radius: 9px;
  background: #f8fafc;
  color: #53657a;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.dialog-compatibility.is-valid {
  border-color: #a8d5bc;
  background: #f0faf4;
  color: #16613a;
}

.dialog-compatibility.is-warning {
  border-color: #efc9a1;
  background: #fff8ed;
  color: #8a4712;
}

#submitExceptionDialog:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 700px) {
  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .exception-modal {
    width: 100%;
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  .exception-identity,
  .quick-shift-panel {
    padding-right: 16px;
    padding-left: 16px;
  }

  .exception-employee-name {
    font-size: 27px;
  }

  .quick-shift-heading,
  .exception-detail-heading {
    display: grid;
    align-items: start;
  }

  .quick-shift-context,
  .exception-detail-heading span {
    max-width: none;
    text-align: left;
  }

  .quick-shift-actions {
    grid-template-columns: 1fr;
  }

  .quick-shift-button {
    min-height: 98px;
  }

  .exception-detail-heading {
    padding-right: 16px;
    padding-left: 16px;
  }

  .exception-form {
    padding-right: 16px;
    padding-left: 16px;
  }
}
