/* Calendalis Kalender – Oberfläche. Keine Fremdschriften, keine externen Ressourcen. */

:root {
  --akzent: #1f6b4a;
  --akzent-dunkel: #164f37;
  --akzent-hell: #e9f3ee;
  --text: #1f2328;
  --text-2: #565c63;
  --text-3: #7d838a;
  --linie: #e3e6ea;
  --linie-2: #eef0f2;
  --leiste: #f6f7f8;
  --flaeche: #ffffff;
  --hover: #eef1f3;
  --gefahr: #b42318;
  --gefahr-hell: #fdecea;
  --warnung-hell: #fff6dc;
  --warnung-linie: #f0d48a;

  /* Ebenen (werden aus /api/me überschrieben) */
  --c-praxis: #F2C200;
  --c-praxis-text: #2b2300;
  --c-praxis-rand: #c99f00;
  --c-online: #1ABC9C;
  --c-online-text: #05332a;
  --c-online-rand: #13917a;
  --c-frei: #2e9e5b;
  --c-frei-bg: rgba(46, 158, 91, .18);
  --c-sperre: #9aa0a6;
  --c-abgesagt: #8a8a8a;

  --radius: 10px;
  --radius-klein: 7px;
  --schatten: 0 10px 30px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .08);
  --schatten-klein: 0 1px 2px rgba(16, 24, 40, .08);
  --leiste-breite: 280px;
  --kopf-hoehe: 60px;

  --fc-border-color: #e6e8eb;
  --fc-today-bg-color: #fafcfb;
  --fc-now-indicator-color: #d93025;
  --fc-highlight-color: rgba(31, 107, 74, .14);
  --fc-bg-event-opacity: 1;
  --fc-neutral-bg-color: #f6f7f8;
  --fc-list-event-hover-bg-color: #f3f5f6;
  --fc-page-bg-color: #fff;

  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--flaeche); }
body { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--akzent); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--linie); background: #fff; color: var(--text);
  font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, box-shadow .12s;
  white-space: nowrap;
}
.knopf:hover { background: var(--hover); }
.knopf:focus-visible, .icon-knopf:focus-visible, .seg button:focus-visible, .menue button:focus-visible {
  outline: 2px solid var(--akzent); outline-offset: 2px;
}
.knopf[disabled] { opacity: .55; cursor: default; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.primaer:hover { background: var(--akzent-dunkel); }
.knopf.zweit { border-color: var(--akzent); color: var(--akzent); background: #fff; }
.knopf.zweit:hover { background: var(--akzent-hell); }
.knopf.gefahr { background: var(--gefahr); border-color: var(--gefahr); color: #fff; }
.knopf.gefahr:hover { background: #8f1c13; }
.knopf.gefahr-rand { border-color: #e7b4ae; color: var(--gefahr); }
.knopf.gefahr-rand:hover { background: var(--gefahr-hell); }
.knopf.breit { width: 100%; }
.knopf.leise { border-color: transparent; background: transparent; font-weight: 500; color: var(--text-2); }
.knopf.leise:hover { background: var(--hover); }
.knopf .plus { font-size: 20px; line-height: 1; font-weight: 500; margin-top: -2px; }

.icon-knopf {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid transparent;
  background: transparent; cursor: pointer; color: var(--text-2); padding: 0;
}
.icon-knopf:hover { background: var(--hover); }
.icon-knopf svg { width: 22px; height: 22px; }

/* ------------------------------------------------------------ Grundlayout */
#app {
  display: grid;
  grid-template-columns: var(--leiste-breite) minmax(0, 1fr);
  height: 100vh; height: 100dvh;
}

#seitenleiste {
  background: var(--leiste);
  border-right: 1px solid var(--linie);
  display: flex; flex-direction: column;
  min-height: 0; overflow-y: auto;
  scrollbar-width: thin;
  padding: 18px 18px 14px;
}
.marke { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.marke-logo {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--akzent); display: grid; place-items: center;
}
.marke-logo svg { width: 20px; height: 20px; }
.marke-text { font-weight: 700; font-size: 19px; letter-spacing: .01em; line-height: 1.1; }
.marke-text small { display: block; font-weight: 500; font-size: 12.5px; color: var(--text-3); letter-spacing: .02em; }
.schublade-zu { margin-left: auto; display: none; }

.konto { margin-bottom: 16px; }
.konto-name { font-weight: 650; font-size: 15.5px; }
.konto-sites { color: var(--text-2); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }

.aktionen { display: grid; gap: 8px; margin-bottom: 18px; }
.aktionen .knopf { min-height: 44px; justify-content: flex-start; padding-left: 18px; }
.aktionen .knopf.leise { min-height: 36px; padding-left: 18px; }

.abschnitt-titel {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); margin: 0 0 8px;
}

.ebenen { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 1px; }
.ebene label {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  min-height: 33px; padding: 4px 8px; margin: 0 -8px; border-radius: 8px; user-select: none;
}
.ebene label:hover { background: var(--hover); }
.ebene input { position: absolute; opacity: 0; pointer-events: none; }
.ebene .haken {
  width: 20px; height: 20px; border-radius: 5px; flex: none;
  border: 2px solid var(--farbe, #999); background: #fff;
  display: grid; place-items: center; transition: background .1s;
}
.ebene .haken svg { width: 13px; height: 13px; opacity: 0; }
.ebene input:checked + .haken { background: var(--farbe); }
.ebene input:checked + .haken svg { opacity: 1; }
.ebene input:focus-visible + .haken { outline: 2px solid var(--akzent); outline-offset: 2px; }
.ebene .haken.hell svg path { stroke: #2b2300; }
.ebene-name { font-size: 14.5px; }
.ebene-hinweis { color: var(--text-3); font-size: 12.5px; margin-left: auto; }
.ebene-sperre { --farbe: #8d949b; }
.ebene-abgesagt { --farbe: var(--c-abgesagt); }
.ebene-abgesagt .ebene-name { text-decoration: line-through; text-decoration-color: #aaa; }

.demnaechst { list-style: none; margin: 0 -8px 12px; padding: 0 8px; display: grid; gap: 2px; align-content: start;
  flex: 1 1 auto; min-height: 96px; overflow-y: auto; }
.demnaechst li button {
  display: grid; grid-template-columns: 4px 1fr; gap: 10px; width: 100%;
  text-align: left; background: transparent; border: 0; cursor: pointer;
  padding: 7px 8px; margin: 0 -8px; width: calc(100% + 16px); border-radius: 8px;
}
.demnaechst li button:hover { background: var(--hover); }
.demnaechst::after {
  content: ""; position: sticky; bottom: 0; height: 22px; margin-top: -22px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(246, 247, 248, 0), var(--leiste));
}
.demnaechst .streifen { border-radius: 2px; background: var(--c-praxis); }
.demnaechst .online .streifen { background: var(--c-online); }
.demnaechst .zeile1 { font-size: 12.5px; color: var(--text-2); }
.demnaechst .zeile2 { font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.demnaechst .zeile2 span { font-weight: 400; color: var(--text-2); font-size: 13px; }
.demnaechst-leer { color: var(--text-3); font-size: 13.5px; margin: 0 0 16px; }

.leiste-fuss {
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--linie); flex: none;
  display: flex; flex-wrap: wrap; gap: 0 14px; font-size: 13.5px;
}
.leiste-fuss .stand { flex-basis: 100%; }
.leiste-fuss a, .leiste-fuss button {
  display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 6px; margin: 0 -6px;
  border-radius: 8px; color: var(--text-2); text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left;
}
.leiste-fuss a:hover, .leiste-fuss button:hover { background: var(--hover); color: var(--text); }
.stand { color: var(--text-3); font-size: 12px; padding: 6px 0 0; }

/* ------------------------------------------------------------ Hauptfläche */
#haupt { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

.leiste-meldung {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px; font-size: 14px;
  border-bottom: 1px solid var(--linie);
}
.leiste-meldung p { margin: 0; flex: 1; }
.leiste-meldung .knopf { min-height: 34px; }
#fehlerleiste { background: var(--gefahr-hell); color: #7a1a12; border-bottom-color: #f3c7c1; }
#banner-gesperrt { background: var(--warnung-hell); color: #5c4400; border-bottom-color: var(--warnung-linie); }

#kopf {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--kopf-hoehe); padding: 10px 20px;
  border-bottom: 1px solid var(--linie);
}
.kopf-nav { display: flex; align-items: center; gap: 4px; }
#titel { font-size: 20px; font-weight: 650; margin: 0 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: 12px; }
#menue-knopf { display: none; }

.seg {
  display: inline-flex; background: #f1f3f4; border-radius: 999px; padding: 3px; gap: 2px;
}
.seg button {
  border: 0; background: transparent; border-radius: 999px; cursor: pointer;
  padding: 0 14px; min-height: 34px; font-size: 14px; font-weight: 550; color: var(--text-2);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: var(--schatten-klein), 0 0 0 1px rgba(0,0,0,.04); }

#ladebalken {
  position: absolute; left: 0; right: 0; height: 2px; top: 0; z-index: 5; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--akzent), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: laden 1s linear infinite; opacity: 0; transition: opacity .2s;
}
#ladebalken.an { opacity: 1; }
@keyframes laden { from { background-position: -40% 0; } to { background-position: 140% 0; } }

#kalender-rahmen { flex: 1; min-height: 0; position: relative; }
#kalender { position: absolute; inset: 0; padding: 0 12px 8px 4px; }

/* ------------------------------------------------------------ FullCalendar anpassen */
.fc { font-size: 13.5px; }
.fc .fc-scrollgrid { border-left: 0; border-top: 0; }
.fc .fc-scrollgrid-section > td, .fc .fc-scrollgrid-section > th { border-right: 0; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--fc-border-color); }
.fc .fc-col-header-cell { border-left-color: transparent; border-right-color: transparent; }
.fc .fc-col-header-cell-cushion { padding: 8px 2px 6px; color: var(--text-2); text-decoration: none; display: block; }
.kt { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.kt-wt { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.kt-nr {
  font-size: 20px; font-weight: 500; color: var(--text); width: 36px; height: 36px; line-height: 36px;
  border-radius: 50%; text-align: center;
}
.kt-nr.heute { background: var(--akzent); color: #fff; font-weight: 650; }
.fc .fc-day-today .kt-wt { color: var(--akzent); }
.kt-monat { font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 4px 0; }

.fc .fc-timegrid-slot { height: 1.9em; }
.fc .fc-timegrid-slot-minor { border-top-style: none; }
.fc .fc-timegrid-slot-label { vertical-align: top; border: 0; }
.fc .fc-timegrid-slot-label-cushion { font-size: 11.5px; color: var(--text-3); padding: 0 8px 0 4px; position: relative; top: -0.75em; background: #fff; }
.fc .fc-timegrid-axis-cushion { font-size: 11.5px; color: var(--text-3); }
.fc .fc-timegrid-now-indicator-line { border-width: 2px 0 0; }
.fc .fc-timegrid-now-indicator-arrow { border-width: 5px 0 5px 6px; border-top-color: transparent; border-bottom-color: transparent; }
.fc .fc-timegrid-col.fc-day-today { background: var(--fc-today-bg-color); }
.fc .fc-highlight { border-radius: 6px; }
.fc .fc-timegrid-slots tr:first-child .fc-timegrid-slot-label-cushion { visibility: hidden; }
.fc .fc-event-mirror:not(.ev) { --fc-event-bg-color: var(--akzent); --fc-event-border-color: var(--akzent-dunkel); --fc-event-text-color: #fff; opacity: .9; }

/* Termine */
.fc .ev { border-radius: 6px; cursor: pointer; box-shadow: none; }
.fc .fc-event:focus { box-shadow: none; }
.fc .fc-event:focus::after { display: none; }
.fc .fc-event:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
.fc .fc-v-event.ev, .fc .fc-h-event.ev, .fc .fc-daygrid-block-event.ev { border-width: 1px; }
.fc .fc-v-event.ev .fc-event-main { padding: 2px 5px; }
.fc .fc-timegrid-event-harness-inset .fc-timegrid-event { box-shadow: 0 0 0 1.5px #fff; }

.ev-praxis { --fc-event-bg-color: var(--c-praxis); --fc-event-border-color: var(--c-praxis-rand); --fc-event-text-color: var(--c-praxis-text); }
.ev-online { --fc-event-bg-color: var(--c-online); --fc-event-border-color: var(--c-online-rand); --fc-event-text-color: var(--c-online-text); }
.fc .fc-event.ev, .fc .fc-event.ev-frei-block { color: var(--fc-event-text-color); }
.fc .ev-sperre:not(.fc-list-event) {
  --fc-event-bg-color: #eceef0; --fc-event-border-color: var(--c-sperre); --fc-event-text-color: #3c4043;
  background: repeating-linear-gradient(135deg, #e6e8eb 0 6px, #f4f5f6 6px 12px);
}
.fc .ev-abgesagt:not(.fc-list-event) {
  --fc-event-bg-color: #f4f5f6; --fc-event-border-color: #c6cacf; --fc-event-text-color: #6f757c;
  border-style: dashed;
}
.fc .ev-abgesagt .ev-titel { text-decoration: line-through; }
.fc .fc-list-event.ev-abgesagt { color: var(--text-3); }
.fc .ev-frei-block {
  --fc-event-bg-color: var(--c-frei-bg); --fc-event-border-color: transparent; --fc-event-text-color: #1c6b3f;
  border-left: 3px solid var(--c-frei) !important;
}

.ev-inhalt { display: flex; flex-direction: column; overflow: hidden; height: 100%; width: 100%; min-width: 0; line-height: 1.25; }
.ev-titel { font-weight: 650; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-zeile { font-size: 11.5px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-zeit { font-size: 11px; opacity: .8; white-space: nowrap; }
.ev-serie { font-weight: 400; opacity: .8; }

/* kurze Termine (30 Min): Titel und Art in eine Zeile */
.fc-timegrid-event-short .ev-inhalt { flex-direction: row; align-items: baseline; gap: 6px; }
.fc-timegrid-event-short .ev-titel { flex: none; max-width: 100%; }
.fc-timegrid-event-short .ev-zeile { flex: 1 1 0; min-width: 0; }
.fc-timegrid-event-short .ev-zeit { display: none; }

/* Monat */
.fc .fc-daygrid-day-number { font-size: 13px; color: var(--text-2); padding: 6px 8px; text-decoration: none; }
.fc .fc-day-today .fc-daygrid-day-number {
  background: var(--akzent); color: #fff; border-radius: 50%; min-width: 26px; height: 26px; line-height: 26px;
  padding: 0 4px; margin: 4px; text-align: center; font-weight: 650;
}
.fc .fc-daygrid-day.fc-day-today { background: #fff; }
.fc .fc-daygrid-event { margin-top: 2px; }
.fc .fc-daygrid-block-event .fc-event-main { padding: 1px 5px; }
.ev-monat { display: flex; gap: 5px; align-items: baseline; overflow: hidden; white-space: nowrap; }
.ev-monat .ev-zeit { font-size: 11.5px; opacity: .85; }
.ev-monat .ev-titel { font-size: 12.5px; }
.fc .fc-daygrid-more-link { font-size: 12px; color: var(--text-2); font-weight: 600; }
.fc .fc-day-other .fc-daygrid-day-top { opacity: .45; }

/* Liste */
.fc .fc-list { border: 0; }
.fc .fc-list-day-cushion { background: var(--leiste); padding: 8px 14px; }
.fc .fc-list-day-text, .fc .fc-list-day-side-text { color: var(--text); text-decoration: none; font-weight: 650; }
.fc .fc-list-event td { padding: 10px 14px; }
.fc .fc-list-event-time { color: var(--text-2); width: 120px; }
.fc .fc-list-event.ev-praxis .fc-list-event-dot { border-color: var(--c-praxis); }
.fc .fc-list-event.ev-online .fc-list-event-dot { border-color: var(--c-online); }
.fc .fc-list-event.ev-sperre .fc-list-event-dot { border-color: var(--c-sperre); }
.fc .fc-list-event.ev-abgesagt .fc-list-event-dot { border-color: #c6cacf; }
.fc .fc-list-event.ev-frei-block .fc-list-event-dot { border-color: var(--c-frei); }
.fc .fc-list-event.ev-frei-block { border-left: 0 !important; }
.fc .fc-list-event.ev, .fc .fc-list-event.ev-frei-block { --fc-event-text-color: var(--text); color: var(--text); background: none; }
.ev-liste { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ev-liste .ev-titel { font-size: 14.5px; }
.ev-liste .ev-zeile { font-size: 13px; color: var(--text-2); }
.fc .fc-list-empty { background: #fff; }
.fc .fc-list-empty-cushion { color: var(--text-3); }

/* freie Zeit als Hintergrund */
.fc .fc-bg-event.ev-frei { background: var(--c-frei-bg); box-shadow: inset 3px 0 0 var(--c-frei); border-radius: 4px; }
.ev-frei-text { font-size: 11px; font-weight: 650; color: #1c6b3f; padding: 3px 4px 0 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc .fc-bg-event .fc-event-title { margin: 0; font-style: normal; }

/* ------------------------------------------------------------ Kontextmenü */
.menue {
  position: fixed; z-index: 60; min-width: 250px; max-width: 340px;
  background: #fff; border-radius: 12px; box-shadow: var(--schatten); border: 1px solid var(--linie);
  padding: 6px; display: grid; gap: 1px;
}
.menue-kopf { font-size: 12.5px; color: var(--text-3); padding: 6px 10px 6px; font-weight: 600; }
.menue button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; border: 0; background: transparent; cursor: pointer;
  min-height: 40px; padding: 0 10px; border-radius: 8px; font-size: 14.5px;
}
.menue button:hover { background: var(--hover); }
.menue button .punkt { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--akzent); }
.menue button .punkt.frei { background: var(--c-frei); }
.menue button .punkt.sperre { background: repeating-linear-gradient(135deg, #8d949b 0 2px, #e3e5e8 2px 4px); }
.menue button .punkt.weg { background: #fff; border: 2px solid var(--gefahr); }
.menue button.gefahr { color: var(--gefahr); }
.menue hr { border: 0; border-top: 1px solid var(--linie-2); margin: 4px 6px; }
.menue .menue-abbrechen { display: none; }
.menue-hintergrund { position: fixed; inset: 0; z-index: 59; background: transparent; }

/* ------------------------------------------------------------ Detail-Panel */
#detail {
  position: absolute; top: 0; right: 0; bottom: 0; width: 380px; z-index: 30;
  background: #fff; border-left: 1px solid var(--linie); box-shadow: -12px 0 30px rgba(16,24,40,.08);
  display: flex; flex-direction: column; overflow: hidden;
}
.detail-kopf { display: flex; align-items: center; gap: 10px; padding: 14px 14px 6px 20px; }
.marker { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.marker i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; background: var(--c-praxis); }
.marker.online i { background: var(--c-online); }
.marker.sperre i { background: repeating-linear-gradient(135deg, #8d949b 0 2px, #e3e5e8 2px 4px); }
.marker.abgesagt i { background: #fff; border: 1.5px dashed #9aa0a6; }
.detail-kopf .icon-knopf { margin-left: auto; }
.detail-inhalt { padding: 4px 20px 16px; overflow-y: auto; flex: 1; }
.detail-inhalt h2 { font-size: 22px; line-height: 1.25; margin: 4px 0 2px; overflow-wrap: anywhere; }
.detail-art { color: var(--text-2); margin: 0 0 14px; }
.detail-art.durch { text-decoration: line-through; }
.felder { margin: 0; display: grid; gap: 12px; }
.felder div { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; }
.felder dt { color: var(--text-3); padding-top: 1px; }
.felder dt svg { width: 18px; height: 18px; }
.felder dd { margin: 0; overflow-wrap: anywhere; }
.felder dd small { display: block; color: var(--text-3); font-size: 12.5px; }
.felder .notiz { white-space: pre-wrap; }
.hinweis-box { background: var(--leiste); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; color: var(--text-2); margin: 14px 0 0; }
.hinweis-box.warn { background: var(--warnung-hell); color: #5c4400; }
.detail-link { display: inline-block; margin-top: 14px; font-weight: 600; text-decoration: none; }
.detail-link:hover { text-decoration: underline; }
.detail-fuss {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--linie-2);
}
.detail-fuss .knopf { flex: 1 1 0; }

/* ------------------------------------------------------------ Dialoge */
dialog.dlg {
  border: 0; padding: 0; border-radius: 16px; box-shadow: var(--schatten);
  width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  color: var(--text); background: #fff; overflow: hidden;
}
dialog.dlg.schmal { width: min(420px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgba(20, 26, 32, .38); }
.dlg-form { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.dlg-kopf { display: flex; align-items: center; gap: 8px; padding: 18px 20px 4px 22px; }
.dlg-kopf h2 { margin: 0; font-size: 19px; font-weight: 650; }
.dlg-kopf .icon-knopf { margin-left: auto; margin-right: -6px; }
.dlg-griff { display: none; }
.dlg-koerper { padding: 10px 22px 6px; overflow-y: auto; display: grid; gap: 14px; }
.dlg-koerper p { margin: 0; }
.dlg-koerper:focus { outline: none; }
.dlg-fuss {
  display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px calc(18px + env(safe-area-inset-bottom));
}
.dlg-fuss .knopf { min-height: 42px; }

.feld { display: grid; gap: 5px; }
.feld > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.feld > span em { font-style: normal; font-weight: 400; color: var(--text-3); }
.feld input, .feld select, .feld textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid #cfd4d9; border-radius: 8px; background: #fff;
}
.feld textarea { min-height: 76px; resize: vertical; }
.feld input:focus, .feld select:focus, .feld textarea:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: var(--akzent); }
.feld .tipp { font-size: 12.5px; color: var(--text-3); font-weight: 400; }
.feld.fehlt input { border-color: var(--gefahr); }
.reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reihe.drei { grid-template-columns: 1.3fr 1fr 1fr; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--akzent); flex: none; }
.dlg-fehler { color: var(--gefahr); font-size: 14px; font-weight: 550; }
.dlg-info { font-size: 13.5px; color: var(--text-2); background: var(--leiste); border-radius: 8px; padding: 10px 12px; }
.konflikt-liste { margin: 0; padding-left: 18px; }

/* ------------------------------------------------------------ Hinweise (Toasts) */
#toasts {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80;
  display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px;
  background: #23282d; color: #fff; border-radius: 10px; padding: 10px 12px 10px 16px;
  box-shadow: var(--schatten); font-size: 14.5px; animation: rein .18s ease-out;
}
.toast.fehler { background: #8f1c13; }
.toast.warn { background: #6b5100; }
.toast button {
  background: transparent; border: 0; color: #9fe0bd; font-weight: 700; cursor: pointer; padding: 6px 8px; border-radius: 6px; min-height: 36px;
}
.toast button:hover { background: rgba(255,255,255,.1); }
@keyframes rein { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------ Plus-Knopf & Schublade (nur Handy) */
#fab {
  display: none; position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 40;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--akzent); color: #fff; box-shadow: 0 6px 18px rgba(31,107,74,.38), 0 2px 4px rgba(0,0,0,.12);
}
#fab svg { width: 28px; height: 28px; }
#schublade-hintergrund { display: none; }
#sheet-hintergrund { display: none; }

/* ------------------------------------------------------------ Handy (< 900 px) */
@media (max-width: 899.98px) {
  :root { font-size: 15px; --kopf-hoehe: 52px; }
  #app { grid-template-columns: minmax(0, 1fr); }
  #seitenleiste {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 70; width: min(320px, 86vw);
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--schatten);
    padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  body.schublade-offen #seitenleiste { transform: none; }
  .demnaechst { flex: none; overflow: visible; min-height: 0; }
  .demnaechst::after { display: none; }
  .leiste-fuss a, .leiste-fuss button { min-height: 44px; }
  #schublade-hintergrund { position: fixed; inset: 0; z-index: 69; background: rgba(20,26,32,.38); }
  body.schublade-offen #schublade-hintergrund { display: block; }
  .schublade-zu { display: inline-flex; }

  #kopf {
    flex-wrap: wrap; gap: 6px 4px; padding: calc(6px + env(safe-area-inset-top)) 8px 8px;
  }
  #menue-knopf { display: inline-flex; order: 0; }
  #titel { order: 1; font-size: 17px; margin: 0 0 0 2px; flex: 1; min-width: 0; }
  .kopf-nav { order: 2; }
  .kopf-nav .knopf { min-height: 40px; padding: 0 12px; }
  .kopf-rechts { order: 3; width: 100%; margin: 0; }
  .kopf-rechts .seg { width: 100%; }
  .kopf-rechts .seg button { flex: 1; min-height: 38px; padding: 0 4px; }
  #stand-kopf { display: none; }

  #kalender { padding: 0 4px 0 0; }
  .fc { font-size: 12.5px; }
  .kt-nr { font-size: 17px; width: 30px; height: 30px; line-height: 30px; }
  .kt-wt { font-size: 10.5px; }
  .fc .fc-timegrid-slot-label-cushion { padding: 0 4px 0 2px; font-size: 10.5px; }
  .fc .fc-v-event.ev .fc-event-main { padding: 1px 3px; }
  .ev-titel { font-size: 12.5px; }
  .ev-zeile { font-size: 11px; }
  .fc-timeGridWeek-view .ev-zeit, .fc-timeGridWeek-view .ev-zeile { display: none; }
  .fc-timeGridWeek-view .fc-v-event.ev .fc-event-main { padding: 1px 2px; }
  .fc-timeGridWeek-view .ev-titel { font-size: 11.5px; text-overflow: clip; }
  .fc .fc-daygrid-day-number { font-size: 12px; padding: 4px; }
  .fc .fc-day-today .fc-daygrid-day-number { min-width: 22px; height: 22px; line-height: 22px; margin: 2px; }
  .ev-monat .ev-zeit { display: none; }
  .ev-monat .ev-titel { font-size: 11px; }
  .fc .fc-daygrid-block-event .fc-event-main { padding: 0 3px; }
  .leiste-meldung { padding: 8px 12px; font-size: 13.5px; }

  #fab { display: grid; place-items: center; }

  /* Detail-Panel als Bottom-Sheet */
  #detail {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 86dvh; z-index: 65;
    border-left: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(16,24,40,.18);
    animation: hoch .22s ease-out;
  }
  #sheet-hintergrund { position: fixed; inset: 0; z-index: 64; background: rgba(20,26,32,.38); }
  body.sheet-offen #sheet-hintergrund { display: block; }
  .detail-kopf { padding-top: 18px; position: relative; }
  .detail-kopf::before, .menue::before, .dlg-griff {
    content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 2px; background: #d5d9dd;
  }
  .detail-fuss .knopf { min-height: 46px; }

  /* Kontextmenü als Aktionsblatt */
  .menue {
    left: 0 !important; right: 0; top: auto !important; bottom: 0; max-width: none; min-width: 0;
    border-radius: 18px 18px 0 0; padding: 22px 10px calc(10px + env(safe-area-inset-bottom)); animation: hoch .2s ease-out;
  }
  .menue button { min-height: 50px; font-size: 16px; padding: 0 14px; }
  .menue .menue-abbrechen { display: flex; justify-content: center; color: var(--text-2); font-weight: 600; }
  .menue-kopf { font-size: 13.5px; padding: 0 14px 6px; }
  .menue-hintergrund { background: rgba(20,26,32,.38); }

  /* Dialoge als Bottom-Sheet */
  dialog.dlg, dialog.dlg.schmal {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0;
    max-height: 92dvh; animation: hoch .22s ease-out;
  }
  .dlg-form { max-height: 92dvh; position: relative; }
  .dlg-griff { display: block; }
  .dlg-kopf { padding: 22px 16px 2px 18px; }
  .dlg-koerper { padding: 10px 18px 4px; }
  .dlg-fuss { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); }
  .dlg-fuss .knopf { flex: 1; min-height: 48px; }
  .feld input, .feld select, .feld textarea { font-size: 16px; min-height: 46px; }
  .reihe.drei { grid-template-columns: 1fr 1fr; }
  .reihe.drei > :first-child { grid-column: 1 / -1; }

  #toasts { bottom: calc(92px + env(safe-area-inset-bottom)); }
}
@keyframes hoch { from { transform: translateY(30px); opacity: .3; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------ Login */
.login-seite { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: var(--leiste); padding: 24px 16px; overflow: auto; }
body.login-body { overflow: auto; }
.login-karte {
  width: min(400px, 100%); background: #fff; border: 1px solid var(--linie); border-radius: 18px;
  padding: 32px 28px 28px; box-shadow: 0 12px 40px rgba(16,24,40,.06);
}
.login-karte .marke { justify-content: center; margin-bottom: 8px; }
.login-karte .marke-logo { width: 44px; height: 44px; }
.login-karte .marke-logo svg { width: 26px; height: 26px; }
.login-karte .marke-text { font-size: 26px; }
.login-unter { text-align: center; color: var(--text-2); margin: 0 0 24px; }
.login-karte form { display: grid; gap: 14px; }
.login-karte .knopf { min-height: 48px; margin-top: 6px; font-size: 16px; }
.login-karte .feld input { min-height: 48px; font-size: 16px; }
.login-fehler { color: var(--gefahr); background: var(--gefahr-hell); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0; }
.login-fuss { text-align: center; color: var(--text-3); font-size: 13px; margin: 18px 0 0; }

/* ------------------------------------------------------------ Hilfe */
body.hilfe-body { overflow: auto; background: #fff; }
.hilfe { max-width: 760px; margin: 0 auto; padding: 28px 20px 60px; }
.hilfe .marke { margin-bottom: 28px; }
.hilfe h1 { font-size: 28px; margin: 0 0 8px; }
.hilfe h2 { font-size: 20px; margin: 34px 0 10px; padding-top: 6px; border-top: 1px solid var(--linie-2); }
.hilfe p, .hilfe li { color: #30363c; }
.hilfe ul, .hilfe ol { padding-left: 22px; }
.hilfe li { margin: 4px 0; }
.hilfe .einleitung { font-size: 17px; color: var(--text-2); }
.farbliste { list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.farbliste li { display: flex; gap: 12px; align-items: flex-start; margin: 0; }
.farbliste .muster { width: 46px; height: 24px; border-radius: 6px; flex: none; margin-top: 1px; border: 1px solid rgba(0,0,0,.08); }
.muster.praxis { background: var(--c-praxis); }
.muster.online { background: var(--c-online); }
.muster.frei { background: var(--c-frei-bg); box-shadow: inset 3px 0 0 var(--c-frei); }
.muster.sperre { background: repeating-linear-gradient(135deg, #e6e8eb 0 6px, #f4f5f6 6px 12px); border-color: #9aa0a6; }
.muster.abgesagt { background: #f4f5f6; border: 1px dashed #c6cacf; }
.beispiel { background: var(--leiste); border-radius: 10px; padding: 14px 16px; margin: 12px 0; }
.beispiel p { margin: 4px 0; }
.zurueck { display: inline-flex; margin-top: 30px; }
