/* Calendar views. Events vs ticket dates (onsale/presale) are visually distinct;
   pending = dashed outline, tracked = star + amber edge. */
.cal-toolbar { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin: .5rem 0; }
.cal-nav { display: flex; gap: .3rem; }
.cal-title { margin: 0; font-size: 1.15rem; min-width: 10rem; }
.cal-toolbar .filter { margin-left: auto; }
.cal-legend { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; padding: 0; margin: 0 0 1rem; font-size: .85rem; color: var(--muted); }
.cal-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.swatch { display: inline-block; width: 1.4rem; height: .9rem; border-radius: 3px; border: 1px solid var(--border); }
.swatch.kind-event { background: var(--event-bg); border-color: var(--event-border); }
.swatch.kind-event.dec-pending { background: transparent; border: 2px dashed var(--event-border); }
.swatch.kind-onsale { background: var(--onsale-bg); border-color: var(--onsale-border); }
.swatch.kind-presale { background: var(--presale-bg); border-color: var(--presale-border); }
.swatch.is-tracked { background: var(--event-bg); border-left: 4px solid var(--tracked); }

/* items */
.cal-item {
  display: flex; align-items: baseline; gap: .3rem; min-width: 0;
  padding: .12rem .4rem; border-radius: 4px; text-decoration: none; font-size: .8rem; line-height: 1.35;
  background: var(--event-bg); color: var(--event-fg); border: 1px solid var(--event-border);
}
.cal-item:hover { filter: brightness(.96); text-decoration: underline; }
.cal-item .cal-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.kind-onsale { background: var(--onsale-bg); color: var(--onsale-fg); border-color: var(--onsale-border); }
.cal-item.kind-presale { background: var(--presale-bg); color: var(--presale-fg); border-color: var(--presale-border); }
.cal-item.dec-pending { background: transparent; border-style: dashed; border-width: 2px; color: var(--text); }
.cal-item.is-tracked { border-left: 4px solid var(--tracked); }
.cal-item.st-cancelled .cal-title-text { text-decoration: line-through; }
.cal-kind { font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.cal-time { font-weight: 650; white-space: nowrap; }
.cal-loc { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dec-pending .cal-loc { color: var(--muted); }

.agenda-items { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .35rem; }
.agenda-items .cal-item { font-size: .92rem; padding: .4rem .6rem; flex-wrap: wrap; }
.agenda-items .cal-item .cal-title-text { white-space: normal; font-weight: 600; }

/* layout: the day panel is a sticky side column on wide screens and a bottom sheet on narrow ones,
   so opening a day never moves the grid. --header-h is the sticky app header's height. */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.cal-layout.has-panel { grid-template-columns: minmax(0, 1fr) 21rem; }
.cal-main { min-width: 0; }
.day-panel {
  border-top: 4px solid var(--accent); margin: 0; padding: .75rem .9rem;
  position: sticky; top: calc(var(--header-h) + .5rem);
  max-height: calc(100vh - var(--header-h) - 1rem); overflow: auto; overscroll-behavior: contain;
}
.day-panel-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.day-panel-head h2 { outline: none; margin: 0; font-size: 1.05rem; }
.day-group h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .9rem 0 .35rem; }
.day-group-count { font-weight: 500; }
.day-panel .agenda-items .cal-item { font-size: .86rem; padding: .35rem .5rem; }
@media (max-width: 1000px) {
  .cal-layout.has-panel { grid-template-columns: minmax(0, 1fr); }
  .day-panel {
    position: fixed; z-index: 30; left: 0; right: 0; top: auto; bottom: var(--bottom-nav-h, 0px);
    max-height: min(60vh, 32rem); border-radius: 14px 14px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 30px rgb(10 5 25 / 25%);
  }
  .cal-layout.has-panel .cal-main { padding-bottom: min(60vh, 32rem); } /* the last rows can scroll above the sheet */
}

/* "Running now": seasons and exhibitions longer than a week, once, above the grid */
.cal-runs { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .45rem .7rem; margin: 0 0 .75rem; }
.cal-runs summary { cursor: pointer; font-weight: 650; }
.cal-runs-count { background: var(--accent-soft); border-radius: 999px; padding: 0 .45rem; font-size: .8rem; }
.cal-runs-note { font-weight: 400; }
.cal-runs-list { list-style: none; padding: 0; margin: .5rem 0 .2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .3rem .5rem; }
.cal-runs-list .cal-item { font-size: .82rem; padding: .25rem .5rem; }
.cal-sub { font-size: .76rem; white-space: nowrap; margin-left: auto; padding-left: .3rem; opacity: .8; }

.cal-toggles { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.cal-toggle { font-size: .9rem; white-space: nowrap; }

/* year view */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.mini-month { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .7rem; }
.mini-month h3 { font-size: .95rem; margin-bottom: .3rem; }
.mini-month h3 a { color: var(--text); text-decoration: none; }
.mini-month h3 a:hover { text-decoration: underline; }
.mini-table { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; }
.mini-table th { font-size: .68rem; color: var(--muted); font-weight: 600; text-align: center; }
.mini-table td { padding: 0; text-align: center; }
.day-btn {
  width: 100%; aspect-ratio: 1; min-height: 1.8rem; border: 1px solid transparent; border-radius: 4px;
  background: transparent; font-size: .75rem; cursor: pointer; position: relative; padding: 0; color: var(--text);
}
.day-btn:hover { border-color: var(--accent); }
.day-btn.heat-1 { background: var(--heat-1); }
.day-btn.heat-2 { background: var(--heat-2); }
.day-btn.heat-3 { background: var(--heat-3-strong, #7c3aed); color: #fff; } /* 5.7:1 with white text */
.day-btn.heat-4 { background: var(--heat-4); color: #fff; font-weight: 700; }
@media (prefers-color-scheme: dark) {
  .day-btn.heat-3 { --heat-3-strong: var(--heat-3); color: #fff; }
  .day-btn.heat-4 { color: #160b2e; }
}
.day-btn.has-onsale::after {
  content: ""; position: absolute; right: 2px; top: 2px; width: .4rem; height: .4rem;
  border-radius: 50%; background: var(--onsale-border); box-shadow: 0 0 0 1px var(--surface);
}
.day-btn.is-past { opacity: .45; }
/* Today: a dark outer ring plus a light inner ring, visible on any heat shade. */
.day-btn.is-today { outline: 2px solid var(--text); outline-offset: 1px; box-shadow: inset 0 0 0 2px var(--surface); font-weight: 800; z-index: 1; }
.day-btn.is-selected { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 1; }
.day-btn.is-today.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }

/* month view */
.month-grid { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.month-head, .month-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month-head div { padding: .4rem; font-size: .78rem; font-weight: 650; color: var(--muted); text-align: center; border-bottom: 1px solid var(--border); }
.month-cell { min-height: 7rem; padding: .25rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.month-cell:nth-child(7) { border-right: 0; }
.month-cell.out { background: var(--surface-2); }
.month-cell.out .day-num { color: var(--muted); }
.month-cell.is-today .day-num { background: var(--accent); color: var(--accent-text); }
.month-cell.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.month-cell.is-past:not(.out) { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.month-cell.is-past .chips, .month-cell.is-past .day-num-n { opacity: .5; }
.day-num {
  align-self: flex-start; border: 0; background: transparent; cursor: pointer;
  font-size: .8rem; font-weight: 650; border-radius: 999px; min-width: 1.6rem; height: 1.6rem; padding: 0 .35rem;
  display: inline-flex; align-items: center; gap: .25rem;
}
.day-num:hover { background: var(--surface-2); }
.day-dots { display: none; gap: 2px; align-items: center; justify-content: center; min-height: .5rem; }
.dot { display: inline-block; width: .42rem; height: .42rem; border-radius: 50%; }
.dot-tickets { background: var(--onsale-border); }
.dot-approved { background: var(--event-border); }
.dot-pending { box-shadow: inset 0 0 0 1.5px var(--event-border); }
.dot-tracked { width: auto; height: auto; border-radius: 0; color: var(--tracked); font-size: .62rem; line-height: 1; }
.dot-tracked::before { content: "★"; }
.month-cell .cal-item .cal-time { font-size: .72rem; }
.month-daylist { display: none; }
.chips { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.more-btn { border: 0; background: none; color: var(--accent); font-size: .75rem; cursor: pointer; text-align: left; padding: .1rem .2rem; }

@media (max-width: 700px) {
  .month-cell { min-height: 3.2rem; align-items: center; padding: .15rem; }
  .month-cell .chips { display: none; }
  .month-cell.has-items .day-dots { display: inline-flex; }
  .day-num { flex-direction: column; height: auto; gap: .1rem; padding: .2rem .3rem; min-height: 2.6rem; justify-content: flex-start; }
  .month-daylist { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
  .month-daylist .agenda-day h3 { font-size: .95rem; margin: 0 0 .3rem; }
  .cal-runs-list { grid-template-columns: 1fr; }
  .cal-runs-note { display: none; }
  .cal-toolbar .filter { margin-left: 0; width: 100%; }
}

/* week view */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.week-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem; min-height: 10rem; min-width: 0; }
.week-day.is-today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.week-day.is-past { opacity: .6; }
.week-day h3 { font-size: .85rem; }
.week-day .agenda-items .cal-item { font-size: .8rem; padding: .3rem .4rem; }
@media (max-width: 900px) {
  .week-grid { grid-template-columns: 1fr; }
  .week-day { min-height: 0; }
}

/* list view */
.agenda { display: flex; flex-direction: column; gap: 1rem; }
.agenda-day h3 { position: sticky; top: var(--header-h); background: var(--bg); padding: .3rem 0; z-index: 1; }
.agenda-day.is-today h3 { color: var(--accent); }
.agenda-day.is-past { opacity: .6; }

/* picked dates (dateMode 'selected'): ✓ on dates you picked; other dates only with "Show other dates" */
.cal-picked { font-weight: 800; color: var(--ok); }
.cal-item.is-unchosen {
  background: transparent; color: var(--muted); border: 1px dashed var(--border); border-left-width: 1px; opacity: .75;
}
.cal-item.is-unchosen .cal-title-text { text-decoration: none; }
.cal-tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; white-space: nowrap; }
.swatch.is-unchosen { background: transparent; border: 1px dashed var(--muted); }

/* calendar feed dialog */
.feed-warning { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: .55rem .75rem; }
.feed-form label, .feed-label { display: block; font-weight: 600; margin: .75rem 0 .3rem; }
.feed-form-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.feed-form-row input { flex: 1 1 14rem; min-width: 0; }
.feed-error:empty { display: none; }
input.feed-url { width: 100%; font-family: var(--mono); font-size: .85rem; }
.feed-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0; }
.feed-help h3 { font-size: .95rem; margin: 1rem 0 .25rem; }
.feed-help p { margin: 0 0 .4rem; }
.feed-regen { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border); }
