/* Kursplan im eigenen Design. Farben und Schrift kommen aus dem Entwurf über diese Variablen:
   --kp-akzent, --kp-akzent-text, --kp-flaeche, --kp-karte, --kp-linie, --kp-text, --kp-leise,
   --kp-radius, --kp-knopf-radius, --kp-titel, --kp-titel-gewicht, --kp-ok, --kp-knapp
   Abstände nur aus der Reihe 4 / 8 / 12 / 16 / 24 / 32. */
.kp{color:var(--kp-text,#222);font-variant-numeric:tabular-nums}
.kp *{box-sizing:border-box}
.kp [hidden]{display:none!important}

/* Knöpfe */
.kp-knopf{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 24px;border-radius:var(--kp-knopf-radius,999px);border:0;background:transparent;box-shadow:inset 0 0 0 1.5px var(--kp-linie,#ddd);color:var(--kp-text,#222);font-family:inherit;font-weight:600;font-size:15px;line-height:1.2;text-decoration:none;white-space:nowrap;cursor:pointer;transition:box-shadow .25s,filter .25s,transform .2s}
.kp-knopf:hover{box-shadow:inset 0 0 0 1.5px var(--kp-text,#222)}
.kp-knopf:active{transform:scale(.98)}
.kp-knopf:focus-visible{outline:2px solid var(--kp-akzent,#222);outline-offset:3px}
.kp-knopf-voll{background:var(--kp-akzent,#222);color:var(--kp-akzent-text,#fff);box-shadow:none}
.kp-knopf-voll:hover{box-shadow:none;filter:brightness(.92)}
.kp-knopf i{font-size:17px;transition:transform .3s cubic-bezier(.22,1,.36,1)}
.kp-knopf:hover i.ph-arrow-right{transform:translateX(3px)}

/* Status-Punkt */
.kp-punkt{width:10px;height:10px;border-radius:50%;background:var(--kp-ok,#2f6b3a);box-shadow:0 0 0 4px color-mix(in srgb,var(--kp-ok,#2f6b3a) 18%,transparent);flex:none}
.kp-punkt.ist-laden{background:var(--kp-leise,#888);box-shadow:none;animation:kp-puls 1s ease-in-out infinite alternate}
.kp-punkt.ist-regel{background:var(--kp-akzent,#333);box-shadow:none}
@keyframes kp-puls{to{opacity:.3}}

/* ---------- Live-Element: eine Zeile, feste Höhe ---------- */
.kp-platz{margin-top:16px}
.kp-next{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;column-gap:16px;height:88px;padding:0 16px 0 24px;border-radius:var(--kp-radius,14px);background:var(--kp-karte,#fff);box-shadow:inset 0 0 0 1px var(--kp-linie,#e5e5e5)}
.kp-next-text{margin:0;display:grid;gap:4px;min-width:0;line-height:1.3}
.kp-next-label{font-size:12.5px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--kp-leise,#666)}
.kp-next-inhalt{display:flex;align-items:baseline;gap:12px;min-width:0;font-size:17px;white-space:nowrap}
.kp-next-wann{color:var(--kp-akzent,#222);flex:none}
.kp-next-kurs{min-width:0;overflow:hidden;text-overflow:ellipsis}
.kp-next-kurs b{font-weight:600}
.kp-next-frei{flex:none;font-size:13.5px;font-weight:600;padding:4px 12px;border-radius:999px;background:var(--kp-flaeche,#f2f2f2);color:var(--kp-ok,#2f6b3a)}
.kp-next-frei.ist-knapp{color:var(--kp-knapp,#9a5a00)}
.kp-next-zusatz{color:var(--kp-leise,#666);overflow:hidden;text-overflow:ellipsis}
.kp-next-skelett{display:block;width:min(420px,90%);height:14px;margin-top:4px;border-radius:7px;background:linear-gradient(90deg,var(--kp-flaeche,#eee) 30%,var(--kp-karte,#fff) 50%,var(--kp-flaeche,#eee) 70%);background-size:300% 100%;animation:kp-schimmer 1.4s linear infinite}
@keyframes kp-schimmer{from{background-position:100% 0}to{background-position:-200% 0}}
/* Handy: kompakter Block mit fester Höhe */
@media (max-width:640px){
  .kp-next{position:relative;grid-template-columns:minmax(0,1fr);grid-template-rows:1fr auto;align-items:start;row-gap:16px;height:176px;padding:16px}
  .kp-next>.kp-punkt{position:absolute;left:16px;top:19px}
  .kp-next-text{padding-left:24px}
  .kp-next-inhalt{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;white-space:normal;font-size:16px;line-height:1.35}
  .kp-next-wann{order:1;flex:none}
  .kp-next-frei{order:2;flex:none}
  .kp-next-kurs{order:3;flex:1 0 100%;white-space:nowrap}
  .kp-next-inhalt>b:not(.kp-next-wann),.kp-next-zusatz,.kp-next-skelett{flex:1 0 100%}
  .kp-next-skelett{width:100%}
  .kp-next-knopf{grid-column:1/-1;width:100%;align-self:end}
}

/* ---------- Popup ---------- */
.kp-dialog{padding:0;border:0;border-radius:calc(var(--kp-radius,14px) + 8px);width:min(980px,calc(100% - 48px));height:min(800px,calc(100dvh - 48px));max-width:none;max-height:none;background:var(--kp-karte,#fff);color:var(--kp-text,#222);box-shadow:0 40px 100px -30px rgba(0,0,0,.45);overflow:hidden}
.kp-dialog::backdrop{background:rgba(20,16,12,.55);backdrop-filter:blur(3px)}
.kp-dialog[open]{animation:kp-auf .32s cubic-bezier(.22,1,.36,1)}
@keyframes kp-auf{from{opacity:0;transform:translateY(16px) scale(.985)}}
.kp-dlg-rahmen{display:flex;flex-direction:column;height:100%}
.kp-dlg-kopf{flex:none;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:24px 32px 16px}
.kp-dlg-kopf h2{margin:0;font-family:var(--kp-titel,inherit);font-weight:var(--kp-titel-gewicht,600);font-size:clamp(26px,2.6vw,34px);line-height:1.1}
.kp-dlg-zu{flex:none;display:grid;place-items:center;width:44px;height:44px;border:0;border-radius:50%;background:var(--kp-flaeche,#f2f2f2);color:inherit;font-size:20px;cursor:pointer;transition:background .2s}
.kp-dlg-zu:hover{background:var(--kp-linie,#e5e5e5)}
.kp-dlg-zu:focus-visible{outline:2px solid var(--kp-akzent,#222);outline-offset:2px}
.kp-plan{flex:1;min-height:0;display:flex;flex-direction:column;padding:0 32px}

/* Tagesreiter */
.kp-reiter{flex:none;display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;padding:4px;border-radius:calc(var(--kp-radius,14px) + 4px);background:var(--kp-flaeche,#f2f2f2)}
.kp-reiter-knopf{display:grid;justify-items:center;gap:2px;padding:8px 4px;border:0;border-radius:var(--kp-radius,14px);background:transparent;color:inherit;font-family:inherit;cursor:pointer;transition:background .25s}
.kp-reiter-knopf b{font-size:15px;font-weight:600}
.kp-reiter-knopf span{font-size:12.5px;color:var(--kp-leise,#666)}
.kp-reiter-knopf:hover{background:color-mix(in srgb,var(--kp-karte,#fff) 60%,transparent)}
.kp-reiter-knopf[aria-selected="true"]{background:var(--kp-akzent,#222);color:var(--kp-akzent-text,#fff)}
.kp-reiter-knopf[aria-selected="true"] span{color:inherit;opacity:.85}
.kp-reiter-knopf:focus-visible{outline:2px solid var(--kp-akzent,#222);outline-offset:2px}

/* Filter */
.kp-filter{flex:none;display:flex;flex-direction:column;align-items:flex-start;gap:12px;margin:16px 0}
/* Kursarten brechen um, alles ohne Wischen erreichbar */
.kp-chips{display:flex;flex-wrap:wrap;gap:8px}
.kp-art{display:none}
.kp-art>span:first-child{font-size:13px;font-weight:600;color:var(--kp-leise,#666)}
.kp-art-feld{position:relative;display:block}
.kp-art-wahl{appearance:none;-webkit-appearance:none;width:100%;min-height:44px;padding:0 44px 0 16px;border:0;border-radius:var(--kp-radius,14px);box-shadow:inset 0 0 0 1px var(--kp-linie,#ddd);background:var(--kp-karte,#fff);color:var(--kp-text,#222);font:inherit;font-size:15px;font-weight:600;cursor:pointer}
.kp-art-wahl:focus-visible{outline:2px solid var(--kp-akzent,#222);outline-offset:2px}
.kp-art-feld i{position:absolute;right:16px;top:50%;transform:translateY(-50%);pointer-events:none;color:var(--kp-akzent,#222)}
.kp-chips button,.kp-segment button{flex:none;min-height:40px;padding:0 16px;border:0;border-radius:999px;background:transparent;box-shadow:inset 0 0 0 1px var(--kp-linie,#ddd);color:inherit;font-family:inherit;font-weight:500;font-size:14px;line-height:1;cursor:pointer;transition:background .2s,color .2s}
.kp-chips button[aria-pressed="true"]{background:var(--kp-text,#222);color:var(--kp-karte,#fff);box-shadow:none}
.kp-segment{flex:none;display:inline-flex;padding:4px;gap:4px;border-radius:999px;background:var(--kp-flaeche,#f2f2f2)}
.kp-segment button{box-shadow:none;min-height:32px}
.kp-segment button[aria-pressed="true"]{background:var(--kp-karte,#fff);box-shadow:0 1px 4px rgba(0,0,0,.12)}
.kp-chips button:focus-visible,.kp-segment button:focus-visible{outline:2px solid var(--kp-akzent,#222);outline-offset:2px}

/* Tagesliste: füllt den Platz, scrollt in sich */
.kp-tag{flex:1;min-height:0;display:flex;flex-direction:column;overflow-y:auto;overscroll-behavior:contain;border-top:1px solid var(--kp-linie,#e5e5e5)}
.kp-tag-titel{flex:none;margin:16px 0 4px;font-family:var(--kp-titel,inherit);font-weight:var(--kp-titel-gewicht,600);font-size:22px;line-height:1.2}
.kp-liste{flex:1 0 auto;list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.kp-zeile{display:grid;grid-template-columns:72px minmax(0,1fr) auto;align-items:center;column-gap:24px;padding:16px 0;border-bottom:1px solid var(--kp-linie,#e5e5e5)}
.kp-zeile.ist-vorbei{opacity:.45}
.kp-zeile.ist-abgesagt .kp-name{text-decoration:line-through}
.kp-zeit{display:grid;line-height:1.2}
.kp-zeit b{font-size:19px;font-weight:600}
.kp-zeit small{font-size:13px;color:var(--kp-leise,#666);white-space:nowrap}
.kp-mitte{display:grid;gap:4px;min-width:0;line-height:1.3}
.kp-name{font-size:17px;font-weight:600}
.kp-wer{font-size:14.5px;color:var(--kp-leise,#666)}
.kp-wer:empty{display:none}
.kp-orte{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}
.kp-ort{display:inline-flex;align-items:center;gap:4px;font-size:13px;font-weight:600;white-space:nowrap;padding:4px 12px 4px 8px;border-radius:999px;background:var(--kp-flaeche,#f2f2f2);color:var(--kp-ok,#2f6b3a)}
.kp-ort i{font-size:15px}
.kp-ort.ist-knapp{color:var(--kp-knapp,#9a5a00)}
.kp-ort.ist-voll{color:var(--kp-leise,#666)}
.kp-aktion{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}
.kp-buchen{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:44px;min-width:128px;padding:0 16px;border-radius:var(--kp-knopf-radius,999px);background:var(--kp-akzent,#222);color:var(--kp-akzent-text,#fff);font-weight:600;font-size:14.5px;text-decoration:none;white-space:nowrap;transition:filter .2s,transform .2s}
.kp-buchen:hover{filter:brightness(.92)}
.kp-buchen:active{transform:scale(.98)}
.kp-buchen:focus-visible{outline:2px solid var(--kp-akzent,#222);outline-offset:3px}
/* Ausgebucht, fällt aus, vorbei: reiner Text, kein Knopf */
.kp-hinweis{display:inline-flex;align-items:center;min-height:44px;font-size:14px;font-weight:600;color:var(--kp-leise,#666)}
.kp-beide{font-size:14px;color:var(--kp-text,#222)}

/* Wenige oder keine Kurse: Hinweis auf den nächsten Tag statt leerer Fläche */
.kp-folgetag{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:24px 0 8px;border-bottom:1px solid var(--kp-linie,#e5e5e5);color:var(--kp-leise,#666)}
.kp-folgetag>span{font-family:var(--kp-titel,inherit);font-size:18px}
.kp-folgetag .kp-weiter{font-size:14px;padding:4px 0}
.kp-stand>.kp-punkt{margin-top:5px}
.kp-leer-kurz{display:flex;align-items:center;gap:12px;padding:16px 0;color:var(--kp-leise,#666);font-size:15px;border-bottom:1px solid var(--kp-linie,#e5e5e5)}
.kp-leer-kurz>i{font-size:22px;color:var(--kp-akzent,#222);opacity:.7;flex:none}
.kp-weiter{display:inline-flex;align-items:center;gap:8px;border:0;background:none;padding:8px 0;color:var(--kp-akzent,#222);font-family:inherit;font-weight:600;font-size:15px;cursor:pointer;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:4px}
.kp-weiter:focus-visible{outline:2px solid var(--kp-akzent,#222);outline-offset:3px}
.kp-leer{flex:1;display:grid;place-content:center;justify-items:center;gap:12px;padding:32px 16px;text-align:center;color:var(--kp-leise,#666);font-size:16px}
.kp-leer>i{font-size:32px;color:var(--kp-akzent,#222);opacity:.7}

/* Ladezustand */
.kp-skelett i{display:block;height:12px;border-radius:6px;background:linear-gradient(90deg,var(--kp-flaeche,#eee) 30%,var(--kp-karte,#fff) 50%,var(--kp-flaeche,#eee) 70%);background-size:300% 100%;animation:kp-schimmer 1.4s linear infinite}
.kp-skelett .kp-zeit i:first-child{width:48px;height:16px;margin-bottom:8px}
.kp-skelett .kp-zeit i:last-child{width:36px}
.kp-skelett .kp-mitte i:first-child{width:56%;height:16px}
.kp-skelett .kp-mitte i:last-child{width:32%}
.kp-skelett .kp-aktion i{width:128px;height:44px;border-radius:999px}

/* Fuß */
.kp-dlg-fuss{flex:none;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px 24px;min-height:72px;padding:12px 32px;border-top:1px solid var(--kp-linie,#e5e5e5);background:var(--kp-karte,#fff)}
.kp-stand{display:inline-flex;align-items:flex-start;gap:12px;font-size:14px;color:var(--kp-leise,#666);line-height:1.4}

/* Rückfall: Eversports-Widget nur hier */
.kp-dlg-widget{flex:1;min-height:0;overflow:auto;padding:0 32px 24px}
.kp-widget-platz{min-height:480px}

html.kp-offen{overflow:hidden}

@media (max-width:640px){
  .kp-dialog{width:100%;max-width:100%;height:100dvh;max-height:100dvh;margin:0;border-radius:0}
  .kp-dlg-kopf{padding:16px 16px 12px}
  .kp-dlg-kopf h2{font-size:24px}
  .kp-plan{padding:0 16px}
  .kp-reiter{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none}
  .kp-reiter::-webkit-scrollbar{display:none}
  .kp-reiter-knopf{flex:0 0 calc((100% - 4 * 4px) / 4.5);scroll-snap-align:start}
  .kp-filter{flex-direction:column;align-items:stretch;gap:12px;margin:12px 0}
  .kp-chips{display:none}
  .kp-art{display:grid;gap:4px;align-self:stretch}
  .kp-segment{align-self:stretch;display:grid;grid-template-columns:repeat(3,1fr);border-radius:calc(var(--kp-radius,14px) + 4px)}
  .kp-segment button{min-height:44px;padding:4px 8px;font-size:13px;line-height:1.2;white-space:normal;border-radius:var(--kp-radius,14px)}
  .kp-zeile{grid-template-columns:64px minmax(0,1fr);row-gap:12px;column-gap:12px}
  .kp-aktion{grid-column:2;justify-content:flex-start}
  .kp-buchen{min-width:0;flex:1}
  .kp-dlg-fuss{padding:12px 16px;min-height:0}
  .kp-dlg-fuss .kp-knopf{width:100%}
  .kp-dlg-widget{padding:0 16px 16px}
}
@media (prefers-reduced-motion:reduce){
  .kp-skelett i,.kp-next-skelett,.kp-punkt.ist-laden{animation:none}
  .kp-dialog[open]{animation:none}
}
