/* ---------- Deck-Umschalter (Events / ÖPNV) ---------- */
.deck { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 4px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); max-width: 520px; }
.deck button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink-2); font-weight: 600; font-size: var(--fs-md); cursor: pointer; }
.deck button svg { width: 20px; height: 20px; }
.deck button .n { font-size: var(--fs-xs); opacity: .75; font-weight: 600; }
.deck button[aria-selected="true"] { background: var(--ink); color: var(--surface); font-weight: 700; }
.deck.has-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- Ticketkarte mit Stapel-Lagen und Code-Taste ---------- */
.stub-wrap { position: relative; }
.stub-wrap.is-stack { padding-bottom: 14px; }
.stub-wrap.is-stack::before, .stub-wrap.is-stack::after {
  content: ""; position: absolute; border-radius: var(--r-lg); border: 1px solid var(--line);
}
.stub-wrap.is-stack::before { left: 18px; right: 18px; top: 16px; bottom: 0; background: var(--line); border-color: var(--line-strong); }
.stub-wrap.is-stack::after { left: 9px; right: 9px; top: 8px; bottom: 7px; background: var(--surface-2); border-color: var(--line-strong); }
.stub-wrap > .stub { z-index: 1; }
.stub { grid-template-columns: 84px minmax(0, 1fr) auto auto; }
.stub-link { position: absolute; inset: 0; z-index: 1; border-radius: var(--r-lg); }
.stub-link:focus-visible { box-shadow: var(--focus); }
.stub-body, .stub-aside { pointer-events: none; }
.stub-code {
  position: relative; z-index: 2; align-self: center; margin-right: var(--sp-3);
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-md);
  background: var(--ink); color: var(--signal); text-decoration: none;
}
:root[data-theme="dark"] .stub-code { background: var(--signal); color: var(--signal-ink); }
.stub-code svg { width: 24px; height: 24px; }
.stub-code:hover { transform: translateY(-1px); }
.stack-badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: var(--r-pill); background: var(--ink); color: var(--surface); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.stack-badge svg { width: 13px; height: 13px; }
.stub-select { position: relative; z-index: 2; align-self: center; display: grid; place-items: center; width: 44px; height: 44px; margin-left: var(--sp-2); }
.stub-select input { width: 22px; height: 22px; accent-color: var(--ink); cursor: pointer; }
.is-selecting .stub { grid-template-columns: auto 84px minmax(0, 1fr) auto; }
.is-selecting .stub-code { display: none; }
.stub.is-selected { border: 2px solid var(--ink); }
@media (max-width: 600px) {
  .stub { grid-template-columns: 70px minmax(0, 1fr) auto; }
  .stub-aside { grid-column: 2; grid-row: 2; }
  .stub-code { grid-column: 3; grid-row: 1 / span 2; }
  .stub-date { grid-row: 1 / span 2; }
  .is-selecting .stub-date { grid-row: 1 / span 2; grid-column: 2; }
  .is-selecting .stub { grid-template-columns: auto 70px minmax(0, 1fr); }
  .is-selecting .stub-aside { grid-column: 3; }
  .is-selecting .stub-select { grid-row: 1 / span 2; }
}

/* Vorschlag / Auswahlleiste */
.suggestion { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--signal-soft); color: var(--ink); font-size: var(--fs-sm); }
.suggestion svg { width: 18px; height: 18px; flex: none; }
.suggestion span { flex: 1; min-width: 200px; }
.selectbar {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: flex; gap: var(--sp-2); align-items: center; justify-content: flex-end;
  padding: var(--sp-3) var(--sp-5) calc(var(--sp-3) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow-2);
}
.selectbar .count { margin-right: auto; font-weight: 700; }
@media (min-width: 861px) { .selectbar { left: var(--nav-w); } }

/* ---------- Vorzeigemodus ---------- */
.present {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  background: #0E141B; color: #E6ECF2; overflow: hidden; touch-action: pan-y;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.present-head { display: flex; align-items: center; gap: var(--sp-3); padding: 14px 16px; }
.present-head .t { flex: 1; min-width: 0; display: grid; }
.present-head .t span { font-size: var(--fs-sm); color: #9AA7B4; }
.present-head .t b { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #1D2833; color: #E6ECF2; display: grid; place-items: center; cursor: pointer; text-decoration: none; flex: none; }
.round svg { width: 20px; height: 20px; }
.pos { height: 32px; padding: 0 12px; border-radius: var(--r-pill); background: var(--signal); color: var(--signal-ink); display: flex; align-items: center; font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; }
.present-stage { position: relative; flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 0 24px; min-height: 0; }
.present-peek { position: absolute; top: 14px; bottom: 30px; width: min(342px, calc(100% - 48px)); border-radius: 24px; background: #2A3542; transform: translateX(18px) scale(.97); }
.present-peek.p2 { background: #3A4654; transform: translateX(9px) scale(.985); }
.pass {
  position: relative; width: min(360px, 100%); max-height: 100%; overflow: auto; border-radius: 24px; background: #FFFFFF; color: #15202C;
  display: flex; flex-direction: column; transition: transform .2s var(--ease), opacity .2s;
}
.pass.is-swiping { transition: none; }
.pass-band { padding: 16px 22px; color: #FFFFFF; display: grid; gap: 2px; }
.pass-band.type-event { background: #B0128F; }
.pass-band.type-rail { background: #D7263D; }
.pass-band .d { font-size: var(--fs-sm); font-weight: 600; opacity: .92; }
.pass-band .h { font-size: 1.3rem; font-weight: 750; line-height: 1.2; letter-spacing: -0.01em; }
.pass-band .s { font-size: var(--fs-sm); opacity: .92; }
.pass-alert { display: flex; gap: 10px; align-items: center; padding: 10px 22px; background: var(--signal); color: var(--signal-ink); font-size: var(--fs-sm); font-weight: 700; }
.pass-alert svg { width: 18px; height: 18px; flex: none; }
.pass-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 14px 22px 12px; }
.pass-grid div { display: grid; }
.pass-grid span { font-size: var(--fs-xs); color: #5B6775; }
.pass-grid b { font-family: var(--font-display); font-weight: 400; font-size: 2rem; line-height: 1.05; overflow-wrap: anywhere; }
.pass-grid.is-text b { font-family: var(--font-ui); font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.pass-perf { position: relative; border-top: 2px dashed #D6DCE2; }
.pass-perf::before, .pass-perf::after { content: ""; position: absolute; top: -14px; width: 28px; height: 28px; border-radius: 50%; background: #0E141B; }
.pass-perf::before { left: -14px; } .pass-perf::after { right: -14px; }
.pass-code { display: grid; justify-items: center; gap: 10px; padding: 18px 22px 16px; }
.pass-code img { width: min(260px, 100%); height: auto; image-rendering: pixelated; background: #fff; }
.pass-code img.is-bar { width: 100%; }
.pass-code img.is-image { width: 100%; image-rendering: auto; }
.pass-code .lbl { font-size: var(--fs-sm); color: #5B6775; text-align: center; }
.pass-missing { display: grid; justify-items: center; gap: 8px; padding: 26px 10px; color: #5B6775; text-align: center; font-size: var(--fs-sm); }
.pass-foot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 14px 22px 18px; background: #F5F7F9; border-top: 1px solid #E3E7EC; }
.pass-foot div { display: grid; }
.pass-foot span { font-size: var(--fs-xs); color: #5B6775; }
.pass-foot b { font-size: .95rem; }
.pass-note { display: flex; gap: 10px; align-items: center; padding: 12px 22px 16px; background: #F5F7F9; border-top: 1px solid #E3E7EC; font-size: var(--fs-sm); font-weight: 600; }
.pass-note svg { width: 20px; height: 20px; flex: none; }
.present-legs { margin: 0 24px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: #1D2833; align-self: center; width: min(360px, calc(100% - 48px)); }
.present-legs button { height: 40px; border: 0; border-radius: 10px; background: transparent; color: #C9D3DD; font-weight: 600; cursor: pointer; }
.present-legs button[aria-selected="true"] { background: #FFFFFF; color: #15202C; font-weight: 700; }
.present-nav { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 8px 0; }
.present-nav .round { background: transparent; border: 1px solid #3A4654; }
.dots { display: flex; gap: 8px; }
.dots span { width: 8px; height: 8px; border-radius: 4px; background: #3A4654; transition: width .2s; }
.dots span.on { width: 22px; background: var(--signal); }
.present-foot { display: flex; align-items: center; gap: 8px; padding: 8px 16px 16px; flex-wrap: wrap; }
.present-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--r-pill); background: #1D2833; color: #C9D3DD; font-size: var(--fs-xs); font-weight: 600; }
.present-chip svg { width: 15px; height: 15px; }
.present-foot .sq { width: 44px; height: 44px; border-radius: 12px; border: 1px solid #3A4654; background: transparent; color: #E6ECF2; display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.present-foot .sq svg { width: 20px; height: 20px; }
.present-foot .grow { flex: 1; }
@media (min-height: 900px) { .pass-code img { width: min(300px, 100%); } }
@media (max-height: 860px) { .pass-code { padding: 12px 22px 10px; gap: 6px; } .pass-code img { width: min(210px, 100%); } .pass-grid { padding: 10px 22px 8px; } .pass-band { padding: 12px 22px; } }

/* ---------- Code-Karte in der Detailansicht ---------- */
.codecard { display: flex; flex-wrap: wrap; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.codecard-img { flex: 1 1 240px; display: grid; place-items: center; padding: 24px; background: #FFFFFF; border-right: 2px dashed var(--line); }
.codecard-img img { width: min(240px, 100%); height: auto; image-rendering: pixelated; }
.codecard-img img.is-image { image-rendering: auto; width: 100%; }
.codecard-body { flex: 1 1 260px; display: grid; gap: var(--sp-4); align-content: start; padding: 22px 24px; }
.codecard .pass-grid { padding: 0; }
.codecard .pass-grid span { color: var(--muted); }
:root[data-theme="dark"] .codecard-img { border-right-color: #29353F; }
.stack-tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack-tabs a { text-decoration: none; }
.holder { display: inline-flex; align-items: center; gap: 6px; }
.holder svg { width: 16px; height: 16px; }
.holder.is-empty { color: var(--warn); font-weight: 600; }

/* ---------- Stapelseite ---------- */
.stack-hero { position: relative; padding-bottom: 16px; max-width: 640px; }
.stack-hero::before, .stack-hero::after { content: ""; position: absolute; border-radius: 20px; }
.stack-hero::before { left: 22px; right: 22px; top: 20px; bottom: 0; background: color-mix(in srgb, var(--type) 35%, var(--bg)); }
.stack-hero::after { left: 11px; right: 11px; top: 10px; bottom: 8px; background: color-mix(in srgb, var(--type) 65%, var(--bg)); }
.stack-hero .card { position: relative; z-index: 1; display: flex; gap: 16px; align-items: center; padding: 18px 20px; border-radius: 20px; background: var(--type); color: #FFFFFF; }
.stack-hero .dt { display: grid; justify-items: center; padding-right: 16px; border-right: 2px dashed rgba(255, 255, 255, .45); }
.stack-hero .dt b { font-family: var(--font-display); font-weight: 400; font-size: 2.6rem; line-height: .95; }
.stack-hero .dt span { font-size: var(--fs-xs); font-weight: 700; }
.stack-hero h1 { font-size: 1.45rem; }
.stack-hero p { opacity: .92; font-size: var(--fs-sm); }
.members { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); overflow: hidden; max-width: 640px; }
.member { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member .thumb { width: 56px; height: 56px; padding: 4px; border-radius: 10px; border: 1px solid var(--line); background: #FFFFFF; display: grid; place-items: center; }
.member .thumb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.member .thumb svg { width: 22px; height: 22px; color: var(--muted); }
.member .who { font-size: var(--fs-sm); }
.member .title { font-weight: 700; }
.member a, .member button { text-decoration: none; }
.cta-big { min-height: 52px; font-size: var(--fs-md); max-width: 640px; width: 100%; }

/* ---------- Zeitkarten ---------- */
.validity { display: grid; gap: var(--sp-3); }
.validity-range { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-3); font-family: var(--font-display); font-size: 1.9rem; line-height: 1.1; }
.validity-range span { font-family: var(--font-ui); font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Import-Zuordnung ---------- */
.kindswitch { display: inline-grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 3px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); }
.kindswitch button { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); cursor: pointer; }
.kindswitch button svg { width: 15px; height: 15px; }
.kindswitch button[aria-checked="true"].k-event { background: var(--event-soft); color: var(--event); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--event); }
.kindswitch button[aria-checked="true"].k-rail { background: var(--rail-soft); color: var(--rail); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--rail); }
.result.is-unsure { border: 2px solid var(--signal); }
.result-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
@media (max-width: 600px) { .result { grid-template-columns: auto 1fr; } .result-actions { grid-column: 1 / -1; justify-content: flex-start; } }

/* „Als Nächstes“ mit Code-Taste */
.next .next-body { position: relative; z-index: 0; pointer-events: none; }
.next .stub-link { z-index: 1; }
.next .next-code { pointer-events: auto; position: relative; z-index: 2; justify-self: start; margin-top: var(--sp-2); }
.next .next-date { pointer-events: none; }
.stack-hero p { display: flex; align-items: center; gap: 6px; }
.stack-hero p svg { width: 16px; height: 16px; }
.kv .holder { min-height: 0; padding: 0; justify-content: flex-start; }
.pass-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
