/* ── Rules Modal Grid Layout ───────────────────────────────────────– */
.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.rules-grid .rule-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rules-grid .rule-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.rules-grid .rule-field input[type="number"] {
  width: 100%;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
}

.rules-grid .rule-field input[type="number"]:focus {
  border-color: var(--primary);
}

.rules-grid .rule-field.full-width {
  grid-column: 1 / -1;
}

.rule-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.rule-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.rule-toggle span {
  font-size: 0.88rem;
  color: var(--text);
}

.rules-desc {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 1px;
}

/* ── Rules modal tabs (Phase 12 M12-5) ─────────────────────────────–
   Deliberately NOT reusing .shifts-tab: renderShiftsTabs() binds handlers with
   a document-wide querySelectorAll('.shifts-tab'), so sharing the class would
   silently wire the shift-config tab logic onto the rules modal. */
.rules-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 14px;
}

.rules-tab {
  padding: 7px 16px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.rules-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.rules-section { display: none; }
.rules-section.active { display: block; }

/* Group heading inside the 12h panel */
.rules-group {
  grid-column: 1 / -1;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin: 12px 0 2px;
}
.rules-group:first-child { margin-top: 0; }

/* Derived read-out / notices. Colour carries no information on its own — each
   state also carries a text prefix, for colour-vision accessibility. */
.rules-note {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-alt, rgba(127,127,127,0.06));
  color: var(--text);
}
.rules-note.info  { border-color: var(--primary); }
.rules-note.warn  { border-color: #d97706; }
.rules-note.error { border-color: #dc2626; }
.rules-note b { font-weight: 700; }

.rules-mode-banner {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  padding: 9px 11px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  color: var(--muted);
  margin-bottom: 4px;
}

/* ── Shifts Configuration Modal ────────────────────────────────────– */
.shifts-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 14px;
}

.shifts-tab {
  padding: 7px 16px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.shifts-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.shifts-section {
  display: none;
}

.shifts-section.active {
  display: block;
}

.shifts-list {
  margin-bottom: 10px;
  max-height: 180px;
  overflow-y: auto;
}

.shift-row {
  display: grid;
  grid-template-columns: 60px 1fr 70px 28px 28px;
  gap: 6px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.shift-row:last-child {
  border-bottom: none;
}

.shift-row input {
  padding: 4px 7px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.8rem;
  outline: none;
  width: 100%;
}

.shift-row input:focus {
  border-color: var(--primary);
}

.shift-row input[readonly] {
  background: var(--bg);
  color: var(--muted);
  cursor: default;
}

.shift-row-code {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text);
  padding: 4px 7px;
  background: var(--bg);
  border-radius: 5px;
  text-align: center;
}

.shift-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.shift-color-swatch:hover {
  border-color: var(--primary);
}

.color-picker-popup {
  display: none;
  position: absolute;
  top: 28px;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 600;
  width: 180px;
}

.color-picker-popup.open {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}

.color-swatch-opt {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 2px solid transparent;
}

.color-swatch-opt:hover {
  border-color: var(--primary);
  transform: scale(1.1);
}

.shift-del-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
}

.shift-del-btn:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* Reorder controls. Stacked vertically so the whole column costs 22px — the
   .shift-row grid columns are set inline from JS and cannot be restacked by
   07-responsive.css, so horizontal budget is tight on narrow screens. */
.shift-move {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.shift-move-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.5rem;
  line-height: 1;
  padding: 2px 0;
  border-radius: var(--radius-xs);
}

.shift-move-btn:hover:not(:disabled) {
  color: var(--primary);
  background: var(--bg);
}

.shift-move-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.clinic-enabled-chk {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
  justify-self: center;
}

.shifts-add-form {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-top: 6px;
}

.shifts-add-form h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.shifts-add-row {
  display: grid;
  gap: 6px;
  align-items: end;
  margin-bottom: 6px;
}

.shifts-add-row.row4 {
  grid-template-columns: 70px 1fr 70px 28px;
}

.shifts-add-row.row5 {
  grid-template-columns: 70px 1fr 70px 52px 28px;
}

.shifts-add-row label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.shifts-add-row input {
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.82rem;
  outline: none;
  width: 100%;
}

.shifts-add-row input:focus {
  border-color: var(--primary);
}

.btn-shift-add {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-shift-add:hover {
  background: var(--primary-dark);
}

.dc-edit-row {
  display: grid;
  grid-template-columns: 60px 1fr 70px 28px;
  gap: 6px;
  align-items: center;
  padding: 6px 0;
  font-size: 0.82rem;
}

.dc-edit-row label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.dc-edit-row input {
  padding: 4px 7px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.8rem;
  outline: none;
  width: 100%;
}

.dc-note {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Notifications Panel ────────────────────────────────────────────– */
#btn-notif {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1;
}

#btn-notif:hover {
  background: var(--hl);
}

#notif-badge {
  display: none;
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 700;
  border-radius: 9px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  line-height: 1.3;
}

.notif-subhead {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 14px 0 4px;
}

.notif-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-top: 6px;
  font-size: 0.83rem;
}

.notif-item.unread {
  background: var(--hl);
  border-left: 3px solid var(--primary);
}

.notif-time {
  color: var(--muted);
  font-size: 0.72rem;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.notif-empty {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 6px 0;
}

.notif-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-accept {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-accept:hover {
  filter: brightness(1.08);
}

.btn-decline {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-decline:hover {
  background: var(--danger-soft);
}

/* Phase 12 M12-7: an allowed rule breach in the conflicts drawer. Left border
   only, so it reads as a variant of .conflict-item rather than a new component
   (radius stays 0 — rounded corners need a full border). */
.conflict-item.breach-item {
  border-left: 3px solid #d97706;
  border-radius: 0;
  padding-left: 8px;
}
