body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: 880px;
  margin: 2rem auto;
  padding: 0 1rem;
  color: #1a1a1a;
}

header h1 {
  margin-bottom: 0.25rem;
}

.muted {
  color: #666;
}

.panel {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.field-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  gap: 0.25rem;
}

input,
select,
textarea {
  padding: 0.4rem;
  font-size: 0.95rem;
  font-family: inherit;
}

textarea {
  width: 100%;
  box-sizing: border-box;
}

code {
  background: #f3f3f3;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  word-break: break-all;
}

.grid-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.availability-grid {
  display: grid;
  gap: 1px;
  background: #ddd;
  border: 1px solid #ddd;
  user-select: none;
  margin-bottom: 0.5rem;
  max-height: 480px;
  overflow-y: auto;
}

.grid-day-header {
  background: #fafafa;
  font-size: 0.75rem;
  text-align: center;
  padding: 0.3rem 0.1rem;
  position: sticky;
  top: 0;
}

.grid-time-label {
  background: #fff;
  font-size: 0.7rem;
  color: #666;
  padding: 0 0.3rem;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.grid-cell {
  /* background-color only — backgroundImage is set by JS for trend overlays
     without the shorthand resetting both layers at once */
  background-color: #fff;
  height: 16px;
  cursor: pointer;
}

.grid-cell:hover {
  /* box-shadow tint sits above backgroundImage so the trend colour shows through */
  box-shadow: inset 0 0 0 2000px rgba(37, 99, 235, 0.1);
}

.grid-cell.selected {
  /* shorthand clears backgroundImage so the user's selection is always visible */
  background: #2563eb;
  box-shadow: none;
}

.grid-cell.too-short {
  background: #dc2626;
  box-shadow: none;
}

#grid-selection-summary.warning {
  color: #dc2626;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #eee;
}

button {
  cursor: pointer;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 1px solid #888;
  background: #fff;
}

button.primary {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-actions,
.modal-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.hidden,
.hidden {
  display: none;
}

.modal {
  background: #fff;
  padding: 1.5rem;
  border-radius: 10px;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.group-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.group-card h3 {
  margin: 0 0 0.4rem;
}

.excluded-list {
  color: #a33;
  margin-top: 0.75rem;
}

.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: #1a1a1a;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  z-index: 10;
}

.override-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

#availability-legend {
  margin-top: 0.75rem;
}

.legend-label {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.plan-selector-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.plan-selector-row select {
  font-size: 0.9rem;
}

.avail-details-content {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.avail-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.avail-detail-row .legend-swatch {
  margin-top: 0.2rem;
}

.avail-block-text {
  color: #444;
  margin-top: 0.1rem;
}
