:root {
  --bg: #fbfaf7; --panel: #ffffff; --text: #24231f; --muted: #6d6a60; --line: #e4e1d8;
  --accent: #1f6f5c; --accent-text: #ffffff; --warn: #b5541c; --danger: #b3261e; --chip: #eef3f1;
  --tab-h: 64px; --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171815; --panel: #20221e; --text: #ecebe5; --muted: #a5a399; --line: #34362f;
    --accent: #6cc4ae; --accent-text: #0f1a17; --warn: #e59866; --danger: #f28b82; --chip: #263330;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171815; --panel: #20221e; --text: #ecebe5; --muted: #a5a399; --line: #34362f;
  --accent: #6cc4ae; --accent-text: #0f1a17; --warn: #e59866; --danger: #f28b82; --chip: #263330;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.35rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.top { position: sticky; top: 0; z-index: 500; display: flex; align-items: center; gap: 1rem; padding: .6rem 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.side { display: none; gap: .3rem; }
.side a { text-decoration: none; padding: .35rem .7rem; border-radius: 999px; color: var(--text); }
.side a.active { background: var(--chip); color: var(--accent); font-weight: 600; }
.who { margin-left: auto; font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .9rem; }
.bloglink { display: inline-flex; }
/* Logo ist braun auf durchsichtig: helle Kachel wie im Blog */
.bloglink img { width: 38px; height: 38px; border-radius: 4px; }
main { max-width: 960px; margin: 0 auto; padding: 16px 16px calc(var(--tab-h) + 88px); }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 600; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); /* so viele Spalten wie Knöpfe */
  background: var(--panel); border-top: 1px solid var(--line); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: .75rem; min-height: 44px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 360px) { .tabs a { font-size: .68rem; } }
.tabs a span { font-size: 1.3rem; line-height: 1; }
.tabs a.active { color: var(--accent); font-weight: 600; }
.fab[hidden] { display: none; }
.fab { position: fixed; right: 18px; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom)); z-index: 650;
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; text-decoration: none;
  background: var(--accent); color: var(--accent-text); box-shadow: 0 4px 14px rgb(0 0 0 / .25); }
@media (min-width: 800px) {
  .side { display: flex; }
  .tabs { display: none; }
  main { padding-bottom: 96px; }
  .fab { bottom: 28px; right: 28px; }
}

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .8rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--text); padding: .45rem .9rem; min-height: 40px; font: inherit; }
.seg button.on { background: var(--accent); color: var(--accent-text); }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px;
  padding: .35rem .8rem; min-height: 36px; font: inherit; font-size: .9rem; cursor: pointer; }
.chip.on { background: var(--chip); border-color: var(--accent); color: var(--accent); font-weight: 600; }

input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: .6rem .7rem; min-height: 44px; width: 100%; }
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: .7rem 0 .25rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .7rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1.1rem;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }
details.more { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .6rem; }
details.more summary { cursor: pointer; color: var(--accent); min-height: 44px; display: flex; align-items: center; }

.search { flex: 1 1 220px; }
.list { display: flex; flex-direction: column; gap: .5rem; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .65rem .8rem; text-decoration: none; color: var(--text); }
.card .l1 { display: flex; justify-content: space-between; gap: .5rem; font-weight: 600; }
.card .l2 { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .l3 { color: var(--muted); font-size: .85rem; display: flex; gap: .7rem; flex-wrap: wrap; }
.yearhead { position: sticky; top: 52px; z-index: 10; background: var(--bg); padding: .5rem 0 .2rem; font-weight: 700; color: var(--muted); }
/* Zeitleiste neben der Flugliste (REQ-L7) */
.flist { display: flex; gap: .7rem; }
.flist > div { flex: 1; min-width: 0; }
.rail { flex: none; align-self: flex-start; position: sticky; top: 60px; display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: none;
  max-height: calc(100dvh - 60px - var(--tab-h) - 96px - env(safe-area-inset-bottom)); }
.rail button { position: relative; flex: 0 1 44px; min-height: 28px; padding: 0 .1rem 0 1.35rem; border: 0; background: none; color: var(--muted);
  font: inherit; font-size: .85rem; text-align: left; font-variant-numeric: tabular-nums; cursor: pointer; }
.rail button::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.rail button::after { content: ""; position: absolute; left: 0; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--line); }
.rail button:hover { color: var(--text); }
.rail button[aria-current] { color: var(--accent); font-weight: 700; }
.rail button[aria-current]::after { background: var(--accent); border-color: var(--accent); }
@media (min-width: 800px) { .rail { max-height: calc(100dvh - 80px); } }
@media (min-width: 1200px) { .flist { gap: 1.4rem; margin-right: -6.2rem; } .rail { width: 4.8rem; font-size: 1rem; } .rail button { font-size: .95rem; } }
.badge { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; background: var(--chip); color: var(--accent); font-weight: 600; }

.map { height: 46vh; min-height: 260px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 1; }
.map.small { height: 220px; min-height: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: .8rem 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; }
.tile .v { font-size: 1.5rem; font-weight: 700; }
.tile .k { color: var(--muted); font-size: .85rem; }
.chart { width: 100%; height: auto; display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 1rem; font-size: .85rem; color: var(--muted); margin: .3rem 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: middle; }
table.t { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.t td, table.t th { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }

.picker { position: relative; }
.btn.val { justify-content: space-between; text-align: left; }
.sheet { position: fixed; inset: 0; z-index: 900; background: rgb(0 0 0 / .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet .box { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 800px) { .sheet { align-items: center; } .sheet .box { border-radius: 16px; } }
.opt { display: flex; justify-content: space-between; gap: .5rem; width: 100%; padding: .7rem .6rem; min-height: 48px; border: 0;
  border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.opt:hover { background: var(--chip); }
.opt .d { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 90px); z-index: 1000; background: var(--text); color: var(--bg);
  padding: .6rem 1rem; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; pointer-events: auto; }
.toast button { margin-left: .8rem; background: none; border: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }
.err { color: var(--danger); }
.dur { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }

/* ---------- Phase 2: Import, Track, Profil ---------- */
.inline { display: flex; align-items: center; gap: .45rem; margin: .35rem 0; color: var(--text); font-size: .95rem; }
.inline input[type=radio], .inline input[type=checkbox] { width: auto; min-height: 0; margin: 0; }
.toolbar .inline { margin: 0 .6rem 0 0; font-size: .85rem; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: .7rem 0 0; padding: .4rem .8rem .6rem; }
legend { font-size: .9rem; font-weight: 600; padding: 0 .3rem; }
.note { background: var(--chip); border-radius: 10px; padding: .55rem .8rem; margin: .3rem 0 .8rem; }
.warn { color: var(--warn); }
.warnbox { border: 1px solid var(--warn); border-radius: var(--radius); padding: .2rem .9rem .9rem; margin-bottom: 1rem; }
.warnbox h2 { margin-top: .8rem; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 130px; margin: 0 0 1rem;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--panel); cursor: pointer; text-align: center; padding: 1rem; color: var(--text); font-size: 1rem; }
.drop.over { border-color: var(--accent); background: var(--chip); }
.card.pend { padding-bottom: .8rem; }
.trackgrid { display: grid; gap: .8rem; }
.trackgrid .info { order: 2; }
.trackmap { height: 42vh; min-height: 240px; }
.minimap { height: 220px; min-height: 0; margin-top: .4rem; }
.profwrap { margin-top: .4rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
canvas.profile { display: block; width: 100%; height: 170px; touch-action: pan-y; cursor: crosshair; }
canvas.profile:focus-visible { outline: 2px solid var(--accent); }
.statusline { display: flex; flex-wrap: wrap; gap: .2rem .8rem; font-size: .82rem; font-variant-numeric: tabular-nums; padding: .35rem .2rem 0; min-height: 2.6em; }
.statusline .up { color: #2e8b57; } .statusline .down { color: var(--danger); }
.infotabs, .rulesets { margin-bottom: .4rem; }
table.t.small td, table.t.small th { padding: .3rem .4rem; font-size: .82rem; }
@media (min-width: 900px) {
  main:has(.trackgrid) { max-width: 1280px; }
  .trackgrid { grid-template-columns: 320px 1fr; align-items: start; }
  .trackgrid .info { order: 0; }
  .trackmap { height: 52vh; }
  canvas.profile { height: 200px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .trackgrid { grid-template-columns: 1fr 1fr; } .trackmap { height: 60vh; }
}

/* Phase 3: Blog */
.postprev { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.postprev:first-of-type { border-top: 0; }
.postprev p { flex-basis: 100%; margin: .1rem 0 0; color: var(--muted); }
.postprev .btn { margin-left: auto; }
.postprev.near strong::after { content: ' · gleiche Tage'; font-weight: 400; color: var(--muted); font-size: .8rem; }
.btn.small { min-height: 32px; padding: .2rem .7rem; font-size: .85rem; }
.blogchip { color: var(--accent); text-decoration: underline; cursor: pointer; }
#blogbox details { margin-top: .5rem; }
#blogbox .search { width: 100%; margin: .4rem 0; }
.sugrow { display: flex; gap: .8rem; align-items: flex-start; cursor: pointer; margin: 0; color: var(--text); font-size: .95rem; }
.sugrow input[type=checkbox] { width: 22px; height: 22px; min-height: 0; padding: 0; margin: .1rem 0 0; flex: none; }
.sugtext { display: grid; gap: .35rem; min-width: 0; }
.sugline { display: grid; grid-template-columns: 6.5rem 1fr; gap: .5rem; align-items: baseline; }
.suglbl { color: var(--muted); font-size: .8rem; }
@media (max-width: 520px) { .sugline { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Phase 4: Service ---------- */
.due { display: inline-block; font-size: .8rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; background: var(--chip); color: var(--accent); }
.due-overdue { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.due-soon { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.due-missing, .due-unknown, .due-inactive { background: var(--chip); color: var(--muted); font-weight: 500; }
.card.card-overdue { border-color: var(--danger); }
.duerow { padding: .55rem 0; border-top: 1px solid var(--line); }
.duerow:first-of-type { border-top: 0; }
.duerow .l1 { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .15rem; }
.svcnotes { white-space: pre-wrap; margin: .3rem 0; }
.filerow { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .3rem 0; }
.filerow a { overflow-wrap: anywhere; }
.note.note-bad { border: 1px solid var(--danger); }
.note.newver { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; max-width: 960px; margin: .6rem auto 0; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--accent); }
.svcact { margin-top: .5rem; }
.fc-head { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: flex-start; margin-bottom: .5rem; }
.fc-legend { display: flex; flex-direction: column; gap: .2rem; font-size: .86rem; }
.fc-item { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.fc-sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px #fff8; }
.fc-status { display: flex; flex-direction: column; gap: .15rem; font-variant-numeric: tabular-nums; padding: .35rem .2rem 0; min-height: 3em; }
.fc-row { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .7rem; }
.fc-row .up { color: #2e8b57; } .fc-row .down { color: var(--danger); }
.fc-item input[type=checkbox] { width: auto; min-height: 0; padding: 0; margin: 0; flex: none; }

/* ---------- Phase 5: ähnliche Flüge, Vergleich, Kartensuche ---------- */
.simlist { display: flex; flex-direction: column; gap: .1rem; }
.simrow { display: flex; align-items: center; gap: .6rem; padding: .45rem .3rem; border-top: 1px solid var(--line); cursor: default; }
.simrow:first-child { border-top: 0; }
.simrow.hl { background: var(--chip); border-radius: 8px; }
.simrow input[type=checkbox] { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; flex: none; }
.simbar { flex: none; width: 52px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.simbar i { display: block; height: 100%; background: var(--accent); }
.simtext { min-width: 0; overflow-wrap: anywhere; }
.simtext a { text-decoration: none; }
#simbox h3 { font-size: .95rem; margin: .8rem 0 .2rem; }
.searchmap { height: 48vh; min-height: 280px; }
.qbar { gap: .5rem; flex-wrap: wrap; }
.qrow > div[hidden] { display: none; }
#qr { padding: 0; min-height: 32px; }
.cmptab td.best { font-weight: 700; color: var(--accent); }
.tablewrap { overflow-x: auto; }
[hidden] { display: none !important; } /* sonst überstimmt z. B. .seg { display: inline-flex } das Attribut */
.fc-ctl { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* ---------- Flugbuch-Auszug, Druck (REQ-M3) ---------- */
.lbtab { font-size: .85rem; }
.lbtab td.lbc { max-width: 22rem; }
.lbhead h2 { margin-bottom: .2rem; }
.lbhead p { margin: .15rem 0; }
.lbsign { display: flex; flex-wrap: wrap; gap: 1.2rem 3rem; margin-top: 2rem; font-size: .9rem; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  :root { --bg: #fff !important; --panel: #fff !important; --text: #000 !important; --muted: #555 !important; --line: #bbb !important; --accent: #000 !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .noprint, .side, .tabs, .fab, header.top, #toast, #newver, nav { display: none !important; }
  main { max-width: none; padding: 0; }
  .lbtab { font-size: 8.5pt; width: 100%; }
  .lbtab thead { display: table-header-group; }
  .lbtab tr { break-inside: avoid; }
  .lbtab th, .lbtab td { border-bottom: .5pt solid #bbb; padding: 2pt 4pt; }
  a { color: #000; text-decoration: none; }
}

/* ---------- Profil und Profilbilder (0.9.0) ---------- */
.av { display: inline-block; width: 22px; height: 22px; border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; background: var(--line); }
.av-s { width: 20px; height: 20px; }
.av-m { width: 34px; height: 34px; }
.av-xl { width: 96px; height: 96px; box-shadow: 0 0 0 3px var(--panel), 0 0 0 4px var(--line); }
.pilot { display: inline-flex; align-items: center; gap: .35rem; }
.wholink { display: inline-flex; align-items: center; gap: .45rem; color: inherit; text-decoration: none; }
.profhead { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.profname { font-size: 1.3rem; font-weight: 600; }
.fc-av { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; }
.fc-avpin img { display: block; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 3px solid; background: #fff; box-shadow: 0 0 4px #0009; }

/* XContest-Abruf (0.10.0) */
.xcrecent { margin: .4rem 0 0; padding-left: 1.1rem; }
.xcrecent li { margin: .15rem 0; }
.xcbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .4rem 0 .6rem; }
.card.xcuser { display: flex; align-items: center; gap: .8rem; }
.card.xcuser .xcgrow { flex: 1; min-width: 0; }
.card.xcsel { border-color: var(--accent, #2a7ae2); }
.xcscreen { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin: .5rem 0; }
.xcscreen img { display: block; width: 100%; height: auto; max-width: 1100px; cursor: pointer; }
.xcscreen img:focus { outline: 3px solid var(--accent, #2a7ae2); outline-offset: -3px; }
.xckeys { flex-wrap: wrap; align-items: center; }
.xckeys input { flex: 1; min-width: 10rem; width: auto; }

/* 0.19.0: Ausrichtung der Startplätze als Kreis mit 8 Segmenten */
.rose path { fill: #fff; stroke: #16161d; stroke-width: 4; }
.rose path.on { fill: #1f6f5c; }
.rosemark { display: flex; align-items: center; justify-content: center; }
.rosemark .rose { width: var(--rose, 26px); height: var(--rose, 26px); display: block; filter: drop-shadow(0 0 2px #0008); }
.orient { display: inline-flex; align-items: center; gap: .25rem; }
.orient .rose { width: 16px; height: 16px; }
.roseedit { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .3rem 0 .6rem; }
.roseedit .rose { width: 160px; height: 160px; }
.roseedit path { stroke-width: 1.2; cursor: pointer; }
.roseedit path:hover { fill: var(--chip); }
.roseedit path.on, .roseedit path.on:hover { fill: var(--accent); }
.roseedit text { font-size: 9px; text-anchor: middle; pointer-events: none; fill: #16161d; font-weight: 600; }
.roseedit p { margin: 0 0 .4rem; }
