:root {
  font: 15px system-ui, sans-serif;
  color: #192b25;
  background: #f4f6f4;
  --green: #20513f;
  --light: #e1e7e2;
  --muted: #53645c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, input, select {
  border: 1px solid #c8d3cc;
  border-radius: 8px;
  padding: 9px 12px;
  min-height: 40px;
  background: #fff;
  color: inherit;
}
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--green); }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 3px solid #3a8b72; outline-offset: 2px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(27px, 4vw, 36px); letter-spacing: -.035em; }
h2 { font-size: 19px; }
.topbar {
  background: #173b31;
  color: #fff;
  padding: 10px max(18px, calc((100vw - 1460px) / 2));
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.brand, nav { display: flex; gap: 8px; align-items: center; }
.brand { font-weight: 700; }
.brand img { border-radius: 8px; }
nav button { background: transparent; border-color: transparent; }
nav button.active-page { background: #336452; }
main { max-width: 1500px; margin: auto; padding: 28px 20px; }
.title-row, .toolbar, .week-controls, .toolbar-actions, .dialog-heading, .dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.title-row, .toolbar, .dialog-heading { justify-content: space-between; }
.title-row { margin-bottom: 18px; }
.location { color: var(--muted); font-size: 13px; font-weight: 650; }
.toolbar { flex-wrap: wrap; gap: 12px; }
.week-controls, .toolbar-actions { flex-wrap: wrap; }
.week-controls strong { text-align: center; min-width: 130px; }
.primary { color: white; background: var(--green); border-color: var(--green); font-weight: 650; }
#status { min-height: 34px; padding: 8px 0; color: var(--muted); }
#status[data-error], #editor-error { color: #9a3227; }
.board { overflow: auto; border: 1px solid var(--light); border-radius: 12px; background: #fff; }
table { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
th, td { padding: 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--light); border-right: 1px solid var(--light); }
tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tr > :last-child { border-right: 0; }
thead th { background: #eaf0eb; }
tr > th:first-child { width: 142px; position: sticky; left: 0; z-index: 1; }
tbody th { background: #f8faf8; }
small { display: block; font-size: 12px; color: var(--muted); font-weight: 450; }
td { height: 103px; background: #fff; }
td.is-target { background: #dcefe5; box-shadow: inset 0 0 0 2px #4b896f; }
.shift, .add { width: 100%; padding: 7px; margin-bottom: 4px; }
.shift { background: #fff0c9; border-color: #e9cb80; text-align: left; cursor: grab; font-size: 13px; font-weight: 700; }
.shift.live { background: #ecf4ef; border-color: #c9dfd1; }
.add { border: 1px dashed #d5dfd8; min-height: 29px; color: var(--muted); }
.employee-day { display: flex; justify-content: space-between; gap: 10px; padding: 16px; border: 1px solid var(--light); border-radius: 10px; background: white; margin-bottom: 8px; }
details { margin: 12px 0; color: var(--green); }
details p { padding-top: 8px; }
dialog { border: 1px solid var(--light); border-radius: 14px; width: min(440px, calc(100vw - 24px)); padding: 20px; color: inherit; }
dialog::backdrop { background: #10281fc0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.fields label { display: grid; gap: 4px; }
.fields input, .fields select { width: 100%; }
.dialog-actions { justify-content: flex-end; margin-top: 14px; }
.danger { color: #9a3227; margin-right: auto; }
#confirm-copy { margin-top: 10px; }
@media (max-width: 550px) {
  main { padding: 18px 12px; }
  .topbar { gap: 4px; }
  nav button, .toolbar button, .title-row button { min-height: 44px; }
  #my-shifts { padding-bottom: env(safe-area-inset-bottom); }
}
.login-panel { display: grid; gap: 14px; max-width: 440px; margin: 24px auto; padding: 24px; background: white; border: 1px solid var(--light); border-radius: 12px; }
.login-panel label { display: grid; gap: 5px; }
#login-error { color: #9a3227; }
#time-off-dialog { width: min(560px, calc(100vw - 24px)); }
#time-off-list { display: grid; gap: 8px; margin-top: 12px; }
#time-off-feedback { margin-top: 8px; }
.time-off-row { border: 1px solid var(--light); border-radius: 8px; padding: 10px; }
.time-off-row button { margin: 8px 6px 0 0; }
.time-off-marker { color: #75430b; margin-bottom: 4px; }
#time-off-form > label { display: grid; gap: 4px; margin-top: 12px; }
#time-off-form.hourly .fields > label:first-child { grid-column: 1 / -1; }
#time-off-form.hourly .fields > label:first-child input { width: calc((100% - 12px) / 2); }
#time-off-form .fields label { min-width: 0; }
.time-off-marker.pending { color: #775319; background: #fff3d7; }
#time-off-form #request-midnight { display: flex; align-items: center; gap: 8px; margin: -6px 0 10px; }
#request-midnight input { min-height: auto; width: auto; }
#availability-dialog { width: min(580px, calc(100vw - 24px)); }
.availability-help { color: var(--muted); margin: 8px 0 12px; }
.availability-day { border: 1px solid var(--light); border-radius: 8px; margin: 8px 0; min-width: 0; }
.availability-day legend { font-weight: 650; }
.availability-window { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 8px 0; }
.availability-window label { display: grid; gap: 4px; min-width: 0; }
.availability-window input[type="time"] { width: 100%; }
.availability-window .availability-midnight { display: flex; align-items: center; }
.availability-window input[type="checkbox"] { min-height: auto; }
#availability-feedback { margin: 10px 0; }
.availability-marker { margin-bottom: 4px; }
.availability-conflict { border-color: #ad5d1d; }
.availability-conflict small:last-child { color: #8a4215; font-weight: 650; }
#trades-dialog { width: min(560px, calc(100vw - 24px)); }
#trade-form p, #trades-feedback { margin-top: 10px; }
#trades-list { display: grid; gap: 8px; margin-top: 12px; }
#trades-list label { display: grid; gap: 5px; margin-top: 8px; }
.shift-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.employee-day { flex-wrap: wrap; align-items: center; }
#staff-trade-section { margin-top: 20px; }
#staff-trade-list { display: grid; gap: 8px; margin-top: 8px; }
#staff-trade-list .time-off-row { background: white; }
#staff-trade-list label, .trade-target { display: grid; gap: 5px; margin: 8px 0; }
#shift-approvals { margin: 20px 0; }
.approval-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#manager-trade-list { display: grid; gap: 8px; margin-top: 8px; }
#manager-trade-list .time-off-row { background: white; }
.trade-status { display: inline-block; width: fit-content; padding: 4px 8px; border-radius: 6px; background: #e8eeeb; color: #31473d; }
.trade-status.accepted { background: #fff0c9; color: #674814; font-weight: 650; }
.trade-error { color: #962f21; }
#templates-dialog { width: min(520px, calc(100vw - 24px)); }
#template-form, #template-form label, #template-list { display: grid; gap: 8px; }
#template-form, #template-list, #template-feedback { margin-top: 10px; }
#template-form button { justify-self: start; }

#shift-pool { padding: 14px; border: 1px solid #c9d4ce; border-radius: 10px; margin: 12px 0; }
#shift-pool h2 { margin: 0; font-size: 1.1rem; }
#pool-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pool-shift { display: grid; gap: 4px; padding: 10px; border: 1px solid #93b4a4; border-radius: 8px; background: #eff7f2; cursor: grab; min-width: 175px; }
.pool-shift button { justify-self: start; }
#template-overlap { margin: 14px 0; border-top: 1px solid #ddd; padding-top: 10px; }
#overlap-days { display: grid; gap: 8px; margin: 12px 0; }
#overlap-days label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#pool-form textarea { min-height: 55px; }

#template-picker { display:grid; gap:12px; margin:14px 0; }
#template-picker > label, .template-day-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:7px 0; }
#template-picker select, .template-day-row select { min-width:0; width:58%; }
#template-overlap { margin:14px 0; padding:12px; border:1px solid var(--light); border-radius:10px; }
#shift-pool.is-target { outline:3px dashed #3a8b72; background:#e3f3e9; }

.pool-heading { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; }
.pool-heading > div { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.pool-week { display:grid !important; grid-template-columns:repeat(7,minmax(170px,1fr)); gap:8px; overflow-x:auto; }
.pool-day { min-width:170px; padding:9px; border:1px solid #d1dad5; border-radius:8px; display:flex; flex-direction:column; gap:8px; }
.pool-day-controls { display:flex; flex-wrap:wrap; gap:4px; }
.pool-day-controls select { width:100%; min-width:0; }
.pool-day-controls button, .pool-card-actions button { padding:5px 7px; font-size:12px; }
.pool-day-drop { min-height:95px; border:1px dashed #a8bdb1; border-radius:7px; padding:5px; display:flex; flex-direction:column; gap:6px; }
.pool-day-drop.is-target { outline:3px solid #579c79; background:#e3f3e9; }
.pool-shift { min-width:0; overflow-wrap:anywhere; }
.pool-card-actions { display:flex; flex-wrap:wrap; gap:3px; }
.shift-copy,.shift-paste { font-size:11px; padding:3px 6px; }
@media(max-width:1100px) {.pool-week {grid-template-columns:repeat(7,minmax(175px,1fr));}}
/* Role-separated scheduling and open shifts */
.role-group-row th { padding: 7px 12px; text-align:left; font-weight:700; }
.role-designate { margin-left:16px; padding:3px 9px; font-size:11px; background:#fff; border:1px solid #888; color:#222; }
.role-undesignate { margin-left:8px; padding:1px 5px; font-size:11px; }
.pool-role-heading { font-size:12px; font-weight:700; padding:4px 6px; border-radius:3px; margin-top:6px; }
.pool-role-heading:not(:has(+ .pool-shift)) { opacity:.65; }
.pool-shift { background:#fff1cd; border-color:#d6c5a0; font-size:12px; }
.pool-day { background:#f8faf8; }

.role-settings-row,.employee-role-row{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;padding:.5rem 0;border-bottom:1px solid #ddd}.employee-role-row label{display:inline-flex;align-items:center;gap:.25rem;margin-right:.5rem}#roles-dialog{max-width:850px;width:min(95vw,850px)}

/* Employee published schedule: aligned column headers and shift values. */
.employee-shift-header, #my-shifts .employee-day {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.4fr) minmax(0, .9fr) minmax(0, 2.2fr) minmax(0, 1.65fr);
  gap: 12px;
  align-items: center;
}
.employee-shift-header { border: 1px solid transparent; padding: 12px 16px; color: var(--muted); font-size: .88rem; }
#my-shifts .employee-day > * { min-width: 0; overflow-wrap: anywhere; }
.employee-shift-notes, .employee-shift-events { display: grid; gap: 8px; }
#my-shifts .employee-day > .shift-actions { grid-column: 1 / -1; }
@media (max-width: 680px) {
  .employee-shift-header { display: none; }
  #my-shifts .employee-day { grid-template-columns: 1fr 1fr; gap: 8px; }
  #my-shifts .employee-day > :is(.employee-shift-notes, .employee-shift-events) { grid-column: 1 / -1; }
  .employee-shift-events::before { content: "Events"; font-weight: 700; }
  #my-shifts .employee-day > .employee-shift-notes:not(:empty)::before { content: 'Notes: '; font-weight: 600; }
}

.employee-shift-notes,.schedule-note-preview {white-space:pre-wrap;} .pool-role-heading button {float:right; font-size:.8rem;} .schedule-note-preview {font-size:.85rem; padding:.4rem; border-left:3px solid #9aa; margin:.3rem 0;}
/* Actual schedule notes are distinct from the Open Shifts template notes. */
.actual-schedule-notes { margin: 20px 0 12px; padding: 16px; border: 1px solid #cbd5d1; border-radius: 10px; }
.actual-schedule-notes h2 { margin: 0 0 8px; font-size: 1.2rem; }
.actual-schedule-notes > p { margin: 0 0 12px; }
.actual-notes-grid { display: grid; grid-template-columns: repeat(7,minmax(170px,1fr)); gap: 8px; overflow-x: auto; }
.actual-notes-day { min-width: 170px; padding: 9px; border: 1px solid #dce3df; border-radius: 8px; display: flex; flex-direction: column; gap: 7px; }
.actual-notes-day button { text-align: left; padding: 7px; }
.actual-note-preview { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .85rem; margin: 0 0 6px; }
@media (max-width: 850px) { .actual-notes-grid { grid-template-columns: repeat(7,190px); } }

/* Schedule grid: reveal add controls only when the cell is targeted. */
.employee-schedule-cell > button.add { opacity:0; visibility:hidden; pointer-events:none; transition:opacity 120ms ease; }
.employee-schedule-cell:hover > button.add,
.employee-schedule-cell:focus-within > button.add,
.employee-schedule-cell.is-target > button.add { opacity:1; visibility:visible; pointer-events:auto; }
@media (hover: none), (pointer: coarse) {
  .employee-schedule-cell > button.add { opacity:1; visibility:visible; pointer-events:auto; }
}

/* v19: Compact rows; the hover action overlays empty cells instead of reserving a row. */
#builder td.employee-schedule-cell { height:auto; min-height:0; padding:5px 7px; position:relative; vertical-align:top; }
#builder td.employee-schedule-cell > button.add { position:absolute; inset:0; width:100%; height:100%; min-height:0; margin:0; border:0; border-radius:0; background:rgba(231,244,236,.92); z-index:2; font-size:19px; }
#builder td.employee-schedule-cell:has(.schedule-card) > button.add { display:none!important; }
#builder .schedule-card { margin:2px 0!important; }
@media (hover:none) { #builder td.employee-schedule-cell > button.add { position:relative; min-height:30px; height:30px; background:transparent; border:1px dashed #d5dfd8; } }

/* Compact, touch-friendly action triggers */
.shift-more {font-size:19px!important;line-height:1!important;min-width:27px!important;min-height:32px!important;touch-action:manipulation;}
.empty-cell-more {opacity:0;pointer-events:none;min-width:28px;min-height:30px;}
.employee-schedule-cell:hover .empty-cell-more,.employee-schedule-cell:focus-within .empty-cell-more {opacity:1;pointer-events:auto;}
@media (hover:none),(pointer:coarse) {.empty-cell-more {opacity:1;pointer-events:auto;} .shift-more {min-width:34px!important;min-height:38px!important;}}

/* v21: Empty-cell action controls must not increase employee row height. */
#builder td.employee-schedule-cell { position:relative; height:auto; }
#builder td.employee-schedule-cell > button.empty-cell-more {
  position:absolute; top:4px; right:4px; z-index:3;
  margin:0; width:27px; height:27px; min-height:0; padding:0;
}
/* Keep notices centered, without allocating space for hidden actions. */
#builder td.employee-schedule-cell:not(:has(.schedule-card)) { vertical-align:middle; }
@media (hover:none),(pointer:coarse) {
  #builder td.employee-schedule-cell > button.empty-cell-more { width:32px; height:32px; }
}

/* Day-header personnel totals and hover/touch role breakdown */
#builder thead th { overflow:visible; }
#builder .staff-summary { position:relative; display:inline-block; margin-top:3px; font-weight:normal; }
#builder .staff-summary-trigger { display:flex; align-items:center; gap:4px; border:0; background:transparent; padding:2px 4px; font-size:12px; color:#56615d; cursor:pointer; border-radius:4px; }
#builder .staff-summary-trigger:hover, #builder .staff-summary-trigger:focus-visible { background:#d5e4da; outline-offset:2px; }
#builder .staff-summary-icon { font-size:13px; line-height:1; }
#builder .staff-summary-popup { display:none; position:absolute; z-index:100; top:100%; left:0; min-width:190px; padding:10px 12px; background:white; border:1px solid #cbd8d1; border-radius:8px; box-shadow:0 6px 18px #0002; text-align:left; color:#182b24; font-size:12px; white-space:normal; }
#builder .staff-summary:hover .staff-summary-popup, #builder .staff-summary:focus-within .staff-summary-popup, #builder .staff-summary.is-open .staff-summary-popup { display:block; }
#builder .staff-summary-role { display:flex; justify-content:space-between; gap:14px; margin-top:7px; }
#builder .staff-summary-popup p { margin:7px 0 0; }

/* v47: daily templates only; notes control sits at left under Open shifts. */
.legacy-week-controls { display:none !important; }
.pool-notes-row { display:flex; justify-content:flex-start; margin:4px 0 6px; }
.pool-heading { justify-content:flex-start; }

/* Compact density, v59. Layout-only changes: scheduling actions remain unchanged. */
#sticky-schedule-controls {padding-top:2px!important}
#sticky-schedule-controls .title-row {margin-bottom:2px!important;align-items:center}
#sticky-schedule-controls .title-row h1 {font-size:25px!important;line-height:1.12!important;margin:0!important}
#sticky-schedule-controls .location {font-size:10px!important;margin:0!important}
#sticky-schedule-controls .toolbar {padding:3px 0!important;margin:0!important;min-height:0!important;gap:6px!important}
#sticky-schedule-controls .toolbar button {padding:5px 8px!important;min-height:30px!important;font-size:12px!important}
#sticky-schedule-controls #status:empty {display:none!important}
#sticky-weekdays th {padding:4px 6px!important;font-size:12px!important;line-height:1.2!important}
#sticky-weekdays .staff-summary-trigger {padding:0 3px!important;font-size:11px!important}
#pool-list .pool-day {padding:3px 4px!important}
#pool-list .pool-day-controls {gap:3px!important;margin-bottom:3px!important}
#pool-list .pool-day-controls button,#pool-list .pool-day-controls select {font-size:10px!important;padding:3px 4px!important;min-height:26px!important}
#pool-list .pool-day-notes {min-height:22px!important;padding:3px!important;margin-bottom:4px!important}
#pool-list .pool-day-drop {padding:3px!important}
#pool-list .pool-day .schedule-card,#pool-list .pool-day .pool-shift {min-height:39px!important;margin-bottom:3px!important}
#builder td.employee-schedule-cell {padding:3px 4px!important}
#builder .schedule-card {min-height:40px!important;margin:2px 0!important}
#builder .schedule-card-details {padding:3px 4px!important;gap:0!important}
#builder .pool-shift-abbrev {padding:2px!important}
#builder .builder-employee-row th {padding:4px 5px!important}
.compact-section-toggle {border:1px solid #c9d4ce;border-radius:5px;background:white;color:#173b31;font-size:11px;padding:3px 5px;cursor:pointer;white-space:nowrap}
#pool-list .pool-employee-spacer .compact-section-toggle {display:block;margin-top:3px}
#pool-list.compact-collapsed .pool-day {height:42px!important;min-height:42px!important;overflow:hidden!important}
#pool-list.compact-collapsed .pool-day > * {display:none!important}
#pool-list.compact-collapsed .pool-employee-spacer {min-height:42px!important;padding:4px 6px!important}
#pool-list.compact-collapsed .pool-employee-spacer .pool-grid-label {font-size:12px!important}
#role-overview .compact-role-heading {display:flex;align-items:center;justify-content:space-between;padding:6px 10px;gap:8px}
#role-overview .compact-role-heading h3 {margin:0;font-size:14px}
#role-overview.compact-collapsed .role-overview-table {display:none!important}
#role-overview.compact-collapsed {min-height:0!important;padding:0!important}
/* v60 maximum density, no scheduling behavior changes */
.topbar{padding-top:2px!important;padding-bottom:2px!important;min-height:0!important}
.topbar button,.topbar a{padding:3px 6px!important;min-height:25px!important;font-size:11px!important}
#sticky-schedule-controls{padding:0!important}
#sticky-schedule-controls .title-row{margin:0!important;gap:5px!important}
#sticky-schedule-controls .title-row h1{font-size:19px!important;line-height:1.05!important}
#sticky-schedule-controls .location{display:none!important}
#sticky-schedule-controls .toolbar{padding:1px 0!important;gap:3px!important;row-gap:2px!important}
#sticky-schedule-controls .week-controls{gap:3px!important}
#sticky-schedule-controls .week-controls button,#sticky-schedule-controls .toolbar-actions button,#sticky-schedule-controls #publish{min-height:25px!important;padding:3px 5px!important;font-size:10px!important;line-height:1.15!important}
#sticky-schedule-controls #week-label{font-size:12px!important}
#sticky-weekdays th{padding:2px 3px!important;font-size:11px!important;line-height:1.05!important}
#sticky-weekdays .staff-summary{margin:0!important}
#sticky-weekdays .staff-summary-trigger{font-size:10px!important;padding:0 2px!important;line-height:1!important}
#shift-pool{margin-top:0!important;margin-bottom:2px!important}
#pool-list .pool-employee-spacer{padding:3px!important;gap:2px!important}
#pool-list .pool-grid-label{font-size:12px!important;line-height:1.1!important}
#pool-list .pool-day{padding:2px!important}
#pool-list .pool-day-controls{gap:2px!important;margin:0 0 2px!important}
#pool-list .pool-day-controls button,#pool-list .pool-day-controls select{min-height:23px!important;height:23px!important;font-size:10px!important;padding:1px 3px!important}
#pool-list .pool-day-notes{min-height:21px!important;padding:2px!important;margin:0 0 2px!important;font-size:10px!important}
#pool-list .pool-day-drop{padding:2px!important;min-height:27px!important}
#pool-list .pool-day-drop .pool-drop-hint{font-size:9px!important;margin:0 0 1px!important}
#pool-list .pool-day-drop .pool-shift.schedule-card{min-height:30px!important;margin:1px 0!important}
#pool-list .pool-day-drop .pool-shift.schedule-card .pool-shift-abbrev{font-size:15px!important;flex-basis:24px!important;width:24px!important;min-width:24px!important}
#pool-list .pool-day-drop .pool-shift.schedule-card .schedule-card-details{padding:1px 3px!important}
#pool-list .pool-day-drop .pool-shift.schedule-card .pool-shift-edit{height:24px!important}
#builder td.employee-schedule-cell{padding:1px 2px!important}
#builder .schedule-card{min-height:32px!important;margin:1px 0!important}
#builder .schedule-card-details{padding:2px 3px!important;line-height:1.1!important}
#builder .builder-employee-row th{padding:2px 3px!important;font-size:11px!important;line-height:1.15!important}
#builder .builder-employee-row th small{font-size:9px!important;line-height:1.1!important}
#builder .shift-more{min-height:27px!important}
#role-overview .compact-role-heading{padding:3px 6px!important}
#role-overview .role-overview-table th,#role-overview .role-overview-table td{padding:2px 3px!important}
#role-overview .role-overview-table .schedule-card{min-height:30px!important;margin:1px 0!important}
.compact-section-toggle{font-size:10px!important;min-height:23px!important;padding:2px 4px!important}
#pool-list.compact-collapsed .pool-day,#pool-list.compact-collapsed .pool-employee-spacer{height:29px!important;min-height:29px!important}
#pool-list.compact-collapsed .pool-day>.pool-collapsed-count{display:block!important;text-align:center;font-size:10px!important;font-weight:600;color:#49645a;padding:5px 0!important}
@media(pointer:coarse){#builder .shift-more{min-height:34px!important;min-width:32px!important}.compact-section-toggle{min-height:30px!important}}

/* v61: keep Open shifts expand/collapse anchored beside its label, even when collapsed. */
#pool-list .pool-employee-spacer {
 display:flex!important;flex-direction:row!important;flex-wrap:wrap!important;
 align-content:flex-start!important;align-items:center!important;
 justify-content:space-between!important;column-gap:3px!important;row-gap:2px!important;
 box-sizing:border-box!important;
}
#pool-list .pool-employee-spacer .pool-grid-label {flex:0 1 auto!important;margin:0!important;white-space:nowrap!important}
#pool-list .pool-employee-spacer .compact-section-toggle {display:inline-flex!important;align-items:center!important;justify-content:center!important;flex:0 0 auto!important;margin:0!important}
#pool-list .pool-employee-spacer .pool-main-notes {flex:1 0 100%!important}
#pool-list.compact-collapsed .pool-employee-spacer {
 height:29px!important;min-height:29px!important;max-height:29px!important;
 padding:2px 4px!important;overflow:hidden!important;flex-wrap:nowrap!important;
}
#pool-list.compact-collapsed .pool-employee-spacer .pool-main-notes {display:none!important}
#pool-list.compact-collapsed .pool-employee-spacer .compact-section-toggle {min-height:22px!important;height:22px!important;padding:1px 4px!important}

/* v62: keep collapsed Open Shifts title and toggle on a single visible line. */
#pool-list.compact-collapsed .pool-employee-spacer {
 display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;
 align-items:center!important;justify-content:flex-start!important;
 gap:5px!important;height:34px!important;min-height:34px!important;max-height:34px!important;
 padding:3px 5px!important;overflow:visible!important;
}
#pool-list.compact-collapsed .pool-employee-spacer .pool-grid-label {
 display:inline-block!important;flex:0 1 auto!important;font-size:11px!important;
 line-height:1!important;white-space:nowrap!important;min-width:0!important;
}
#pool-list.compact-collapsed .pool-employee-spacer .compact-section-toggle {
 display:inline-flex!important;flex:0 0 auto!important;position:static!important;
 margin:0!important;padding:2px 4px!important;min-height:23px!important;height:23px!important;
 font-size:10px!important;line-height:1!important;white-space:nowrap!important;
}
#pool-list.compact-collapsed .pool-day {height:34px!important;min-height:34px!important;max-height:34px!important}

/* v63 daily timeline */
.schedule-view-switch{display:flex;gap:4px;align-items:center;margin:2px 0}
.schedule-view-switch button{padding:3px 9px;font-size:11px;min-height:25px}
.schedule-view-switch button[aria-pressed="true"]{background:#315f50;color:white;border-color:#315f50}
.clickable-weekday{cursor:pointer}
.clickable-weekday:hover{background:#d7e7df}
.daily-tools{display:flex;justify-content:space-between;align-items:center;gap:8px 16px;padding:8px 0;flex-wrap:wrap}
.daily-tools strong{font-size:14px}
.daily-tools label{display:flex;align-items:center;gap:6px;font-size:12px}
.daily-tools select,.daily-tools button{font-size:11px;padding:4px 7px;min-height:27px}
.daily-timeline{border:1px solid #cfd9d3;border-radius:7px;min-width:0}
.daily-timeline-header,.daily-employee-row{display:grid;grid-template-columns:clamp(80px, 16vw, 155px) minmax(0, 1fr)}
.daily-timeline-header{position:sticky;top:0;z-index:5;background:#eef2ef}
.daily-name-heading{font-size:11px;font-weight:700;padding:7px;border-right:1px solid #cfd9d3}
.daily-hour-head{display:grid;grid-template-columns:repeat(var(--daily-hours),minmax(0,1fr));container-type:inline-size}
.daily-hour{font-size:10px;text-align:center;border-left:1px solid #d4ddd8;padding:8px 0}
.daily-employee-row{min-height:44px;border-top:1px solid #d7deda}
.daily-employee-label{display:flex;flex-direction:column;justify-content:center;padding:3px 5px;overflow:hidden;font-size:11px}
.daily-employee-label small{font-size:10px;color:#52655c}
.daily-track{position:relative;min-height:43px;background:repeating-linear-gradient(to right,transparent 0,transparent calc(100% / 24 - 1px),#d9dfdc calc(100% / 24 - 1px),#d9dfdc calc(100% / 24));}
.daily-shift-cell{display:block!important;position:absolute;inset:0;min-height:43px!important;padding:0!important;border:0!important;background:transparent!important}
.daily-shift-cell>.schedule-card{position:absolute;top:4px;height:34px!important;min-height:34px!important;overflow:hidden;z-index:2;box-sizing:border-box;margin:0!important}
.daily-shift-cell>.schedule-card .schedule-card-details{overflow:hidden;white-space:nowrap}
.daily-shift-cell>.schedule-card .pool-shift-note{display:none}
.daily-shift-cell>.schedule-card .pool-shift-time{font-size:10px;white-space:nowrap}
.daily-shift-cell>.schedule-card .pool-shift-abbrev{min-width:23px!important;width:23px!important;flex-basis:23px!important;font-size:12px!important}
.daily-shift-cell>.schedule-card .shift-more{margin-left:auto}
.daily-shift-cell>.add,.daily-shift-cell>.empty-cell-more{position:absolute;left:3px;top:8px;z-index:1}
.daily-shift-cell>.empty-cell-more{left:30px}
.daily-shift-cell>.availability-marker,.daily-shift-cell>.time-off-marker{position:absolute;left:65px;top:12px;font-size:10px}
#shift-pool.daily-pool #pool-list{display:grid!important;grid-template-columns:155px minmax(0,1fr)!important}
#shift-pool.daily-pool #pool-list>.pool-day{display:none!important}
#shift-pool.daily-pool #pool-list[data-daily-index="0"]>.pool-day:nth-child(2),
#shift-pool.daily-pool #pool-list[data-daily-index="1"]>.pool-day:nth-child(3),
#shift-pool.daily-pool #pool-list[data-daily-index="2"]>.pool-day:nth-child(4),
#shift-pool.daily-pool #pool-list[data-daily-index="3"]>.pool-day:nth-child(5),
#shift-pool.daily-pool #pool-list[data-daily-index="4"]>.pool-day:nth-child(6),
#shift-pool.daily-pool #pool-list[data-daily-index="5"]>.pool-day:nth-child(7),
#shift-pool.daily-pool #pool-list[data-daily-index="6"]>.pool-day:nth-child(8){display:block!important}
#shift-pool.daily-pool #pool-list>.pool-day .pool-day-drop{display:flex;flex-wrap:wrap;gap:3px}
#shift-pool.daily-pool #pool-list>.pool-day .pool-shift{max-width:200px}

/* v64 daily timeline: open shifts and role overview use the same hour grid. */
.daily-open-section,.daily-role-section{margin:4px 0 7px}
.daily-section-bar{display:flex;align-items:center;gap:9px;padding:3px 6px;border:1px solid #cfd9d3;border-radius:6px;background:#f7faf8;font-size:12px}
.daily-section-bar .compact-section-toggle{position:static!important;transform:none!important;margin:0!important;min-height:23px!important}
.daily-open-timeline,.daily-role-timeline{margin-top:2px}
.daily-open-row{min-height:40px}
.daily-open-row .daily-track{min-height:39px}
.daily-timeline-card{position:absolute!important;top:3px!important;height:33px!important;min-height:33px!important;max-width:none!important;margin:0!important;overflow:hidden;box-sizing:border-box;z-index:2}
.daily-timeline-card .pool-shift-note{display:none}
.daily-timeline-card .schedule-card-details{overflow:hidden;white-space:nowrap}
.daily-timeline-card .pool-shift-time{font-size:10px!important;white-space:nowrap}
.daily-timeline-card .pool-shift-abbrev{min-width:23px!important;width:23px!important;flex-basis:23px!important;font-size:12px!important}
.daily-collapsed-summary,.daily-empty{font-size:11px;padding:5px 10px;border:1px solid #d7deda}
.daily-role-controls{display:flex;justify-content:flex-end;align-items:center;padding:3px 5px;font-size:11px}
.daily-role-controls select{font-size:11px;padding:3px}
.daily-role-group{padding:4px 8px;font-size:11px;font-weight:bold;background:#333;color:white}
.daily-role-time{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:6px}

/* v65: role bands and all daily shift cards match weekly card presentation. */
.daily-role-timeline .daily-role-group {
  grid-column:1 / -1!important;
  display:block!important;
  width:100%!important;
  box-sizing:border-box!important;
  border-left:0!important;
  color:#fff!important;
  background-image:none!important;
  font-weight:700!important;
  padding:4px 10px!important;
}
.daily-role-timeline .daily-timeline-card,
.daily-open-timeline .daily-timeline-card {
  display:flex!important;align-items:stretch!important;
  border:1px solid #cbd8d1!important;
  border-radius:5px!important;
  background:#e8f2ed!important;
  padding:0!important;
}
.daily-open-timeline .daily-timeline-card {background:#fff1ce!important;}
.daily-role-timeline .daily-timeline-card:not(.live) {background:#fce8e8!important;}
.daily-role-timeline .daily-timeline-card .pool-shift-abbrev,
.daily-open-timeline .daily-timeline-card .pool-shift-abbrev {
  display:flex!important;align-items:center!important;justify-content:center!important;
  flex:0 0 24px!important;min-width:24px!important;width:24px!important;
  color:#14241c!important;padding:0!important;margin:0!important;
}
.daily-role-timeline .daily-timeline-card .schedule-card-details,
.daily-open-timeline .daily-timeline-card .schedule-card-details {
  flex:1 1 auto!important;min-width:0!important;display:flex!important;
  flex-direction:column!important;justify-content:center!important;
  padding:2px 5px!important;line-height:1.1!important;
}
.daily-role-timeline .daily-timeline-card .pool-shift-note,
.daily-open-timeline .daily-timeline-card .pool-shift-note {display:block!important;font-size:9px!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;}
.daily-open-timeline .daily-timeline-card .pool-card-actions {margin-left:auto!important;display:flex!important;align-items:center!important;}
.daily-open-timeline .daily-timeline-card .pool-shift-edit {height:27px!important;min-height:27px!important;}

/* v66: shared sticky hours and fully expanded employee list */
.daily-shared-hours{background:#eef2ef}
#daily-sticky-controls .daily-shared-hours .daily-timeline-header{position:static}
#daily-sticky-controls .daily-hour{padding:3px 0;line-height:1.15}
#daily-sticky-controls .daily-hour strong{display:block;font-size:10px}
#daily-sticky-controls .daily-hour-count{display:block;font-size:10px;color:#51645a}
#daily-view .daily-main-timeline .daily-employee-row{min-height:44px}
#daily-view .daily-track{background-size:calc(100% / var(--daily-hours,24)) 100%;background-image:linear-gradient(to right,#d9dfdc 1px,transparent 1px);background-repeat:repeat}
#daily-view .daily-role-timeline .daily-role-group{margin:0}

/* v67 hourly role breakdown: portal escapes sticky-header clipping. */
.daily-hour-with-breakdown{cursor:help}
.daily-hour-with-breakdown:focus-visible{outline:2px solid #2c6756;outline-offset:-2px}
.daily-hour-floating-breakdown{position:fixed;z-index:100000;min-width:175px;max-width:270px;padding:10px 12px;background:#fff;border:1px solid #cbd8d1;border-radius:8px;box-shadow:0 8px 24px #0003;color:#182b24;font-size:12px;text-align:left;pointer-events:none;white-space:normal}
.daily-hour-floating-breakdown[hidden]{display:none!important}
.daily-hour-floating-breakdown .staff-summary-role{display:flex;justify-content:space-between;gap:18px;margin-top:7px}
.daily-hour-floating-breakdown p{margin:7px 0 0}

/* v70: keep role details in the DOM; collapse without rebuilding the daily page. */
#daily-view .daily-role-body[hidden]{display:none!important}
#daily-view .daily-role-error{padding:10px;color:#a21d1d;font-size:12px}

/* v71: the absolute-positioned schedule-cell hit area was covering the role toggle.
   Keep each hit area in its own track stacking context and put section controls above it. */
#daily-view .daily-main-timeline .daily-track { isolation:isolate; }
#daily-view .daily-main-timeline .daily-employee-row { position:relative; }
#daily-view .daily-role-section { position:relative; z-index:20; }
#daily-view .daily-role-section .daily-section-bar { position:relative; z-index:21; }
#daily-view .daily-role-section .compact-section-toggle { position:relative!important; z-index:22; pointer-events:auto!important; }

.task-queue { margin: 3px 0 6px; display: grid; gap: 4px; }
.task-queue-header { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: .75rem; }
.task-queue-header button, .unassigned-task button { padding: 2px 5px; min-height: 22px; font-size: .72rem; }
.unassigned-task { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 3px 5px; border: 1px solid #95b8ac; border-radius: 5px; background: #e7f3ef; color: #193c33; cursor: grab; font-size: .75rem; overflow-wrap: anywhere; }
.unassigned-task button { flex: none; }
.schedule-card.task-drop-target { outline: 2px solid #247258; outline-offset: -2px; }
.shift-task-summary { display: block; color: #204d41; font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.employee-shift-tasks { grid-column: 1 / -1; overflow-wrap: anywhere; }
.employee-shift-tasks ul { margin: 4px 0 0; padding-left: 20px; }
#recurring-tasks-page { width: 100%; max-width: 900px; margin: 20px auto; padding: 20px; box-sizing: border-box; border: 1px solid #d7e0db; border-radius: 12px; background: #fff; }
.recurring-task-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #d7e0db; }
.recurring-task-row div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.recurring-task-row small { display: block; }

#add-task-dialog, #editor { width: min(480px, calc(100vw - 24px)); }
#add-task-date { margin: 4px 0 18px; color: var(--muted); }
.task-title-field { display: grid; gap: 6px; }
.task-title-field input { width: 100%; min-width: 0; }
#add-task-error:not(:empty), #editor-error:not(:empty) { margin-top: 10px; overflow-wrap: anywhere; }
#shift-form .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#shift-form .shift-notes-field { grid-column: 1 / -1; }
.shift-notes-field textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #c8d3cc;
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  color: inherit;
}
.shift-task-editor {
  min-width: 0;
  margin: 12px 0;
  padding: 6px 10px 10px;
  border: 1px solid #c8d3cc;
  border-radius: 8px;
  background: #f7faf8;
}
.shift-task-editor legend { padding: 0 5px; font-weight: 650; }
#shift-task-options { padding: 4px; display: grid; gap: 3px; max-height: 160px; overflow: auto; }
#shift-task-options label.check-option, .check-option {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 30px;
  padding: 4px 5px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
.check-option:hover { background: #eaf2ed; }
.check-option input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-height: 0;
  padding: 0;
  margin: 0;
  accent-color: var(--green);
}
#add-task-dialog .dialog-actions, #editor .dialog-actions { flex-wrap: wrap; }
#template-form > label, .template-shift-mode { display: grid; gap: 5px; margin: 9px 0; }
.recurrence-interval { display: flex; align-items: center; gap: 8px; }
.recurrence-interval input { width: 90px; }
#recurring-task-form .fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
#recurring-task-form .fields > label { min-width: 0; }
@media (max-width: 360px) {
  #shift-form .fields { grid-template-columns: 1fr; }
}
#save-open-template-dialog { width: min(520px, calc(100vw - 24px)); }
#template-form > label select, .template-shift-mode select { min-width: 0; width: 100%; }
#save-open-template-scope { margin: 6px 0 14px; color: var(--muted); }
#template-load-error:not(:empty) { margin-bottom: 10px; overflow-wrap: anywhere; }

#daily-sticky-controls { padding-top: 6px; }
.daily-tool-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.daily-tool-group select { max-width: 100%; }
#daily-view .daily-open-section {
  margin: 12px 0 16px;
  border-radius: 10px;
  background: #eef5f0;
  box-shadow: inset 0 0 0 1px #9bb8aa;
}
.daily-open-section > .daily-section-bar {
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid #9bb8aa;
  border-radius: 10px 10px 0 0;
  background: #dcebe2;
}
.daily-open-section h2 { font-size: 14px; }
.daily-pool-controls {
  display: grid;
  gap: 4px;
  padding: 8px 12px;
}
.daily-pool-controls .pool-day-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.daily-pool-controls .pool-day-controls select {
  width: min(36vw, 420px);
  min-width: min(120px, 100%);
}
.daily-pool-controls .pool-day-controls > * {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 12px;
}
.daily-pool-controls .task-queue {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}
.daily-pool-controls .task-queue-header {
  grid-column: 1 / -1;
  justify-content: flex-start;
}
.daily-pool-controls .unassigned-task > span { min-width: 0; }
@media (max-width: 850px) {
  .daily-pool-controls .task-queue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .daily-pool-controls .task-queue { grid-template-columns: minmax(0, 1fr); }
}
.daily-open-section > .daily-open-timeline {
  margin: 0;
  border-color: #9bb8aa;
  border-radius: 0 0 10px 10px;
}
#daily-view .daily-employee-label small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#daily-view .schedule-card { container-type: inline-size; }
#daily-view .schedule-card .pool-shift-time {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@container (max-width: 85px) {
  #daily-view .schedule-card .pool-card-actions, #daily-view .schedule-card .shift-more {
    display: none !important;
  }
}
@container (max-width: 55px) {
  #daily-view .schedule-card .pool-shift-abbrev { display: none !important; }
}

@media (max-height: 580px) {
  #sticky-schedule-controls:has(#daily-sticky-controls:not([hidden])) { position: static; }
}

/* Keep the grid intact at narrow widths and thin the visible labels only. */
@container (max-width: 760px) {
  .daily-hour-head:is([data-hour-count="20"],[data-hour-count="21"],[data-hour-count="22"],[data-hour-count="23"],[data-hour-count="24"]) .daily-hour:nth-child(even) > * { visibility: hidden; }
}
@container (max-width: 520px) {
  .daily-hour-head .daily-hour:nth-child(even) > * { visibility: hidden; }
}
@container (max-width: 330px) {
  .daily-hour-head .daily-hour:nth-child(n) > .daily-hour-count { visibility: hidden; }
  .daily-hour-head .daily-hour:nth-child(n) > strong { visibility: hidden; }
  .daily-hour-head .daily-hour:nth-child(4n + 1) > strong { visibility: visible; }
}

#template-list { display: grid; gap: 6px; max-height: 230px; overflow-y: auto; padding: 4px; }
.saved-template-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--light);
  border-radius: 8px;
  padding: 7px 10px;
}
.saved-template-row div { min-width: 0; overflow-wrap: anywhere; }
.saved-template-row small { display: block; color: var(--muted); }
.template-weekday-field { display: grid; gap: 5px; margin: 12px 0; }

#schedule-events {
  display:grid;
  grid-template-columns:142px repeat(7,minmax(0,1fr));
  border:1px solid #cbd9d3;
  border-radius:8px;
  background:#f8fbfa;
  margin:6px 0;
}
#schedule-events.event-row-daily { grid-template-columns:clamp(80px,16vw,155px) minmax(0,1fr); }
.event-row-title { padding:10px 8px; font-size:12px; }
.calendar-event-day { min-width:0; border-left:1px solid #e0e9e4; padding:4px; display:grid; gap:3px; align-content:start; }
.calendar-event { display:flex; align-items:center; gap:5px; width:100%; min-width:0; min-height:26px; padding:3px 6px; background:#e2f1eb; border-color:#b7d7ca; text-align:left; font-size:11px; }
.calendar-event span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.calendar-event small { flex:none; font-size:10px; }
.calendar-more { justify-self:start; min-height:23px; padding:2px 5px; font-size:10px; }
.event-row-error { grid-column:1 / -1; padding:6px 10px; font-size:12px; overflow-wrap:anywhere; }
.calendar-source { display:flex; align-items:center; justify-content:space-between; gap:8px; border-top:1px solid var(--light); padding:8px 0; }
.calendar-source span,#event-title,#calendar-feedback,#event-description { overflow-wrap:anywhere; }
#calendar-feedback,#event-time,#event-description { margin:10px 0; }
#event-description { white-space:pre-wrap; }
#event-attachments { padding-left:20px; }
#event-attachments:empty,#event-description:empty,#event-time:empty { display:none; }
#event-day-list { display:grid; gap:5px; }
@media (max-width:700px) {
  #schedule-events:not(.event-row-daily) { grid-template-columns:repeat(7,minmax(0,1fr)); }
  #schedule-events:not(.event-row-daily) .event-row-title { grid-column:1 / -1; }
  .calendar-event { flex-wrap:wrap; }
}

.employee-event-title { padding: 6px 8px; min-height: 30px; text-align: left; overflow-wrap: anywhere; background: #e2f1eb; border-color: #b7d7ca; }

#daily-view .schedule-card[hidden] { display: none !important; }
#daily-view .schedule-card.ends-after-midnight { border-right: 3px solid #397967 !important; }
.overnight-indicator { color: #225e4b; }
#shift-end-hint { color: var(--muted); }

.clickable-weekday { cursor: pointer; }
.clickable-weekday:hover { background: #dfebe4; }
.weekday-open {
  display: block;
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-align: left;
}
.clickable-weekday:hover .weekday-open { text-decoration: underline; }
