/* ── View Toggle ─────────────────────────────────────────────────────────── */
.view-toggle {
  display: inline-flex;
  gap: .4rem;
  margin-bottom: .5rem;
}
.einheiten-wochen-zaehler {
  margin: 0 0 1.5rem 0;
  font-size: .95rem;
  color: var(--text-muted);
}
.einheiten-wochen-zaehler strong {
  color: var(--text);
  font-weight: 600;
}
.einheiten-storniert {
  font-size: .85em;
  color: var(--text-muted);
  opacity: .75;
}
.btn-toggle {
  padding: .35rem .9rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  text-decoration: none;
  font-size: .875rem;
  transition: all .15s;
}
.btn-toggle:hover { border-color: var(--sage-mid); color: var(--sage); text-decoration: none; }
.btn-toggle.active { background: var(--sage); border-color: var(--sage); color: #fff; font-weight: 600; }

/* ── Week Navigation ─────────────────────────────────────────────────────── */
.week-nav {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.week-label {
  flex: 1;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  min-width: 180px;
}
.week-label small { font-weight: 400; color: var(--text-muted); margin-left: .4rem; }

/* ── Ohne-Uhrzeit-Zone ───────────────────────────────────────────────────── */
.cal-untimed {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--card);
  overflow: hidden;
}
.cal-untimed-label {
  padding: .4rem .5rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  background: var(--bg);
}
.cal-untimed-cell {
  min-height: 36px;
  padding: .2rem .25rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.cal-untimed-cell.is-today { background: rgba(122,140,94,.06); }

/* ── Time Grid ───────────────────────────────────────────────────────────── */
.cal-grid {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  grid-auto-rows: 28px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--card);
  position: relative;
  overflow: hidden;
}
.cal-corner {
  border-right: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
  background: var(--bg);
  grid-row: 1;
  min-height: 48px;
}
.cal-day-header {
  padding: .4rem .25rem .35rem;
  text-align: center;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
  background: var(--bg);
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}
.cal-day-header.is-today { background: rgba(122,140,94,.1); font-weight: 600; }
.cal-day-header.is-holiday { background: rgba(196,167,110,.12); }
.cal-day-header.is-today.is-holiday { background: rgba(122,140,94,.1); }
.cal-grid.has-holidays .cal-corner,
.cal-grid.has-holidays .cal-day-header { min-height: 68px; }
.cal-day-header .day-name { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
.cal-day-header .day-date { font-size: .85rem; color: var(--text); line-height: 1.2; }
.cal-day-header .day-holiday { font-size: .62rem; line-height: 1.2; color: var(--highlight, #c4a76e); overflow-wrap: break-word; word-break: break-word; max-height: 2.6em; overflow: hidden; }
@media (max-width: 768px) { .cal-day-header .day-holiday { display: none; } }

.cal-time-label {
  padding: 0 .4rem;
  font-size: .68rem;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  border-bottom: 1px dotted var(--border-light);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: 2px;
}
.cal-slot {
  border-right: 1px solid var(--border);
  border-bottom: 1px dotted var(--border-light);
}
.cal-slot.is-today { background: rgba(122,140,94,.03); }

/* ── Event Block ─────────────────────────────────────────────────────────── */
.cal-event {
  background: var(--sage);
  color: #fff;
  padding: .2rem .35rem;
  margin: 1px 2px;
  border-radius: 3px;
  font-size: .72rem;
  cursor: pointer;
  overflow: hidden;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1px;
  position: relative;
  transition: filter .1s;
}
.cal-event:hover { filter: brightness(1.08); }
.cal-event-untimed { position: static; margin: 1px; }

.cal-event.status-completed { background: var(--sage-dark, #5a6b40); }
.cal-event.status-cancelled {
  background: transparent;
  color: var(--text-muted);
  text-decoration: line-through;
  border: 1px dashed var(--border);
}
.cal-event.is-abgerechnet::after {
  content: "✓";
  position: absolute;
  top: 2px; right: 4px;
  font-size: .65rem;
  opacity: .85;
}
.cal-event-time { font-weight: 700; font-size: .7rem; }
.cal-event-client { font-weight: 600; }
.cal-event-honorar { font-size: .68rem; opacity: .8; }

/* ── Popover ─────────────────────────────────────────────────────────────── */
.cal-popover {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(var(--shadow-color),.15);
  padding: 1rem 1.5rem 1.25rem;
  border-radius: var(--radius-lg);
  min-width: 260px;
  z-index: 200;
}
.cal-popover h4 { margin: 0 0 .75rem; font-size: 1rem; color: var(--sage); }
.cal-popover dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25rem .75rem;
  margin: 0 0 1rem;
  font-size: .875rem;
}
.cal-popover dt { color: var(--text-muted); }
.cal-popover dd { margin: 0; }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cal-grid, .cal-untimed {
    grid-template-columns: 48px repeat(7, minmax(50px, 1fr));
    overflow-x: auto;
  }
  .cal-event-honorar { display: none; }
  .week-nav { gap: .4rem; }
  .week-label { min-width: 120px; font-size: .875rem; }
}
