/* Navigationszeile: zurück, Zeitraum, weiter, Heute */
.cal-nav { display: flex; align-items: center; gap: 4px; margin-bottom: var(--pad); }
.cal-nav-arrow {
  flex: none;
  width: 40px; height: 40px;
  border: 0;
  background: transparent;
  color: var(--gold);
  font-size: 28px; line-height: 1;
  cursor: pointer;
}
.cal-nav-label { flex: 1; min-width: 0; text-align: center; font-size: 14px; font-weight: 600; }
.cal-nav .btn { flex: none; min-height: 40px; margin-left: 4px; padding: 8px 12px; font-size: 14px; }

/* Zeitraster für Tag und Woche: schmale Stundenspalte, danach gleich breite Tagesspalten */
.cal-grid { --cal-hours-width: 34px; }
.cal-week-head, .cal-grid-body {
  display: grid;
  grid-template-columns: var(--cal-hours-width);
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}
.cal-grid-body { border-bottom: 1px solid var(--line); }

.cal-week-head {
  position: sticky; top: env(safe-area-inset-top, 0px);
  z-index: 2;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.cal-day-head {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 2px 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  line-height: 1.2;
  cursor: pointer;
}
.cal-day-head-name { font-size: 11px; }
.cal-day-head-number { font-size: 15px; font-weight: 600; color: var(--text); }
.cal-day-head.is-today { background: var(--gold); color: var(--on-gold); }
.cal-day-head.is-today .cal-day-head-number { color: var(--on-gold); }

.cal-hour {
  height: var(--cal-hour-height);
  padding: 2px 4px 0 0;
  font-size: 10px; line-height: 1;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cal-day {
  position: relative;
  border-left: 1px solid var(--line);
  /* Je Stunde eine Linie, ohne eigenes Element je Stunde */
  background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent var(--cal-hour-height));
  cursor: pointer;
}

.cal-block {
  position: absolute;
  display: block;
  padding: 2px 4px;
  overflow: hidden;
  text-align: left;
  font-size: 12px; line-height: 1.25;
  color: var(--text);
  /* Farbton je Kategorie, Sättigung und Helligkeit fest: gedeckt und auf dunklem Grund lesbar */
  background: hsl(var(--hue, 38), 32%, 22%);
  border: 1px solid var(--bg);
  border-left: 3px solid hsl(var(--hue, 38), 55%, 62%);
  border-radius: 6px;
  cursor: pointer;
}
.cal-block-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-block-items, .cal-block-time { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-block-items { color: hsl(var(--hue, 38), 45%, 82%); }
.cal-block-time { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Woche: rund 44 px je Spalte bei 375 px Breite, deshalb kaum Innenabstand und umbrechender Name */
.is-week .cal-block { padding: 1px 2px; font-size: 11px; line-height: 1.15; border-left-width: 2px; border-radius: 4px; }
/* Umbruch nur an Wortgrenzen: In einer halben Spalte stünde der Name sonst buchstabenweise untereinander */
.is-week .cal-block-name { font-weight: 500; white-space: normal; overflow-wrap: normal; text-overflow: clip; }

.cal-now {
  position: absolute; left: 0; right: 0;
  z-index: 1;
  height: 2px;
  background: var(--danger);
  /* Die Linie darf keinen Tipp auf Raster oder Block abfangen */
  pointer-events: none;
}

/* Monatsraster */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-weekday { padding: 4px 0; text-align: center; font-size: 12px; color: var(--muted); }
.cal-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 56px;
  padding: 6px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.cal-cell-day { font-size: 15px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.cal-cell.is-outside { opacity: .4; }
.cal-cell.is-today { border-color: var(--gold); }
.cal-cell.is-today .cal-cell-day { color: var(--gold); font-weight: 600; }
.cal-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--on-gold);
  font-size: 11px; font-weight: 600; line-height: 1.4;
  text-align: center;
}

/* iPad: mehr Platz je Spalte */
@media (min-width: 600px) {
  .cal-grid { --cal-hours-width: 48px; }
  .cal-hour { font-size: 12px; }
  .cal-nav-label { font-size: 16px; }
  .is-week .cal-block { padding: 2px 4px; font-size: 12px; }
  .cal-cell { min-height: 76px; }
}

/* Preis klein in der rechten unteren Ecke des Termins. Der Verlauf nach links hält ihn
   lesbar, wo ein kurzer Termin darunter noch Text zeigt */
.cal-block-price {
  position: absolute; right: 0; bottom: 0;
  padding: 0 4px 1px 10px;
  font-size: 10px; line-height: 1.3;
  font-variant-numeric: tabular-nums;
  color: var(--gold-strong);
  background: linear-gradient(to right, transparent, hsl(var(--hue, 38), 32%, 22%) 8px);
  border-bottom-right-radius: inherit;
  white-space: nowrap;
}
.is-week .cal-block-price { padding: 0 1px 0 5px; font-size: 9px; letter-spacing: -.02em; }
