:root {
  --ink: #1b2528;
  --ink-soft: #55625f;
  --paper: #f1f3ee;
  --surface: #ffffff;
  --line: #d6dbd0;
  --accent: #2455c4;
  --accent-ink: #ffffff;
  --moss: #3f7a2f;
  --ochre: #8f5f0c;
  --brick: #a83232;
  --danger: #a83232;
  --focus: #2455c4;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8ece6;
    --ink-soft: #a2aea9;
    --paper: #14191b;
    --surface: #1c2326;
    --line: #2f3a3d;
    --accent: #7ba3ff;
    --accent-ink: #0d1424;
    --moss: #8bc47a;
    --ochre: #e0b25a;
    --brick: #f08a8a;
    --danger: #f08a8a;
    --focus: #7ba3ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--font); font-variant-numeric: tabular-nums;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.125rem; font-weight: 650; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.boot { padding: 2rem; color: var(--ink-soft); }

/* Kopfzeile */
.topbar { background: var(--ink); color: var(--paper); }
@media (prefers-color-scheme: dark) { .topbar { background: #0d1113; border-bottom: 1px solid var(--line); } }
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 1rem; min-height: 56px;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { font-weight: 750; font-size: 1.125rem; color: #fff; text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.brand img { width: 24px; height: 24px; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a {
  color: #d8dfda; text-decoration: none; padding: .5rem .75rem; border-radius: var(--radius); font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.16); color: #fff; }
.who { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: #d8dfda; }
.who .role { opacity: .75; }
.topbar :focus-visible { outline-color: #9db8ff; }

main { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: .25rem 0 0; color: var(--ink-soft); }
.crumb { display: inline-block; margin-bottom: .75rem; font-size: .9rem; }

/* Buttons und Formulare */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  min-height: 42px;
}
.btn:hover { border-color: var(--ink-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-small { padding: .3rem .65rem; min-height: 34px; font-size: .9rem; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

label { display: block; font-weight: 600; margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=search], input[type=email], select, textarea {
  font: inherit; width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); min-height: 42px;
}
input[type=file] { font: inherit; width: 100%; }
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: 1.1rem; }
.field .hint { font-size: .875rem; color: var(--ink-soft); margin-top: .25rem; }
.field .error, .form-error { color: var(--danger); font-size: .9rem; margin-top: .3rem; }
.form-error:empty, .field .error:empty { display: none; }
.form-error { padding: .6rem .8rem; border: 1px solid var(--danger); border-radius: var(--radius); margin-bottom: 1rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.narrow { max-width: 620px; }

/* Anmeldung */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { margin-bottom: .25rem; }
.login-card .sub { color: var(--ink-soft); margin: 0 0 1.5rem; }
.login-track { display: block; width: 100%; height: auto; margin-bottom: 1.25rem; border-radius: var(--radius); }

/* Meldungen */
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--moss); color: var(--moss); background: var(--surface); }
.flash.error { border-color: var(--danger); color: var(--danger); }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-soft); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Filterleiste */
.filters {
  display: grid; grid-template-columns: minmax(180px, 2fr) 1fr 1fr 1fr; gap: .75rem; margin-bottom: 1rem;
  padding: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.filters label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .2rem; }
.result-count { color: var(--ink-soft); font-size: .9rem; margin: 0 0 .6rem; }

/* Streckenliste */
.route-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.route-row {
  display: grid; grid-template-columns: 200px 1fr auto; gap: 1rem; align-items: center; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.route-row:hover { border-color: var(--accent); }
.route-row img { display: block; width: 200px; height: 125px; object-fit: cover; background: #e8ede4; }
.route-body { padding: .75rem 0; min-width: 0; }
.route-body h2 { overflow-wrap: anywhere; }
.route-tags { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; align-items: center; }
.route-sub { color: var(--ink-soft); font-size: .9rem; margin-top: .35rem; }
.route-length { padding: 0 1.25rem; text-align: right; }
.route-length .num { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.route-length .unit { color: var(--ink-soft); font-size: .9rem; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 650; border: 1.5px solid currentColor; }
.badge.leicht { color: var(--moss); }
.badge.mittel { color: var(--ochre); }
.badge.schwer { color: var(--brick); }
.tag { font-size: .9rem; color: var(--ink-soft); }

/* Detail */
.detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; }
.detail-preview { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: var(--radius); background: #e8ede4; }
.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.facts div { border-top: 2px solid var(--line); padding-top: .5rem; }
.facts dt { font-size: .85rem; color: var(--ink-soft); }
.facts dd { margin: 0; font-size: 1.35rem; font-weight: 700; }
.facts .wide { grid-column: 1 / -1; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; margin: 1.25rem 0; }
.meta-line { color: var(--ink-soft); font-size: .875rem; margin-top: 1rem; }
.profile { margin-top: 1.5rem; }
.profile svg { width: 100%; height: auto; display: block; }
.profile-area { fill: var(--accent); opacity: .16; }
.profile-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.axis { stroke: var(--line); stroke-width: 1; }
.axis-label { fill: var(--ink-soft); font: 11px var(--font); }

/* Analyse-Ergebnis im Formular */
.analysis { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; align-items: center; margin: .75rem 0 1.25rem; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.analysis img { width: 100%; height: auto; border-radius: 4px; display: block; }
.analysis dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .15rem .9rem; }
.analysis dt { color: var(--ink-soft); }
.analysis dd { margin: 0; font-weight: 650; }
.analysis[hidden] { display: none; }

/* Tabelle */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.status-off { color: var(--danger); font-weight: 600; }
.status-on { color: var(--moss); font-weight: 600; }

@media (max-width: 800px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .f-search { grid-column: 1 / -1; }
  .detail { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .analysis { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .route-row { grid-template-columns: 1fr; gap: 0; }
  .route-row img { width: 100%; height: auto; aspect-ratio: 8 / 5; }
  .route-body { padding: .75rem 1rem 0; }
  .route-length { padding: .25rem 1rem .9rem; text-align: left; display: flex; gap: .4rem; align-items: baseline; }
  .route-length .num { font-size: 1.4rem; }
  .who .role { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .route-row { transition: border-color .12s, filter .12s; }
}
