/* ===== CSS Custom Properties ===== */
:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --text-muted: #666;
  --card-bg: #fff;
  --border: #e0e0e0;
  --accent: #4a6fa5;
  --accent-light: #e8eef5;
  --header-bg: #2c3e50;
  --header-text: #fff;

  /* Fasting colors */
  --fast-free: #2e7d32;
  --fast-free-bg: #e8f5e9;
  --fast-fish: #f57f17;
  --fast-fish-bg: #fff8e1;
  --fast-wine-oil: #e65100;
  --fast-wine-oil-bg: #fff3e0;
  --fast-strict: #c62828;
  --fast-strict-bg: #ffebee;
  --fast-total: #880e4f;
  --fast-total-bg: #fce4ec;

  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Dark mode — system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --text: #e0e0e0;
    --text-muted: #999;
    --card-bg: #1e1e1e;
    --border: #333;
    --accent: #7ba3d4;
    --accent-light: #1e2d3d;
    --header-bg: #1a2530;

    --fast-free-bg: #1b3a1b;
    --fast-fish-bg: #3a2e00;
    --fast-wine-oil-bg: #3a1e00;
    --fast-strict-bg: #3a0e0e;
    --fast-total-bg: #3a0a20;

    --shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
}

/* Dark mode — manual override */
[data-theme="dark"] {
  --bg: #121212;
  --text: #e0e0e0;
  --text-muted: #999;
  --card-bg: #1e1e1e;
  --border: #333;
  --accent: #7ba3d4;
  --accent-light: #1e2d3d;
  --header-bg: #1a2530;

  --fast-free-bg: #1b3a1b;
  --fast-fish-bg: #3a2e00;
  --fast-wine-oil-bg: #3a1e00;
  --fast-strict-bg: #3a0e0e;
  --fast-total-bg: #3a0a20;

  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ===== Header ===== */
header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-icon {
  vertical-align: -3px;
  margin-right: 2px;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.date-nav button,
#theme-toggle {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--header-text);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.date-nav button:hover,
#theme-toggle:hover {
  background: rgba(255,255,255,0.25);
}

#date-picker {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--header-text);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 0.9rem;
  font-family: inherit;
  color-scheme: dark;
}

#theme-toggle {
  margin-left: auto;
  font-size: 1.1rem;
  padding: 6px 10px;
}

/* ===== Main Content ===== */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ===== Summary ===== */
.summary h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.pill.season {
  background: var(--accent-light);
  color: var(--accent);
}

.pill.season.lenten {
  background: var(--fast-strict-bg);
  color: var(--fast-strict);
}

.pill.tone {
  background: var(--accent-light);
  color: var(--accent);
}

/* Vestment base colors */
.pill.vestments-bright { background: #f5e6a3; color: #6b4f12; }
.pill.vestments-bright-dark { background: #d4a844; color: #3d1f5c; }
.pill.vestments-dark { background: #7a1a1a; color: #f0c0c0; }
.pill.vestments-dark-black { background: #1c0a2e; color: #b0a0c0; }

/* Traditional color tints — override base colors */
.pill.tint-white { background: #f0f0f0; color: #333; }
.pill.tint-blue { background: #1e3a5f; color: #b8d4f0; }
.pill.tint-red { background: #7a1a1a; color: #f0c0c0; }
.pill.tint-green { background: #1a5c2a; color: #c0f0c8; }

.pill.fast-free { background: var(--fast-free-bg); color: var(--fast-free); }
.pill.fast-fish { background: var(--fast-fish-bg); color: var(--fast-fish); }
.pill.fast-wine-oil { background: var(--fast-wine-oil-bg); color: var(--fast-wine-oil); }
.pill.fast-strict { background: var(--fast-strict-bg); color: var(--fast-strict); }
.pill.fast-total { background: var(--fast-total-bg); color: var(--fast-total); }

.fasting-period {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ===== Details / Collapsible sections ===== */
details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 12px;
}

details > summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

details > summary::before {
  content: '\25B6';
  font-size: 0.7rem;
  transition: transform 0.2s;
  color: var(--text-muted);
}

details[open] > summary::before {
  transform: rotate(90deg);
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary h3 {
  margin: 0;
  font-size: 1rem;
}

.details-grid {
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.detail-item {
  display: flex;
  gap: 12px;
}

.detail-item dt {
  font-weight: 500;
  color: var(--text-muted);
  min-width: 120px;
  font-size: 0.85rem;
}

.detail-item dd {
  font-size: 0.85rem;
}

.section-body {
  padding: 10px 14px;
}

/* ===== Sections ===== */
.section {
  margin-top: 20px;
}

.section > h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--accent);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
}

.expand-all-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.expand-all-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-fixed { background: var(--accent-light); color: var(--accent); }
.badge-movable { background: #e8f5e9; color: #2e7d32; }
[data-theme="dark"] .badge-movable,
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-movable { background: #1b3a1b; } }
.badge-variable { background: #fff3e0; color: #e65100; }
[data-theme="dark"] .badge-variable,
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-variable { background: #3a1e00; } }
.badge-class { background: var(--accent-light); color: var(--accent); }
.badge-context { background: var(--accent-light); color: var(--accent); }

/* ===== Lists ===== */
.feast-list,
.saint-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feast-list li,
.saint-list li {
  padding: 6px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Hymn items ===== */
.hymn-item {
  background: var(--card-bg);
}

.hymn-item.troparion {
  border-left: 3px solid var(--accent);
}

.hymn-item.kontakion {
  border-left: 3px solid #e65100;
}

.hymn-text,
.reading-text {
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.7;
}

.hymn-text p,
.reading-text p {
  margin-bottom: 8px;
}

.hymn-text p:last-child,
.reading-text p:last-child {
  margin-bottom: 0;
}

/* ===== Readings ===== */
.reading-item {
  background: var(--card-bg);
}

.reading-role {
  font-weight: 600;
  color: var(--accent);
}

.reading-source {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.prokimenon,
.alleluia {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.stichon {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Saint Bios ===== */
.saint-bio-card {
  background: var(--card-bg);
  border-left: 3px solid var(--text-muted);
}

.saint-bio-card[data-category="martyr"]    { border-left-color: #c0392b; }
.saint-bio-card[data-category="hierarch"]   { border-left-color: #8e44ad; }
.saint-bio-card[data-category="monastic"]   { border-left-color: #2c3e50; }
.saint-bio-card[data-category="prophet"]    { border-left-color: #27ae60; }
.saint-bio-card[data-category="apostle"]    { border-left-color: #2980b9; }
.saint-bio-card[data-category="confessor"]  { border-left-color: #d4ac0d; }
.saint-bio-card[data-category="righteous"]  { border-left-color: #16a085; }
.saint-bio-card[data-category="equal-to-apostles"]   { border-left-color: #2980b9; }
.saint-bio-card[data-category="unmercenary-healer"]   { border-left-color: #1abc9c; }
.saint-bio-card[data-category="fool-for-christ"]      { border-left-color: #7f8c8d; }
.saint-bio-card[data-category="passion-bearer"]       { border-left-color: #c0392b; }

.badge-category {
  text-transform: capitalize;
  background: var(--accent-light);
  color: var(--accent);
}

.badge-category[data-cat="martyr"]    { background: #c0392b; color: #fff; }
.badge-category[data-cat="hierarch"]   { background: #8e44ad; color: #fff; }
.badge-category[data-cat="monastic"]   { background: #2c3e50; color: #fff; }
.badge-category[data-cat="prophet"]    { background: #27ae60; color: #fff; }
.badge-category[data-cat="apostle"]    { background: #2980b9; color: #fff; }
.badge-category[data-cat="confessor"]  { background: #d4ac0d; color: #fff; }
.badge-category[data-cat="righteous"]  { background: #16a085; color: #fff; }
.badge-category[data-cat="equal-to-apostles"]   { background: #2980b9; color: #fff; }
.badge-category[data-cat="unmercenary-healer"]   { background: #1abc9c; color: #fff; }
.badge-category[data-cat="fool-for-christ"]      { background: #7f8c8d; color: #fff; }
.badge-category[data-cat="passion-bearer"]       { background: #c0392b; color: #fff; }

.saint-dates {
  font-weight: 400;
  font-size: 0.85em;
  color: var(--text-muted);
}

.saint-bio-body {
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.7;
}

.saint-title {
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.saint-description {
  margin-bottom: 8px;
}

.saint-key-facts {
  list-style: disc;
  padding-left: 1.4em;
  margin-bottom: 8px;
}

.saint-key-facts li {
  margin-bottom: 3px;
  font-size: 0.88rem;
}

.saint-patronage {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 6px;
}

.saint-meta {
  display: flex;
  gap: 1em;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ===== Rubrics Tabs ===== */
.rubrics-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
}

.rubrics-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.rubrics-tab:hover {
  color: var(--accent);
}

.rubrics-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.rubrics-panel {
  display: none;
  padding: 12px 0;
}

.rubrics-panel.active {
  display: block;
}

.rubrics-panel .details-grid {
  padding: 0;
}

.rubrics-couturier {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ===== Feast Propers ===== */
.feast-propers {
  margin-top: 12px;
}

.feast-antiphon {
  margin-bottom: 16px;
}

.feast-antiphon h5 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.feast-antiphon .psalm-ref {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.antiphon-verse {
  font-size: 0.88rem;
  line-height: 1.6;
  padding-left: 1em;
}

.antiphon-verse .verse-num {
  font-weight: 600;
  color: var(--accent);
  margin-right: 4px;
}

.antiphon-refrain {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-muted);
  padding-left: 1em;
  margin-bottom: 6px;
}

.ambon-prayer {
  margin-top: 12px;
  background: var(--card-bg);
}

/* ===== Service Instructions (legacy + shared) ===== */
.svc-section,
.couturier-section {
  background: var(--card-bg);
}

.svc-note {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.couturier-item {
  margin-bottom: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.couturier-item:last-child {
  margin-bottom: 0;
}

/* ===== Arabic text ===== */
.arabic {
  font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;
  font-size: 1.05em;
  line-height: 1.8;
}

/* ===== Empty state ===== */
.empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.see-ref {
  color: var(--text-muted);
  font-style: italic;
}

/* ===== ESV Bible text ===== */
.reading-text .verse-num {
  font-size: 0.7em;
  font-weight: 700;
  color: var(--accent);
  vertical-align: super;
  margin-right: 2px;
}

.reading-text .block-indent {
  padding-left: 1.5em;
}

.reading-text .poetry .line {
  padding-left: 1.5em;
  text-indent: -1em;
}

.reading-text .poetry .indent {
  padding-left: 3em;
}

.reading-text .poetry {
  margin: 4px 0;
}

.reading-text p {
  margin-bottom: 6px;
}

.esv-credit {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 8px;
}

/* ===== Footer ===== */
footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  header {
    padding: 10px 12px;
    gap: 8px;
  }

  header h1 {
    font-size: 1rem;
    width: 100%;
    text-align: center;
  }

  .date-nav {
    width: 100%;
    justify-content: space-between;
  }

  #theme-toggle {
    position: absolute;
    top: 10px;
    right: 12px;
  }

  main {
    padding: 16px 12px 32px;
  }

  .summary h2 {
    font-size: 1.25rem;
  }

  .detail-item {
    flex-direction: column;
    gap: 2px;
  }

  .detail-item dt {
    min-width: auto;
  }

  .hymn-text,
  .reading-text {
    padding: 8px 10px;
  }

  details > summary {
    padding: 8px 10px;
  }

  .details-grid {
    padding: 8px 10px;
  }

  .section-body {
    padding: 8px 10px;
  }
}

/* ===== Monthly Calendar Grid ===== */

.calendar-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-nav button {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.calendar-nav button:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.calendar-title {
  font-size: 1.4rem;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-header-row,
.calendar-week {
  display: contents;
}

.calendar-day-header {
  background: var(--header-bg);
  color: var(--header-text);
  text-align: center;
  padding: 8px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-cell {
  min-height: 120px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  transition: background 0.15s;
  overflow: hidden;
  position: relative;
}

.calendar-cell:hover {
  background: var(--accent-light);
}

.calendar-cell.empty {
  background: var(--bg);
  cursor: default;
  min-height: 0;
}

.calendar-cell.today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.calendar-cell.today .cell-day-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Fasting left-border on cells */
.calendar-cell.fast-free { border-left: 3px solid var(--fast-free); }
.calendar-cell.fast-fish { border-left: 3px solid var(--fast-fish); }
.calendar-cell.fast-wine-oil { border-left: 3px solid var(--fast-wine-oil); }
.calendar-cell.fast-strict { border-left: 3px solid var(--fast-strict); }
.calendar-cell.fast-total { border-left: 3px solid var(--fast-total); }

.cell-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.cell-day-num {
  font-weight: 700;
  font-size: 0.9rem;
}

/* Day-of-week abbreviation — hidden on desktop grid, shown on mobile agenda */
.cell-dow {
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cell-tone {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 4px;
  border-radius: 3px;
}

.cell-fasting-icon {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  position: relative;
  cursor: default;
  font-size: 14px;
  line-height: 1;
}

/* Styled tooltip on hover */
.cell-fasting-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 200;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
}

.cell-fasting-icon:hover::after {
  opacity: 1;
  transform: translateY(2px);
}

.cell-feasts {
  margin-bottom: 2px;
}

.cell-feast {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-feast.major {
  font-weight: 700;
  color: var(--accent);
}

.cell-saints {
  margin-bottom: 2px;
}

.cell-saint {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cell-events {
  margin-top: 3px;
}

.cell-event {
  font-size: 0.68rem;
  background: var(--accent-light);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-time {
  font-weight: 600;
}

/* Detail panel — expands below the clicked row */
.calendar-detail-panel {
  grid-column: 1 / -1;
  background: var(--card-bg);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  margin: 8px 0;
  padding: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.cal-detail-date {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.cal-detail-feast {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
}

.cal-detail-saint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cal-detail-fasting {
  margin: 6px 0;
  font-size: 0.85rem;
}

.cal-detail-fasting-period {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.cal-detail-reading {
  font-size: 0.85rem;
}

.cal-detail-role {
  font-weight: 600;
}

.cal-detail-event {
  font-size: 0.85rem;
  margin-top: 4px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.cal-detail-event-time {
  font-weight: 600;
}

.calendar-detail-panel .detail-close {
  float: right;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.calendar-detail-panel .detail-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Header links */
.header-links {
  display: flex;
  gap: 12px;
}

.header-link {
  color: var(--header-text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  transition: background 0.2s;
}

.header-link:hover {
  background: rgba(255,255,255,0.25);
}

/* Embed mode */
body.embed {
  background: #fff;
  color: #1a1a1a;
}

body.embed .calendar-main {
  padding: 8px;
}

/* Force light mode in embed — override dark mode system preference and manual toggle */
body.embed,
body.embed * {
  --bg: #fafafa;
  --text: #1a1a1a;
  --text-muted: #666;
  --card-bg: #fff;
  --border: #e0e0e0;
  --accent: #4a6fa5;
  --accent-light: #e8eef5;
  --header-bg: #2c3e50;
  --header-text: #fff;
  --fast-free-bg: #e8f5e9;
  --fast-fish-bg: #fff8e1;
  --fast-wine-oil-bg: #fff3e0;
  --fast-strict-bg: #ffebee;
  --fast-total-bg: #fce4ec;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ===== Calendar Responsive — Agenda View ===== */
@media (max-width: 768px) {
  .calendar-main {
    padding: 8px 4px 24px;
  }

  .calendar-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .calendar-title {
    font-size: 1.1rem;
    width: 100%;
    text-align: center;
    order: -1;
  }

  .calendar-nav button {
    padding: 5px 10px;
    font-size: 0.85rem;
  }

  /* Agenda list layout */
  .calendar-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: none;
    border-radius: 0;
  }

  .calendar-header-row {
    display: none;
  }

  .calendar-week {
    display: contents;
  }

  .calendar-cell.empty {
    display: none;
  }

  .calendar-cell {
    min-height: auto;
    display: grid;
    grid-template-columns: 54px 1fr auto;
    grid-template-rows: auto;
    gap: 0 8px;
    padding: 8px 10px;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }

  /* Fasting left-border on mobile */
  .calendar-cell.fast-fish { border-left: 3px solid var(--fast-fish); }
  .calendar-cell.fast-wine-oil { border-left: 3px solid var(--fast-wine-oil); }
  .calendar-cell.fast-strict { border-left: 3px solid var(--fast-strict); }
  .calendar-cell.fast-total { border-left: 3px solid var(--fast-total); }

  .calendar-cell.today {
    box-shadow: none;
    background: var(--accent-light);
  }

  /* Left column: date + day-of-week */
  .cell-header {
    grid-column: 1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    gap: 0;
  }

  .cell-day-num {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
  }

  .cell-dow {
    display: block;
  }

  .cell-fasting-icon {
    margin-left: 0;
    margin-top: 2px;
  }

  /* Hide tooltip on mobile — not useful with touch */
  .cell-fasting-icon::after {
    display: none;
  }

  /* Content column */
  .cell-feasts {
    grid-column: 2;
    margin-bottom: 0;
  }

  .cell-feast {
    font-size: 0.8rem;
    white-space: normal;
    overflow: visible;
  }

  .cell-saints {
    grid-column: 2;
    margin-bottom: 0;
  }

  .cell-saint {
    font-size: 0.75rem;
    white-space: normal;
    overflow: visible;
  }

  .cell-events {
    grid-column: 2;
    margin-top: 2px;
  }

  .cell-event {
    font-size: 0.75rem;
    white-space: normal;
    overflow: visible;
  }

  .calendar-detail-panel {
    margin: 0;
    padding: 12px;
    border-radius: 0;
    border: none;
    border-bottom: 2px solid var(--accent);
    max-height: none;
  }
}
