*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #ffffff;
  --surface:   #f8f9fb;
  --border:    #eaecf0;
  --border2:   #d1d5db;
  --text:      #111827;
  --text2:     #6b7280;
  --text3:     #9ca3af;
  --blue:      #2563eb;
  --blue-bg:   #eff6ff;
  --blue-dim:  #bfdbfe;
  --radius:    14px;
  --radius-sm: 10px;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 580px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.75rem;
}
.app-icon {
  width: 36px; height: 36px;
  background: var(--blue);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.app-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Search — full width, no button */
.search-wrap {
  position: relative;
  margin-bottom: 1rem;
}
.search-wrap input[type="text"] {
  width: 100%;
  padding: 13px 16px 13px 44px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
}
.search-wrap input[type="text"]::placeholder { color: var(--text3); font-weight: 400; }
.search-wrap input[type="text"]:focus {
  border-color: var(--blue);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
  display: flex;
}
.search-clear {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: var(--border2);
  border: none;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--bg);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  font-weight: 700;
}
.search-clear.visible { display: flex; }

/* Suggestions */
.suggestions {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
}
.sug-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 6px;
  transition: background .1s;
}
.sug-item:last-child { border-bottom: none; }
.sug-item:hover { background: var(--surface); }
.sug-city { color: var(--text3); font-size: 12.5px; font-weight: 400; }

/* Departure header */
.dep-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.dep-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.dep-sub {
  font-size: 12.5px;
  color: var(--text3);
  margin-top: 4px;
}
.reload-btn {
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  color: var(--text3);
  flex-shrink: 0;
  margin-left: 12px;
  transition: background .12s, color .12s;
}
.reload-btn:hover { background: var(--surface); color: var(--text); }

/* Filters */
.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.fbtn {
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
  cursor: pointer;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text3);
  transition: all .12s;
}
.fbtn:hover { background: var(--surface); color: var(--text2); border-color: var(--border2); }
.fbtn.on { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-dim); }

/* Departure rows */
.dep-list { display: flex; flex-direction: column; gap: 6px; }
.dep-row {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: border-color .1s;
}
.dep-row:hover { border-color: var(--border2); }

.badge {
  min-width: 52px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
  gap: 3px;
}
.tram  { background: #dbeafe; color: #1e40af; }
.bus   { background: #dcfce7; color: #15803d; }
.sbahn { background: #fef9c3; color: #92400e; }
.ferry { background: #e0f2fe; color: #0c4a6e; }

.dir {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pf {
  font-size: 12px;
  color: var(--text3);
  flex-shrink: 0;
  background: var(--surface);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
}
.tblock { text-align: right; flex-shrink: 0; min-width: 64px; }
.tuntil { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); }
.tnow   { font-size: 15px; font-weight: 700; color: #16a34a; }
.trow2  { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 2px; }
.ttime  { font-size: 11.5px; color: var(--text3); font-weight: 400; }
.tok    { font-size: 11.5px; color: #16a34a; font-weight: 500; }
.tlate  { font-size: 11.5px; color: #dc2626; font-weight: 500; }
.tneut  { font-size: 11.5px; color: var(--text3); }
.dep-row.cancelled { opacity: .6; }
.tcancelled { font-size: 13px; font-weight: 700; color: #dc2626; }
.ttime.strike { text-decoration: line-through; color: var(--text3); }

.status {
  text-align: center;
  padding: 3.5rem 1rem;
  font-size: 14px;
  color: var(--text3);
}
.status .icon { font-size: 30px; margin-bottom: .75rem; line-height: 1; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #0f0f11;
    --surface: #18181b;
    --border:  #27272a;
    --border2: #3f3f46;
    --text:    #f4f4f5;
    --text2:   #a1a1aa;
    --text3:   #71717a;
    --blue-bg: rgba(37,99,235,.12);
    --blue-dim:rgba(37,99,235,.35);
  }
  .tram  { background: rgba(30,64,175,.2);  color: #93c5fd; }
  .bus   { background: rgba(21,128,61,.2);  color: #86efac; }
  .sbahn { background: rgba(146,64,14,.2);  color: #fde68a; }
  .ferry { background: rgba(12,74,110,.2);  color: #7dd3fc; }
  .search-clear { background: #52525b; }
}

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 1rem; }
.tab { flex: 1; padding: 8px 10px; font-size: 13.5px; font-family: inherit; font-weight: 600; border: none; border-radius: 8px; background: transparent; color: var(--text3); cursor: pointer; }
.tab.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ── Trip fields ── */
.trip-fields { display: flex; gap: 8px; align-items: center; margin-bottom: 1rem; }
.trip-inputs { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.trip-field { margin-bottom: 0; }
.trip-field input[type="text"] { padding-left: 58px; }
.field-label { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--text3); pointer-events: none; }
.trip-inputs .suggestions { margin-bottom: 0; }
.swap-btn { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--bg); color: var(--text2); font-size: 17px; cursor: pointer; font-family: inherit; }
.swap-btn:hover { background: var(--surface); }

/* ── Trip cards ── */
.trip-card { background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; }
.trip-card:hover { border-color: var(--border2); }
.trip-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.trip-times { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.trip-until { font-size: 13px; font-weight: 600; color: var(--blue); flex-shrink: 0; }
.trip-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }
.trip-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; }
.trip-chain .badge { min-width: 0; padding: 0 8px; height: 24px; font-size: 12px; }
.chain-arrow { color: var(--text3); font-size: 14px; }
.trip-details { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); flex-direction: column; gap: 10px; }
.trip-card.open .trip-details { display: flex; }
.leg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.leg-head .badge { min-width: 0; padding: 0 8px; height: 24px; font-size: 12px; }
.leg-dir { font-size: 12.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leg-stop { font-size: 13px; display: flex; gap: 8px; align-items: baseline; padding-left: 2px; }
.leg-time { font-weight: 700; min-width: 40px; }
.leg-meta { color: var(--text3); font-size: 12px; }
.leg-walk { font-size: 12.5px; color: var(--text3); }

/* ── Zeitwahl ── */
.time-row { display: flex; gap: 6px; align-items: center; margin-bottom: .5rem; }
.seg { display: flex; background: var(--surface); border: 1.5px solid var(--border); border-radius: 9px; padding: 2px; flex-shrink: 0; }
.seg-btn { padding: 6px 10px; font-size: 13px; font-weight: 600; font-family: inherit; border: none; border-radius: 7px; background: transparent; color: var(--text3); cursor: pointer; }
.seg-btn.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.time-inp { flex: 1; min-width: 0; padding: 8px 10px; font-size: 14px; font-family: inherit; font-weight: 500; border: 1.5px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); color-scheme: light dark; }
.time-inp::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; }
.time-inp::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.time-inp:focus { outline: none; border-color: var(--blue); }
.now-btn { flex-shrink: 0; padding: 8px 12px; font-size: 13px; font-weight: 600; font-family: inherit; border: 1.5px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--text2); cursor: pointer; }

/* ── Aufklappbares ── */
.trip-card { cursor: default; }
.trip-summary { cursor: pointer; }
.mid-toggle { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 2px 50px; padding: 2px 0; font-size: 12px; font-family: inherit; font-weight: 500; color: var(--text3); background: none; border: none; cursor: pointer; }
.mid-arrow { display: inline-block; transition: transform .15s; }
.leg.mids-open .mid-arrow { transform: rotate(90deg); }
.mids { display: none; border-left: 2px solid var(--border); margin: 2px 0 4px 18px; padding-left: 10px; }
.leg.mids-open .mids { display: block; }
.leg-stop.mid { font-size: 12.5px; color: var(--text2); padding: 2px 0; }
.leg-stop.mid .leg-time { font-weight: 500; }

/* ── Karte ── */
.map-toggle { align-self: flex-start; padding: 7px 12px; font-size: 13px; font-weight: 600; font-family: inherit; border: 1.5px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text2); cursor: pointer; }
.trip-more { align-self: stretch; width: 100%; padding: 10px 12px; margin-top: 4px; }
.trip-more:disabled { opacity: .6; cursor: default; }
.trip-map { display: none; height: 260px; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--border); position: relative; }
.trip-card.map-open .trip-map { display: block; }
.map-note { position: absolute; bottom: 8px; left: 8px; z-index: 500; background: var(--bg); padding: 4px 8px; border-radius: 6px; font-size: 12px; color: var(--text3); }

/* ── Zeit-Chips ── */
.chips { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 1rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; font-size: 12.5px; font-family: inherit; font-weight: 600; padding: 5px 12px; border-radius: 20px; cursor: pointer; background: transparent; border: 1.5px solid var(--border); color: var(--text3); white-space: nowrap; }
.chip:hover { background: var(--surface); color: var(--text2); border-color: var(--border2); }
.chip.on { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-dim); }
