/* ---------- Abrisskarte (Ticket in Listen) ---------- */
.stub {
  position: relative; display: grid; grid-template-columns: 84px 1fr auto; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  text-decoration: none; color: inherit; min-height: 92px;
}
.stub:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.stub:focus-visible { border-radius: var(--r-lg); }
.stub-date {
  display: grid; place-content: center; justify-items: center; gap: 2px; padding: var(--sp-3) var(--sp-2);
  background: var(--type-soft); color: var(--type); border-radius: calc(var(--r-lg) - 1px) 0 0 calc(var(--r-lg) - 1px);
  border-right: 2px dashed color-mix(in srgb, var(--type) 35%, transparent);
  position: relative;
}
/* Stanzlöcher an der Perforation */
.stub-date::before, .stub-date::after {
  content: ""; position: absolute; right: -10px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line);
}
.stub-date::before { top: -10px; clip-path: inset(50% 0 0 0); }
.stub-date::after { bottom: -10px; clip-path: inset(0 0 50% 0); }
.stub-day { font-family: var(--font-display); font-size: 2.35rem; line-height: .95; }
.stub-mon { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; }
.stub-wd { font-size: var(--fs-xs); color: var(--ink-2); opacity: .8; }
.stub-date.is-undated .stub-day { font-size: 1.6rem; }
.stub-body { min-width: 0; padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-5); display: grid; align-content: center; gap: 3px; }
.stub-kind { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--type); }
.stub-kind svg { width: 14px; height: 14px; }
.stub-title { font-size: 1.05rem; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.stub-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: var(--fs-sm); color: var(--muted); }
.stub-meta span { display: inline-flex; align-items: center; gap: 5px; }
.stub-meta svg { width: 14px; height: 14px; }
.stub-aside { display: grid; align-content: center; justify-items: end; gap: 6px; padding: var(--sp-3) var(--sp-4); }
.stub.is-dim { opacity: .72; }
.stub.is-dim:hover { opacity: 1; }
.stub-list { display: grid; gap: var(--sp-3); }
.month-head { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); margin-top: var(--sp-3); }
@media (max-width: 600px) {
  .stub { grid-template-columns: 70px 1fr; }
  .stub-day { font-size: 2rem; }
  .stub-aside { grid-column: 2; justify-items: start; padding: 0 var(--sp-4) var(--sp-3) var(--sp-5); grid-auto-flow: column; justify-content: start; }
  .stub-body { padding-bottom: var(--sp-2); }
}

/* ---------- Fristbalken (Ersatzfahrt) ---------- */
.runway { display: grid; gap: 4px; min-width: 150px; }
.runway-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.runway-fill { height: 100%; background: var(--signal); border-radius: 3px; }
.runway.is-urgent .runway-fill { background: var(--warn); }
.runway-label { font-size: var(--fs-xs); color: var(--muted); }

/* ---------- Übersicht: „Als Nächstes“ ---------- */
.next {
  display: grid; grid-template-columns: minmax(160px, 220px) 1fr; overflow: hidden;
  background: var(--ink); color: var(--surface); border-radius: var(--r-lg); text-decoration: none;
  position: relative;
}
:root[data-theme="dark"] .next { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.next-date { position: relative; display: grid; align-content: center; justify-items: start; padding: var(--sp-6) var(--sp-5); background: var(--signal); color: var(--signal-ink); }
.next-date::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: -7px; width: 14px;
  background: radial-gradient(circle at 7px 7px, var(--bg) 6px, transparent 6.5px) 0 0 / 14px 18px repeat-y;
}
.next-day { font-family: var(--font-display); font-size: 5.2rem; line-height: .85; }
.next-mon { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: .03em; }
.next-wd { font-weight: 600; margin-top: 6px; }
.next-body { padding: var(--sp-6) var(--sp-6) var(--sp-6) var(--sp-7); display: grid; align-content: center; gap: var(--sp-3); min-width: 0; }
.next-when { font-weight: 700; color: var(--signal); font-size: var(--fs-sm); }
:root[data-theme="dark"] .next-when { color: var(--warn); }
.next-title { font-size: clamp(1.5rem, 3.2vw, 2.2rem); line-height: 1.12; font-weight: 750; letter-spacing: -0.02em; }
.next-facts { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); font-size: var(--fs-sm); opacity: .85; }
.next-facts span { display: inline-flex; gap: 6px; align-items: center; }
.next-facts svg { width: 16px; height: 16px; }
@media (max-width: 600px) {
  .next { grid-template-columns: 1fr; }
  .next-date { grid-auto-flow: column; justify-content: start; align-items: end; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); }
  .next-date::after { top: auto; left: 0; right: 0; bottom: -7px; width: auto; height: 14px; background: radial-gradient(circle at 7px 7px, var(--bg) 6px, transparent 6.5px) 0 0 / 18px 14px repeat-x; }
  .next-day { font-size: 3.4rem; }
  .next-body { padding: var(--sp-5); }
}

.stats-row { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); font-size: var(--fs-sm); color: var(--muted); }
.stats-row b { color: var(--ink); font-size: var(--fs-md); }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-6); align-items: start; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }
.mini-list { display: grid; }
.mini { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.mini > span:nth-child(2) { display: grid; min-width: 0; }
.mini .runway { min-width: 110px; }
.mini:hover .mini-title { text-decoration: underline; text-underline-offset: 3px; }
.mini:last-child { border-bottom: 0; }
.mini-title { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { font-size: var(--fs-xs); color: var(--muted); }

/* ---------- Filterleiste ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }
.search .input { padding-left: 38px; }

/* ---------- Ticket-Detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-6); align-items: start; }
@media (max-width: 1000px) { .detail { grid-template-columns: 1fr; } }
.detail-head { display: grid; gap: var(--sp-3); padding-bottom: var(--sp-5); border-bottom: 3px solid var(--type); }
.detail-head h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -0.02em; line-height: 1.1; }
.detail-head .sub { color: var(--ink-2); font-size: var(--fs-lg); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: var(--fs-sm); font-weight: 600; width: max-content; }
.back svg { width: 16px; height: 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-4); }
.fact { display: grid; gap: 2px; }
.fact-label { font-size: var(--fs-xs); color: var(--muted); }
.fact-value { font-weight: 650; }
.fact-big { font-family: var(--font-display); font-size: 1.9rem; line-height: 1; font-weight: 400; }

/* Fahrt-Karten */
.journey { display: grid; gap: var(--sp-4); padding: var(--sp-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.journey.is-lifted { border-color: var(--signal); box-shadow: inset 4px 0 0 var(--signal); }
.journey-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.journey-route { font-size: var(--fs-lg); font-weight: 700; line-height: 1.25; }
.journey-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 56px 18px 1fr; gap: var(--sp-2); }
.timeline .t { font-weight: 700; font-size: var(--fs-sm); padding-top: 1px; }
.timeline .rail { position: relative; }
.timeline .rail::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: -6px; width: 2px; background: var(--line-strong); }
.timeline li:last-child .rail::before { display: none; }
.timeline .rail::after { content: ""; position: absolute; left: 3px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-2); }
.timeline li.dep .rail::after { background: var(--ink-2); }
.timeline .stop { padding-bottom: var(--sp-3); font-size: var(--fs-sm); }
.timeline .stop b { font-weight: 600; }
.timeline .prod { display: inline-flex; align-items: center; gap: 4px; margin: 4px 0 2px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 700; }
.timeline .prod.is-bound { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.lift-box { display: grid; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); }
.lift-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; }

/* Sitzplätze */
.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.seat { display: grid; gap: 4px; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.seat-main { display: flex; gap: var(--sp-4); }
.seat-main div { display: grid; }
.seat-main span { font-size: var(--fs-xs); color: var(--muted); }
.seat-main b { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; line-height: 1.1; }
.seat-sub { font-size: var(--fs-xs); color: var(--muted); }

/* PDF-Ansicht */
.viewer { display: grid; gap: var(--sp-3); }
.viewer-pages { display: grid; gap: var(--sp-3); max-height: 78vh; overflow: auto; padding: var(--sp-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.viewer-pages canvas, .viewer-pages img { width: 100%; height: auto; background: #fff; border-radius: 6px; box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.viewer-bar { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* ---------- Import ---------- */
.drop {
  display: grid; justify-items: center; gap: var(--sp-3); padding: var(--sp-7) var(--sp-5);
  border: 2px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop svg { width: 44px; height: 44px; color: var(--ink-2); }
.drop h2 { font-size: var(--fs-lg); }
.drop.is-over { border-color: var(--ink); background: var(--signal-soft); }
.results { display: grid; gap: var(--sp-2); }
.result { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.result-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.result-icon svg { width: 18px; height: 18px; }
.result-imported .result-icon { background: var(--ok-soft); color: var(--ok); }
.result-duplicate .result-icon { background: var(--other-soft); color: var(--other); }
.result-skipped .result-icon { background: var(--warn-soft); color: var(--warn); }
.result-error .result-icon { background: var(--danger-soft); color: var(--danger); }
.result-busy .result-icon { background: var(--surface-2); color: var(--muted); }
.result-name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-msg { font-size: var(--fs-xs); color: var(--muted); }

/* ---------- Postfach ---------- */
.account { display: grid; gap: var(--sp-4); }
.account-head { display: flex; gap: var(--sp-3); align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.account-title { display: flex; align-items: center; gap: var(--sp-3); }
.account-title svg { width: 22px; height: 22px; }
.account-stats { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); font-size: var(--fs-sm); color: var(--muted); }
.account-stats b { color: var(--ink); }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; background: var(--ink); color: var(--surface); display: grid; align-content: end; padding: var(--sp-7); overflow: hidden; }
:root[data-theme="dark"] .login-art { background: #0A0F14; }
.login-art .brand-word { font-size: 4.5rem; color: var(--signal); }
.login-art p { max-width: 34ch; margin-top: var(--sp-3); font-size: var(--fs-lg); line-height: 1.35; opacity: .9; }
.login-stubs { position: absolute; inset: 8% -10% auto 12%; display: grid; gap: 14px; transform: rotate(-8deg); opacity: .95; }
.login-stub { display: grid; grid-template-columns: 70px 1fr; height: 76px; border-radius: 14px; overflow: hidden; background: #1F2B38; }
.login-stub b { display: grid; place-items: center; font-family: var(--font-display); font-size: 2rem; font-weight: 400; border-right: 2px dashed rgba(255,255,255,.25); }
.login-stub span { align-self: center; padding: 0 18px; font-weight: 600; color: #C9D3DD; }
.login-stub.r b { background: var(--rail); color: #fff; }
.login-stub.e b { background: var(--event); color: #fff; }
.login-stub.y b { background: var(--signal); color: var(--signal-ink); }
.login-form { display: grid; place-items: center; padding: var(--sp-6); background: var(--bg); }
.login-card { width: min(380px, 100%); display: grid; gap: var(--sp-4); }
.login-card h1 { font-size: var(--fs-xl); }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; grid-template-rows: 260px 1fr; }
  .login-art { padding: var(--sp-5); }
  .login-art .brand-word { font-size: 3rem; }
  .login-art p { font-size: var(--fs-md); }
  .login-stubs { inset: 6% -20% auto 30%; gap: 10px; }
  .login-stub { height: 56px; }
}

/* ---------- Einstellungen ---------- */
.settings { display: grid; gap: var(--sp-5); max-width: 760px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.setting-row p { color: var(--muted); font-size: var(--fs-sm); }
.session { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.session:last-child { border-bottom: 0; }
.prose p + p { margin-top: var(--sp-2); }
.prose { font-size: var(--fs-sm); color: var(--ink-2); max-width: 70ch; }
.result > span:nth-child(2) { display: grid; min-width: 0; }
