/* event on – Energie-AG-angelehnt: schwarz, Magenta, alles eckig */
:root { --mag: #D20048; --mag2: #E73257; --ink: #111; --grau: #4a4a4a; --bg: #F6F5F2; --linie: #e6e3dd; --side: 248px; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; border-radius: 0; }
:focus-visible { outline: 3px solid var(--mag); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 0; background: #fff; padding: 12px; z-index: 50; }
.skip:focus { left: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.laden { padding: 40px; }
a { color: var(--mag); }

/* Rahmen */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #fff; display: flex; flex-direction: column; gap: 28px; padding: 28px 0; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; gap: 12px; align-items: stretch; padding: 0 20px; text-decoration: none; }
.logo .bar { width: 4px; background: var(--mag2); }
.logo .t { display: flex; flex-direction: column; gap: 6px; line-height: 1; font-size: 24px; font-weight: 700; letter-spacing: -.5px; color: #fff; }
.logo svg { display: block; height: .8em; width: auto; }
.nav { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 0 12px; }
.nav .glide { position: absolute; left: 12px; right: 12px; top: 0; height: 48px; background: var(--mag); border-radius: 3px; transition: transform .22s ease; pointer-events: none; }
.nav a { position: relative; display: flex; align-items: center; height: 48px; padding: 0 16px; color: #fff; text-decoration: none; font-weight: 600; }
.side .unten { margin-top: auto; padding: 0 20px; font-size: 13px; color: #bbb; }
.side .unten button { background: none; border: 1.5px solid #555; color: #fff; height: 40px; padding: 0 12px; cursor: pointer; margin-top: 8px; }
main { padding: 32px 40px 80px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.kopf { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.kopf h1 { margin: 0; font-size: 34px; line-height: 1.1; letter-spacing: -.5px; }
.ueber { font-size: 14px; font-weight: 600; color: var(--mag); }
main:focus { outline: none; }
.inhalt { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.burger { width: 44px; height: 44px; border: 0; background: none; padding: 10px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.burger span { display: block; height: 2px; background: #fff; }
.nr { border: 0; background: none; padding: 4px 0; font: inherit; font-weight: 700; color: var(--ink); cursor: copy; text-decoration: underline dotted var(--mag); text-underline-offset: 4px; min-height: 32px; }
.nr:hover { color: var(--mag); }
.chip { align-self: flex-start; }
table.woche th { width: 64px; padding: 10px 8px; border-bottom: 1px solid #eee; vertical-align: top; }
table.woche td { padding: 8px; border-bottom: 1px solid #eee; }
table.woche tr.heute th { background: var(--mag); color: #fff; }
.wtag { display: block; font-weight: 700; font-size: 15px; }
.wdat { display: block; font-size: 12px; font-weight: 400; }
.wev { display: block; padding: 6px 0; color: var(--ink); font-weight: 600; text-decoration: none; border-left: 3px solid var(--mag); padding-left: 8px; margin: 2px 0; }

/* Bausteine */
.box { background: #fff; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.box.akzent { border-top: 4px solid var(--mag); }
.box h2 { margin: 0; font-size: 22px; }
.box h3 { margin: 0; font-size: 17px; }
.zeile { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.zeile.zw { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kachel { background: #fff; padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; }
.kachel span:first-child { font-size: 13px; color: var(--grau); }
.kachel strong { font-size: 22px; }
.kachel.mag { background: var(--mag); color: #fff; }
.kachel.mag span:first-child { color: #fff; }
.leise { color: var(--grau); font-size: 14px; }
.btn { height: 48px; padding: 0 20px; border: 1.5px solid var(--ink); background: #fff; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn.prim { background: var(--mag); border-color: var(--mag); color: #fff; }
.btn.klein { height: 40px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; font-size: 18px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.fld, label.f input, label.f select, label.f textarea { height: 48px; border: 1.5px solid var(--ink); background: #fff; padding: 0 12px; font-size: 16px; font-weight: 400; width: 100%; }
label.f textarea { height: auto; min-height: 96px; padding: 10px 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 400; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--mag); margin: 0; }
.tabs { display: flex; flex-wrap: wrap; }
.tabs button { height: 48px; padding: 0 18px; border: 1.5px solid var(--ink); margin-left: -1.5px; background: #fff; font-weight: 600; cursor: pointer; }
.tabs button:first-child { margin-left: 0; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; padding: 10px 8px; border-bottom: 2px solid var(--ink); font-size: 13px; }
td { padding: 10px 8px; border-bottom: 1px solid #eee; vertical-align: top; }
td.r, th.r { text-align: right; white-space: nowrap; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; }
.chip.ESP { border: 1.5px solid var(--ink); }
.chip.EMK { background: #F2F0EC; }
.chip.EMM { background: var(--ink); color: #fff; }
.chip.EMG { background: var(--mag); color: #fff; }
.chip.laufend { background: #FCE4EC; color: #A3003A; }
.chip.abgeschlossen { background: var(--ink); color: #fff; }
.chip.geplant { border: 1.5px dashed var(--grau); }
.liste { display: flex; flex-direction: column; }
.liste > a, .liste > button.li { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 14px 4px; border: 0; border-bottom: 1px solid #eee; background: none; text-align: left; color: var(--ink); text-decoration: none; cursor: pointer; min-height: 48px; }
.liste > a:hover, .liste > button.li:hover { background: var(--bg); }
.karten { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.karte { background: #fff; border: 1.5px solid transparent; padding: 20px; display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: var(--ink); }
.karte:hover { border-color: var(--ink); }
.datum { width: 56px; flex: 0 0 56px; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--ink); color: #fff; }
.datum b { font-size: 20px; line-height: 1; }
.datum span { font-size: 12px; font-weight: 600; }
.karte .t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.karte .t b { font-size: 17px; }
.karte .t span { font-size: 13px; color: var(--grau); }
.ordner { display: flex; flex-direction: column; gap: 8px; }
.ordner summary { cursor: pointer; font-weight: 700; font-size: 17px; min-height: 44px; display: flex; align-items: center; gap: 10px; }
.zeitform { grid-template-columns: 1fr 2fr 1fr auto; align-items: end; }
.preis { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.preis-l { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 52px; }
.preis-f { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.liste > a > .leise:last-child { white-space: nowrap; flex: 0 0 auto; }
.btn.breit { align-self: flex-start; }
.summe { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; background: var(--bg); padding: 14px 16px; }
.kal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.kal div { min-height: 64px; background: #fff; padding: 6px; font-size: 12px; }
.kal .wt { min-height: 0; background: none; font-weight: 700; }
.kal .leer { background: transparent; }
.kal .ev { display: block; background: var(--mag); color: #fff; padding: 1px 4px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.kal .heute { outline: 2px solid var(--ink); outline-offset: -2px; }
.foto { width: 100%; max-height: 260px; object-fit: contain; background: var(--bg); }
.fehler { color: #A3003A; font-weight: 600; }

/* Dialog */
dialog { border: 0; border-top: 4px solid var(--mag); padding: 24px; width: min(640px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog form { display: flex; flex-direction: column; gap: 14px; }
dialog h2 { margin: 0; font-size: 22px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; font-weight: 600; display: none; z-index: 60; }
#toast.an { display: block; }
video.scan { width: 100%; max-height: 320px; background: #000; }

/* Anmeldung */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login .links { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login .links .logo .t { font-size: 40px; }
.login .rechts { padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 20px; max-width: 520px; }
.login h1 { margin: 0; font-size: 30px; }
.trenner { display: flex; align-items: center; gap: 12px; color: var(--grau); font-size: 13px; }
.trenner::before, .trenner::after { content: ""; flex: 1; height: 1px; background: var(--linie); }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .karten, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 40; }
  .side.offen { transform: none; }
  main { padding: 16px 16px 80px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; gap: 12px; background: var(--ink); padding: 8px 12px 8px 6px; }
  .topbar .logo { padding: 0; }
  .topbar .logo .t { font-size: 18px; gap: 4px; }
  .side.offen ~ .inhalt .topbar { visibility: hidden; }
  .side.offen { box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .kopf h1 { font-size: 26px; }
  .g2, .g3, .karten, .zeitform { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kachel strong { font-size: 17px; }
  /* Symmetrie am Handy: Knöpfe und Reiter gleich breit, gleiche Höhe */
  .kopf { flex-direction: column; align-items: stretch; }
  .kopf .aktionen { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; width: 100%; }
  .kopf .aktionen:has(.tabs) { grid-auto-flow: row; grid-auto-columns: auto; }
  .kopf .aktionen .btn { justify-content: center; padding: 0 8px; }
  .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; width: 100%; }
  .tabs button { margin: 0 0 -1.5px 0; padding: 0 8px; font-size: 14px; min-height: 48px; height: auto; border-width: 1.5px; }
  .tabs button:nth-child(even) { margin-left: -1.5px; }
  /* Kopf jeder Box: Überschrift oben, Knopf darunter in voller Breite */
  .box > .zeile.zw { flex-direction: column; align-items: stretch; gap: 10px; }
  .box > .zeile.zw > h2 { overflow-wrap: break-word; hyphens: auto; }
  .box > .zeile.zw > .btn, .box > .zeile.zw > label.btn { width: 100%; justify-content: center; }
  .box > .zeile.zw > .zeile { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
  .box > .zeile.zw > .zeile .btn { justify-content: center; }
  .box > .zeile.zw > .chip { align-self: flex-start; }
  .box > .zeile:not(.zw):has(> .btn) { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
  .box > .zeile:not(.zw):has(> .btn) .btn { justify-content: center; padding: 0 6px; font-size: 15px; }
  .btn.klein { height: 44px; }
  .summe { flex-direction: column; align-items: stretch; }
  .summe > .btn { width: 100%; justify-content: center; }
  .rechts .btn, .rechts form .btn { width: 100%; justify-content: center; }
  .kachel span:first-child { min-height: 2.9em; }
  .preis-l { min-height: 64px; }
  form .btn, .btn.breit, .box > .btn { width: 100%; justify-content: center; }
  .login { grid-template-columns: 1fr; }
  .login .links { padding: 28px; }
  .login .rechts { padding: 28px; }
  table.mobil thead { display: none; }
  table.mobil tr { display: block; border-bottom: 1px solid #ddd; padding: 8px 0; }
  table.mobil td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; text-align: right; overflow-wrap: anywhere; min-width: 0; }
  table.mobil td::before { flex: 0 0 auto; }
  table.mobil { table-layout: fixed; }
  table.mobil td::before { content: attr(data-l); font-weight: 600; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.karte .t .chip.abgeschlossen { color: #fff; } .karte .t .chip.laufend { color: #A3003A; }
.grid > *, .box, .liste > a > span:first-child, .liste > button.li > span:first-child { min-width: 0; }
.liste > a > span:first-child { overflow-wrap: break-word; }

/* Auf-Zu-Feld (abgeschlossene Veranstaltungen) */
details.aufzu { border-top: 1px solid var(--linie); margin-top: 8px; }
details.aufzu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 2px; font-weight: 700; }
details.aufzu > summary::-webkit-details-marker { display: none; }
details.aufzu > summary::after { content: ''; width: 12px; height: 12px; margin-right: 10px; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: translateY(-3px) rotate(45deg); transition: transform .2s ease; }
details.aufzu[open] > summary::after { border-color: var(--mag); transform: translateY(3px) rotate(-135deg); }
@media (prefers-reduced-motion: reduce) { details.aufzu > summary::after { transition: none; } }
details.aufzu > .karten { padding-top: 8px; }

.wev .wbis { display: block; font-weight: 400; font-size: 13px; }
