/* The calendar month view. Tokens come from r.css. */

.rcal { --cal-voting: #4C6FA5; --cal-cancel: #9C8AA1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rcal { --cal-voting: #8FB4E8; --cal-cancel: #8B779A; } }
:root[data-theme="dark"] .rcal { --cal-voting: #8FB4E8; --cal-cancel: #8B779A; }

.rcal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; }
.rcal-head .r-title { font-size: 28px; }
.rcal-nav { display: flex; align-items: center; gap: 6px; flex: none; }
.rcal-btn { height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--text) !important; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 14px; font-weight: 700; }
.rcal-round { width: 44px; }
.rcal-today { padding: 0 14px; }
.rcal-today.is-here { color: var(--muted) !important; }
.rcal-btn:hover { background: var(--tile); }

.rcal-chips { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.rcal-chips::-webkit-scrollbar { display: none; }
.rcal-chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text) !important; text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.rcal-chip.is-active { background: var(--pink); border-color: transparent; color: var(--on-pink) !important; font-weight: 800; }

.rcal-main { display: flex; flex-direction: column; gap: 18px; }

.rcal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.rcal-wd { font-size: 12px; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.rcal-day { height: 48px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text) !important; text-decoration: none; font-size: 14px; font-weight: 600; position: relative; }
.rcal-day:hover { background: var(--tile); }
.rcal-day.is-free { background: var(--review-bg); }
.rcal-day.is-away { color: var(--muted) !important; background: repeating-linear-gradient(135deg, transparent 0 5px, var(--gray-bg) 5px 7px); }
.rcal-day.is-away .rcal-num { text-decoration: line-through; }
.rcal-day.is-today { background: var(--pink); color: var(--on-pink) !important; font-weight: 800; }
.rcal-day.is-selected { box-shadow: inset 0 0 0 2px var(--text); }
.rcal-day:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rcal-dots { display: flex; align-items: center; gap: 3px; height: 6px; }
.rcal-dots b { font-size: 9px; line-height: 6px; font-weight: 800; }

.rcal-dot { display: inline-block; width: 6px; height: 6px; border-radius: 3px; box-sizing: border-box; flex: none; }
.rcal-dot.is-on { background: var(--pink); box-shadow: 0 0 0 1px var(--text); }
.rcal-dot.is-voting { background: var(--cal-voting); }
.rcal-dot.is-draft, .rcal-dot.is-review { background: var(--plum); }
.rcal-dot.is-cancelled { background: var(--cal-cancel); opacity: .7; }
.rcal-dot.is-done { background: var(--muted); }
.rcal-dot.is-auto { border: 1.5px dashed var(--cal-voting); background: transparent; }
.rcal-day.is-today .rcal-dot.is-on { background: var(--text); box-shadow: none; }
.rcal-day.is-today .rcal-dot.is-voting, .rcal-day.is-today .rcal-dot.is-draft, .rcal-day.is-today .rcal-dot.is-review { background: var(--text); }

.rcal-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; font-weight: 600; color: var(--muted); }
.rcal-legend li { display: flex; align-items: center; gap: 6px; }
.rcal-legend .rcal-dot { width: 10px; height: 10px; border-radius: 5px; }
.rcal-key { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 1px solid var(--review-line); }
.rcal-key.is-free { background: var(--review-bg); }
.rcal-key.is-away { background: repeating-linear-gradient(135deg, transparent 0 3px, var(--gray-bg) 3px 5px); border-color: var(--gray-bar); }

.rcal-side { display: flex; flex-direction: column; gap: 18px; }
.rcal-daysec { display: flex; flex-direction: column; gap: 10px; }
.rcal-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--card-line); color: var(--text) !important; text-decoration: none; }
.rcal-card:hover { background: var(--tile); }
.rcal-card.is-voting { background: var(--info-bg); }
.rcal-card.is-draft, .rcal-card.is-review { background: var(--review-bg); border: 1px dashed var(--review-line); }
.rcal-card.is-cancelled, .rcal-card.is-done { background: var(--gray-card); }
.rcal-card.is-cancelled .rcal-card-title { text-decoration: line-through; color: var(--muted); }
.rcal-time { font-size: 15px; font-weight: 800; width: 48px; flex: none; }
.rcal-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rcal-card-title { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.rcal-card-sub { font-size: 13px; color: var(--muted); }
.rcal-card .r-chip { flex: none; margin-right: 0; white-space: nowrap; }
.rcal-note { margin: 0; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 12px; }
.rcal-note.is-free { background: var(--review-bg); color: var(--review-ink); }
.rcal-note.is-away { background: var(--gray-bg); color: var(--muted); }
.rcal-gfree { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }

.rcal-feed { border: 1px solid var(--line); border-radius: 18px; }
.rcal-feed > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 44px; }
.rcal-feed > summary::-webkit-details-marker { display: none; }
.rcal-feed[open] > summary svg:last-child { transform: rotate(90deg); }
.rcal-feed-text { flex: 1; display: flex; flex-direction: column; }
.rcal-feed-text strong { font-size: 15px; }
.rcal-feed-text span { font-size: 13px; color: var(--muted); }
.rcal-feeds { list-style: none; margin: 0; padding: 0 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.rcal-feeds li { display: flex; flex-direction: column; gap: 6px; }
.rcal-feed-name { font-size: 14px; font-weight: 800; }
.rcal-feed-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; font-weight: 700; }

.rg-calendar-link { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 44px; border: 1px solid var(--line); border-radius: 18px; color: var(--text) !important; text-decoration: none; font-size: 15px; font-weight: 700; }
.rg-calendar-link span { flex: 1; }
.rg-calendar-link:hover { background: var(--tile); }

@media (min-width: 900px) {
  .rcal-head .r-title { font-size: 40px; }
  .rcal-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "grid side" "legend side"; column-gap: 40px; row-gap: 16px; align-items: start; }
  .rcal-grid { grid-area: grid; gap: 6px; }
  .rcal-legend { grid-area: legend; }
  .rcal-side { grid-area: side; }
  .rcal-day { height: 76px; justify-content: flex-start; padding-top: 12px; font-size: 15px; }
  .rcal-dot { width: 8px; height: 8px; border-radius: 4px; }
  .rcal-dots { height: 8px; }
}
.rcal-year { font-weight: 600; color: var(--muted); font-size: 0.6em; letter-spacing: 0; }

/* The Upcoming list under the month (flag calendar_upcoming). */
.rcal-up { display: flex; flex-direction: column; gap: 10px; }
#up-list { display: flex; flex-direction: column; gap: 16px; }
.rcal-upday { display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 72px; }
.rcal-uph { margin: 0; font-size: 15px; font-weight: 800; color: var(--text); }
.rcal-upday:target .rcal-uph { color: var(--accent, var(--text)); }
.rcal-up .rcal-time { width: auto; min-width: 48px; max-width: 76px; font-size: 14px; }
#up-more { display: flex; justify-content: center; }
.rcal-morebtn { width: auto; padding: 0 18px; }

/* Plans tab: the List | Month switch, the link to the free-days settings and the link to past plans. */
.rcal-switch { list-style: none; margin: 0; padding: 4px; display: inline-flex; gap: 2px; align-self: flex-start; border-radius: 999px; background: var(--card); }
.rcal-switch .rcal-chip { border-color: transparent; background: transparent; min-height: 36px; }
.rcal-switch .rcal-chip.is-active { background: var(--surface); color: var(--text) !important; box-shadow: 0 1px 4px rgba(11, 31, 58, 0.12); }
.rcal-freelink, .rcal-pastlink { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text) !important; text-decoration: none; font-size: 15px; font-weight: 700; }
.rcal-freelink svg, .rcal-pastlink svg { margin-left: auto; flex: none; }
.rcal-pastlink > span:first-child { flex: 1; }
.rcal-pastlink svg { margin-left: 0; }
.rcal-pastcount { min-width: 28px; padding: 2px 9px; border-radius: 999px; background: var(--card); color: var(--muted); font-size: 13px; font-weight: 800; text-align: center; }
.rcal-list .rcal-main { display: flex; flex-direction: column; max-width: 640px; }
.rcal-list .rcal-side { display: flex; flex-direction: column; gap: 18px; }
.rcal-past .rcal-up { max-width: 640px; }
