/* Calendar month grid (public/calendar.html). Screen-only interactive view.
 * All colors come from the ovg.css :root tokens so every chip reuses the
 * WCAG-AA-verified status pairs (success/warning/danger + navy neutral).
 * Zero inline styles — CSP style-src 'self'. Prefix: cal-. */

.cal-page {
  max-width: 980px;
}

.topbar-link[aria-current="page"] {
  background: rgba(255, 255, 255, 0.16);
  text-decoration: underline;
}

/* ---------- toolbar ---------- */

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cal-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cal-month {
  font-size: 19px;
  margin: 0;
  flex: 1 1 auto;
  text-align: center;
  min-width: 160px;
}

.cal-view {
  display: flex;
  gap: 6px;
}

.cal-view-btn[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.cal-count {
  margin: 12px 0 0;
  font-size: 13px;
}

/* ---------- legend ---------- */

.cal-legend {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.cal-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border-navy-strong);
  flex: 0 0 auto;
}

/* ---------- weekday header ---------- */

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 5px;
}

.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 4px 0;
}

/* ---------- grid ---------- */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.cal-day {
  background: #fff;
  border: 1px solid var(--border-navy);
  border-radius: 8px;
  min-height: 98px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cal-day--pad {
  background: rgba(28, 53, 94, 0.03);
  border-style: dashed;
}

.cal-day--today {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(203, 154, 51, 0.35);
}

.cal-day-num {
  align-self: flex-start;
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
  text-decoration: none;
  border-radius: 6px;
  padding: 3px 7px;
  min-width: 26px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-day-num:hover,
.cal-day-num:focus-visible {
  background: rgba(28, 53, 94, 0.08);
  text-decoration: underline;
}

.cal-day--today .cal-day-num {
  background: var(--gold);
  color: var(--navy-dark);
}

.cal-day-chips {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

/* ---------- chips ---------- */

.cal-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
}

.cal-chip:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.cal-chip-flag {
  flex: 0 0 auto;
  font-weight: 700;
}

.cal-chip-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cal-more {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 6px;
}

.cal-more:hover,
.cal-more:focus-visible {
  background: rgba(28, 53, 94, 0.08);
  text-decoration: underline;
}

/* ---------- status color pairs (ovg AA-verified tokens) ---------- */

.cal-chip--overdue {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: rgba(153, 27, 27, 0.25);
}

.cal-chip--due_today {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: rgba(146, 64, 14, 0.25);
}

.cal-chip--upcoming {
  background: rgba(28, 53, 94, 0.08);
  color: var(--navy);
  border-color: rgba(28, 53, 94, 0.2);
}

.cal-chip--done {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(10, 110, 63, 0.25);
}

.cal-chip--cancelled {
  background: rgba(28, 53, 94, 0.05);
  color: var(--text-secondary);
  border-color: rgba(28, 53, 94, 0.16);
}

.cal-chip--cancelled .cal-chip-title {
  text-decoration: line-through;
}

/* ---------- phone-width: compact chips ---------- */

@media (max-width: 560px) {
  .cal-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .cal-month {
    order: -1;
  }

  .cal-nav,
  .cal-view {
    justify-content: center;
  }

  .cal-weekdays {
    gap: 3px;
  }

  .cal-weekdays span {
    font-size: 10px;
    padding: 2px 0;
  }

  .cal-grid {
    gap: 3px;
  }

  .cal-day {
    min-height: 72px;
    padding: 3px;
    gap: 3px;
  }

  .cal-day-num {
    font-size: 12px;
    padding: 2px 5px;
    min-width: 22px;
    min-height: 22px;
  }

  .cal-chip {
    font-size: 10px;
    padding: 1px 4px;
  }

  .cal-more {
    font-size: 10px;
    padding: 1px 4px;
  }
}
