/* CBF Calendar Display [cbf_calendar] — ported from the approved mock-up design (light theme, scoped under .cbfcd) */
.cbfcd {
  --red: #cc0000;
  --red-dark: #a30000;
  --bg: #ffffff;
  --bg-soft: #f7f5f2;
  --surface: #ffffff;
  --ink: #1c1a17;
  --ink-soft: #4c463f;
  --ink-faint: #6f675c;
  --line: #e5ded4;
  --line-strong: #d5cbbd;
  --gold-btn: #b8860b;
  --today-bg: #fdf0f0;
  --today-line: #cc0000;
  --next-bg: #fff8e6;
  --chip-off-bg: #f1ede6;
  --chip-off-ink: #8a8175;
  --focus: #0b5cad;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px 24px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.cbfcd *, .cbfcd *::before, .cbfcd *::after { box-sizing: border-box; }
.cbfcd a { color: var(--red-dark); }
.cbfcd :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
body.cbfcd-lock { overflow: hidden; }

/* ---------- Page head (matches the approved mock-up) ---------- */
.cbfcd .pagehead { padding: 28px 0 6px; }
.cbfcd .pagehead h1 {
  font-weight: 700;
  font-size: clamp(30px, 5vw, 42px);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.cbfcd .lede { color: var(--ink-soft); font-size: 16.5px; margin: 0 0 4px; max-width: 62ch; }
.cbfcd .tz-note { color: var(--ink-faint); font-size: 13.5px; margin: 6px 0 0; }
.cbfcd .submit-box {
  font-size: 14.5px; color: var(--ink);
  margin: 16px 0 0; padding: 13px 16px;
  background: #fff8e7; border: 1.5px solid #e3c46c; border-radius: 10px;
}
.cbfcd .submit-box a { font-weight: 700; color: var(--red-dark); }

/* ---------- Sticky toolbar ---------- */
.cbfcd .toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 14px 0 12px;
  margin-top: 18px;
}
.cbfcd .search-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.cbfcd .search-box { position: relative; flex: 1 1 260px; }
.cbfcd .search-box svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ink-faint); pointer-events: none;
}
.cbfcd #search, .cbfcd .cbfcd-search-input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 12px 40px 12px 40px;
  border: 1.5px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  min-height: 48px;
}
.cbfcd .cbfcd-search-input::placeholder { color: var(--ink-faint); }
.cbfcd .clear-search {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: var(--ink-faint);
  font-size: 20px; line-height: 1; width: 36px; height: 36px;
  border-radius: 50%; cursor: pointer; display: none;
  padding: 0;
}
.cbfcd .clear-search:hover { color: var(--ink); }
.cbfcd .month-nav { display: flex; gap: 6px; align-items: stretch; }
.cbfcd .month-arrow {
  font: inherit; font-size: 22px; font-weight: 700; line-height: 1;
  width: 46px; min-height: 48px; flex: 0 0 auto;
  border: 1.5px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.cbfcd .month-arrow:hover:not(:disabled) { border-color: var(--red); color: var(--red-dark); }
.cbfcd .month-arrow:disabled { opacity: .35; cursor: default; }
.cbfcd .month-select {
  font: inherit; font-weight: 600; font-size: 15px;
  min-height: 48px; padding: 10px 12px; width: auto; max-width: 210px;
  border: 1.5px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}

.cbfcd .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cbfcd .chip {
  font: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 8px 14px;
  border-radius: 7px; border: 1.5px solid transparent;
  font-size: 14px; font-weight: 600;
}
.cbfcd .chip .count {
  font-size: 12px; font-weight: 700;
  background: rgba(0,0,0,.12); border-radius: 4px;
  padding: 1px 7px; line-height: 1.5;
}
.cbfcd .chip[aria-pressed="false"] {
  background: var(--chip-off-bg) !important;
  color: var(--chip-off-ink) !important;
  border-color: var(--line);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.cbfcd .chip[aria-pressed="false"] .count { background: rgba(0,0,0,.06); text-decoration: none; }
.cbfcd .chip-all { background: var(--ink); color: var(--bg); }
.cbfcd .results-line { font-size: 13.5px; color: var(--ink-faint); margin: 10px 2px 0; min-height: 1.2em; }

/* ---------- View toggle / past toggle ---------- */
.cbfcd .view-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: nowrap; }
.cbfcd .vr-label { font-size: 12.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); }
.cbfcd .view-seg { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.cbfcd .view-seg button {
  font: inherit; font-weight: 700; font-size: 14.5px;
  padding: 10px 20px; min-height: 44px;
  background: transparent; color: var(--ink-soft); border: none; cursor: pointer;
}
.cbfcd .view-seg button + button { border-left: 1.5px solid var(--line-strong); }
.cbfcd .view-seg button[aria-pressed="true"] { background: var(--red); color: #fff; }
@media (max-width: 860px) { .cbfcd .view-row { gap: 8px; } }
.cbfcd .past-toggle {
  display: inline-flex; align-items: center; gap: 9px;
  margin-left: auto; cursor: pointer; user-select: none;
  font-size: 14px; font-weight: 600; color: var(--ink-soft);
  min-height: 44px; padding: 6px 2px;
}
.cbfcd .past-toggle input {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 auto; width: 44px; height: 24px; border-radius: 999px;
  background: var(--chip-off-bg); border: 1.5px solid var(--line-strong);
  position: relative; cursor: pointer; margin: 0;
  transition: background .15s ease, border-color .15s ease;
}
.cbfcd .past-toggle input::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line-strong);
  transition: transform .15s ease;
}
.cbfcd .past-toggle input:checked { background: var(--ink); border-color: var(--ink); }
.cbfcd .past-toggle input:checked::after { transform: translateX(20px); }
.cbfcd .past-toggle input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.cbfcd .past-toggle-hint { font-size: 12.5px; font-weight: 500; color: var(--ink-faint); }

/* ---------- Month sections ---------- */
.cbfcd section.month { margin-top: 34px; scroll-margin-top: 210px; }
.cbfcd .month-head {
  display: flex; align-items: baseline; gap: 12px;
  border-bottom: 2.5px solid var(--red);
  padding-bottom: 8px; margin-bottom: 6px;
}
.cbfcd .month-head h2 {
  font-size: 26px; font-weight: 700; margin: 0; color: var(--ink);
}
.cbfcd .month-head .m-count { color: var(--ink-faint); font-size: 14px; font-weight: 600; }

.cbfcd .event {
  display: flex; gap: 16px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
  background: var(--surface);
  border-radius: 6px;
}
.cbfcd .event:hover { background: var(--bg-soft); }
.cbfcd .date-badge {
  flex: 0 0 62px;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-top: 4px solid var(--red);
  border-radius: 8px;
  padding: 7px 2px 6px;
  background: var(--surface);
}
.cbfcd .date-badge .dow { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--red-dark); }
.cbfcd .date-badge .dnum { display: block; font-size: 25px; font-weight: 800; line-height: 1.1; }
.cbfcd .date-badge .dmon { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint); }
.cbfcd .event-main { flex: 1 1 auto; min-width: 0; }
.cbfcd .event-title { font-size: 17.5px; font-weight: 700; margin: 1px 0 5px; line-height: 1.3; overflow-wrap: break-word; }
.cbfcd .event-title-btn {
  font: inherit; color: inherit; text-align: left;
  background: none; border: none; padding: 0; margin: 0;
  cursor: pointer; overflow-wrap: break-word;
}
.cbfcd .event-title-btn:hover { color: var(--red-dark); text-decoration: underline; }
.cbfcd .event-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 5px; }
.cbfcd .cat-chip {
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  border-radius: 5px; padding: 3px 9px; white-space: nowrap;
}
.cbfcd .range-line { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.cbfcd .detail-line { font-size: 15px; color: var(--ink-soft); margin: 2px 0 0; }
.cbfcd .pill {
  font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 5px; padding: 3px 8px; white-space: nowrap;
}
.cbfcd .pill-now { background: var(--red); color: #fff; }
.cbfcd .pill-next { background: var(--gold-btn); color: #fff; }
.cbfcd .pill-ended { background: #e8e2d9; color: #6b6256; border: 1px solid var(--line-strong); }
.cbfcd .btn-addcal {
  flex: 0 0 auto;
  font: inherit; font-size: 13.5px; font-weight: 700;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 9px 13px; min-height: 42px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  text-decoration: none;
}
.cbfcd .btn-addcal:hover { border-color: var(--red); color: var(--red-dark); }
.cbfcd .btn-addcal.added { border-color: #285c35; color: #285c35; background: #ddefe2; }

.cbfcd .event.is-today-adjacent { background: var(--next-bg); }
.cbfcd .today-strip {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 0;
  color: var(--today-line);
  font-weight: 800; font-size: 13.5px; letter-spacing: .05em; text-transform: uppercase;
}
.cbfcd .today-strip::before, .cbfcd .today-strip::after {
  content: ""; flex: 1; border-top: 2px dashed var(--today-line); opacity: .65;
}
.cbfcd .today-strip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--today-line); flex: 0 0 auto; }
.cbfcd .no-match {
  padding: 20px 14px; color: var(--ink-faint); font-size: 15px;
  border-bottom: 1px solid var(--line); display: none;
}
.cbfcd .no-match.show { display: block; }
.cbfcd .hidden { display: none !important; }
.cbfcd [hidden] { display: none !important; }

/* Past / ended treatment */
.cbfcd .event.is-past { opacity: .72; background: var(--bg-soft); }
.cbfcd .event.is-past .date-badge { border-top-color: var(--line-strong); opacity: .85; }
.cbfcd .event.is-past .event-title, .cbfcd .event.is-past .event-title-btn { color: var(--ink-faint); }
.cbfcd .event.is-past .cat-chip { filter: grayscale(.55); opacity: .85; }
.cbfcd .cal-bar.is-past { opacity: .58; filter: grayscale(.65); }
.cbfcd .dp-event.is-past { opacity: .78; }
.cbfcd .dp-event.is-past .dp-name-btn { color: var(--ink-faint); }

/* ---------- Calendar grid ---------- */
.cbfcd .month-cal { padding-top: 6px; }
.cbfcd .cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cbfcd .cal-week span { text-align: center; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); padding: 3px 0; }
.cbfcd .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cbfcd .cal-day {
  font: inherit; color: var(--ink); text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; min-height: 88px; padding: 6px;
  display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  align-items: stretch; min-width: 0; overflow: hidden;
}
.cbfcd .cal-day:hover { border-color: var(--red); }
.cbfcd .cal-day.blank { background: transparent; border-color: transparent; cursor: default; min-height: 0; }
.cbfcd .cal-day.blank:hover { border-color: transparent; }
.cbfcd .cal-dnum { font-weight: 800; font-size: 14px; line-height: 1.2; }
.cbfcd .cal-day.today { border-color: var(--today-line); box-shadow: inset 0 0 0 1.5px var(--today-line); }
.cbfcd .cal-day.today .cal-dnum { color: var(--today-line); }
.cbfcd .cal-day.sel { background: var(--today-bg); border-color: var(--red); }
.cbfcd .cal-bar {
  font-size: 11px; font-weight: 600; line-height: 1.35;
  border-radius: 4px; padding: 2px 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; min-width: 0; max-width: 100%; cursor: pointer;
}
.cbfcd .cal-bar.end { opacity: .72; }
.cbfcd .cal-bar.multi { white-space: normal; }
.cbfcd .cal-bar .bar-range { display: block; font-size: 10px; font-weight: 500; opacity: .8; line-height: 1.3; }
.cbfcd .cal-bar:hover { text-decoration: underline; }

/* ---------- Day panel ---------- */
.cbfcd .day-panel {
  margin-top: 10px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); padding: 10px 14px 4px;
}
.cbfcd .dp-title { margin: 0 0 2px; font-size: 15px; font-weight: 800; }
.cbfcd .dp-none { margin: 2px 0 8px; color: var(--ink-faint); font-size: 13.5px; }
.cbfcd .dp-event {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 6px 0; border-top: 1px solid var(--line);
}
.cbfcd .dp-name { font-weight: 700; font-size: 14.5px; }
.cbfcd .dp-name-btn {
  font: inherit; font-weight: 700; font-size: 14.5px; color: inherit;
  background: transparent; border: none; padding: 2px 2px;
  cursor: pointer; text-align: left;
}
.cbfcd .dp-name-btn:hover { color: var(--red-dark); text-decoration: underline; }
.cbfcd .dp-event .range-line { font-size: 13px; }
.cbfcd .dp-event .cat-chip { padding: 2px 8px; }
.cbfcd .dp-jump {
  font: inherit; font-size: 13px; font-weight: 700;
  background: transparent; border: none; color: var(--red-dark);
  cursor: pointer; padding: 4px 2px; text-decoration: underline;
}
.cbfcd .dp-event .btn-addcal { margin-left: auto; min-height: 36px; padding: 6px 10px; font-size: 12.5px; }
.cbfcd .event.flash { background: var(--next-bg); box-shadow: inset 0 0 0 2px var(--gold-btn); }
.cbfcd .event.clickable { cursor: pointer; }

/* ---------- Event popup ---------- */
.cbfcd .modal-backdrop {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(20, 16, 10, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.cbfcd .modal-backdrop[hidden] { display: none; }
.cbfcd .modal {
  position: relative;
  background: var(--surface); color: var(--ink);
  border-radius: 14px;
  width: 100%; max-width: 460px;
  max-height: calc(100dvh - 36px); overflow-y: auto;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
  padding: 22px 22px 20px;
}
.cbfcd .modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink);
  font-size: 22px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.cbfcd .modal-close:hover { border-color: var(--red); color: var(--red-dark); }
.cbfcd .modal-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cbfcd .modal-title {
  font-size: 24px; font-weight: 700; line-height: 1.25;
  margin: 10px 40px 4px 0; color: var(--ink);
}
.cbfcd .modal-detail { font-size: 15.5px; color: var(--ink-soft); margin: 8px 0 0; }
.cbfcd .modal-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.cbfcd .modal-pills:empty { display: none; margin-top: 0; }
.cbfcd .modal-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.cbfcd .btn-event-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red); color: #fff; text-decoration: none;
  font-weight: 700; font-size: 14.5px;
  padding: 11px 18px; border-radius: 8px; min-height: 44px;
}
.cbfcd .btn-event-link:hover { background: var(--red-dark); }
.cbfcd .modal-actions .btn-addcal { min-height: 44px; }

@media (max-width: 560px) {
  .cbfcd { padding: 0 14px 24px; }
  .cbfcd .pagehead { padding: 16px 0 2px; }
  .cbfcd .pagehead h1 { font-size: 27px; margin-bottom: 5px; }
  .cbfcd .lede { font-size: 14.5px; }
  .cbfcd .tz-note { font-size: 12.5px; margin-top: 4px; }
  .cbfcd .submit-box { font-size: 13px; margin-top: 10px; padding: 11px 13px; }
  .cbfcd .toolbar { margin-top: 12px; padding: 10px 0 9px; }
  .cbfcd .cal-day { min-height: 54px; padding: 4px; border-radius: 6px; }
  .cbfcd .cal-dnum { font-size: 12.5px; }
  .cbfcd .cal-bar { height: 7px; padding: 0; color: transparent; font-size: 0; border-radius: 3px; }
  .cbfcd .cal-bar .bar-range { display: none; }
  .cbfcd .view-seg { flex: 1 1 auto; }
  .cbfcd .view-seg button { flex: 1 1 0; }
  .cbfcd .dp-event .btn-addcal { margin-left: 0; }
  .cbfcd .month-nav { flex: 1 1 100%; }
  .cbfcd .month-select { flex: 1 1 auto; max-width: none; }
  .cbfcd .event { gap: 12px; padding: 14px 8px; flex-wrap: wrap; }
  .cbfcd .date-badge { flex-basis: 56px; }
  .cbfcd .event-title { font-size: 17px; }
  .cbfcd section.month { scroll-margin-top: 250px; }
}
