/* AQcredix — calendar styles. Every colour is a theme token, so light/dark/neon follow
   automatically and there is nothing to keep in step when the palette changes. No
   hardcoded colour appears inside a media query — a test enforces that site-wide, so
   mobile always inherits palette fixes. */

.cal-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.cal-tab {
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg-muted);
  cursor: pointer;
  min-height: 40px;
}
.cal-tab.is-on {
  background:var(--accent-solid);
  border-color:var(--brand-2);
  /* NOT #fff. --brand-2 is a bright teal under neon, where white text measures ~1.5:1.
     --on-brand is whatever reads on the brand colour in the active theme. */
  color: var(--on-brand);
}

/* ------------------------------- month grid ------------------------------- */

.cal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.cal-head h3 {
  font-size: 19px;
  margin: 0;
  min-width: 10ch;
}
.cal-nav {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.cal-nav:hover { background: var(--brand-tint); border-color:var(--brand-2); }

.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.cal-dow span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fg-faint);
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-cell {
  min-height: 96px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.cal-cell.is-blank { background: transparent; border-color: transparent; }
.cal-cell.is-past { opacity: .72; }
.cal-cell.is-today {
  border-color:var(--brand-2);
  box-shadow: 0 0 0 1px var(--brand-2) inset;
}
.cal-d {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-faint);
}
.cal-cell.is-today .cal-d { color:var(--accent-text); }

.cal-chip {
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.25;
  padding: 3px 6px;
  border-radius: 5px;
  /* Long committee names must not stretch a grid column; the cell is fixed and the text
     is clipped rather than allowed to reflow the whole month. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.cal-chip.is-cmte   { background: var(--brand-tint);          color:var(--accent-text); }
.cal-chip.is-task   { background: var(--accent-bright-tint);  color:var(--accent-text); }
.cal-chip.is-held   { background: var(--ok-tint, var(--brand-tint)); color: var(--ok, var(--brand-2)); }
.cal-chip.is-planned{ background: var(--info-tint);           color: var(--info); }
.cal-chip.is-missed { background: var(--nc-tint);             color: var(--nc); }
.cal-more { font-size: 10px; color: var(--fg-faint); font-weight: 700; }

.cal-key {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 12px;
  color: var(--fg-muted);
}
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.cal-key i.k { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.cal-key i.is-cmte   { background:var(--accent-solid); }
.cal-key i.is-task   { background:var(--accent-solid); }
.cal-key i.is-held   { background: var(--ok, var(--brand-2)); }
.cal-key i.is-missed { background: var(--nc); }

/* ------------------------------- registers ------------------------------- */

.cal-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.cal-bar h3 { margin: 0; font-size: 17px; flex: 1; }

.cal-rows { display: grid; gap: 10px; }
.cal-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--r-md);
  background: var(--bg-elevated);
}
.cal-row.st-overdue { border-left-color: var(--nc); }
.cal-row.st-never   { border-left-color: var(--warn); }
.cal-row.st-due     { border-left-color: var(--warn); }
.cal-row.st-soon    { border-left-color:var(--brand-2); }
.cal-row.st-ok      { border-left-color: var(--border); }

.cal-row-main { flex: 1; min-width: 0; }
.cal-row-main h4 { margin: 0 0 4px; font-size: 15px; }
.cal-abbr {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
  font-weight: 600;
}
.cal-meta { font-size: 12.5px; color: var(--fg-muted); }
.cal-warn { font-size: 12.5px; color: var(--nc); font-weight: 600; margin-top: 5px; }

.cal-row-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.cal-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.cal-pill.st-overdue { background: var(--nc-tint);            color: var(--nc); }
.cal-pill.st-never   { background: var(--warn-tint);          color: var(--warn); }
.cal-pill.st-due     { background: var(--warn-tint);          color: var(--warn); }
.cal-pill.st-soon    { background: var(--accent-bright-tint); color:var(--accent-text); }
.cal-pill.st-ok      { background: var(--bg);                 color: var(--fg-muted); }

.cal-x {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-muted);
  cursor: pointer;
}
.cal-x:hover { color:var(--accent-text); border-color:var(--brand-2); }

.cal-empty {
  text-align: center;
  padding: 44px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
}
.cal-empty h3 { margin: 0 0 8px; font-size: 18px; }
.cal-empty p {
  color: var(--fg-muted);
  max-width: 56ch;
  margin: 0 auto 18px;
  font-size: 14px;
}

.cal-check { flex-direction: row !important; align-items: center; gap: 9px; }
.cal-check input { width: auto; }

/* --------------------------------- mobile ---------------------------------
   Layout only — no colours here, so mobile keeps inheriting every palette fix. */
@media (max-width: 760px) {
  /* A seven-column month grid on a phone gives ~45px cells, too small to read a
     committee name in. The grid stays but the cells shrink to date-plus-dot density,
     and the registers become the primary way in. */
  .cal-cell { min-height: 62px; padding: 4px; }
  .cal-chip {
    /* Text would be illegible at this width; the chip becomes a coloured bar that still
       says "something is due here", and the register tab says what. */
    font-size: 0;
    height: 5px;
    padding: 0;
    border-radius: 3px;
  }
  .cal-more { font-size: 9px; }
  .cal-head h3 { font-size: 16px; min-width: 0; }
  .cal-row { gap: 10px; }
  .cal-row-side { width: 100%; }
  .cal-row-side .btn { flex: 1; }
}

/* Next-due line under each register row. Both dates are shown when they differ: the
   preferred day is when the meeting happens, the exact date is what an assessor measures
   the interval against. */
.cal-next {
  font-size: 12.5px;
  color: var(--fg);
  margin-top: 5px;
}
.cal-exact {
  font-size: 11.5px;
  color: var(--fg-faint);
  font-family: var(--font-mono);
  margin-left: 6px;
}
.cal-hint {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.5;
  margin: 0;
}
.cal-hint b { color: var(--fg); }
