.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
}

.btn:active { opacity: 0.85; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  width: 100%;
  margin-top: 8px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.month-nav h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.calendar-widget-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-widget-toolbar .calendar-view-toggle {
  flex: 1 1 auto;
  justify-content: flex-start;
  margin-bottom: 0;
}

.calendar-options-anchor {
  position: relative;
  flex: 0 0 auto;
}

.calendar-gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  color: var(--text-dim);
}

.calendar-gear-btn:hover,
.calendar-gear-btn:focus-visible,
.calendar-gear-btn.active {
  background: var(--bg);
  color: var(--text);
}

.calendar-gear-icon {
  display: block;
  flex-shrink: 0;
}

.calendar-options-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: min(100%, 320px);
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 20;
}

.calendar-options-menu .calendar-option-row:last-child .calendar-view-toggle {
  margin-bottom: 0;
}

.calendar-view-toggle {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 12px;
}

.calendar-option-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-option-row .calendar-view-toggle {
  margin-bottom: 0;
}

.calendar-option-label {
  font-size: 11px;
  color: var(--text-muted);
  cursor: help;
  border-bottom: 1px dotted currentColor;
  flex: 0 0 auto;
}

.term-with-tip {
  cursor: help;
  border-bottom: 1px dotted currentColor;
}

.legend-item[title] {
  cursor: help;
}

.tab-dashboard-header .page-range-toggle {
  flex: 1 1 auto;
  justify-content: center;
  margin-bottom: 0;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
}

.cal-weekday {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0;
}

.calendar-week {
  grid-template-columns: repeat(7, 1fr);
}

.calendar-week .cal-day {
  font-size: 12px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 2px solid transparent;
  min-height: 44px;
}

.cal-day.empty {
  visibility: hidden;
  pointer-events: none;
}

.cal-day .peak {
  font-size: 10px;
  opacity: 0.9;
  margin-top: 2px;
  cursor: help;
}

.cal-day.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.cal-day.rating-no-data { background: rgba(91, 155, 213, 0.25); color: var(--rating-no-data); }
.cal-day.rating-low { background: rgba(183, 148, 246, 0.25); color: var(--rating-low); }
.cal-day.rating-good { background: rgba(61, 214, 140, 0.25); color: var(--rating-good); }
.cal-day.rating-elevated { background: rgba(245, 158, 66, 0.25); color: var(--rating-elevated); }
.cal-day.rating-high { background: rgba(255, 107, 107, 0.25); color: var(--rating-high); }

.notes-calendar .cal-day {
  background: rgba(91, 155, 213, 0.12);
  color: var(--text);
}

.notes-calendar .cal-day.has-note {
  background: rgba(61, 214, 140, 0.22);
  color: var(--rating-good);
}

.notes-calendar .cal-day.has-note::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  margin-top: 2px;
}

.feedback-calendar .cal-day {
  background: rgba(61, 214, 140, 0.08);
  color: var(--text-dim);
  font-size: 11px;
  min-height: 36px;
  border-radius: 4px;
}

.feedback-calendar .cal-day.future {
  opacity: 0.35;
  pointer-events: none;
}

.feedback-calendar .cal-day.heat-1 {
  background: rgba(61, 214, 140, 0.28);
  color: var(--text);
}

.feedback-calendar .cal-day.heat-2 {
  background: rgba(61, 214, 140, 0.48);
  color: var(--text);
}

.feedback-calendar .cal-day.heat-3 {
  background: rgba(61, 214, 140, 0.68);
  color: var(--bg);
}

.feedback-calendar .cal-day.heat-4 {
  background: rgba(61, 214, 140, 0.88);
  color: var(--bg);
}

#feedback-day-title {
  margin: 4px 0 10px;
}

.notes-editor {
  width: 100%;
  margin-top: 8px;
  line-height: 1.45;
  resize: vertical;
  min-height: 140px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

