/*
 * Workshop Roster Manager styles
 * ------------------------------
 * The stylesheet is grouped by component so future edits have a clear home.
 */

/* Sign-in and role-aware controls. API permissions are enforced on the server. */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 390px; padding: 32px; background: white; border: 1px solid #d4dce5; border-radius: 10px; }
.login-card h1 { font-size: 23px; margin: 0 0 8px; color: #17365d; }
.login-card form { display: grid; gap: 12px; margin-top: 24px; }
.login-card .username-login { margin-top: 16px; width: 100%; }
.login-card .username-login > summary { width: fit-content; list-style: none; cursor: pointer; }
.login-card .username-login > summary::-webkit-details-marker { display: none; }
.login-card .username-login > summary span { display: inline-block; }
.login-card .username-login[open] > summary span { transform: rotate(90deg); }
.login-card input { width: 100%; }
.login-card button { margin-top: 8px; width: 100%; }
.login-error { color: #b42318; }
.account-controls { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.account-controls form { margin: 0; }
.account-controls a { color: inherit; }
body[data-can-edit="false"] [data-requires="edit"],
body[data-can-edit="false"] [data-coverage-action],
body[data-can-edit="false"] #mandatoryCoverageRosterList,
body[data-can-edit="false"] .modal-overlay:not(#dayOverviewModal),
body[data-can-edit="false"] #dashboardTabDialog { display: none !important; }
body[data-can-edit="false"] .roster-cell { cursor: default; }

/* Base theme tokens used across the app. */
:root {
  --brand: #17365d;
  --brand-dark: #0f2948;
  --accent: #0f766e;
  --surface: #ffffff;
  --page: #f4f6f8;
  --panel: #eef3f8;
  --line: #d4dce5;
  --text: #1f2933;
  --muted: #52606d;
  --danger: #b42318;
  --danger-bg: #fff5f5;
  --success: #166534;
  --success-bg: #f0fdf4;
  --warning: #92400e;
  --warning-bg: #fff7ed;
  --radius: 8px;
  --shadow: 0 12px 35px rgba(15, 41, 72, 0.18);
}

/* Global reset and typography. */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: Arial, sans-serif;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* Page shell. */
header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 40px;
  color: #ffffff;
  background: var(--brand);
}

header h1 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 2vw, 2.1rem);
}

header p {
  margin: 0;
  opacity: 0.88;
}

.storage-status {
  align-self: center;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.storage-status.status-database {
  background: rgba(20, 184, 166, 0.18);
}

.storage-status.status-local {
  background: rgba(251, 191, 36, 0.18);
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

main {
  width: min(1600px, 100%);
  margin: 32px auto;
  padding: 0 24px 40px;
}

.app-page,
.roster-config-page {
  display: none;
}

.app-page.active-page,
.roster-config-page.active-config-page {
  display: block;
}

/* Headings and page-level panels. */
.dashboard-header,
.employee-page-header,
.roster-section-heading,
.modal-header,
.available-people-header,
.coverage-report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.dashboard-header {
  margin-bottom: 28px;
}

.employee-page-header {
  margin-bottom: 20px;
}

.config-page-header {
  margin-top: 4px;
}

.dashboard-header h2,
.employee-page-header h2,
.employee-page-header h3,
.roster-section-heading h3,
.coverage-report-heading h3,
.available-people-header h3,
.modal-header h3 {
  margin: 0 0 8px;
}

.dashboard-header p,
.employee-page-header p,
.roster-section-heading p,
.coverage-report-heading p,
.available-people-header p,
.modal-header p {
  margin: 0;
  color: var(--muted);
}

/* Buttons and form controls. */
button {
  min-height: 42px;
  padding: 10px 16px;
  color: #ffffff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.nav-button,
.secondary-button {
  color: var(--brand);
  background: #e6edf5;
  border-color: #b8c4d1;
}

.nav-button {
  min-height: 38px;
  padding: 8px 15px;
}

.nav-button.active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.secondary-button:hover,
.nav-button:hover {
  color: var(--brand);
  background: #dce7f2;
}

.roster-view-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.roster-view-button {
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 0;
}

.roster-view-button:hover {
  color: var(--brand);
  background: var(--panel);
}

.roster-view-button.active {
  color: var(--brand);
  border-bottom: 3px solid var(--brand);
}

.controls,
.employee-tools {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.control-group[hidden] {
  display: none;
}

.control-label {
  font-size: 14px;
  font-weight: 700;
}

.roster-filter-group {
  width: 100%;
}

.roster-filter-group > summary {
  cursor: pointer;
  padding: 10px 0;
}

.roster-filter-group[open] > summary {
  margin-bottom: 7px;
}

.roster-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.roster-filter-option {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  cursor: pointer;
}

.roster-filter-option:has(input:checked) {
  color: var(--brand);
  border-color: var(--brand);
  background: #e7eef7;
}

.roster-filter-option input[type="checkbox"] {
  flex: 0 0 16px;
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
}

label {
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 210px;
  padding: 10px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid #b8c4d1;
  border-radius: 5px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  outline: 2px solid #8eb7e3;
}

input[type="color"] {
  height: 42px;
  min-width: 100%;
  padding: 3px;
  cursor: pointer;
}

.employee-search-group {
  flex: 1 1 320px;
}

.employee-search-group input {
  min-width: 0;
}

.employee-count {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

/* Roster calendar. */
.roster-card,
.coverage-report-card,
.available-people-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.roster-card {
  padding: 24px;
}

.roster-section-heading {
  margin-bottom: 18px;
}

.week-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.roster-table-wrapper,
.employee-table-wrapper,
.available-people-table-wrap {
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.available-shifts-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.available-shifts-table th,
.available-shifts-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #dbe2ea;
  vertical-align: middle;
}

.available-shifts-table th {
  background: #f1f5f9;
  white-space: nowrap;
}

.roster-table {
  width: 100%;
  min-width: 1750px;
  border-collapse: collapse;
  font-size: 13px;
}

.roster-table th,
.roster-table td {
  padding: 9px 7px;
  text-align: center;
  white-space: nowrap;
  border: 1px solid var(--line);
}

.roster-table th,
.employee-table th,
.available-people-table th {
  color: #ffffff;
  background: var(--brand);
  font-weight: 700;
}

.table-sort-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.table-sort-button:hover,
.table-sort-button:focus-visible {
  text-decoration: underline;
}

.sort-indicator {
  display: inline-block;
  min-width: 0.8em;
  margin-left: 0.25rem;
}

.roster-table th span,
.roster-table th small {
  display: block;
}

.roster-table th small {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.85;
}

.roster-table th .sort-indicator {
  display: inline-block;
}

.roster-table .table-sort-button {
  width: 100%;
}

.roster-table th[data-date] {
  position: relative;
}

.day-overview-trigger {
  cursor: pointer;
}

.day-overview-trigger:hover,
.day-overview-trigger:focus-visible {
  background: #475569;
  outline: 3px solid #94a3b8;
  outline-offset: -3px;
  border-radius: 6px;
}

.roster-table td:first-child,
.roster-table td:nth-child(2),
.roster-table td:nth-child(3) {
  text-align: left;
}

.roster-table th:nth-child(1),
.roster-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 190px;
  min-width: 190px;
}

.roster-table th:nth-child(2),
.roster-table td:nth-child(2) {
  position: sticky;
  left: 190px;
  z-index: 3;
  width: 80px;
  min-width: 80px;
}

.roster-table th:nth-child(3),
.roster-table td:nth-child(3) {
  position: sticky;
  left: 270px;
  z-index: 3;
  width: 135px;
  min-width: 135px;
  box-shadow: 3px 0 8px rgba(23, 54, 93, 0.16);
}

.roster-table td:nth-child(1),
.roster-table td:nth-child(2),
.roster-table td:nth-child(3) {
  background: #ffffff;
}

.roster-table th:nth-child(1),
.roster-table th:nth-child(2),
.roster-table th:nth-child(3) {
  z-index: 7;
  background: var(--brand);
}

.roster-table:not(.overtime-calendar-table) tbody tr:hover,
.employee-table tbody tr:hover {
  background: #f3f7fb;
}

.roster-shift-cell {
  min-width: 90px;
  color: #172b4d;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.roster-shift-cell:hover,
.overtime-calendar-cell[data-overtime-cell]:hover,
.overtime-calendar-cell[data-overtime-cell]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.today-column {
  box-shadow: inset 0 3px 0 var(--accent);
}

.roster-table td.today-column {
  box-shadow: inset 2px 0 0 rgba(15, 118, 110, 0.3), inset -2px 0 0 rgba(15, 118, 110, 0.3);
}

.coverage-gap-day {
  position: relative;
  box-shadow: inset 0 -4px 0 #dc2626;
}

.coverage-gap-day::after {
  content: "*";
  position: absolute;
  top: 3px;
  left: 6px;
  color: #fecaca;
  font-size: 17px;
  font-weight: 900;
}

.public-holiday-day {
  position: relative;
  background: #6d28d9 !important;
}

.public-holiday-name {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.2;
}

.roster-table td.public-holiday-cell {
  background-color: #ede9fe !important;
  color: #4c1d95;
}

/* Admin tables. */
.employee-table,
.available-people-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.employee-table th,
.employee-table td,
.available-people-table th,
.available-people-table td {
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.employee-actions {
  white-space: nowrap;
}

.employee-actions > button + button {
  margin-left: 6px;
}

.edit-button,
.delete-button,
.find-available-button,
.assign-cover-button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 13px;
}

.edit-button {
  color: var(--brand);
  background: transparent;
  border-color: transparent;
}

.edit-button:hover {
  color: var(--brand);
  background: #e6edf5;
  border-color: #e6edf5;
}

.delete-button {
  color: var(--danger);
  background: transparent;
  border-color: transparent;
}

.delete-button:hover {
  color: var(--danger);
  background: #fef0ef;
  border-color: #fef0ef;
}

.empty-state {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.status-badge {
  display: inline-block;
  min-width: 70px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.status-active {
  color: #176b3a;
  background: #dff6e8;
}

.status-inactive {
  color: var(--muted);
  background: #eceff2;
}

.pattern-colour-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
}

.pattern-colour-square {
  width: 22px;
  height: 22px;
  border: 1px solid #8292a5;
  border-radius: 4px;
}

/* Roster setup tabs and sequence builder. */
.roster-config-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.roster-config-button {
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 0;
  white-space: nowrap;
}

.roster-config-button:hover {
  color: var(--brand);
  background: var(--panel);
}

.roster-config-button.active {
  color: var(--brand);
  border-bottom: 3px solid var(--brand);
}

.sequence-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.sequence-heading h4 {
  margin: 0 0 5px;
}

.sequence-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sequence-builder {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sequence-day {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sequence-day label {
  font-size: 12px;
}

.sequence-day select {
  min-width: 0;
}

.sequence-builder.rotative-sequence-builder {
  display: block;
  max-height: 58vh;
  overflow: auto;
  padding: 16px;
}

.rotative-reference-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  color: var(--brand);
  background: #e8f1fb;
  border: 1px solid #b8cde4;
  border-radius: var(--radius);
  font-size: 13px;
}

.rotative-line-card {
  margin: 0 0 16px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
}

.rotative-line-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--brand);
}

.rotative-line-heading span {
  font-size: 12px;
  opacity: 0.9;
}

.rotative-line-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
}

.rotative-line-days {
  display: grid;
  grid-template-columns: repeat(14, minmax(130px, 1fr));
  gap: 8px;
  min-width: 1960px;
  padding: 12px;
  background: var(--panel);
}

.rotative-sequence-day label {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--brand);
}

.rotative-sequence-day label small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

/* Modal layout. */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 24px;
  background: rgba(15, 41, 72, 0.45);
}

.modal-overlay.show-modal {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.modal-wide {
  max-width: 850px;
}

.modal-header {
  align-items: flex-start;
  margin-bottom: 22px;
}

.close-modal-button {
  min-width: 36px;
  padding: 0 6px;
  color: var(--brand);
  background: transparent;
  border-color: transparent;
  font-size: 30px;
  line-height: 1;
}

.close-modal-button:hover {
  color: var(--brand);
  background: #e6edf5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.full-width-field {
  grid-column: 1 / -1;
}

.checkbox-field {
  justify-content: flex-start;
  gap: 6px;
  padding: 8px 0;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
}

.checkbox-field small,
.form-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.form-hint {
  margin: 14px 0 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.planned-shift-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Day overview modal. */
.day-overview-section + .day-overview-section {
  margin-top: 24px;
}

.day-overview-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.day-overview-section-heading h4 {
  margin: 0;
  color: var(--brand);
  font-size: 17px;
}

.day-overview-count {
  padding: 4px 9px;
  color: var(--brand);
  background: var(--panel);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.day-overview-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.day-overview-table {
  width: 100%;
  border-collapse: collapse;
}

.day-overview-table th,
.day-overview-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.day-overview-table th {
  color: #ffffff;
  background: var(--brand);
  font-size: 12px;
}

.day-overview-table tr:last-child td {
  border-bottom: 0;
}

.day-overview-assignment {
  margin-top: 16px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.day-overview-assignment h5 {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 15px;
}

.day-overview-publish-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
}

.day-overview-publish-controls .form-hint {
  grid-column: 1 / -1;
}

.day-overview-publish-controls input {
  min-width: 0;
  width: 100%;
}

.day-overview-assignment-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
}

.day-overview-assignment-controls > * {
  grid-column: span 2;
}

.day-overview-assignment-controls > .control-group:nth-child(-n + 2) {
  grid-column: span 3;
}

.day-overview-assignment-controls .control-group,
.day-overview-assignment-controls input,
.day-overview-assignment-controls select {
  min-width: 0;
}

.day-overview-assignment-controls button {
  white-space: nowrap;
}

.day-overview-empty,
.day-overview-ok,
.day-overview-problem-summary,
.day-overview-gap {
  margin: 0;
  padding: 14px;
  border-radius: var(--radius);
}

.day-overview-empty {
  color: var(--muted);
  background: var(--panel);
}

.day-overview-ok {
  display: grid;
  gap: 3px;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
}

.day-overview-problem-summary {
  display: grid;
  gap: 3px;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

.day-overview-gap-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.day-overview-gap {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 4px 16px;
  background: #fff7ed;
  border: 1px solid #fdba74;
}

.day-overview-gap small {
  grid-column: 2;
  color: var(--muted);
}

.planned-shift-summary div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.planned-shift-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.planned-shift-summary strong {
  font-size: 14px;
}

.cell-adjustments-panel {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.cell-adjustments-header,
.cell-adjustment-row,
.cell-adjustment-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cell-adjustments-header {
  justify-content: space-between;
  align-items: flex-start;
}

.cell-adjustments-header h4,
.cell-adjustment-form-title {
  margin: 0;
}

.cell-adjustments-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.cell-adjustment-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.cell-adjustment-row {
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid #dbe3ec;
  border-radius: 9px;
  background: white;
}

.cell-adjustment-summary strong,
.cell-adjustment-summary span {
  display: block;
}

.cell-adjustment-summary span,
.cell-adjustment-empty {
  color: var(--muted);
  font-size: 12px;
}

.cell-adjustment-actions button {
  padding: 6px 10px;
}

.cell-adjustment-form-title {
  margin-bottom: 12px;
}

/* Cell action colours. */
.cell-action-label {
  display: block;
  margin-bottom: 4px;
  color: #172b4d;
  font-size: 10px;
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.cell-action-subtext {
  display: block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
}

.cell-leave {
  color: #991b1b;
  background: #fee2e2 !important;
}

/* Timed leave keeps the planned shift colour visible, with a red segment sized
   to the unavailable portion of that shift. This prevents partial leave from
   looking like a full-day absence in the compact roster grid. */
.cell-partial-leave {
  color: #7f1d1d;
  background: linear-gradient(
    to right,
    var(--planned-shift-colour) 0,
    var(--planned-shift-colour) var(--partial-leave-start),
    #fecaca var(--partial-leave-start),
    #fecaca var(--partial-leave-end),
    var(--planned-shift-colour) var(--partial-leave-end),
    var(--planned-shift-colour) 100%
  ) !important;
  box-shadow: inset 0 0 0 1px rgb(153 27 27 / 18%);
}

.cell-partial-leave .cell-action-label,
.cell-partial-leave .cell-action-subtext {
  text-shadow: 0 1px rgb(255 255 255 / 65%);
}

.cell-off {
  color: #374151;
  background: #e5e7eb !important;
}

.cell-training {
  color: var(--warning);
  background: #fef3c7 !important;
}

.cell-override {
  color: #1e3a8a;
  background: #dbeafe !important;
}

.cell-extra {
  color: #075985;
  background: #cffafe !important;
}

.cell-availability {
  color: var(--success);
  background: #dcfce7 !important;
}

.cell-restricted {
  color: #9a3412;
  background: #ffedd5 !important;
}

.cell-unavailable {
  color: #6b21a8;
  background: #f3e8ff !important;
}

.modal-actions [hidden] {
  display: none !important;
}

/* Coverage reporting. */
.coverage-explainer,
.coverage-report-toolbar {
  margin-bottom: 20px;
  padding: 15px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.coverage-report-toolbar strong {
  color: var(--brand);
  font-size: 17px;
}

.payroll-export-toolbar {
  flex-wrap: wrap;
}

.standalone-tool-card {
  margin-top: 18px;
}

.payroll-export-controls {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 14px;
}

.payroll-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.payroll-export-controls .control-group {
  min-width: 0;
}

.payroll-export-controls select,
.payroll-export-controls input[type="date"] {
  min-width: 240px;
}

.transition-current-roster {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.transition-current-roster span,
.transition-history-row small,
.transition-history-empty {
  color: var(--muted);
}

.transition-history-section {
  margin-top: 20px;
}

.transition-history-section h4 {
  margin: 0 0 10px;
}

.transition-history-list {
  display: grid;
  gap: 8px;
}

.transition-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.transition-history-row strong,
.transition-history-row small {
  display: block;
}

.employee-transition-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  white-space: normal;
}

.public-holiday-form {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.public-holiday-form .control-group {
  min-width: 0;
}

.public-holiday-form input[type="date"] {
  min-width: 160px;
}

.public-holiday-form input[type="text"] {
  min-width: 220px;
}

.public-holiday-form input[type="time"] {
  min-width: 125px;
}

.public-holiday-form input[type="time"]:disabled {
  color: var(--muted);
  background: #e5e7eb;
  border-color: var(--line);
  cursor: not-allowed;
}

.public-holiday-form .control-group:has(input[type="time"]:disabled) label {
  color: var(--muted);
}

.coverage-report-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.coverage-gap-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.coverage-stat-card {
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.coverage-stat-card span,
.coverage-number span,
.availability-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.coverage-stat-card strong {
  display: block;
  margin-top: 7px;
  color: var(--brand);
  font-size: 28px;
}

.coverage-stat-card.danger {
  background: var(--danger-bg);
  border-color: #fecaca;
}

.coverage-stat-card.danger strong {
  color: #b91c1c;
}

.coverage-report-card {
  padding: 22px;
}

.mandatory-coverage-roster-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.mandatory-coverage-roster-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.mandatory-coverage-roster-row input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin-top: 2px;
  padding: 0;
}

.mandatory-coverage-roster-row strong {
  display: block;
  color: var(--brand);
  font-size: 14px;
}

.mandatory-coverage-roster-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.coverage-report-heading {
  margin-bottom: 18px;
}

.coverage-gap-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.coverage-day-title {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 15px;
}

.coverage-day-status {
  margin-left: 8px;
  color: #b91c1c;
  font-size: 12px;
}

.coverage-gap-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.3fr) minmax(150px, 1fr) minmax(220px, 1.4fr) minmax(88px, 0.5fr) minmax(165px, 0.8fr);
  gap: 14px;
  align-items: center;
  padding: 15px 16px;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-left: 6px solid #dc2626;
  border-radius: var(--radius);
}

.coverage-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.coverage-category {
  padding: 4px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #fecaca;
  color: #7f1d1d;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.coverage-category span {
  margin-right: 5px;
  text-transform: uppercase;
  font-size: 10px;
  opacity: 0.8;
}

.coverage-category.short {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.coverage-date,
.coverage-window,
.coverage-number strong {
  color: #7f1d1d;
  font-weight: 800;
}

.coverage-time-note {
  margin-top: 3px;
  color: #991b1b;
  font-size: 11px;
  font-weight: 500;
}

.coverage-number strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.coverage-no-gaps {
  padding: 34px;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  text-align: center;
  font-weight: 700;
}

.find-available-button {
  color: #991b1b;
  background: #ffffff;
  border-color: #fca5a5;
  white-space: nowrap;
}

.find-available-button:hover {
  color: #991b1b;
  background: #fee2e2;
}

/* Available people report. */
.available-people-section {
  margin-top: 24px;
  padding: 22px;
}

.available-people-header {
  align-items: flex-start;
  margin-bottom: 16px;
}

.available-people-header h3 {
  color: var(--brand);
}

.available-people-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.availability-stat {
  padding: 13px 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.availability-stat strong {
  display: block;
  margin-top: 5px;
  color: var(--brand);
  font-size: 20px;
}

.available-people-table {
  min-width: 920px;
}

.available-people-table tr.not-available {
  background: #fff8f8;
}

.available-people-table tr.warning {
  background: #fffaf0;
}

.availability-status {
  display: inline-block;
  max-width: 270px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.availability-status.available {
  color: var(--success);
  background: #dcfce7;
}

.availability-status.warning {
  color: var(--warning);
  background: #fef3c7;
}

.availability-status.not-available {
  color: #991b1b;
  background: #fee2e2;
}

.assign-cover-button {
  color: #ffffff;
  background: var(--brand);
}

.assignment-blocked {
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

.row-warning {
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
}

/* Tablet layout. */
@media (max-width: 900px) {
  header,
  .dashboard-header,
  .employee-page-header,
  .roster-section-heading,
  .coverage-report-toolbar,
  .available-people-header,
  .sequence-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  header {
    padding: 22px 24px;
  }

  .main-nav {
    padding: 12px 24px;
  }

  main {
    margin-top: 24px;
    padding: 0 18px 32px;
  }

  .coverage-gap-panel,
  .available-people-summary {
    grid-template-columns: 1fr;
  }

  .coverage-gap-row {
    grid-template-columns: 1fr 1fr;
  }

  .planned-shift-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#rosterFilters[hidden],
#mobileRosterTools[hidden],
#rosterTableWrapper[hidden],
#personalRosterViewControl[hidden],
#personalRoster[hidden] {
  display: none;
}

.personal-roster {
  display: grid;
  gap: 16px;
  align-items: start;
}

.personal-roster-table,
.personal-month-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.personal-roster-table td,
.personal-month-table td {
  border: 1px solid var(--line);
  padding: 0;
  vertical-align: top;
}

.personal-roster-table caption {
  padding: 0 0 8px;
  color: var(--brand);
  text-align: center;
  font-weight: 700;
}

.personal-roster-day {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.personal-roster-day time {
  display: block;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
}

.personal-roster-shift {
  display: block;
  padding: 12px 8px;
}

.personal-roster-day[aria-current="date"] {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

button.personal-roster-day:hover,
button.personal-roster-day:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  color: var(--text);
  background: transparent;
}

.personal-roster-view-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.personal-roster-view-control select { width: auto; }
.personal-month-wrapper { grid-column: 1 / -1; min-width: 0; }
.personal-month-table th {
  width: calc(100% / 7);
  padding: 10px 4px;
  text-align: center;
  background: var(--brand);
  color: #fff;
}
.personal-month-table .personal-roster-day { min-height: 110px; }
.personal-month-table .personal-roster-day time {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.personal-month-table .personal-roster-shift { padding: 10px 5px; }
.personal-month-empty { background: #f3f5f7; }
.personal-month-today { font-size: 10px; color: var(--brand); }
.personal-month-table .cell-action-subtext { white-space: normal; }

@media (max-width: 640px) {
  .personal-month-table th { padding: 8px 1px; font-size: 10px; }
  .personal-month-table .personal-roster-day { min-height: 90px; font-size: 10px; }
  .personal-month-table .personal-roster-day time { padding: 6px 3px; }
  .personal-month-table .personal-roster-shift { padding: 7px 2px; }
  .personal-month-table .cell-action-label,
  .personal-month-table .cell-action-subtext,
  .personal-month-table .public-holiday-name { font-size: 9px; }
  .personal-month-today { font-size: 8px; }
  .week-controls:has(#personalRosterViewControl:not([hidden])) {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
  }
  .week-controls:has(#personalRosterViewControl:not([hidden])) .personal-roster-view-control {
    grid-column: 1 / -1;
  }
  .week-controls:has(#personalRosterViewControl:not([hidden])) button {
    padding: 9px 4px;
    font-size: 11px;
    white-space: normal;
  }
  .week-controls:has(#personalRosterViewControl:not([hidden])) strong { font-size: 12px; }
  .personal-month-table .cell-action-label { font-size: 8px; }
}

@media (max-width: 900px) {
  .personal-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .personal-roster-table tbody,
  .personal-roster-table tr,
  .personal-roster-table td {
    display: block;
  }

  .personal-roster-table td + td {
    border-top: 0;
  }
}

/* Size the roster against its available space, including after window resizing. */
  #rosterTableWrapper {
    max-width: 100%;
    min-width: 0;
    container-type: inline-size;
  }

/* Compact roster layout on every screen size. */
  .mobile-roster-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  .mobile-roster-tools select {
    flex: 1;
    min-width: 0;
  }

  .mobile-roster-tools p {
    flex-basis: 100%;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
  }

  .roster-table {
    table-layout: fixed;
    width: 100%;
    min-width: 980px;
    font-size: clamp(10px, 1cqw, 13px);
  }

  .roster-table th,
  .roster-table td {
    padding: 9px clamp(3px, 0.5cqw, 7px);
  }

  .roster-table .roster-shift-cell,
  .roster-table th small {
    min-width: 0;
    font-size: clamp(10px, 0.9cqw, 12px);
  }

  .roster-table th:nth-child(1),
  .roster-table td:nth-child(1) {
    width: clamp(112px, 10cqw, 160px);
    min-width: 112px;
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: 3px 0 8px rgba(23, 54, 93, 0.16);
  }

  .roster-table th:nth-child(2),
  .roster-table td:nth-child(2),
  .roster-table th:nth-child(3),
  .roster-table td:nth-child(3) {
    display: none;
  }

  .mobile-roster-details,
  .mobile-roster-details > span {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 400;
    color: var(--muted);
  }

  .roster-table th[data-date],
  .roster-table .roster-shift-cell {
    white-space: normal;
    overflow-wrap: anywhere;
  }

/* Phone layout. */
@media (max-width: 640px) {
  .day-overview-publish-controls,
  .day-overview-assignment-controls {
    grid-template-columns: 1fr;
  }

  .day-overview-assignment-controls > *,
  .day-overview-assignment-controls > .control-group:nth-child(-n + 2) {
    grid-column: auto;
  }

  header {
    padding: 20px;
  }

  .main-nav {
    padding: 10px 20px;
  }

  .main-nav .nav-button {
    flex: 1 1 calc(50% - 10px);
  }

  main {
    padding: 0 12px 28px;
  }

  .controls,
  .employee-tools,
  .roster-card,
  .coverage-report-card,
  .available-people-section {
    padding: 16px;
  }

  .week-controls,
  .modal-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .week-controls strong {
    text-align: center;
  }

  .form-grid,
  .planned-shift-summary {
    grid-template-columns: 1fr;
  }

  .full-width-field {
    grid-column: auto;
  }

  input,
  select,
  textarea {
    min-width: 0;
  }

  .coverage-gap-row {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-content {
    padding: 18px;
  }
}

.dashboard-tab-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
#dashboardTabDialog, #overtimeRejectionDialog { width: min(560px, 90vw); max-height: 85vh; overflow: auto; border: 0; border-radius: 12px; padding: 24px; color: #17233b; }
#dashboardTabDialog::backdrop, #overtimeRejectionDialog::backdrop { background: rgb(15 23 42 / 50%); }
#dashboardTabDialog .control-group { margin-bottom: 14px; }
.overtime-calendar-cell[data-overtime-cell] { cursor: pointer; }
#dashboardTabPeople { max-height: 320px; overflow: auto; border: 1px solid #dbe2ea; border-radius: 8px; }
.dashboard-person { display: flex; align-items: center; gap: 10px; padding: 8px; }
.dashboard-person[hidden] { display: none; }
.dashboard-person input { width: auto; flex: 0 0 auto; }
.dashboard-person small { display: block; color: #526174; }
#dashboardTabError { color: #b91c1c; }

body[data-connected="false"] main, body[data-connected="false"] .main-nav { display: none !important; }

 .payroll-frequency-section > summary { cursor: pointer; font-size: 1.1rem; font-weight: 700; }
.payroll-frequency-section[open] > summary { margin-bottom: 1rem; }
.payroll-classifications { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1.25rem; }
.payroll-classification { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem; border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; }
.payroll-classification > span { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.payroll-classification small { display: block; font-weight: 400; color: #475569; }
.payroll-classification:focus-within { border-color: #2563eb; background: #eff6ff; }
.payroll-classification select { width: auto; min-width: 9rem; flex-shrink: 0; }
@media (max-width: 700px) {
  .payroll-classifications { grid-template-columns: 1fr; }
}

.payroll-export-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.payroll-period-card { display: flex; flex-direction: column; gap: 1rem; }
.payroll-period-card h3 { margin: 0; }
.payroll-period-card .payroll-export-actions { margin-top: auto; }
.payroll-filter-controls { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.payroll-filter-controls label { display: grid; gap: 0.4rem; }
.payroll-classification { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.pay-frequency-save-status { grid-column: 1 / -1; }
.pay-frequency-save-status:empty { display: none; }
@media (max-width: 700px) { .payroll-export-grid { grid-template-columns: 1fr; } }

/* Compact shift cards keep signup details in the same page at every width. */
.menu-toggle, .menu-close, .menu-backdrop { display: none; }
#shiftBiddingPage .employee-page-header h2 { margin: 0; }
#shiftBiddingPage button { min-height: 44px; font-size: 16px; }
#shiftBiddingPage button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
#shiftBiddingPage p[role="status"] { margin: 0 0 20px; color: var(--muted); }
#shiftBiddingPage p[role="status"]:empty { display: none; }
.published-shifts-panel > h3 { margin: 0 0 18px; }
#shiftBiddingPage .roster-table-wrapper { overflow: visible; border: 0; border-radius: 0; background: transparent; }
#shiftBiddingPage .available-shifts-table { display: block; min-width: 0; width: 100%; }
#shiftBiddingPage .available-shifts-table thead { display: none; }
#publishedShiftList { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr)); gap: 16px; align-items: start; }
#publishedShiftList > tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); align-content: start; }
#publishedShiftList > tr > td { display: block; padding: 0; border: 0; overflow-wrap: anywhere; min-width: 0; }
#publishedShiftList > tr > td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 14px; margin-bottom: 4px; }
#publishedShiftList > tr > td[data-label="Date"] { grid-column: 1 / -1; }
#publishedShiftList .shift-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#publishedShiftList > tr > td.shift-card-heading::before { display: none; }
.shift-card-date { display: grid; gap: 2px; }
.shift-card-date strong { font-family: inherit; font-size: inherit; font-weight: 700; }
.shift-card-date span { color: var(--muted); font-size: 14px; font-weight: 400; }
#publishedShiftList .danger-button { flex: 0 0 auto; width: auto; min-height: 44px; margin: 0; padding: 8px 14px; color: #fff; background: var(--danger); border: 1px solid var(--danger); }
#publishedShiftList .danger-button:hover { background: #8f1d14; border-color: #8f1d14; }
#publishedShiftList > tr > td[data-label="Eligibility"], #publishedShiftList > tr > td[data-label="Your interest"], #publishedShiftList > tr > td[data-label="Expires"], #publishedShiftList > tr > td[data-label="Employees interested"], #publishedShiftList .empty-state { grid-column: 1 / -1; }
#publishedShiftList small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 400; }
#publishedShiftList > tr:has(.empty-state) { grid-column: 1 / -1; padding: 24px 16px; background: var(--panel); }
#publishedShiftList button { min-height: 44px; width: 100%; margin-top: 6px; }
#publishShiftForm { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); align-items: end; gap: 16px; min-width: 0; max-width: 100%; }
#publishShiftButton { grid-column: 1 / -1; justify-self: end; }
#publishShiftForm label { display: grid; gap: 6px; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
#publishShiftForm input { display: block; box-sizing: border-box; min-height: 44px; font-size: 16px; min-width: 0; min-inline-size: 0; width: 100%; max-width: 100%; max-inline-size: 100%; }
/* Native date/time controls must shrink inside their grid cell on mobile Safari. */
#publishShiftForm input::-webkit-datetime-edit { min-width: 0; padding: 0; }
#publishShiftForm input::-webkit-date-and-time-value { min-width: 0; text-align: left; }
@media (max-width: 768px) {
  .app-header { display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 12px 12px; }
  .app-header > div:first-of-type { display: none; }
  .menu-toggle { display: block; flex: 0 0 44px; height: 44px; padding: 0; color: white; background: transparent; border: 1px solid #ffffff70; font-size: 25px; }
  .account-controls { margin-left: auto; flex-wrap: nowrap; gap: 10px; min-width: 0; }
  .account-controls > span { overflow-wrap: anywhere; min-width: 0; }
  .account-controls button { min-height: 44px; white-space: nowrap; }
  #mainNavigation { position: fixed; inset: 0 auto 0 0; z-index: 101; width: min(320px, 85vw); padding: max(16px, env(safe-area-inset-top)) 16px 24px; display: none; flex-direction: column; flex-wrap: nowrap; overflow-y: auto; gap: 10px; box-shadow: var(--shadow); }
  .navigation-open #mainNavigation { display: flex; }
  #mainNavigation .nav-button, #mainNavigation a, #mainNavigation form button { width: 100%; min-height: 44px; text-align: center; }
  #mainNavigation a { padding: 12px; color: var(--brand); }
  .menu-close { display: block; min-height: 44px; }
  .menu-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 100; border: 0; border-radius: 0; background: #0f294880; }
  body.navigation-open { overflow: hidden; }
  main { margin-top: 16px; padding: 0 12px 24px; }
  #shiftBiddingPage .employee-page-header { flex-direction: row; gap: 8px; align-items: center; }
  #shiftBiddingPage h2 { font-size: 21px; }
  #shiftBiddingPage .roster-card { padding: 12px; }
  #publishShiftForm { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
  #publishShiftForm label:first-child, #publishShiftForm label:last-of-type, #publishShiftButton { grid-column: 1 / -1; }
  #publishShiftButton { justify-self: stretch; }
  #publishShiftForm input { font-size: 16px; min-height: 44px; }
}
@media (max-width: 640px) {
  #publishShiftForm { grid-template-columns: minmax(0, 1fr); }
  #publishShiftForm > label, #publishShiftButton { grid-column: 1; }
  #publishShiftForm input { appearance: none; -webkit-appearance: none; }
}
@media (max-width: 768px) {
  .app-header { flex-direction: row; }
  .app-header .menu-toggle { width: 44px; min-width: 44px; flex-shrink: 0; }
}

/* Primary destinations remain visible outside the secondary menu. */
.primary-nav { display: flex; gap: 10px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.primary-nav .nav-button { flex: 0 0 auto; min-height: 44px; }
.roster-view-tabs { max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
.roster-view-tabs .roster-view-button { flex: 0 0 auto; white-space: nowrap; min-height: 44px; }
.shift-alert-controls:has(button[hidden]):has(p:empty) { display: none; }
.shift-alert-controls { margin-bottom: 12px; }
@media (max-width: 768px) {
  .primary-nav { padding: 8px 12px; }
  #mainNavigation .nav-button, #mainNavigation > a, #mainNavigation > form, #mainNavigation .menu-close { flex: 0 0 auto; }
  #mainNavigation { justify-content: flex-start; align-content: flex-start; }
}

#mainNavigation .menu-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #b8c4d1;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
}
#mainNavigation .menu-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.navigation-row { display: flex; align-items: center; gap: 10px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.navigation-row .primary-nav { order: 0; padding: 0; border: 0; flex: 0 0 auto; flex-wrap: nowrap; }
.navigation-row .main-nav { order: 1; padding: 0; border: 0; flex: 1 0 auto; flex-wrap: nowrap; align-items: center; }
.navigation-row .nav-button { white-space: nowrap; min-height: 44px; }
.menu-account-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
.menu-account-actions form { margin: 0; }
.menu-account-actions > *, .menu-account-actions button { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 768px) {
  .navigation-row { padding: 8px 12px; }
  .navigation-row #mainNavigation { padding: max(16px, env(safe-area-inset-top)) 16px 24px; align-items: stretch; }
  #mainNavigation .menu-account-actions { width: 100%; flex: 0 0 auto; }
  #mainNavigation .menu-account-actions .menu-link { width: auto; }
  #mainNavigation .menu-account-actions button, #mainNavigation .menu-account-actions .menu-link { padding: 10px 12px; font-size: 14px; }
}

.shift-page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
.shift-page-actions button { min-height: 44px; }
#pushNotificationsStatus:empty { display: none; }
@media (max-width: 768px) {
  #shiftBiddingPage .employee-page-header { flex-wrap: wrap; }
  .shift-page-actions { margin-left: auto; max-width: 100%; }
  .shift-page-actions button { flex: 0 1 auto; }
}

#publishedShiftList .shift-interest-table { display: table; width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; font-size: 14px; }
#publishedShiftList .shift-interest-table thead { display: table-header-group; }
#publishedShiftList .shift-interest-table th, #publishedShiftList .shift-interest-table td { padding: 8px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#publishedShiftList .shift-interest-table th { white-space: normal; background: var(--panel); }
.shift-interest-table small { display: block; margin-top: 4px; color: var(--muted); }
.shift-interest-table p { margin: 0; }
#publishedShiftList .shift-interest-table button { padding: 10px 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.shift-interest-table th:first-child { width: 40%; }
.shift-assignment-row { display: grid; gap: 8px; min-width: 0; }
.shift-assignment-row small { overflow-wrap: anywhere; }
.shift-decision-reason { display: grid; gap: 6px; margin: 12px 0 0; }
.shift-decision-reason textarea { width: 100%; min-width: 0; box-sizing: border-box; }
#shiftBiddingPage .shift-decision-reason textarea { font-size: 16px; }
.shift-decision-reason small { color: var(--muted); }
.overtime-report-table { border-collapse: collapse; width: 100%; }
.overtime-report-table th, .overtime-report-table td { padding: 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.overtime-report-table td { overflow-wrap: anywhere; min-width: 80px; }
.overtime-report-table td[data-label="Reason"] { min-width: 220px; }
@media (max-width: 700px) {
  .overtime-report-table thead { display: none; }
  .overtime-report-table, .overtime-report-table tbody { display: block; min-width: 0; }
  .overtime-report-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; }
  .overtime-report-table td, .overtime-report-table td[data-label="Reason"] { display: block; min-width: 0; border: 0; }
  .overtime-report-table td::before { content: attr(data-label); display: block; font-weight: 600; color: var(--muted); }
  .overtime-report-table td[data-label="Reason"], .overtime-report-table td[colspan] { grid-column: 1 / -1; }
}
.shift-assignment-row p { min-width: 0; }
#publishedShiftList .shift-assignment-row button { width: 100%; min-width: 0; white-space: normal; margin: 0; }

/* Let controls wrap within their panel instead of widening the page. */
.roster-view-tabs,
.roster-config-tabs {
  flex-wrap: wrap;
  overflow-x: visible;
}

.roster-view-tabs .roster-view-button,
.roster-config-tabs .roster-config-button {
  flex: 0 1 auto;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (min-width: 769px) {
  .navigation-row,
  .navigation-row .main-nav {
    flex-wrap: wrap;
  }

  .navigation-row .main-nav {
    flex: 1 1 auto;
  }
}

.week-controls {
  max-width: 100%;
  flex-wrap: wrap;
  white-space: normal;
}

.week-controls > *,
.control-group,
.payroll-filter-controls label {
  min-width: 0;
  max-width: 100%;
}

.modal-content {
  max-height: min(90dvh, calc(100dvh - 48px));
}

@media (max-width: 900px) {
  .week-controls {
    width: 100%;
  }

  .week-controls strong {
    overflow-wrap: anywhere;
  }

  .modal-actions,
  .shift-page-actions,
  .transition-history-row,
  .rotative-line-heading {
    flex-wrap: wrap;
  }

  button:not(.table-sort-button) {
    min-height: 44px;
  }
}

@media (max-width: 640px) {
  .controls > .control-group,
  .employee-tools > .control-group,
  .public-holiday-form > .control-group,
  .payroll-filter-controls label {
    flex: 1 1 100%;
  }

  .public-holiday-form input[type="text"],
  .public-holiday-form input[type="date"],
  .payroll-export-controls select,
  .payroll-export-controls input[type="date"] {
    min-width: 0;
    max-width: 100%;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .payroll-classification {
    grid-template-columns: minmax(0, 1fr);
  }

  .payroll-classification select {
    width: 100%;
    min-width: 0;
  }

  .modal-content {
    max-height: calc(100dvh - 24px);
  }

  .login-page {
    padding: 12px;
  }

  .login-card {
    padding: 20px;
  }
}
/* Roster releases share the existing dashboard and modal layout. */
.roster-publication-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.roster-publication-controls:has(#openRosterPublication) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem;
  width: 20rem;
}
.roster-publication-controls:has(#openRosterPublication) .roster-publication-status {
  min-height: 48px;
  justify-content: center;
  text-align: center;
}
#openRosterPublication { min-height: 48px; white-space: nowrap; }
.roster-publication-status { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #e2e8f0; color: #334155; }
.roster-publication-status[data-state="published"] { background: #dcfce7; color: #166534; }
.roster-publication-status[data-state="unpublished"],
.roster-publication-status[data-state="changes"] { background: #fef3c7; color: #92400e; }
.roster-unpublished-label { display: block; margin-top: .25rem; font-size: .7rem; font-weight: 600; color: #854d0e; }
.publication-message {
  display: block;
  font-size: 12px;
  min-height: 3em;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.publication-message:empty { visibility: hidden; }
@media (max-width: 640px) {
  .week-controls:has(#personalRosterViewControl:not([hidden])) .roster-publication-controls { grid-column: 1 / -1; }
}
.payroll-policy { margin: 1rem 0; padding: 1rem; border: 1px solid #cbd5e1; border-radius: 8px; min-width: 0; }
.payroll-policy legend { font-weight: 600; padding: 0 .35rem; }
.overtime-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; margin: 1rem 0; }
.overtime-days label { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; }
.overtime-days label:hover { border-color: var(--brand); }
.overtime-days label:has(input:checked) { color: var(--brand); border-color: var(--brand); background: #e7eef7; }
.overtime-days label:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.payroll-policy input[type="checkbox"] { width: 18px; min-width: 18px; height: 18px; padding: 0; margin: 0; flex: 0 0 18px; accent-color: var(--brand); }
.payroll-policy > label { display: flex; align-items: center; gap: .3rem; }
.payroll-meal-break-settings { display: grid; gap: 1rem; }
.overtime-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.overtime-legend > span { border: 1px solid; border-radius: 6px; padding: 6px 10px; font-weight: 600; font-size: 13px; }
.overtime-state-assigned { background: #dcfce7; color: #14532d; border-color: #86efac; }
.overtime-state-pending { background: #fef3c7; color: #78350f; border-color: #fcd34d; }
.overtime-state-rejected { background: #ffe4e6; color: #881337; border-color: #fda4af; }
.overtime-state-expired { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.overtime-calendar-wrapper { width: 100%; }
.overtime-calendar-table { table-layout: fixed; width: 100%; min-width: 0; font-size: 11px; }
.overtime-calendar-table th:nth-child(n), .overtime-calendar-table td:nth-child(n) { display: table-cell; position: static; left: auto; z-index: auto; box-shadow: none; min-width: 0; width: 6%; padding: 4px 2px; vertical-align: top; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.overtime-calendar-table th:first-child, .overtime-calendar-table td:first-child { width: 10%; text-align: left; padding: 6px; }
.overtime-calendar-table th:nth-child(2), .overtime-calendar-table td.overtime-hours-cell { width: 6%; padding: 6px 2px; }
.overtime-hours-cell { font-variant-numeric: tabular-nums; }
.overtime-hours-label { display: none; }
.overtime-calendar-table th small { font-size: 10px; }
.overtime-calendar-table th.today-column { box-shadow: inset 0 3px 0 var(--accent); }
.overtime-calendar-table td.today-column { box-shadow: inset 2px 0 0 rgba(15, 118, 110, 0.3), inset -2px 0 0 rgba(15, 118, 110, 0.3); }
.overtime-employee-meta { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; font-weight: 400; }
.overtime-cell-date { display: none; }
.overtime-shift-card { display: block; container: overtime-shift / inline-size; border: 1px solid; border-radius: 6px; padding: 0; margin: 4px 0; text-align: center; min-width: 0; overflow-wrap: anywhere; }
.overtime-shift-card summary { position: relative; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; padding: 10px 2px 5px; align-items: center; list-style: none; }
.overtime-shift-card summary::-webkit-details-marker { display: none; }
.overtime-shift-card summary::before { content: ""; position: absolute; top: 4px; right: 4px; width: 0; height: 0; border-top: 3px solid transparent; border-bottom: 3px solid transparent; border-left: 4px solid currentColor; }
.overtime-shift-card[open] summary::before { transform: rotate(90deg); }
.overtime-shift-card summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 5px; }
.overtime-shift-times { display: grid; gap: 2px; font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1.25; }
.overtime-shift-times time { display: block; white-space: nowrap; text-align: center; }
.overtime-shift-status { display: block; border-radius: 3px; background: rgba(255, 255, 255, .55); padding: 2px 0; font-size: 10px; line-height: 14px; white-space: nowrap; }
.overtime-shift-card .overtime-state-symbol { display: none; }
.overtime-shift-card .overtime-overnight { display: block; min-height: 11px; font-size: 9px; line-height: 11px; white-space: nowrap; }
.overtime-shift-details { display: grid; gap: 8px; border-top: 1px solid; padding: 8px 4px; text-align: left; line-height: 1.4; }
.overtime-shift-details small { font-size: 10px; }
.overtime-shift-details p { margin: 0; font-size: 11px; }
@container overtime-shift (max-width: 62px) {
  .overtime-shift-card .overtime-state-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .overtime-shift-card .overtime-state-symbol { display: block; font-size: 13px; }
}
.overtime-cell-empty { display: block; padding: 14px 0; color: #94a3b8; }
.overtime-you { color: var(--brand); }
.overtime-audit, .overtime-filters { margin-top: 16px; }
.overtime-filters { margin-bottom: 16px; }
.overtime-filters .roster-filter-option { display: inline-flex; align-items: center; flex: 0 1 auto; gap: 7px; }
.overtime-audit > summary, .overtime-filters > summary { cursor: pointer; font-weight: 700; }
.overtime-audit > .coverage-report-heading { margin-top: 16px; }
.overtime-period-controls { flex-wrap: wrap; }
@media (max-width: 1000px) {
  .overtime-calendar-table, .overtime-calendar-table tbody { display: block; }
  .overtime-calendar-table thead { display: none; }
  .overtime-calendar-table tr { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .overtime-calendar-table td:nth-child(n) { display: block; width: auto; min-width: 0; padding: 4px 2px; }
  .overtime-calendar-table td.overtime-employee-cell { grid-column: 1 / 6; padding: 8px; }
  .overtime-calendar-table td.overtime-hours-cell { grid-column: 6 / -1; width: auto; padding: 8px; background: var(--panel); font-size: 13px; }
  .overtime-hours-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; }
  .overtime-calendar-table td[colspan] { grid-column: 1 / -1; padding: 10px; }
  .overtime-calendar-table .overtime-employee-cell { background: var(--panel); font-size: 13px; font-weight: 700; }
  .overtime-cell-date { display: block; font-size: 10px; font-weight: 700; margin-bottom: 6px; }
  .overtime-cell-date > span, .overtime-cell-date > small { display: block; }
  .overtime-shift-card { min-height: 44px; }
  .overtime-period-controls { width: 100%; }
  .overtime-period-controls strong { text-align: center; }
}
@media (max-width: 640px) {
  .overtime-calendar-table td.overtime-calendar-cell { padding: 4px 1px; }
  .overtime-shift-card { font-size: 10px; }
  .overtime-shift-card summary { padding-inline: 1px; }
}
.payroll-meal-break-form fieldset { min-width: 0; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
.payroll-meal-break-form legend { padding: 0 .35rem; font-weight: 700; }
.payroll-meal-break-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.payroll-meal-break-fields input { min-width: 0; }
.payroll-meal-break-form [role="status"]:empty { display: none; }
@media (max-width: 700px) { .payroll-meal-break-fields { grid-template-columns: 1fr; } }
/* Pending requests supplement the roster without replacing scheduled work. */
.week-controls:has(.roster-request-controls) { justify-content: flex-end; }
.roster-request-controls { display: flex; flex: 0 0 100%; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.4rem; }
.roster-request-controls label { display: inline-flex; align-items: center; gap: 0.4rem; }
.roster-request-controls input { flex: 0 0 16px; width: 16px; min-width: 16px; height: 16px; padding: 0; margin: 0; }
.roster-request-controls [role="status"] { flex-basis: 100%; font-size: 0.85rem; text-align: right; overflow-wrap: anywhere; }
.roster-request-controls [role="status"]:empty { display: none; }
@media (max-width: 640px) {
  .roster-request-controls { flex-basis: auto; }
  .week-controls:has(#personalRosterViewControl:not([hidden])) .roster-request-controls { grid-column: 1 / -1; }
}
button.roster-request-marker { display: flex; flex-direction: column; gap: 0.2rem; width: 100%; min-height: 44px; margin-top: 0.4rem; padding: 0.4rem 0.2rem; border: 2px dashed #986800; border-radius: 6px; background: #fff8df; color: #684400; font-size: 0.75rem; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
button.roster-request-marker:hover { background: #ffedb3; }
.roster-shift-cell button.roster-request-marker > strong,
.roster-shift-cell button.roster-request-marker > .roster-request-status { font-size: 0.6rem; white-space: nowrap; overflow-wrap: normal; }
button.roster-request-marker:focus-visible { outline: 3px solid #175cd3; outline-offset: 2px; }
.day-request-card { padding: 1rem; margin: 0.75rem 0; border: 1px dashed #986800; border-radius: 8px; background: #fffdf5; }
.day-request-card h5 { margin: 0 0 0.75rem; font-size: 1rem; }
.day-request-card ul { list-style: none; margin: 0; padding: 0; }
.day-request-card li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 0; border-top: 1px solid #e9dfc6; }
.day-request-card p { margin: 0.3rem 0; }
.day-request-card .request-projection { font-weight: 600; color: #684400; }
.day-request-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.day-request-card textarea { display: block; width: 100%; margin: 0.4rem 0; }
