/* Jobs (pages/jobs.html): Karten, Strecke A → B, Meine Jobs, Rangliste, Formular mit Orts-Auswahl */

/* Reiter + Filter */
.jb-tabbar { display: flex; }
.jb-filters { display: grid; grid-template-columns: minmax(0, 1fr) 200px 190px; gap: 10px; margin-bottom: 18px; }
.jb-search { position: relative; display: block; }
.jb-search > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.jb-search input { padding-left: 38px; }
.jb-filter { display: block; min-width: 0; }

/* Raster der offenen Jobs */
.jb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.jb-grid .skeleton-block { height: 230px; border-radius: var(--radius-l); }
.jb-empty-box, #jb-empty .empty, #jb-board-empty .empty {
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-xl);
}

.jb-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); box-shadow: var(--shadow-1);
  transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.jb-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.jb-card.is-accepted { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.jb-card.is-full { opacity: .78; }
.jb-card:has(.jb-title a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.jb-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.jb-cat {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: var(--surface-3); color: var(--text-2);
}
.jb-cat-hazardous { background: var(--bad-soft); color: var(--bad); }
.jb-cat-refrigerated, .jb-cat-food { background: var(--info-soft); color: var(--info); }
.jb-cat-heavy, .jb-cat-machinery, .jb-cat-construction { background: var(--warn-soft); color: var(--warn); }
.jb-cat-livestock, .jb-cat-fragile { background: var(--ok-soft); color: var(--ok); }
.jb-title { margin: 2px 0 0; font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.jb-title a { color: var(--text); text-decoration: none; }
.jb-title a::after { content: ''; position: absolute; inset: 0; border-radius: inherit; } /* ganze Karte klickbar */
.jb-title a:focus-visible { outline: none; }
.jb-cargo { display: flex; align-items: center; gap: 7px; margin: -4px 0 0; color: var(--muted); font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.jb-cargo .icon { width: 15px; height: 15px; flex: none; }

/* Belohnung */
.jb-reward { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.jb-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 13px; border: 1px solid var(--border); background: var(--bg-2); white-space: nowrap;
}
.jb-chip .icon { width: 14px; height: 14px; }
.jb-chip b { font-variant-numeric: tabular-nums; font-weight: 750; }
.jb-chip span { color: var(--muted); font-size: 12px; }
.jb-chip-xp { border-color: var(--accent-line); background: var(--accent-soft); }
.jb-chip-xp .icon { color: var(--accent); }
.jb-chip-cr .icon { color: var(--info); }

/* Strecke A → B */
.jb-route { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); }
.jb-point { display: flex; align-items: center; gap: 8px; min-width: 0; }
.jb-point:last-child { justify-content: flex-end; text-align: right; }
.jb-point:last-child .jb-dot { order: 2; }
.jb-place-name { font-weight: 650; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; min-width: 0; }
.jb-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.jb-dot.is-dest { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.jb-line { height: 2px; background: repeating-linear-gradient(90deg, var(--faint) 0 6px, transparent 6px 10px); position: relative; }
.jb-line::after { content: ''; position: absolute; right: -2px; top: -4px; border: 5px solid transparent; border-left: 6px solid var(--faint); border-right: 0; }
.jb-route-lg { padding: 14px 16px; margin: 4px 0 14px; }
.jb-route-lg .jb-place-name { font-size: 15.5px; }

.jb-meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13.5px; }
.jb-meta li { display: inline-flex; align-items: center; gap: 6px; }
.jb-meta .icon { width: 15px; height: 15px; flex: none; }
.jb-foot { margin-top: auto; display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.jb-takers { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13.5px; }
.jb-takers .icon { width: 15px; height: 15px; }
.jb-by { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.jb-actions { margin-left: auto; display: flex; gap: 6px; position: relative; z-index: 1; }
.jb-remove { color: var(--bad); }

/* Detail */
.jb-d-cargo { margin: 0 0 4px; color: var(--accent-text); font-weight: 650; font-size: 14px; overflow-wrap: anywhere; }
.jb-d-map { position: relative; margin: 6px 0 12px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--map-bg); }
.jb-d-map canvas { display: block; width: 100%; height: 220px; }
.jb-d-map-note { position: absolute; left: 10px; bottom: 8px; font-size: 11.5px; color: #F2F1EE; background: rgb(19 18 17 / 70%); padding: 2px 8px; border-radius: 6px; }
.jb-rewards .jb-chip { height: 32px; font-size: 14px; padding: 0 14px; }

/* Meine Jobs */
.jb-wallet .stat b { color: var(--text); }
.jb-h2 { font: 650 17px/1.3 var(--font-body); margin: 26px 0 12px; }
.jb-h2:first-of-type { margin-top: 6px; }
.jb-active { display: grid; gap: 16px; }
.jb-active-card { display: grid; gap: 14px; }
.jb-active-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.jb-active-title { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.jb-active-title h3 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.jb-due { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 12px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--border); font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.jb-due .icon { width: 16px; height: 16px; color: var(--accent); }
.jb-due.is-urgent { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.jb-due.is-urgent .icon { color: var(--bad); }
.jb-next { display: flex; align-items: flex-start; gap: 8px; margin: 0; color: var(--text-2); font-size: 14.5px; }
.jb-next .icon { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: 1px; }
.jb-active-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.jb-progress { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; counter-reset: none; }
.jb-progress li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.jb-progress li::before { content: ''; position: absolute; top: 14px; left: -50%; right: 50%; height: 2px; background: var(--border-strong); z-index: 0; }
.jb-progress li:first-child::before { display: none; }
.jb-progress li.is-done::before, .jb-progress li.is-current::before { background: var(--accent); }
.jb-step-dot { position: relative; z-index: 1; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--border-strong); font-size: 13px; font-weight: 700; color: var(--muted); }
.jb-step-dot .icon { width: 15px; height: 15px; }
.jb-progress li.is-done { color: var(--text); }
.jb-progress li.is-done .jb-step-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.jb-progress li.is-current { color: var(--text); }
.jb-progress li.is-current .jb-step-dot { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }

.jb-history { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); overflow: hidden; }
.jb-history:has(> .jb-empty-box) { border: 0; background: none; }
.jb-history .skeleton-item { border-bottom: 1px solid var(--border); }
.jb-hist { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.jb-hist:last-child { border-bottom: 0; }
.jb-hist-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--muted); }
.jb-hist-icon .icon { width: 18px; height: 18px; }
.jb-hist.is-ok .jb-hist-icon { background: var(--ok-soft); color: var(--ok); }
.jb-hist.is-bad .jb-hist-icon { background: var(--bad-soft); color: var(--bad); }
.jb-hist-main { min-width: 0; display: grid; gap: 3px; }
.jb-hist-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jb-hist-title strong { overflow-wrap: anywhere; }
.jb-hist-route, .jb-hist-facts { margin: 0; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.jb-hist-facts { font-variant-numeric: tabular-nums; }
.jb-reasons { margin: 4px 0 0; padding: 8px 12px 8px 28px; border-radius: var(--radius-s); background: var(--bad-soft); color: var(--text-2); font-size: 13.5px; display: grid; gap: 2px; }
.jb-hist-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }

/* Rangliste */
.jb-board-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.jb-board td.jb-rank, .jb-board th.jb-rank { width: 56px; text-align: center; }
.jb-rank-n { color: var(--muted); font-weight: 650; }
.jb-driver { color: var(--text); font-weight: 650; text-decoration: none; margin-right: 8px; overflow-wrap: anywhere; }
.jb-driver:hover { color: var(--accent-text); text-decoration: underline; }
.jb-board th.jb-active-col { color: var(--accent-text); }
.jb-board td.jb-active-col { font-weight: 750; }
.jb-board tr.jb-own td { background: var(--accent-soft); }
.jb-board tr.jb-own td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.jb-board .skeleton-line { width: 100%; }

/* So funktioniert's */
.jb-steps { list-style: none; counter-reset: jb; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.jb-steps li { counter-increment: jb; display: grid; gap: 4px; align-content: start; padding-top: 38px; position: relative; color: var(--muted); font-size: 14px; }
.jb-steps li::before {
  content: counter(jb); position: absolute; top: 0; left: 0; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text); font: 400 14px var(--font-display);
}
.jb-steps b { color: var(--text); font-size: 15px; }

/* Formular */
#jb-form .field { align-content: start; } /* Felder in einer Zeile nicht strecken */
.jb-places { border: 0; margin: 4px 0 16px; padding: 14px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--border); display: grid; gap: 12px; }
.jb-place { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; }
.jb-place .field { margin: 0; }
.jb-place select { margin-top: 2px; }
.jb-places input, .jb-places select { background-color: var(--surface); }
.jb-place-dot { display: grid; place-items: center; width: 30px; height: 30px; margin-top: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px; }
.jb-place-dot.is-dest { background: var(--ok); color: #0d1f16; }
.jb-estimate { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 14px; color: var(--text-2); }
.jb-estimate .icon { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--accent); }
.jb-estimate[data-tone="bad"] { color: var(--bad); }
.jb-estimate[data-tone="bad"] .icon { color: var(--bad); }
.jb-team { margin: 4px 0 0; padding: 14px; border: 1px dashed var(--accent-line); border-radius: var(--radius); }
.jb-team legend { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--accent-text); text-transform: uppercase; letter-spacing: .08em; }
.jb-team legend .icon { width: 15px; height: 15px; }
.jb-coords summary { cursor: pointer; color: var(--muted); font-size: 14px; }

/* Durchsuchbare Auswahl (Combobox) */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 264px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-2);
}
.combo-option { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.combo-option[aria-selected="true"], .combo-option:hover { background: var(--accent-soft); }
.combo-name { font-weight: 600; overflow-wrap: anywhere; }
.combo-meta { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.combo-empty { padding: 10px; color: var(--muted); font-size: 14px; }

@media (max-width: 860px) {
  .jb-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jb-filters { grid-template-columns: 1fr 1fr; }
  .jb-search { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .jb-tabbar .tabs { width: 100%; }
  .jb-tabbar .tab { flex: 1; justify-content: center; padding: 0 8px; }
  .jb-tabbar .tab .icon { display: none; }
  .jb-grid { grid-template-columns: 1fr; }
  .jb-hist { grid-template-columns: auto minmax(0, 1fr); }
  .jb-hist-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .jb-board-controls .tabs { width: 100%; }
  .jb-board-controls .tab { flex: 1; justify-content: center; }
  .jb-steps { grid-template-columns: 1fr; }
  .jb-d-map canvas { height: 180px; }
  .page-head #jb-new { width: 100%; }
  .combo-meta { display: none; }
}
@media (max-width: 420px) {
  .jb-filters { grid-template-columns: 1fr; }
  .jb-route { grid-template-columns: 1fr; gap: 6px; }
  .jb-line { display: none; }
  .jb-point:last-child { justify-content: flex-start; text-align: left; }
  .jb-point:last-child .jb-dot { order: 0; }
}
