/* ---------- Farben & Grundwerte ---------- */
:root {
  color-scheme: light;
  --page: #f4f5f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7d7b75;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-soft: rgba(42, 120, 214, 0.38);
  --accent-wash: rgba(42, 120, 214, 0.10);
  --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95;
  --ocean: #e3ebf3;
  --land: #f7f6f2;
  --land-line: #cfd4d9;
  --navy: #0b1d30;
  --navy-2: #12304d;
  --on-navy: #f3f6fa;
  --on-navy-2: #a9bbcf;
  --good: #0ca30c;
  --shadow: 0 1px 2px rgba(11, 29, 48, 0.06), 0 8px 24px rgba(11, 29, 48, 0.06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #252524;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5; --accent-soft: rgba(57, 135, 229, 0.40); --accent-wash: rgba(57, 135, 229, 0.16);
    --seq-1: #12304d; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #2a78d6; --seq-5: #5598e7; --seq-6: #9ec5f4;
    --ocean: #0f1a26; --land: #22252a; --land-line: #3a3f46;
    --navy: #07131f; --navy-2: #0e2338;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #252524;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5; --accent-soft: rgba(57, 135, 229, 0.40); --accent-wash: rgba(57, 135, 229, 0.16);
  --seq-1: #12304d; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #2a78d6; --seq-5: #5598e7; --seq-6: #9ec5f4;
  --ocean: #0f1a26; --land: #22252a; --land-line: #3a3f46;
  --navy: #07131f; --navy-2: #0e2338;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ---------- Startseite ---------- */
.gate {
  position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden;
  display: grid; place-items: center; text-align: center;
  color: #f3f6fa;
  background: radial-gradient(120% 80% at 50% 0%, #1c4570 0%, #0e2742 45%, #07131f 100%);
}
.gate-sky {
  position: absolute; inset: 0; opacity: .55; pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 32%, #cfe0f5 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 46% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 26%, #cfe0f5 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 78% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 34%, #cfe0f5 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 42%, #cfe0f5 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 56% 40%, #fff 50%, transparent 51%);
}
.gate-inner { position: relative; z-index: 2; padding: 32px 16px 160px; width: min(520px, 100%); }
.gate-kicker { letter-spacing: .32em; text-transform: uppercase; font-size: 12px; color: #9fbbd9; margin-bottom: 18px; }
.gate-title {
  font-weight: 300; font-size: clamp(44px, 10vw, 88px); letter-spacing: .04em; line-height: 1.05;
  color: #eef4fb; text-shadow: 0 2px 30px rgba(127, 178, 236, .25); margin-right: -.04em;
}
.gate-lead { margin-top: 18px; color: #c3d3e5; font-size: 17px; }
.gate-form {
  margin: 48px auto 0; padding: 18px; width: min(380px, 100%); text-align: left;
  border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.gate-label { display: block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #9fbbd9; margin-bottom: 10px; }
.gate-row { display: flex; gap: 8px; }
.gate-row input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(7, 19, 31, .55); color: #fff; outline: none;
}
.gate-row input::placeholder { color: #7f97b2; }
.gate-row input:focus { border-color: #7fb2ec; box-shadow: 0 0 0 3px rgba(127, 178, 236, .25); }
.gate-row button {
  padding: 11px 18px; border-radius: 10px; border: 0; cursor: pointer; font-weight: 600;
  background: #f3f6fa; color: #0b1d30;
}
.gate-row button:hover { background: #fff; }
.gate-row button:disabled { opacity: .6; cursor: progress; }
.gate-remember { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; color: #a9bbcf; cursor: pointer; }
.gate-msg { min-height: 1.4em; margin-top: 8px; font-size: 13px; color: #ffc9c9; }
.gate-waves { position: absolute; left: -5%; bottom: 0; width: 110%; height: 200px; z-index: 1; }
.gate-waves .w1 { fill: rgba(127, 178, 236, .10); animation: drift 14s ease-in-out infinite alternate; }
.gate-waves .w2 { fill: rgba(127, 178, 236, .14); animation: drift 10s ease-in-out infinite alternate-reverse; }
.gate-waves .w3 { fill: rgba(7, 19, 31, .65); }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(30px); } }
@media (prefers-reduced-motion: reduce) { .gate-waves path { animation: none; } }
.gate-foot { position: absolute; bottom: 18px; left: 0; right: 0; z-index: 2; font-size: 12px; color: #7f97b2; letter-spacing: .08em; }
.gate.shake .gate-form { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- Kopf ---------- */
.top { background: linear-gradient(160deg, var(--navy-2) 0%, var(--navy) 70%); color: var(--on-navy); padding-bottom: 72px; }
.top-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: #9fc6f2; }
.brand-mark svg { width: 24px; height: 24px; }
.brand-title { font-weight: 600; font-size: 17px; }
.brand-sub { font-size: 13px; color: var(--on-navy-2); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.stamp { font-size: 12px; color: var(--on-navy-2); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .14); background: transparent; color: var(--on-navy); cursor: pointer; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.top .text-btn { color: var(--on-navy); border-color: rgba(255, 255, 255, .14); }
@media (max-width: 640px) { .stamp { display: none; } }

.hero { display: grid; grid-template-columns: 1fr minmax(280px, 400px); gap: 24px; align-items: end; padding-top: 28px; }
.hero-label { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--on-navy-2); }
.hero-figure { font-size: clamp(56px, 11vw, 96px); font-weight: 600; line-height: 1; letter-spacing: -.02em; margin-top: 6px; }
.hero-sub { margin-top: 10px; color: var(--on-navy-2); font-size: 16px; }
.next { border-radius: var(--radius); padding: 18px 20px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); }
.next:empty { display: none; }
.next-kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #9fc6f2; }
.next-title { font-size: 19px; font-weight: 600; margin-top: 6px; }
.next-route { color: var(--on-navy-2); font-size: 14px; margin-top: 2px; }
.next-count { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; }
.next-count b { font-size: 34px; font-weight: 600; line-height: 1; }
.next-count span { color: var(--on-navy-2); }
.next-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); margin-top: 12px; overflow: hidden; }
.next-bar i { display: block; height: 100%; background: #7fb2ec; border-radius: 4px; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }

/* ---------- Inhalt ---------- */
.content { margin-top: -48px; position: relative; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-label { font-size: 13px; color: var(--ink-2); }
.kpi-value { font-size: 30px; font-weight: 600; line-height: 1.15; margin-top: 4px; }
.kpi-note { font-size: 12px; color: var(--muted); margin-top: 2px; }

.filters {
  position: sticky; top: 0; z-index: 900; margin: 20px -8px 0; padding: 12px 8px;
  display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px;
  background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.filter { display: flex; flex-direction: column; gap: 4px; }
.filter label { font-size: 12px; color: var(--ink-2); }
.filter select {
  appearance: none; -webkit-appearance: none; padding: 8px 32px 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23898781' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  min-width: 96px; cursor: pointer;
}
.switch { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; padding-bottom: 8px; }
.switch input { width: 16px; height: 16px; accent-color: var(--accent); }
.reset { margin-left: auto; }
.text-btn { background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.text-btn:hover { background: var(--accent-wash); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card h2 { font-size: 17px; font-weight: 600; }
.card-sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.span-2 { grid-column: span 2; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }

/* ---------- Karte ---------- */
.card-map { margin-top: 4px; padding-bottom: 14px; }
.map-wrap { position: relative; }
#map { height: min(62vh, 600px); min-height: 380px; border-radius: 10px; background: var(--ocean); border: 1px solid var(--border); }
.leaflet-container { font: inherit; background: var(--ocean); }
.leaflet-tooltip.port-label { background: var(--surface); color: var(--ink); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.leaflet-tooltip.port-label::before { display: none; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 14px 16px; font-size: 13px; line-height: 1.45; }
.leaflet-popup-content h3 { font-size: 15px; margin-bottom: 2px; }
.leaflet-popup-content .muted { color: var(--ink-2); }
.leaflet-popup-content ul { margin: 8px 0 0; padding: 0; list-style: none; max-height: 180px; overflow: auto; }
.leaflet-popup-content li { padding: 3px 0; border-top: 1px solid var(--grid); }
.leaflet-bar a { background: var(--surface); color: var(--ink); border-color: var(--grid); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--ink-2); }
.map-focus {
  position: absolute; left: 12px; bottom: 12px; z-index: 800; max-width: min(420px, calc(100% - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 13px;
}
.map-focus b { font-size: 15px; display: block; }
.map-focus .text-btn { margin-top: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--accent-wash); color: var(--ink); border-color: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; font-size: 12px; color: var(--ink-2); align-items: center; }
.legend .key { display: inline-flex; align-items: center; gap: 8px; }
.legend .ramp { width: 120px; height: 8px; border-radius: 4px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.legend .dot.big { width: 16px; height: 16px; }
.legend .line { width: 26px; height: 0; border-top: 2px solid var(--accent); }
.legend .line.dash { border-top-style: dashed; }
.legend .swatch { width: 14px; height: 10px; border-radius: 3px; }

/* ---------- Diagramme ---------- */
.chart { position: relative; min-height: 120px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--accent); }
.chart .bar.planned { fill: var(--accent-soft); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g.col:hover .bar { filter: brightness(1.12); }
.hbars { display: grid; gap: 6px; }
.hrow { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; gap: 10px; align-items: center; font-size: 13px; padding: 2px 0; border-radius: 6px; }
.hrow:hover { background: var(--accent-wash); }
.hlabel { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hlabel small { color: var(--muted); margin-left: 6px; }
.htrack { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar { height: 16px; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; flex: none; }
.hval { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.more { margin-top: 10px; }
.empty { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--grid); }
table.data th { color: var(--ink-2); font-weight: 600; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { max-height: 420px; overflow: auto; }

.tooltip {
  position: fixed; z-index: 2000; pointer-events: none; max-width: 300px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}
.tooltip b { display: block; font-size: 14px; }
.tooltip .muted { color: var(--ink-2); }

/* ---------- Fakten, Flaggen, Logbuch ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.fact { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.fact-label { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }
.fact-value { font-size: 20px; font-weight: 600; margin-top: 4px; line-height: 1.25; }
.fact-note { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

.flags { display: grid; gap: 18px; }
.flag-group h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.flag-group h3 span { color: var(--muted); font-weight: 400; }
.flag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.flag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.flag .fl { font-size: 18px; line-height: 1; }
.flag small { color: var(--muted); }

.search { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); min-width: min(280px, 100%); }
.log { list-style: none; margin: 0; padding: 0; }
.log-year { font-size: 13px; font-weight: 600; color: var(--muted); padding: 14px 0 6px; letter-spacing: .06em; }
.trip {
  display: grid; grid-template-columns: 120px 1fr auto; gap: 4px 16px; align-items: center;
  padding: 12px 10px; border-top: 1px solid var(--grid); cursor: pointer; border-radius: 8px;
}
.trip:hover, .trip:focus-visible { background: var(--accent-wash); outline: none; }
.trip.active { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); }
.trip-date { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.trip-title { font-weight: 600; }
.trip-title small { font-weight: 400; color: var(--ink-2); margin-left: 6px; }
.trip-route { font-size: 13px; color: var(--ink-2); }
.trip-ports { grid-column: 2 / 4; font-size: 12px; color: var(--muted); }
.trip-meta { text-align: right; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.trip-meta b { color: var(--ink); font-size: 15px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--accent-wash); color: var(--ink); margin-left: 6px; vertical-align: 2px; font-weight: 500; }
@media (max-width: 640px) {
  .trip { grid-template-columns: 1fr auto; }
  .trip-date { grid-column: 1 / 3; }
  .trip-ports { grid-column: 1 / 3; }
}

.foot { padding: 32px 24px 48px; font-size: 12px; color: var(--muted); }
