.work-schedule {
  --ws-soft: #f7f9fc;
  --ws-quiet: #e9eff6;
  --ws-office-ink: #204c72;
  --ws-office-edge: #477eaf;
  --ws-office-bg: #eaf3fc;
  --ws-home-ink: #205640;
  --ws-home-edge: #438065;
  --ws-home-bg: #e9f5ee;
  --ws-flex-ink: #78441d;
  --ws-flex-edge: #c57131;
  --ws-flex-bg: #fff0df;
  --ws-holiday-ink: #952b40;
  --ws-holiday-bg: #fff4f5;
}

.work-schedule .ws-page-heading { align-items: flex-end; }
.ws-actions, .ws-toolbar-controls, .ws-date-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ws-schedule-panel { min-width: 0; border: 1px solid var(--line); background: var(--paper); }
.ws-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 22px;
  padding: 18px 20px;
}
.ws-toolbar-period h2 { font-size: clamp(20px, 3vw, 25px); line-height: 1.23; letter-spacing: -.035em; }
.ws-toolbar-period :is(h2, p)::first-letter { text-transform: uppercase; }
.ws-toolbar-period p { margin-top: 3px; color: var(--muted); font-size: 13px; }
.ws-toolbar-controls { justify-content: flex-end; gap: 8px 12px; }
.ws-date-control { flex-wrap: nowrap; gap: 4px; }
.ws-toolbar :is(.button, .icon-button) { min-height: 38px; }
.ws-toolbar .icon-button { min-width: 38px; }
.ws-picker, .ws-picker input { max-width: 100%; }
.ws-picker input {
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid #c4d0df;
  background: var(--paper);
  color: var(--ink);
}
.ws-modes { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); background: var(--ws-quiet); }
.ws-modes button {
  flex: 1 0 auto;
  min-height: 32px;
  padding-inline: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.ws-modes button:hover { color: var(--ink); background: rgba(255,255,255,.58); }
.ws-modes button[aria-pressed="true"] { border-color: #c9d8e7; background: var(--paper); color: var(--navy); }

.ws-personnel-filter { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink); }
.ws-personnel-filter select { max-width: 100%; min-height: 36px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); font: inherit; }
.ws-grid-scroll { max-width: 100%; overflow: auto; }
.ws-grid { width: 100%; border-spacing: 0; table-layout: fixed; }
.ws-grid[data-mode="week"] { min-width: 950px; }
.ws-grid[data-mode="fortnight"] { min-width: 1840px; }
.ws-grid :is(th, td) {
  padding: 9px;
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.ws-grid :is(th, td):last-child { border-right: 0; }
.ws-grid thead th { background: var(--ws-soft); vertical-align: middle; font-size: 13px; font-weight: 650; }
.ws-grid thead th strong { display: block; text-transform: capitalize; }
.ws-grid thead th > span { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; }
.ws-grid thead th > small { display: block; margin-top: 3px; font-size: 10px; line-height: 1.15; overflow-wrap: anywhere; }
.ws-grid thead th.holiday { color: var(--ws-holiday-ink); background: var(--ws-holiday-bg); }
.ws-grid thead th.holiday > span { color: inherit; }
.ws-grid thead th.today { box-shadow: inset 0 2px var(--steel); }
.ws-grid td.holiday { background: #fffafa; }
.ws-grid td.today { background: #f3f8fd; }
.ws-grid .ws-person {
  position: sticky;
  left: 0;
  width: clamp(115px, 14vw, 170px);
  max-width: 25vw;
  z-index: 1;
  padding-inline: 13px;
  background: var(--ws-soft);
}
.ws-grid tbody .ws-person { font-size: clamp(15px, 1.2vw, 17px); line-height: 1.22; white-space: normal; overflow-wrap: anywhere; }
.ws-grid tbody .ws-person small { display: block; margin-top: 2px; color: var(--muted); font-weight: 550; }
.ws-grid tbody .ws-person .ws-person-type { font-size: 11px; }
.ws-grid tbody .ws-person .ws-person-external { display: table; padding: 2px 5px; border-radius: 4px; color: #73401b; background: #ffecd5; font-weight: 700; }
.ws-grid tbody .ws-person .ws-provider-name { font-size: 11px; }
.ws-grid tbody .ws-person-department { margin-top: 4px; font-size: 12px; }
.work-schedule [data-category-color="blue"] { --ws-category-edge: #3d79b2; --ws-category-head: #e8f1fb; --ws-category-bg: #f6faff; --ws-category-text: #214f79; }
.work-schedule [data-category-color="green"] { --ws-category-edge: #48865b; --ws-category-head: #e8f3eb; --ws-category-bg: #f6fbf7; --ws-category-text: #285b39; }
.work-schedule [data-category-color="amber"] { --ws-category-edge: #a67720; --ws-category-head: #f9f0d9; --ws-category-bg: #fdf9ee; --ws-category-text: #694c15; }
.work-schedule [data-category-color="violet"] { --ws-category-edge: #7e63a7; --ws-category-head: #efe9f7; --ws-category-bg: #faf6fe; --ws-category-text: #563b7c; }
.work-schedule [data-category-color="rose"] { --ws-category-edge: #ac5675; --ws-category-head: #f8e9ef; --ws-category-bg: #fdf6f9; --ws-category-text: #773751; }
.work-schedule [data-category-color="teal"] { --ws-category-edge: #3d8885; --ws-category-head: #e5f3f3; --ws-category-bg: #f2fbfa; --ws-category-text: #235d57; }
.ws-grid .ws-group-heading :is(th, td) { padding-block: 4px; border-top-color: var(--ws-category-edge, var(--line)); background: var(--ws-category-head, var(--ws-quiet)); color: var(--ws-category-text, var(--muted)); }
.ws-grid .ws-group-heading .ws-person { border-right: 0; }
.ws-group-title { display: inline-block; max-width: 100%; padding: 2px 0; border: 0; background: transparent; color: inherit; font-family: inherit; font-size: 13px; font-weight: 750; line-height: 1.3; text-align: left; overflow-wrap: anywhere; }
button.ws-group-title { min-height: 28px; text-decoration: underline; text-underline-offset: 3px; }
button.ws-group-title:hover { color: var(--navy); }
.ws-grid .ws-roster-group[data-category-color] tr:not(.ws-group-heading) :is(td, th):not(.today, .holiday) { background: var(--ws-category-bg); }
.ws-grid .ws-roster-group.ws-drop-active .ws-group-heading :is(th, td) { box-shadow: inset 0 2px var(--ws-category-edge, var(--steel)), inset 0 -2px var(--ws-category-edge, var(--steel)); }
.ws-employee-heading[draggable] { display: flex; align-items: flex-start; gap: 5px; cursor: grab; user-select: none; }
.ws-employee-heading[draggable]:active { cursor: grabbing; }
.ws-drag-handle { flex: 0 0 auto; color: var(--ws-category-edge, var(--muted)); font-size: 14px; line-height: 1.2; }
.ws-grid[data-mode="day"] .ws-person { width: max(27%, 116px); }
.ws-grid[data-mode="day"] .ws-cell { grid-template-columns: repeat(auto-fit, minmax(min(100%, 142px), 1fr)); align-items: start; }
.ws-cell { display: grid; min-height: 56px; gap: 5px; align-content: start; }

.ws-entry, .ws-nonshift, .ws-empty-cell {
  min-width: 0;
  width: 100%;
  display: block;
  padding: 5px 6px;
  border: 0;
  text-align: left;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.28;
}
.ws-entry { border-left: 3px solid var(--ws-entry-edge); color: var(--ws-entry-ink); background: var(--ws-entry-bg); }
.ws-entry strong { display: block; margin-bottom: 3px; font-size: clamp(14px, 1.15vw, 16px); font-variant-numeric: tabular-nums; letter-spacing: -.025em; white-space: nowrap; }
.ws-entry-duration { display: block; margin-top: 3px; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
button.ws-entry:hover { box-shadow: inset 0 0 0 1px var(--ws-entry-edge); }
button.ws-entry:focus-visible { outline-offset: 1px; }
.work-schedule :is(.ws-entry, .ws-legend li).office {
  --ws-entry-ink: var(--ws-office-ink); --ws-entry-edge: var(--ws-office-edge); --ws-entry-bg: var(--ws-office-bg);
}
.work-schedule :is(.ws-entry, .ws-legend li).home {
  --ws-entry-ink: var(--ws-home-ink); --ws-entry-edge: var(--ws-home-edge); --ws-entry-bg: var(--ws-home-bg);
}
.work-schedule :is(.ws-entry, .ws-legend li).flex {
  --ws-entry-ink: var(--ws-flex-ink); --ws-entry-edge: var(--ws-flex-edge); --ws-entry-bg: var(--ws-flex-bg);
}
.ws-nonshift, .ws-empty-cell { color: var(--muted); }
.ws-nonshift.closed { border-left: 2px solid #9b5a65; color: #7d3040; background: #f7e9ec; font-weight: 700; }
.ws-nonshift.absence { border-inline-start: 3px solid #9872aa; background: #f3ebf8; color: #573567; font-weight: 700; }
.ws-legend .absence { --ws-entry-edge: #9872aa; }
.ws-add-cell { justify-self: start; width: 27px; height: 27px; margin-left: 1px; padding: 0; border: 1px dashed #a5b8cc; background: none; color: #385a7f; font-size: 16px; line-height: 1; }
.ws-add-cell:is(:hover, :focus-visible) { border-style: solid; background: var(--ws-office-bg); color: var(--navy); }

.ws-legend { display: flex; flex-wrap: wrap; gap: 4px 17px; margin: 0; padding: 10px 20px; border-top: 1px solid var(--line); color: var(--muted); list-style: none; font-size: 12px; }
.ws-legend li { display: inline-flex; align-items: center; gap: 5px; }
.ws-legend li::before { width: 8px; height: 8px; background: var(--ws-entry-edge, var(--ws-holiday-ink)); content: ""; }
.ws-empty { padding: 28px 20px; border-top: 1px solid var(--line); color: var(--muted); }
.ws-error-text { color: var(--ws-holiday-ink); }
.ws-retry { margin: 0 20px 22px; }
.ws-feedback { margin: -9px 0 10px; padding: 9px 11px; border-left: 3px solid var(--ws-home-edge); color: var(--ws-home-ink); background: var(--ws-home-bg); font-size: 14px; }
.ws-feedback.ws-feedback-error { border-left-color: var(--ws-holiday-ink); color: var(--ws-holiday-ink); background: var(--ws-holiday-bg); }
.ws-rule-warnings { margin: 0 0 14px; padding: 9px 12px 9px 30px; border-inline-start: 3px solid var(--ws-flex-edge); background: var(--ws-flex-bg); color: var(--ws-flex-ink); font-size: 14px; }

.ws-absence-panel { display: grid; gap: 12px; margin-top: 18px; padding: 16px 20px; border: 1px solid var(--line); background: var(--paper); }
.ws-absence-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.ws-absence-heading h2 { font-size: clamp(20px, 3vw, 25px); line-height: 1.23; letter-spacing: -.035em; }
.ws-absence-heading p, .ws-absence-empty { margin-top: 3px; color: var(--muted); font-size: 14px; }
.ws-absence-panel .ws-retry { justify-self: start; margin: 0; }
.ws-absence-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ws-absence-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 12px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--ws-soft);
}
.ws-absence-row-copy { min-width: 0; overflow-wrap: anywhere; }
.ws-absence-row-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; }
.ws-absence-row-copy p, .ws-absence-message { margin-top: 4px; white-space: pre-wrap; font-size: 14px; }
.ws-absence-note { color: var(--muted); }
.ws-absence-status { padding: 3px 6px; border-radius: 4px; background: var(--ws-quiet); color: var(--muted); font-size: 12px; font-weight: 700; }
.ws-absence-status[data-status="pending"] { background: var(--ws-flex-bg); color: var(--ws-flex-ink); }
.ws-absence-status[data-status="approved"] { background: var(--ws-home-bg); color: var(--ws-home-ink); }
.ws-absence-status:is([data-status="denied"], [data-status="revoked"]) { background: var(--ws-holiday-bg); color: var(--ws-holiday-ink); }
.ws-absence-row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.ws-absence-history summary { color: var(--steel-hover); font-weight: 700; cursor: pointer; }
.ws-absence-history .ws-absence-list { margin-top: 7px; }

.ws-month-board { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin: 0 20px 15px; }
.ws-month-board.compact { margin: 0; }
.ws-month-categories { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 20px 15px; padding: 0; list-style: none; }
.ws-month-categories li { padding-inline: 7px; border-inline-start: 3px solid var(--ws-category-edge, var(--steel)); background: var(--ws-category-head, var(--ws-quiet)); color: var(--ws-category-text, var(--muted)); }
.ws-month-categories .ws-group-title { min-height: 0; padding-block: 4px; }
.ws-month-weekday { padding: 4px 0; color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; }
.ws-month-day { min-height: 77px; padding: 5px 6px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-align: left; }
.ws-month-day strong, .ws-month-holiday, .ws-month-meta { display: block; }
.ws-month-day strong { font-size: 14px; }
.ws-month-holiday { color: var(--ws-holiday-ink); font-size: 10px; font-weight: 650; overflow-wrap: anywhere; }
.ws-month-holiday:empty { display: none; }
.ws-month-meta { margin-top: 4px; color: #245274; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.ws-month-day.outside { color: #68798e; background: var(--ws-soft); }
.ws-month-day.holiday { color: var(--ws-holiday-ink); background: var(--ws-holiday-bg); }
.ws-month-day.marked { border-bottom: 2px solid var(--steel); }
.ws-month-day[aria-current="date"] strong { color: var(--steel-hover); text-decoration: underline 2px; text-underline-offset: 3px; }
.ws-month-day:is(:hover, [aria-pressed="true"]) { border-color: var(--steel); background: var(--ws-office-bg); }
.ws-month-board.compact .ws-month-day { min-height: 40px; padding: 4px; text-align: center; }
.ws-month-board.compact .ws-month-meta { font-size: 9px; line-height: 1.1; }
.ws-month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ws-month-nav strong { text-align: center; text-transform: capitalize; }
.ws-month-nav .icon-button { min-height: 35px; min-width: 35px; }

.work-schedule .ws-dialog { max-height: min(91vh, 880px); overflow: auto; }
.work-schedule .ws-dialog-wide { width: min(850px, calc(100% - 24px)); }
.ws-dialog .dialog-head, .ws-dialog .dialog-footer { position: sticky; z-index: 2; }
.ws-dialog .dialog-head { inset-block-start: 0; background: var(--paper); }
.ws-dialog .dialog-footer { inset-block-end: 0; }
.ws-dialog .ws-close { min-width: 35px; min-height: 35px; font-size: 24px; line-height: 1; }
.ws-dialog .ws-delete { margin-right: auto; color: var(--ws-holiday-ink); }
.ws-shift-conflicts {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e0b9c0;
  border-inline-start: 3px solid #a14556;
  background: #fff4f5;
  color: #592d39;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.ws-shift-conflict-copy { display: grid; gap: 5px; }
.ws-shift-conflict-list {
  display: grid;
  gap: 6px;
  max-height: 19rem;
  margin: 3px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.ws-shift-conflict-list li { padding: 8px; border: 1px solid #edd0d6; background: #fffafb; }
.ws-shift-conflict-times { display: grid; gap: 5px; margin: 4px 0 0; }
.ws-shift-conflict-times dt { font-size: 12px; font-weight: 750; }
.ws-shift-conflict-times dd { margin: 0; font-variant-numeric: tabular-nums; }
.ws-shift-conflict-list details { margin-top: 5px; }
.ws-shift-conflict-list summary { min-height: 36px; align-content: center; font-weight: 700; cursor: pointer; }
.ws-template-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.ws-template-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 11px; padding: 7px 9px; border: 1px solid var(--line); background: var(--ws-soft); overflow-wrap: anywhere; }
.ws-template-list li > :first-child { flex: 1 1 135px; }
.ws-template-list li small { display: block; color: var(--muted); }
.ws-template-section { display: grid; gap: 9px; border-top: 1px solid var(--line); padding-top: 14px; }
.ws-template-section h3 { margin: 0; font-size: 17px; letter-spacing: -.018em; }
.ws-template-section p { color: var(--muted); font-size: 13px; }
.ws-pattern { display: grid; gap: 6px; }
.ws-pattern-day, .ws-flex-choice, .ws-rollout-employees, .ws-category-fields {
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
}
.ws-pattern-day legend, .ws-flex-choice legend, .ws-rollout-employees legend, .ws-category-fields legend { padding: 0 4px; font-size: 13px; font-weight: 700; }
.ws-pattern-day legend { padding-right: 7px; }
.ws-rule-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(110px, 1.25fr) minmax(68px, .65fr) auto; align-items: end; gap: 5px 7px; margin-bottom: 5px; }
.ws-rule-row .field span { color: var(--muted); font-size: 12px; font-weight: 650; }
.ws-rule-row :is(input, select) { font-size: 14px; }
.ws-rule-options { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ws-paid-break { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; font-size: 14px; overflow-wrap: anywhere; }
.ws-shift-break { align-items: end; }
.ws-shift-break .ws-paid-break { min-height: 40px; }
.ws-dialog textarea { min-width: 0; width: 100%; padding: 8px; border: 1px solid #c4d0df; color: var(--ink); background: var(--paper); font: inherit; resize: vertical; }
.ws-remove-rule { min-width: 38px; min-height: 42px; padding-inline: 3px; font-size: 20px; line-height: 1; }
.ws-rule-empty { display: inline-block; margin-right: 9px; }
.ws-text-button { min-height: 32px; padding: 0 3px; border: 0; background: none; color: var(--steel-hover); font-size: 13px; font-weight: 700; text-align: left; }
.ws-text-button:hover { text-decoration: underline; text-underline-offset: 2px; }
.ws-text-button.ws-danger { color: var(--ws-holiday-ink); }
.ws-muted { color: var(--muted); font-weight: 500; }
.ws-exception-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); align-items: start; gap: 13px; }
.ws-exception-form { display: grid; gap: 8px; padding: 8px; border: 1px solid var(--line); background: var(--ws-soft); }
.ws-flex-choice .button[aria-pressed="true"] { border-color: var(--steel); background: var(--ws-office-bg); color: var(--navy); }
.ws-rollout-employees { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr)); gap: 5px; font-size: 14px; }
.ws-rollout-employees label { padding: 3px 5px; overflow-wrap: anywhere; }
.ws-rollout-employees .ws-rollout-select-all { grid-column: 1 / -1; padding-bottom: 7px; border-bottom: 1px solid var(--line); font-weight: 700; }
.ws-category-colors { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 105px), 1fr)); gap: 5px; }
.ws-category-colors label { display: flex; align-items: center; gap: 6px; padding: 5px; border: 1px solid var(--line); color: var(--ws-category-text); background: var(--ws-category-bg); font-size: 13px; font-weight: 650; }
.ws-category-colors label:has(:checked) { border-color: var(--ws-category-edge); background: var(--ws-category-head); }
.ws-category-colors input { margin: 0; accent-color: var(--ws-category-edge); }
.ws-category-swatch { width: 9px; height: 9px; background: var(--ws-category-edge); }
.ws-category-current { display: block; margin-left: 19px; color: var(--muted); font-size: 11px; }
.ws-preview { display: grid; gap: 5px; padding: 11px; border: 1px solid var(--line); background: var(--ws-soft); font-size: 14px; }
.ws-preview p { color: var(--muted); }
.ws-preview :is(ul, ol) { max-height: 180px; overflow: auto; margin: 4px 0; padding-left: 21px; }
.ws-preview summary { color: var(--steel-hover); font-weight: 700; cursor: pointer; }

@media (max-width: 700px) {
  .work-schedule .ws-page-heading { align-items: flex-start; }
  .ws-toolbar { padding: 12px; gap: 10px; }
  .ws-toolbar-controls { justify-content: flex-start; }
  .ws-month-board { margin-inline: 8px; gap: 3px; }
  .ws-month-categories { margin-inline: 8px; }
  .ws-month-day { min-height: 58px; padding: 3px; }
  .ws-month-holiday, .ws-month-meta { font-size: 9px; }
  .ws-legend { padding-inline: 12px; }
  .ws-absence-panel { padding-inline: 12px; }
}

@media (max-width: 570px) {
  .ws-personnel-filter select { min-height: 44px; font-size: 16px; }

  .ws-exception-layout { grid-template-columns: minmax(0, 1fr); }
  .ws-month-board.compact .ws-month-day { min-height: 36px; }
  .ws-dialog .dialog-body { padding-inline: 12px; }
  .ws-dialog .dialog-footer { padding-inline: 10px; }
  .ws-dialog .dialog-footer .button, .ws-absence-panel .button { min-height: 44px; }
  .ws-dialog .field :is(input, select, textarea) { min-height: 44px; font-size: 16px; }
  .ws-toolbar :is(.button, .icon-button), .ws-modes button, .ws-picker input { min-height: 44px; }
  .ws-toolbar .icon-button, .ws-add-cell { min-width: 44px; min-height: 44px; }
  .ws-rule-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-remove-rule { grid-row: auto; justify-self: end; }
  .ws-shift-break { grid-template-columns: minmax(0, 1fr); }
  .ws-grid .ws-person { padding-inline: 7px; }
}

@media (max-width: 380px) {
  .ws-modes { flex: 1 1 auto; }
  .ws-modes button { padding-inline: 5px; }
  .ws-rule-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-remove-rule { width: 38px; justify-self: end; }
  .ws-month-board.compact .ws-month-meta { font-size: 8px; }
}
