/* Roster app — app-specific only (Tailwind is in tailwind.min.css) */

.worker-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  flex-shrink: 0;
  font-size: 11px;
  line-height: 1;
  letter-spacing: -1px;
  color: #94a3b8;
  cursor: grab;
  user-select: none;
}
.worker-col-drag { cursor: grab; }
body.worker-row-dragging,
body.worker-row-dragging * { cursor: grabbing !important; user-select: none !important; }
tr.worker-row-source { opacity: 0.4; }
tr.worker-drop-before td { box-shadow: inset 0 3px 0 0 #2563eb; }
tr.worker-drop-after td { box-shadow: inset 0 -3px 0 0 #2563eb; }
#worker-row-ghost {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#worker-row-ghost.hidden { display: none !important; }

.bf-drag-handle { width: 16px; cursor: grab; }
body.bf-row-dragging,
body.bf-row-dragging * { cursor: grabbing !important; user-select: none !important; }
.bf-list-row.bf-row-source { opacity: 0.4; }
.bf-list-row.bf-drop-before { box-shadow: inset 0 3px 0 0 #2563eb; }
.bf-list-row.bf-drop-after { box-shadow: inset 0 -3px 0 0 #2563eb; }
#bf-row-ghost {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#bf-row-ghost.hidden { display: none !important; }

.roster-table th.totals-col-drag,
.roster-table td.totals-col-drag { cursor: grab; }
body.bf-col-dragging,
body.bf-col-dragging * { cursor: grabbing !important; user-select: none !important; }
.roster-table .totals-col.bf-col-source { opacity: 0.35; }
.roster-table .totals-col.bf-col-drop-before { box-shadow: inset 3px 0 0 0 #2563eb; }
.roster-table .totals-col.bf-col-drop-after { box-shadow: inset -3px 0 0 0 #2563eb; }
#bf-col-ghost {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#bf-col-ghost.hidden { display: none !important; }

/* Help page */
.help-h { font-size: 1.15rem; font-weight: 700; color: #0f172a; margin: 0 0 0.75rem; }
.help-h2 { font-size: 0.95rem; font-weight: 700; color: #334155; margin: 1.25rem 0 0.5rem; }
.help-ul, .help-ol { margin: 0.4rem 0 0.8rem 1.2rem; }
.help-ul li, .help-ol li { margin: 0.28rem 0; }
.help-fig { margin: 0.75rem 0 1.1rem; }
.help-fig figcaption { font-size: 12px; color: #64748b; margin-top: 0.4rem; }
.help-shot {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px;
  overflow: auto;
}
.hs-topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px;
  font-size: 11px;
}
.hs-user { font-weight: 700; margin-right: 8px; line-height: 1.15; }
.hs-tab { padding: 4px 8px; border-radius: 6px; background: #f1f5f9; color: #475569; }
.hs-tab.on { background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,0.08); font-weight: 600; }
.hs-spacer { flex: 1; }
.hs-card { text-align: center; padding: 16px; background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; }
.hs-icon { font-size: 28px; margin-bottom: 6px; }
.hs-title { font-weight: 700; }
.hs-sub { font-size: 11px; color: #64748b; margin: 4px 0 10px; }
.hs-btn { display: inline-block; background: #0f172a; color: #fff; font-size: 12px; padding: 6px 12px; border-radius: 8px; }
.hs-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.hs-chip { font-size: 11px; padding: 4px 8px; border-radius: 8px; background: #e2e8f0; }
.hs-chip.on { background: #0284c7; color: #fff; }
.hs-palette { display: flex; flex-wrap: wrap; gap: 4px; }
.hs-grid { display: grid; gap: 2px; font-size: 11px; }
.hs-row { display: flex; align-items: stretch; gap: 2px; }
.hs-head { font-weight: 700; color: #64748b; }
.hs-name { width: 88px; flex-shrink: 0; background: #e2e8f0; padding: 6px 8px; border-radius: 4px; font-weight: 600; }
.hs-cell {
  width: 36px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; font-weight: 700; color: #000;
}
.hs-d { background: #93c5fd; }
.hs-n { background: #c4b5fd; }
.hs-dw { background: #86efac; }
.hs-al { background: #fde68a; }
.hs-armed { outline: 3px solid #000; }
.hs-sel { outline: 2px solid #2563eb; outline-offset: -2px; }
.hs-hl { background: rgba(100,116,139,0.18); border-radius: 6px; padding: 2px; }
.hs-grip { letter-spacing: 0; color: #64748b; }
.hs-ghost { opacity: 0.45; }
.hs-drop { height: 3px; background: #2563eb; border-radius: 2px; margin: 2px 0 2px 88px; }
.hs-cal { display: flex; gap: 4px; }
.hs-cal-d {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; background: #fff; border: 1px solid #e2e8f0; font-size: 12px;
}
.hs-cal-work { background: #dcfce7; }
.hs-cal-leave { background: #fef08a; }
.hs-rules { display: flex; flex-wrap: wrap; gap: 16px; }
#help-panel kbd {
  font-size: 11px; padding: 1px 5px; background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 4px; font-family: ui-monospace, monospace;
}
.help-callout {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 0.6rem 0 1rem;
}
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 0.5rem 0 1rem;
  background: #fff;
}
.help-table th, .help-table td {
  border: 1px solid #e2e8f0;
  padding: 6px 8px;
  text-align: left;
}
.help-table th { background: #f1f5f9; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: #64748b; }
.help-group {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
  padding: 10px 8px 4px;
  margin: 0;
}
.hs-banner {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #78350f;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
}
.hs-beforeafter { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.hs-caption { font-size: 10px; font-weight: 700; text-transform: uppercase; color: #64748b; margin-bottom: 4px; }
.hs-menu {
  width: 14rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  box-shadow: 0 8px 20px rgba(15,23,42,0.08); padding: 6px 0; font-size: 13px;
}
.hs-menu-item { padding: 6px 12px; }
.hs-menu-item.on { background: #f1f5f9; font-weight: 600; }
.hs-menu-sep { height: 1px; background: #e2e8f0; margin: 4px 0; }
.hs-sl { background: #fda4af; }

.view-hidden { display: none !important; }
.rules-engine-collapsed { display: none !important; }

.log-cat {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
}
.log-cat:hover { filter: brightness(0.94); }
.log-cat-shift { background: #e0f2fe; color: #0369a1; }
.log-cat-profile { background: #ede9fe; color: #6d28d9; }
.log-cat-roster { background: #dcfce7; color: #166534; }
.log-cat-leave { background: #fef9c3; color: #854d0e; }
.log-cat-hours { background: #ffedd5; color: #9a3412; }
.log-cat-config { background: #e2e8f0; color: #334155; }

/* Tools / Reporting / Data dropdowns */
.tools-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  min-width: 14rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  z-index: 60;
  padding: 0.35rem 0;
}
.tools-dropdown.open { display: block !important; }
.tools-dd-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  color: #334155;
  background: transparent;
  border: none;
  cursor: pointer;
}
.tools-dd-item:hover { background: #f1f5f9; }
.tools-dd-sep {
  height: 1px;
  background: #e2e8f0;
  margin: 0.3rem 0;
}

/* Legend */
#roster-legend-bar .legend-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #000;
  margin-right: 0.35rem;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.22);
  white-space: nowrap;
}
#roster-legend-bar .legend-swatch { display: none; }
#roster-legend-bar .legend-text {
  color: #000;
  font-weight: 700;
}

.app-color-picker { min-width: 12rem; }
.app-swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 9.5rem;
  overflow-y: auto;
}
.app-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.28);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.app-swatch:hover { transform: scale(1.12); }
.app-swatch-on {
  outline: 2px solid #0f172a;
  outline-offset: 1px;
}

.today-col { background-color: #e0f2fe !important; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 9999;
}

/* Modal: centered, constrained, draggable + resizable */
#modal-backdrop {
  /* keep Tailwind flex centering; panel itself is sized */
}
#modal-panel {
  position: relative;
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#modal-panel > .overflow-y-auto {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* After user resize: inner scroll regions grow with the modal */
#modal-panel.modal-resized #modal-body .overflow-y-auto,
#modal-panel.modal-resized #modal-body .overflow-auto,
#modal-panel.modal-resized #modal-body [class*="max-h-"] {
  max-height: none !important;
}
#modal-panel.modal-moved {
  position: fixed;
  margin: 0;
  /* left/top set by JS */
}
#modal-drag-bar {
  cursor: move;
  user-select: none;
  touch-action: none;
}
#modal-drag-bar button {
  cursor: pointer;
}
#modal-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 5;
  background:
    linear-gradient(135deg, transparent 50%, #94a3b8 50%) no-repeat,
    linear-gradient(135deg, transparent 60%, #cbd5e1 60%) no-repeat;
  background-position: right 3px bottom 3px, right 7px bottom 7px;
  background-size: 10px 10px, 6px 6px;
  border-bottom-right-radius: 1rem;
  opacity: 0.85;
}
#modal-resize-handle:hover { opacity: 1; }
#modal-panel.is-resizing,
#modal-panel.is-dragging {
  user-select: none;
}

/* Tools menu section headings */
.tools-dd-heading {
  padding: 0.35rem 0.9rem 0.15rem;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* Paint-armed roster cursor */
body.paint-armed #roster-grid-card,
body.paint-armed #roster-grid-card td[data-date] {
  cursor: cell;
}
body.paint-armed #roster-grid-card td[data-date]:hover {
  outline: 2px solid rgba(14, 165, 233, 0.55);
  outline-offset: -2px;
}

/* Stronger today column */
.today-col {
  background-color: #bae6fd !important;
  box-shadow: inset 0 -3px 0 #0284c7;
}
th.today-col {
  font-weight: 700;
  color: #0c4a6e;
}

/* Session-only row highlight (double-click name). Not saved, not shared. */
tr.worker-row-hl td {
  position: relative;
}
tr.worker-row-hl td::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(100, 116, 139, 0.16);
  pointer-events: none;
  z-index: 3;
}
tr.worker-row-hl td.worker-col {
  background-color: #d8dee8 !important;
  box-shadow: 3px 0 8px -4px rgba(15, 23, 42, 0.18);
}

/* Subtler region banding */

/* Roster cell type scale */
.roster-cell-code {
  font-weight: 700;
  font-size: 11px;
  line-height: 1.15;
}
.roster-cell-meta {
  font-size: 9px;
  line-height: 1.1;
  opacity: 0.85;
}

/* Sticky cover outcome legend */
.cover-outcome-legend-sticky {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fff;
  padding: 0.35rem 0 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
}

/* Sick step indicator */
.sick-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.sick-step {
  flex: 1;
  min-width: 7rem;
  text-align: center;
  padding: 0.4rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.sick-step.active {
  background: #fffbeb;
  color: #92400e;
  border-color: #fcd34d;
}
.sick-step.done {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

/* Mode chip hidden — selected paint tool uses black outline on the palette button */
#mode-chip { display: none !important; }

/* Floating paint palette (pop out) — no backdrop so the grid stays clickable */
#paint-float {
  position: fixed;
  z-index: 45;
  width: 22rem;
  max-width: calc(100vw - 1.5rem);
  max-height: 70vh;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#paint-float.hidden { display: none !important; }
#paint-float-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}
#paint-float-title {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}
#paint-float-bar button {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  cursor: pointer;
}
#paint-float-bar button:hover { background: #f1f5f9; }
#paint-float-bar .paint-float-x {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  font-size: 12px;
}
#paint-float-body {
  overflow-y: auto;
  padding: 10px;
  min-height: 0;
  flex: 1 1 auto;
}

/* Status strip kbd */
#keyboard-help kbd {
  font-family: ui-monospace, monospace;
}


/* Modal content breathing room — avoid controls flush to edges */
#modal-panel .px-7,
#modal-panel > div.overflow-y-auto {
  padding-left: 1.75rem;
  padding-right: 1.75rem;
  padding-bottom: 1.5rem;
}
#modal-body {
  padding-bottom: 0.5rem;
}
#modal-body > :last-child {
  margin-bottom: 0.25rem;
}
#modal-resize-handle {
  margin: 0;
}

/* Fill the modal so inner lists scroll instead of stretching the panel */
#modal-body.modal-body-fill {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}
#modal-body.modal-body-fill > :last-child {
  margin-bottom: 0;
}

.sl-editor,
.legend-creator {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 0.6rem;
}

.legend-creator-help {
  flex: 0 0 auto;
  font-size: 13px;
  color: #475569;
  margin: 0;
}
.legend-preview-wrap {
  flex: 0 0 auto;
  max-height: 7.25rem;
  overflow: auto;
  padding: 0.4rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.6rem;
  background: #fff;
}
.legend-creator-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 0.75rem;
}
.legend-list-col,
.legend-palette-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #f8fafc;
}
.legend-list-col { flex: 1 1 auto; min-width: 0; }
.legend-palette-col { flex: 0 0 16.5rem; width: 16.5rem; padding: 0.65rem; overflow: auto; background: #f8fafc; }
.legend-col-head {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  padding: 0.4rem 0.7rem;
  margin: 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.legend-palette-col .legend-col-head {
  padding: 0 0 0.35rem;
  border-bottom: none;
  background: transparent;
}
#legend-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem;
}
.legend-add-custom {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}
.legend-creator-footer {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e2e8f0;
}

.legend-edit-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.45rem;
  margin-bottom: 0.35rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
}
.legend-edit-row.is-selected {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 2px rgba(14,165,233,0.35);
  background: #f0f9ff;
}
.legend-edit-row .leg-row-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid #94a3b8;
  flex-shrink: 0;
}
.legend-edit-row .leg-item-label {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 13px;
  font-weight: 600;
}
.legend-edit-row .leg-remove-btn {
  flex-shrink: 0;
  font-size: 12px;
  color: #dc2626;
  border: 1px solid #fecaca;
  background: #fff;
  border-radius: 0.4rem;
  padding: 0.25rem 0.5rem;
}
.legend-edit-row .leg-remove-btn:hover { background: #fef2f2; }
.legend-edit-row .leg-move {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}
.legend-edit-row .leg-move button {
  font-size: 10px;
  line-height: 1;
  padding: 1px 5px;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  background: #fff;
}
