/* Calendars (calendar.js, from 5.8): toolbar, calendar toggles, month grid, day panel, agenda, event dialogs. Calendar colour – --cc. */
.cal { --cc: var(--muted); }
.cal-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-nav { display: inline-flex; align-items: center; gap: 4px; }
.cal-nav .icon-btn { padding: 6px 8px; }
.cal-period { margin: 0 0 0 6px; font: 600 20px/1.2 var(--font-display); letter-spacing: -.01em; }
.cal-bar .spacer { flex: 1; }
.cal-seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.cal-seg button { border: none; background: none; padding: 5px 14px; border-radius: 9px; color: var(--muted); }
.cal-seg button:hover { background: var(--surface-2); color: var(--text); }
.cal-seg button.active { background: var(--primary-bg); color: var(--primary-text); font-weight: 600; }

/* Calendar toggles */
.cal-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cal-filter { gap: 7px; padding: 4px 12px 4px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; }
.cal-filter.off { color: var(--muted); border-style: dashed; }
.cal-filter.off .cal-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--cc); }
.cal-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--cc); }

/* Month grid with the day panel */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.cal-wd { padding: 8px 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); }
.cal-cell { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 96px; padding: 4px 5px 5px; cursor: pointer;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); transition: background .12s; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:nth-last-child(-n+7) { border-bottom: none; }
.cal-cell:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.cal-cell.weekend { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .cal-num { color: var(--off); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--focus); }
.cal-cell:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.cal-num { align-self: flex-start; min-width: 24px; height: 24px; padding: 0 6px; margin-bottom: 2px; border-radius: 999px; display: grid; place-items: center;
  font: 600 12.5px/1 var(--font-mono); color: var(--text); }
.cal-cell.today .cal-num { background: var(--signal); color: var(--signal-ink); }
.cal-chip { display: flex; align-items: center; justify-content: flex-start; gap: 5px; width: 100%; min-width: 0; padding: 2px 6px; border: none; border-radius: 6px;
  background: none; font-size: 12px; line-height: 1.35; font-weight: 500; text-align: left; color: var(--text); }
.cal-chip:hover { background: color-mix(in srgb, var(--cc) 14%, transparent); border: none; }
.cal-chip.allday { background: color-mix(in srgb, var(--cc) 20%, var(--surface)); box-shadow: inset 3px 0 0 var(--cc); }
.cal-chip.allday:hover { background: color-mix(in srgb, var(--cc) 30%, var(--surface)); }
.cal-chip .cal-dot { width: 7px; height: 7px; }
.cal-chip-time { flex: none; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); }
.cal-chip-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { align-self: flex-start; padding: 0 6px; border: none; background: none; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 6px; }
.cal-more:hover { color: var(--text); background: var(--surface-2); border: none; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.cal-dots .cal-dot { width: 6px; height: 6px; }

.cal-day { position: sticky; top: 12px; padding: 16px; }
.cal-day-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-day-head strong { font: 600 16px/1.3 var(--font-display); }
.cal-empty { margin: 4px 0 0; }

/* Event rows (day panel and agenda) */
.cal-list { display: flex; flex-direction: column; gap: 6px; }
.cal-item { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: start; justify-content: stretch; gap: 10px; width: 100%; padding: 9px 12px;
  text-align: left; white-space: normal; border: 1px solid var(--border); border-left: 4px solid var(--cc); border-radius: 12px; background: var(--surface); font-weight: 400; }
.cal-item:hover { border-color: var(--border-strong); border-left-color: var(--cc); background: color-mix(in srgb, var(--cc) 6%, var(--surface)); }
.cal-item-time { font-size: 12.5px; line-height: 1.5; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); }
.cal-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-item-text strong { font-weight: 600; overflow-wrap: anywhere; }
.cal-item-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-flag { display: inline-flex; }
.cal-flag .ic { width: 13px; height: 13px; margin: 0; }
.cal-day .cal-item { grid-template-columns: 1fr; gap: 2px; }

.cal-agenda { display: flex; flex-direction: column; gap: 18px; max-width: 860px; }
.cal-agenda-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cal-agenda-head strong { font-weight: 600; }
.cal-agenda-num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; font: 600 15px/1 var(--font-mono);
  background: var(--surface); border: 1px solid var(--border); }
.cal-agenda-day.today .cal-agenda-num { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.cal-agenda-day .cal-list { padding-left: 44px; }
.cal-none { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 560px; }

/* Dialogs */
.cal-detail-cal { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.cal-detail { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.cal-desc { margin: 0; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 10px; background: var(--surface-2); }
.cal-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cal-form-row > [hidden] { display: none; }
.cal-dt { display: flex; gap: 6px; }
.cal-dt input[type=date] { flex: 1.4 1 0; min-width: 0; }
.cal-dt input[type=time] { flex: 1 1 0; min-width: 0; }
.cal-dt input[hidden] { display: none; }
.cal-scope { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.cal-scope legend { padding: 0 4px; color: var(--muted); font-weight: 600; }
.cal-feed-row { display: flex; gap: 8px; }
.cal-feed-row input { flex: 1; min-width: 0; font-size: 12px; }
.cal-feed-link p { margin: 0 0 6px; }

@media (max-width: 1100px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-day { position: static; }
}
@media (max-width: 640px) {
  .cal-bar { gap: 6px; }
  .cal-period { order: -1; width: 100%; margin: 0; font-size: 18px; }
  .cal-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 12px; padding: 0 14px; }
  .cal-filter { flex: none; }
  .cal-month { border-radius: 14px; }
  .cal-wd { padding: 6px 0; text-align: center; font-size: 10.5px; letter-spacing: 0; }
  .cal-cell { min-height: 54px; padding: 4px 2px; align-items: center; }
  .cal-num { align-self: center; min-width: 26px; height: 26px; font-size: 12px; }
  .cal-item { grid-template-columns: 1fr; gap: 2px; padding: 9px 12px; }
  .cal-agenda-day .cal-list { padding-left: 0; }
  .cal-detail { grid-template-columns: 1fr; gap: 2px; }
  .cal-form-row { grid-template-columns: 1fr; }
}
/* 5.8.1: voice meeting flag (green while in progress), "Clear calendar" confirmation tick */
.cal-flag.live { color: var(--ok); font-weight: 600; }
.cal-clear-tick { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-weight: 600; }
