/* Calendar (module "calendar"). Prefix: cal-. */

.cal-pane {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: var(--s-4) var(--s-5) var(--s-6);
}
.cal-label { min-width: 132px; text-align: center; font: 600 17px/1 var(--font-display); }
.cal-filters { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.cal-intro { padding: var(--s-2) 0; background: var(--teal-soft); border-radius: var(--r-md); }
.cal-link { padding: 0; font: inherit; font-weight: 700; color: var(--link); text-decoration: underline; background: none; border: 0; cursor: pointer; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.cal-legend .legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .dot, .cal-tl-label .dot { width: 10px; height: 10px; }

/* ---------------------------------------------------------------- month */

.cal-month {
  display: flex;
  flex-direction: column;
  min-width: 640px;
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  user-select: none;
}
.cal-wdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--surface-sunken);
  border-bottom: var(--bw) solid var(--line);
}
.cal-wday { padding: 6px 8px; font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-2); }
.cal-week {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: 26px repeat(4, 23px) 22px;
  flex: 1 0 auto;
  row-gap: 2px;
  min-height: 132px;
  border-bottom: 1px solid var(--border);
}
.cal-week:last-child { border-bottom: 0; }
.cal-day {
  grid-row: 1 / -1;
  min-width: 0;
  padding: 4px 6px;
  border-left: 1px solid var(--border);
  cursor: cell;
}
.cal-day:first-child { border-left: 0; }
.cal-day:hover { background: var(--hover); }
.cal-day.is-weekend { background: var(--surface-2); }
.cal-day.is-other { background: var(--surface-sunken); }
.cal-day.is-other .cal-daynum { color: var(--text-muted); }
.cal-day.is-selecting { background: var(--teal-soft); box-shadow: inset 0 0 0 2px var(--teal); }
.cal-daynum { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; font: 700 12.5px/1 var(--font-ui); font-variant-numeric: tabular-nums; color: var(--text); border-radius: var(--r-pill); }
.cal-day.is-today .cal-daynum { color: var(--on-candy); background: var(--teal); border: var(--bw-thin) solid var(--line); }

.cal-bar {
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  height: 21px;
  margin: 0 3px;
  padding: 0 6px;
  overflow: hidden;
  font: 700 11.5px/1 var(--font-ui);
  white-space: nowrap;
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-xs);
  box-shadow: 1px 1px 0 0 var(--shadow-color);
  cursor: grab;
  touch-action: none;
}
.cal-bar:hover { filter: brightness(1.04) saturate(1.1); }
.cal-bar:active { cursor: grabbing; }
.cal-bar .icon { flex: none; }
.cal-bar.starts-before { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-style: dashed; }
.cal-bar.ends-after { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dashed; }
.cal-bar.is-done .cal-bar-text { text-decoration: line-through; }
.cal-bar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cal-bar-time { flex: none; font-weight: 800; opacity: 0.8; }
.cal-bar-shoot { cursor: pointer; }
.cal-bar-task {
  height: 19px;
  color: var(--text);
  background: var(--surface);
  border-style: dashed;
  box-shadow: none;
  cursor: pointer;
}
.cal-bar-task .icon { color: var(--blue-ink); }
.cal-more {
  z-index: 1;
  align-self: center;
  justify-self: start;
  margin: 0 6px;
  padding: 1px 6px;
  font: 700 11px/1.3 var(--font-ui);
  color: var(--text-2);
  background: none;
  border: 0;
  border-radius: var(--r-xs);
  cursor: pointer;
}
.cal-more:hover { color: var(--text); background: var(--hover); }

/* ---------------------------------------------------------------- timeline */

.cal-tl {
  position: relative;
  flex: 1 1 auto;
  min-height: 260px;
  overflow: auto;
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  user-select: none;
}
.cal-tl-inner { position: relative; min-height: 100%; }
.cal-tl-head {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  background: var(--surface-sunken);
  border-bottom: var(--bw) solid var(--line);
}
.cal-tl-corner {
  position: sticky;
  left: 0;
  z-index: 2;
  flex: none;
  width: var(--cal-label);
  padding: 8px 12px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-right: var(--bw-thin) solid var(--line);
}
.cal-tl-scale { position: relative; flex: none; height: 48px; }
.cal-tl-months, .cal-tl-days { position: absolute; left: 0; right: 0; height: 24px; }
.cal-tl-months { top: 0; }
.cal-tl-days { top: 24px; border-top: 1px solid var(--border); }
.cal-tl-months span, .cal-tl-days span {
  position: absolute;
  top: 0;
  height: 24px;
  overflow: hidden;
  font-size: var(--fs-xs);
  line-height: 24px;
  white-space: nowrap;
  border-left: 1px solid var(--border);
}
.cal-tl-months span { padding: 0 8px; font: 600 13px/24px var(--font-display); color: var(--text); }
.cal-tl-days span { text-align: center; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cal-tl-days span.is-today { color: var(--on-candy); background: var(--teal); }
.cal-tl-body { position: relative; }
.cal-tl-bg { position: absolute; top: 0; bottom: 0; pointer-events: none; }
.cal-tl-weekend { position: absolute; top: 0; bottom: 0; background: var(--surface-2); }
.cal-tl-today { position: absolute; top: 0; bottom: 0; z-index: 4; width: 0; border-left: var(--bw) solid var(--teal-ink); }
.cal-tl-today span {
  position: absolute;
  top: 2px;
  left: 3px;
  padding: 1px 5px;
  font: 800 10px/1.3 var(--font-ui);
  color: var(--on-candy);
  background: var(--teal);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}
.cal-tl-row { position: relative; display: flex; border-bottom: 1px solid var(--border); }
.cal-tl-label {
  position: sticky;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  width: var(--cal-label);
  padding: 0 12px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border-right: var(--bw-thin) solid var(--line);
}
.cal-tl-track { position: relative; flex: none; }
.cal-tl-track.is-creatable { cursor: cell; }
.cal-tl-track.is-new:hover { background: var(--teal-soft); }
.cal-tl-empty { position: sticky; left: calc(var(--cal-label) + 12px); display: inline-block; padding: 9px 0; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); pointer-events: none; }
.cal-tbar {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  overflow: hidden;
  font: 700 11.5px/1 var(--font-ui);
  white-space: nowrap;
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-xs);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  touch-action: none;
}
.cal-tbar.is-dragging { z-index: 4; box-shadow: var(--shadow-md); cursor: grabbing; }
.cal-tbar.is-done .cal-bar-text { text-decoration: line-through; }
.cal-tbar .icon { flex: none; }
.cal-tlabel {
  position: absolute;
  z-index: 2;
  max-width: 220px;
  height: 24px;
  overflow: hidden;
  font: 700 11.5px/24px var(--font-ui);
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
  pointer-events: none;
}
.cal-tlabel.is-done { text-decoration: line-through; color: var(--text-2); }
.cal-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.cal-handle.is-start { left: 0; }
.cal-handle.is-end { right: 0; }
.cal-tbar:hover .cal-handle { background: color-mix(in srgb, var(--line) 22%, transparent); }
.cal-tghost { position: absolute; top: 4px; bottom: 4px; z-index: 2; background: var(--teal-soft); border: var(--bw) dashed var(--teal-ink); border-radius: var(--r-xs); }
.cal-tshoot {
  position: absolute;
  top: 5px;
  z-index: 3;
  display: grid;
  place-items: center;
  height: 24px;
  font: 800 11px/1 var(--font-ui);
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
  border-radius: 5px;
  cursor: pointer;
}
.cal-tshoot:hover { filter: brightness(1.05); transform: translateY(-1px); }
.cal-ttask {
  position: absolute;
  top: 5px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  color: var(--blue-ink);
  background: var(--surface);
  border: var(--bw-thin) solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}
.cal-ttask.is-done { color: var(--ok-text); }

/* ---------------------------------------------------------------- agenda */

.cal-agenda { display: flex; flex-direction: column; gap: 6px; max-width: 860px; }
.cal-agenda-past { display: flex; }
.cal-agenda-month { margin: var(--s-3) 0 2px; font: 600 19px/1.2 var(--font-display); }
.cal-agenda-day {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: var(--s-3);
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.cal-agenda-day.is-today { border: var(--bw) solid var(--line); box-shadow: var(--shadow-sm); }
.cal-agenda-day.is-past { opacity: 0.7; }
.cal-agenda-date { display: flex; flex-direction: column; align-items: center; padding-top: 2px; }
.cal-agenda-date span { font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.cal-agenda-date b { font: 600 24px/1.1 var(--font-display); }
.cal-agenda-day.is-today .cal-agenda-date b { color: var(--teal-ink); }
.cal-agenda-items { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.cal-agenda-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  color: var(--text);
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.cal-agenda-item:hover { background: var(--c-soft); }
.cal-agenda-swatch { flex: none; width: 10px; align-self: stretch; min-height: 28px; background: var(--c); border: var(--bw-thin) solid var(--line); border-radius: 4px; }
.cal-agenda-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.cal-agenda-main b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-agenda-main b.is-done { text-decoration: line-through; color: var(--text-2); }
.cal-agenda-main small { font-size: var(--fs-xs); color: var(--text-2); }

/* ---------------------------------------------------------------- editor */

.cal-editor-buttons { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-2); }
.cal-editor-buttons .grow { flex: 1 1 auto; }
.cal-delete { color: var(--danger-text); }

/* phones: the month grid fits the screen instead of scrolling sideways */
@media (max-width: 600px) {
  .cal-month { min-width: 0; }
  .cal-daynum { min-width: 18px; height: 18px; font-size: 11px; padding: 0 3px; }
}
