/* ============================================================================
   ATLAS REDESIGN — Calendar screen styles  ·  Phase 2
   Branch: atlas-redesign-2026-06-29

   Prefix: .rd-calendar. Tokens only (--r-*) — both Calm + Operator auto-theme.
   No hardcoded hex. 1920×1080: agenda timeline scrolls internally; outer frame
   never scrolls.
   ========================================================================== */

.rd-calendar {
  font-family: var(--r-font-body);
  color: var(--r-body);
  padding: var(--r-gutter);
  max-width: var(--r-page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- header -------------------------------------------------------------- */
.rd-cal-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.rd-cal-headline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-cal-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-clay);
}
.rd-cal-h1 {
  font-family: var(--r-font-display);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--r-ink);
  margin: 0;
}
.rd-cal-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Today/Week/Month toggle removed 2026-07-04 — replaced by the shared
   RDDateFilter component mounted at .rd-cal-datefilter (styled by
   css/redesign/components/date-filter.css). */

/* primary "New event" button */
.rd-cal-new {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--r-font-body);
  font-size: var(--r-fs-body);
  font-weight: 600;
  color: var(--r-primary-ink);
  background: var(--r-primary);
  border: 0;
  border-radius: var(--r-radius-control);
  padding: 9px 16px;
  cursor: pointer;
  transition: filter var(--r-dur) var(--r-ease), box-shadow var(--r-dur) var(--r-ease);
}
.rd-cal-new .ph { font-size: 15px; }
.rd-cal-new:hover { filter: brightness(1.06); box-shadow: var(--r-shadow-hover); }
.rd-cal-new:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* ---- KPI strip (single rounded panel split into 4 cells) ----------------- */
.rd-cal-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  overflow: hidden;
}
.rd-cal-kpi {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  border-left: 1px solid var(--r-hairline);
}
.rd-cal-kpi:first-child { border-left: 0; }
.rd-cal-kpi-label {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-faint);
}
.rd-cal-kpi-value {
  font-family: var(--r-font-display);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  color: var(--r-ink);
}

/* ---- main grid ----------------------------------------------------------- */
.rd-cal-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: start;
}
.rd-cal-card {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 20px 22px;
}
.rd-cal-cardtitle {
  font-family: var(--r-font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--r-ink);
  margin: 0 0 4px;
}
.rd-cal-cardtitle--sm { font-size: 16px; }

/* ---- left: today's timeline (scrolls internally) ------------------------- */
.rd-cal-timeline {
  display: flex;
  flex-direction: column;
  max-height: 520px;
  overflow-y: auto;
}
.rd-cal-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 0;
  border-top: 1px solid var(--r-hairline);
}
.rd-cal-row:first-child { border-top: 0; }
.rd-cal-time {
  flex: 0 0 62px;
  width: 62px;
  font-family: var(--r-font-mono);
  font-size: 12px;
  color: var(--r-muted);
  text-align: right;
}
.rd-cal-bar {
  flex: 0 0 3px;
  align-self: stretch;
  min-height: 26px;
  width: 3px;
  border-radius: var(--r-radius-pill);
}
.rd-cal-rowmain {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.rd-cal-rowtitle {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--r-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rd-cal-rowsub {
  font-size: 12px;
  color: var(--r-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rd-cal-chip {
  flex: 0 0 auto;
  font-family: var(--r-font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  border-radius: var(--r-radius-pill);
  padding: 2px 7px;
  background: var(--r-well);
  color: var(--r-muted);
}
.rd-cal-chip[data-tone="primary"] { background: color-mix(in srgb, var(--r-primary) 14%, transparent); color: var(--r-primary); }
.rd-cal-chip[data-tone="clay"]    { background: color-mix(in srgb, var(--r-clay) 16%, transparent);    color: var(--r-clay); }
.rd-cal-chip[data-tone="amber"]   { background: color-mix(in srgb, var(--r-amber) 18%, transparent);   color: var(--r-amber); }
.rd-cal-chip[data-tone="alert"]   { background: color-mix(in srgb, var(--r-alert) 16%, transparent);   color: var(--r-alert); }
.rd-cal-chip[data-tone="faint"]   { background: var(--r-well); color: var(--r-faint); }

.rd-cal-row--empty { border-top: 0; padding: 18px 0; }
.rd-cal-empty {
  font-family: var(--r-font-body);
  font-size: var(--r-fs-body);
  color: var(--r-muted);
}

/* ---- right: rest of the week --------------------------------------------- */
.rd-cal-week { display: flex; flex-direction: column; }
.rd-cal-weeklist {
  display: flex;
  flex-direction: column;
  margin-top: 4px;
}
.rd-cal-weekrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--r-hairline);
}
.rd-cal-weekrow:first-child { border-top: 0; }
.rd-cal-weekday {
  font-size: 13px;
  font-weight: 500;
  color: var(--r-ink);
}
.rd-cal-weekcount {
  font-family: var(--r-font-mono);
  font-size: 12px;
  color: var(--r-muted);
}
.rd-cal-weekrow--empty { border-top: 0; padding: 16px 0; }

.rd-cal-weekfoot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--r-hairline);
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  color: var(--r-faint);
}
.rd-cal-weekfoot .ph { font-size: 13px; color: var(--r-muted); }
.rd-cal-org {
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--r-muted);
}
.rd-cal-sync { margin-left: auto; }

/* ---- responsive: stack 2-col → 1-col under 980px ------------------------- */
@media (max-width: 980px) {
  .rd-cal-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .rd-cal-controls { flex-wrap: wrap; row-gap: 8px; }
  .rd-cal-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd-cal-kpi:nth-child(3) { border-left: 0; }
  .rd-cal-kpi:nth-child(n+3) { border-top: 1px solid var(--r-hairline); }
}
