/* Kurstermine: helles Werkzeug in der EC-CI. Anthrazit fuer Text, Orange nur als Akzent,
   Text auf Orange immer dunkel (Kontrast). */
:root {
  --grund: #f5f5f3;
  --flaeche: #ffffff;
  --flaeche-zart: #fafaf8;
  --linie: #e3e3df;
  --linie-stark: #cbcbc6;
  --text: var(--ec-anthrazit);
  --text-stark: #262625;
  --text-leise: #66665f;
  --orange-hell: #fff5dc;
  --orange-linie: #efcd7a;
  --orange-text: #6f4c00;
  --rot: #b42318;
  --rot-hell: #fdeceb;
  --gruen: #2f6b3a;
  --fokus: #9c6800;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(38, 38, 37, .05), 0 1px 1px rgba(38, 38, 37, .03);
  --schatten-hoch: 0 12px 40px rgba(38, 38, 37, .18), 0 2px 6px rgba(38, 38, 37, .08);
  color-scheme: light;
}

body { background: var(--grund); color: var(--text); font-size: 16px; line-height: 1.5; }
h1, h2, h3, h4 { color: var(--text-stark); margin: 0; line-height: 1.25; font-weight: 600; }
p { margin: 0; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
[hidden] { display: none !important; }
button, a, summary, label { -webkit-tap-highlight-color: transparent; }

.sprung { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--text-stark); color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none; }
.sprung:focus { top: 12px; }

/* ---------------------------------------------------------------- Kopf */
.kopf { background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.kopf-innen { max-width: 1120px; margin: 0 auto; padding: 0 24px; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.marke { flex: none; display: flex; align-items: center; min-height: 44px; border-radius: 6px; }
.marke img { width: 132px; height: auto; }
.kopf-nav { display: flex; align-self: stretch; gap: 24px; }
.kopf-nav a { display: inline-flex; align-items: center; min-height: 44px; border-bottom: 3px solid transparent; border-top: 3px solid transparent; color: var(--text); font-weight: 500; text-decoration: none; }
.kopf-nav a:hover { color: var(--text-stark); border-bottom-color: var(--linie-stark); }
.kopf-nav a[aria-current] { color: var(--text-stark); border-bottom-color: var(--ec-orange); }

/* ---------------------------------------------------------------- Knoepfe und Felder */
.knopf { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 500; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .12s; }
.knopf:disabled { cursor: progress; opacity: .75; }
.knopf-primaer { background: var(--ec-orange); color: var(--text-stark); }
.knopf-primaer:hover:not(:disabled) { background: #eb9e00; }
.knopf-leise { background: var(--flaeche); color: var(--text-stark); border-color: var(--linie-stark); }
.knopf-leise:hover:not(:disabled) { background: #f1f1ee; }
.knopf-gefahr { background: transparent; color: var(--rot); padding: 0 10px; margin-left: -10px; }
.knopf-gefahr:hover { background: var(--rot-hell); }
.knopf-gefahr-voll { background: var(--rot); color: #fff; }
.knopf-gefahr-voll:hover:not(:disabled) { background: #961d13; }
.textknopf { min-height: 44px; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.textknopf:hover { color: var(--text-stark); }

.feld { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.feld > label, .feld > legend { display: block; font-size: 15px; font-weight: 500; color: var(--text-stark); margin-bottom: 6px; padding: 0; }
.optional { font-weight: 400; color: var(--text-leise); }
input[type="date"], input[type="text"], select {
  font: inherit; font-size: 16px; color: var(--text-stark); background-color: var(--flaeche);
  border: 1px solid var(--linie-stark); border-radius: 8px; height: 44px; padding: 0 12px; width: 100%;
}
input[type="date"] { font-variant-numeric: tabular-nums; -webkit-appearance: none; appearance: none; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
select { -webkit-appearance: none; appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%23565655' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; cursor: pointer; }
input:hover, select:hover { border-color: #a9a9a3; }
input[aria-invalid="true"] { border-color: var(--rot); box-shadow: 0 0 0 1px var(--rot); }
.feld-fehler { font-size: 14px; color: var(--rot); margin-top: 6px; font-weight: 500; }
.form-fehler { margin: 0 0 14px; }
.klein-auswahl { width: auto; font-size: 15px; }
.ist-fehler .auswahl-chip span { border-color: var(--rot); }

/* Auswahl (Checkboxen) */
.auswahl-liste { display: flex; flex-wrap: wrap; gap: 8px; }
.auswahl-chip { position: relative; display: flex; }
.auswahl-chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.auswahl-chip span { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px 6px 12px; line-height: 1.2; border: 1px solid var(--linie-stark); border-radius: 8px; background: var(--flaeche); color: var(--text-stark); user-select: none; }
.auswahl-chip span::before { content: ""; width: 16px; height: 16px; border: 1.5px solid #8d8d87; border-radius: 4px; flex: none; background: #fff; }
.auswahl-chip input:checked + span { background: var(--orange-hell); border-color: var(--orange-linie); }
.auswahl-chip input:checked + span::before { background: var(--text-stark) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.2l2.6 2.6L11 4.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat; border-color: var(--text-stark); }
.auswahl-chip input:focus-visible + span { outline: 3px solid var(--fokus); outline-offset: 2px; }
.auswahl-chip:hover span { border-color: #a9a9a3; }

/* ---------------------------------------------------------------- Seite */
.seite { max-width: 1120px; margin: 0 auto; padding: 48px 24px 40px; }
.seite:focus { outline: none; }
.seitenkopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; margin-bottom: 28px; }
.seitenkopf h1 { font-size: 34px; line-height: 1.15; }

.kurswahl { display: flex; flex-wrap: wrap; gap: 0 28px; min-height: 46px; margin-bottom: 24px; border-bottom: 1px solid var(--linie-stark); }
.kurs-knopf { min-height: 46px; margin-bottom: -1px; padding: 0; border: 0; border-bottom: 3px solid transparent; background: none; font: inherit; font-size: 17px; font-weight: 500; color: var(--text); cursor: pointer; }
.kurs-knopf:hover { color: var(--text-stark); border-bottom-color: var(--linie-stark); }
.kurs-knopf[aria-pressed="true"] { color: var(--text-stark); border-bottom-color: var(--ec-orange); }

.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; min-width: 0; }
.orte { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.orte[aria-busy="true"] { min-height: 320px; }
.laden { color: var(--text-leise); }
.lade-fehler { grid-column: 1 / -1; padding: 24px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.lade-fehler-titel { font-weight: 600; color: var(--rot); }

.ort-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 12px 12px 20px; }
.ort-kopf h2 { font-size: 20px; }
.ort-kopf select { border-color: transparent; padding-left: 8px; color: var(--text); background-color: transparent; }
.ort-kopf select:hover { border-color: var(--linie-stark); }
.ort-anfrage .ort-kopf select, .ort-aus .ort-kopf select { color: var(--text-stark); background-color: var(--orange-hell); }
.ort-aus .ort-kopf select { background-color: #ededea; }
.ort-anfrage .termin-datum, .ort-aus .termin-datum { color: var(--text-leise); font-weight: 400; }

.termine { list-style: none; margin: 0; padding: 0 0 8px; }
.termin { display: flex; align-items: center; border-top: 1px solid var(--linie); padding: 0 8px 0 0; }
.termin:hover { background: var(--flaeche-zart); }
.termin-knopf { flex: 1; min-width: 0; min-height: 52px; padding: 8px 8px 8px 20px; border: 0; background: none; font: inherit; text-align: left; color: var(--text-stark); cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 12px; align-content: center; }
.termin-datum { font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.termin-knopf:hover .termin-datum { text-decoration: underline; text-decoration-color: var(--ec-orange); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.termin-zusatz { font-size: 15px; color: var(--text-leise); overflow-wrap: anywhere; }
.termin-wenige { color: var(--orange-text); }
.termin-ausgebucht { color: var(--rot); }
.termin-weg { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: none; color: var(--text-leise); cursor: pointer; }
.termin-weg:hover { color: var(--rot); background: var(--rot-hell); }
.termin-wartet { opacity: .55; }
.leer { padding: 16px 20px 20px; border-top: 1px solid var(--linie); color: var(--text-leise); }

.vergangen { border-top: 1px solid var(--linie); font-size: 15px; color: var(--text-leise); padding: 0 20px; }
.vergangen summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; list-style: none; }
.vergangen summary::-webkit-details-marker { display: none; }
.vergangen ul { list-style: none; margin: 0; padding: 0 0 12px; }

/* ---------------------------------------------------------------- Hinweise im Dialog */
.hinweise { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 6px; }
.hinweise:empty { display: none; }
.hinweis { font-size: 15px; line-height: 1.4; padding: 8px 12px; border-radius: 8px; background: var(--orange-hell); color: var(--text-stark); }
.hinweis-stopp { background: var(--rot-hell); }

/* ---------------------------------------------------------------- Verlauf */
.verlauf { list-style: none; padding: 0; margin: 0; }
.verlauf-eintrag { display: flex; justify-content: space-between; gap: 4px 24px; padding: 13px 20px; }
.verlauf-eintrag + .verlauf-eintrag { border-top: 1px solid var(--linie); }
.verlauf-text { color: var(--text-stark); overflow-wrap: anywhere; min-width: 0; }
.verlauf-zeit { flex: none; font-size: 15px; color: var(--text-leise); font-variant-numeric: tabular-nums; }
.verlauf-leer { color: var(--text-leise); padding: 20px; }
#verlauf-mehr { margin: 4px 20px 20px; }

.fuss { max-width: 1120px; margin: 0 auto; padding: 0 24px 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; font-size: 15px; color: var(--text-leise); }

/* ---------------------------------------------------------------- Dialoge */
.dialog { border: 0; padding: 0; border-radius: 14px; background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-hoch); width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.dialog::backdrop { background: rgba(38, 38, 37, .4); }
.dialog > form, .dialog-inhalt { padding: 28px; }
.dialog-titel { font-size: 24px; margin-bottom: 20px; }
.dialog-titel:focus { outline: none; }
#reset-dialog .dialog-titel { margin-bottom: 10px; }
.dialog-fuss { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 24px; }
.dialog-fuss-ende { justify-content: flex-end; }
.dialog-fuss-rechts { display: flex; gap: 8px; margin-left: auto; }

/* ---------------------------------------------------------------- Toasts */
.toasts { position: fixed; left: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: 10px; background: var(--text-stark); color: #fff; box-shadow: var(--schatten-hoch); font-size: 14px; animation: rein .16s ease-out; }
.toast-fehler { background: #7a1810; }
.toast-text { flex: 1; min-width: 0; line-height: 1.4; }
.toast-aktion { flex: none; min-height: 36px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ec-orange); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.toast-aktion:hover { background: rgba(255,255,255,.1); }
.toast-zu { flex: none; width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: #e9e9e7; font-size: 20px; line-height: 1; cursor: pointer; }
.toast-zu:hover { background: rgba(255,255,255,.12); }
.toast :focus-visible { outline-color: var(--ec-orange); }
.toast-weg { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
@keyframes rein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- Breiten */
@media (max-width: 960px) {
  .orte { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 640px) {
  .kopf-innen { padding: 0 16px; min-height: 64px; gap: 12px; }
  .marke img { width: 108px; }
  .kopf-nav { gap: 18px; }
  .seite { padding: 28px 16px 32px; }
  .seitenkopf { margin-bottom: 20px; }
  .seitenkopf h1 { font-size: 28px; }
  #ansicht-termine .seitenkopf .knopf { width: 100%; }
  .kurswahl { gap: 0 20px; border-bottom: 0; }
  .kurs-knopf { font-size: 16px; }
  .ort-kopf { padding-left: 16px; }
  .termin-knopf { padding-left: 16px; }
  .leer, .vergangen { padding-left: 16px; padding-right: 16px; }
  .verlauf-eintrag { flex-direction: column; padding: 12px 16px; }
  .fuss { padding: 0 16px 28px; flex-direction: column; align-items: flex-start; }
  .dialog { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; max-height: calc(100dvh - 24px); }
  .dialog > form, .dialog-inhalt { padding: 24px 16px calc(20px + env(safe-area-inset-bottom)); }
  #neu-dialog .dialog-fuss { position: sticky; bottom: 0; margin: 8px -16px 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--flaeche); border-top: 1px solid var(--linie); }
  #neu-dialog > form { padding-bottom: 0; }
  #neu-dialog .dialog-fuss-rechts { width: 100%; }
  #neu-dialog .dialog-fuss-rechts .knopf { flex: 1; }
  .dialog-fuss .knopf { padding: 0 14px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; width: auto; }
  .toast-zu, .toast-aktion { min-height: 44px; min-width: 44px; }
}
