/* =========================================================
   Flugwetter – Karte
   Themes: data-theme="cockpit" (dunkel, schwebende Panels)
           data-theme="flugbuch" (hell, angedockte Spalten)
   ========================================================= */

:root,
[data-theme="cockpit"] {
  --bg: #0D1416;
  --panel: rgba(21, 30, 33, 0.93);
  --panel-solid: #151E21;
  --panel-border: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #E6EDEF;
  --text-2: #CFDDE1;
  --muted: #8FA3AA;
  --faint: #6F8890;
  --accent: #8FD3E3;
  --accent-fg: #0D1416;
  --accent-soft: rgba(143, 211, 227, 0.12);
  --sector: #8FD3E3;
  --hover: rgba(255, 255, 255, 0.05);
  --marker-bg: rgba(13, 20, 22, 0.9);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  --v-good: #7BD88F;
  --v-borderline: #F2C14E;
  --v-edge: #F2C14E;
  --v-calm: #6FB7C9;
  --v-wrong: #7D8C92;
  --v-strong: #F0605D;
  --v-rain: #9C8CF0;
  --v-nodata: #4F646B;
  --wx-sun: #F2B53A;
  --wx-cloud: #A9BCC2;
  --wx-rain: #5BB0EE;
  --v-on-dark: #0D1416;

  --font: "Barlow", system-ui, sans-serif;
  --font-head: "Barlow", system-ui, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, monospace;
  --head-weight: 700;
  --radius: 16px;
  --gap: 20px;
  --left-w: 390px;
  --right-w: 370px;
  --tile-filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.35);
  color-scheme: dark;
}

[data-theme="flugbuch"] {
  --bg: #F5F0E6;
  --panel: #FBF8F2;
  --panel-solid: #FBF8F2;
  --panel-border: #E4DCCB;
  --line: #ECE5D6;
  --line-strong: #DCD2BE;
  --text: #1E2724;
  --text-2: #33403B;
  --muted: #5F635C;
  --faint: #8A8676;
  --accent: #9A4522;
  --accent-fg: #FFFFFF;
  --accent-soft: #F3ECDF;
  --sector: #4F86A3;
  --hover: #F3ECDF;
  --marker-bg: #FFFFFF;
  --shadow: 0 2px 8px rgba(60, 45, 20, 0.14);

  --v-good: #3F7D4E;
  --v-borderline: #B67812;
  --v-edge: #B67812;
  --v-calm: #4F86A3;
  --v-wrong: #8A8676;
  --v-strong: #A8352A;
  --v-rain: #6A55C2;
  --v-nodata: #B9B2A2;
  --wx-sun: #D98E0B;
  --wx-cloud: #A7A08F;
  --wx-rain: #2F7CC0;
  --v-on-dark: #FFFFFF;

  --font: "Outfit", system-ui, sans-serif;
  --font-head: "Fraunces", Georgia, serif;
  --font-num: "Outfit", system-ui, sans-serif;
  --head-weight: 400;
  --radius: 0px;
  --gap: 0px;
  --left-w: 420px;
  --right-w: 380px;
  --tile-filter: sepia(0.28) saturate(0.55) brightness(1.03) contrast(0.95);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ---------- Grundgerüst ---------- */
.app { position: fixed; inset: 0; }
.map { position: absolute; inset: 0; background: var(--bg); }
.map .tiles-themed { filter: var(--tile-filter); }
.leaflet-container { font: inherit; background: var(--bg); }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.col-left {
  position: absolute; z-index: 500;
  left: var(--gap); top: var(--gap); bottom: var(--gap);
  width: var(--left-w);
  display: flex; flex-direction: column; gap: 12px;
}
.col-right {
  position: absolute; z-index: 500;
  right: var(--gap); top: var(--gap); bottom: var(--gap);
  width: var(--right-w);
  overflow-y: auto;
}
.sheet-handle { display: none; }

[data-theme="flugbuch"] .col-left { gap: 0; background: var(--panel); border-right: 1px solid var(--panel-border); }
[data-theme="flugbuch"] .col-left .panel { border: 0; border-bottom: 1px solid var(--panel-border); backdrop-filter: none; }
[data-theme="flugbuch"] .col-left .list-panel { border-bottom: 0; }
[data-theme="flugbuch"] .col-right { border: 0; border-left: 1px solid var(--panel-border); backdrop-filter: none; }

/* ---------- Kopf & Zeit ---------- */
.head-panel { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; flex: none; }
[data-theme="flugbuch"] .head-panel { padding: 26px 30px 20px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); min-width: 0; }
.brand-name { color: var(--text); font-weight: 700; letter-spacing: 0.22em; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-theme="flugbuch"] .brand-name { color: var(--accent); font-size: 12px; font-weight: 600; }
.brand-actions { display: flex; gap: 6px; }
.page-title { display: none; }
[data-theme="flugbuch"] .page-title { display: block; margin: -4px 0 0; font: 400 42px/1 var(--font-head); letter-spacing: -0.01em; }

.icon-btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.icon-btn-small { width: 32px; height: 32px; border-color: transparent; color: var(--faint); }
[data-theme="flugbuch"] .icon-btn { border-radius: 50%; background: #FFFFFF; }
[data-theme="flugbuch"] .icon-btn-small { background: transparent; }
[data-theme="cockpit"] .i-moon, [data-theme="flugbuch"] .i-sun { display: none; }
.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search-form { display: flex; gap: 8px; }
.search-form input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: transparent; }
[data-theme="flugbuch"] .search-form input { background: #FFFFFF; }
.btn-small { height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--accent); color: var(--accent-fg); font-weight: 600; cursor: pointer; }

.day-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.day-tabs button {
  padding: 7px 0; border-radius: 10px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--text-2);
}
.day-tabs .wd { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.day-tabs .dt { font-family: var(--font-num); font-size: 15px; font-weight: 600; }
.day-tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
[data-theme="flugbuch"] .day-tabs { gap: 0; border-bottom: 1px solid var(--line-strong); }
[data-theme="flugbuch"] .day-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px; color: var(--faint); }
[data-theme="flugbuch"] .day-tabs .dt { font-family: var(--font-head); font-weight: 400; font-size: 20px; }
[data-theme="flugbuch"] .day-tabs .wd { text-transform: none; letter-spacing: 0.04em; }
[data-theme="flugbuch"] .day-tabs button[aria-pressed="true"] { background: transparent; color: var(--text); border-bottom-color: var(--accent); }

.time-block { display: flex; flex-direction: column; gap: 4px; }
.time-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.time-value { font-family: var(--font-num); font-size: 13px; color: var(--text); font-weight: 600; }
.time-ticks { display: flex; justify-content: space-between; font-family: var(--font-num); font-size: 11px; color: var(--faint); padding: 0 2px; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--line-strong) var(--fill, 50%)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line-strong); }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9.5px; border-radius: 50%; background: var(--accent); border: 4px solid var(--panel-solid); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 4px solid var(--panel-solid); box-shadow: 0 0 0 1px var(--accent); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
input[type="range"].is-now::-webkit-slider-thumb { background: var(--panel-solid); }

.quick-row { display: flex; gap: 6px; }
.quick-row button { flex: 1; height: 36px; border-radius: 8px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.quick-row button:hover { background: var(--hover); }
.quick-row button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
[data-theme="flugbuch"] .quick-row button { border-radius: 999px; background: #FFFFFF; color: var(--text); }
[data-theme="flugbuch"] .quick-row button[aria-pressed="true"] { background: var(--text); color: var(--panel-solid); border-color: var(--text); }

.fly-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.fly-count { font-family: var(--font-num); font-weight: 600; color: var(--v-good); font-size: 14px; }

/* ---------- Liste ---------- */
.list-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 20px 8px; }
.list-head h2 { margin: 0; font-size: 12px; letter-spacing: 0.2em; font-weight: 600; color: var(--muted); text-transform: uppercase; }
[data-theme="flugbuch"] .list-head { padding: 18px 30px 8px; }
[data-theme="flugbuch"] .list-head h2 { font: italic 400 18px var(--font-head); letter-spacing: 0; text-transform: none; color: var(--text); }
.sort select { height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel-solid); color: var(--muted); font-size: 12px; cursor: pointer; }

.site-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
[data-theme="flugbuch"] .site-list { padding: 0 16px 8px; }
.site-row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: transparent; text-align: left; cursor: pointer; color: inherit;
}
.site-row:hover { background: var(--hover); }
.site-row[aria-current="true"] { background: var(--accent-soft); }
[data-theme="flugbuch"] .site-row { border-top: 1px solid var(--line); border-radius: 0; padding: 11px 14px; }
[data-theme="flugbuch"] .site-row[aria-current="true"] { background: var(--hover); }
.site-row .rose { flex: none; }
.site-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.site-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.site-wind { flex: none; display: flex; flex-direction: column; align-items: flex-end; }
.site-speed { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }
.site-speed small { font-size: 11px; color: var(--muted); font-weight: 400; }
.site-dir { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--muted); }

.status-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px 8px 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
[data-theme="flugbuch"] .status-bar { padding: 10px 22px 10px 30px; }

/* ---------- Verdict-Farben ---------- */
.v-good { --v: var(--v-good); }
.v-borderline { --v: var(--v-borderline); }
.v-edge { --v: var(--v-edge); }
.v-calm { --v: var(--v-calm); }
.v-wrong { --v: var(--v-wrong); }
.v-strong { --v: var(--v-strong); }
.v-nodata { --v: var(--v-nodata); }
.v-rain { --v: var(--v-rain); }
.v-text { color: var(--v); }

/* ---------- Mini-Windrose (Liste) ---------- */
.rose .rim { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.rose .sec { fill: var(--sector); fill-opacity: 0.3; }
.rose .arrow { fill: var(--v); }

/* ---------- Detail ---------- */
.detail-panel { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
[data-theme="flugbuch"] .detail-panel { padding: 26px 28px; }
.detail-empty { margin: auto 0; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; }
.detail-empty svg { color: var(--faint); }
.detail-close { display: none; }
.d-verdict { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; letter-spacing: 0.18em; color: var(--v); font-weight: 700; text-transform: uppercase; }
.d-verdict::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--v); }
.d-name { margin: 4px 0 2px; font: var(--head-weight) 26px/1.1 var(--font-head); }
[data-theme="flugbuch"] .d-name { font-size: 32px; }
.d-region { font-size: 13px; color: var(--muted); }
.d-notes { font-size: 13px; color: var(--text-2); background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
.d-top { display: flex; align-items: center; gap: 14px; }
.d-rose { flex: none; }
.d-rose .rim { fill: none; stroke: var(--line-strong); stroke-width: 0.8; }
.d-rose .tick { stroke: var(--line-strong); }
.d-rose .lbl { font: 6px var(--font-num); fill: var(--faint); }
.d-rose .lbl-n { fill: var(--text-2); }
.d-rose .sec { fill: var(--sector); fill-opacity: 0.2; stroke: var(--sector); stroke-opacity: 0.8; stroke-width: 0.6; }
.d-rose .sec.active { fill-opacity: 0.42; }
.d-rose .sec-lbl { font: 600 6px var(--font-num); fill: var(--text); }
.d-rose .arrow-line { stroke: var(--v); stroke-width: 2.4; stroke-linecap: round; }
.d-rose .arrow-head { fill: var(--v); }
.d-rose .hub { fill: var(--text); }
.d-facts { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.fact-k { font-size: 11px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.fact-v { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 15px; }
.fact-v.big { font-size: 22px; font-weight: 600; }
.fact-v .sep { color: var(--muted); }
.sec-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sec-chip { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-strong); }
.sec-chip.active { border-color: var(--sector); background: color-mix(in srgb, var(--sector) 14%, transparent); }
.sec-chip .fact-v { font-weight: 600; font-size: 14px; }
.sec-missing { font-size: 13px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 8px 10px; }

.hours-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); letter-spacing: 0.1em; margin-bottom: 6px; }
.hours { display: grid; grid-template-columns: repeat(var(--n, 13), minmax(0, 1fr)); gap: 3px; }
.hour { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 3px 0; border-radius: 6px; border: 1px solid transparent; background: transparent; cursor: pointer; color: inherit; }
.hour:hover { background: var(--hover); }
.hour.sel { border-color: var(--line-strong); background: var(--hover); }
.hour svg { display: block; }
.hour .h-arrow { fill: var(--v); }
.hour .h-val { font-family: var(--font-num); font-size: 10px; color: var(--text-2); }
.hour .h-bar { width: 100%; height: 50px; display: flex; align-items: flex-end; }
.hour .h-bar i { display: block; width: 100%; border-radius: 3px; background: var(--v); }
.hour.v-wrong .h-bar i, .hour.v-nodata .h-bar i { opacity: 0.45; }
.hour .h-lbl { font-family: var(--font-num); font-size: 10px; color: var(--faint); }
.hour.key .h-lbl { color: var(--text-2); }
.window-text { font-size: 13px; color: var(--text-2); margin-top: 8px; }

.days4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.day4 { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.day4:hover { background: var(--hover); }
.day4.sel { border-color: var(--line-strong); }
.day4 .wd { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }
.day4 .val { font-family: var(--font-num); font-size: 14px; font-weight: 600; color: var(--v); }
.day4 svg:not(.wx) path { fill: var(--v); }
.d4-sum { display: flex; flex-direction: column; align-items: center; font-family: var(--font-num); font-size: 10px; line-height: 1.3; }
.d4-sum .sun { color: var(--wx-sun); }
.d4-sum .rain { color: var(--wx-rain); }
.d-links { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--faint); }
.d-links a { text-decoration: none; font-weight: 600; }

/* ---------- Karten-Marker ---------- */
.wm-icon { background: none; border: 0; }
.wm {
  display: inline-flex; align-items: center; gap: 3px; height: 40px; padding: 0 8px 0 0;
  border-radius: 999px; background: var(--marker-bg); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  white-space: nowrap; cursor: pointer;
}
.wm.sel { border: 2px solid var(--text); }
.wm svg { flex: none; display: block; margin: -1px 0 -1px -1px; }
.wm .ring-bg { fill: var(--marker-bg); stroke: var(--line-strong); stroke-width: 1; }
.wm .ring { fill: var(--sector); fill-opacity: 0.75; }
.wm .core { fill: var(--v); }
.wm .arrow { fill: var(--v-on-dark); }
.wm-speed { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; color: var(--text); }
.wm-name { display: none; }
[data-theme="flugbuch"] .wm-name { display: block; position: absolute; left: 0; top: 42px; font-size: 12px; font-weight: 500; color: var(--text-2); background: rgba(251, 248, 242, 0.88); padding: 0 5px; border-radius: 4px; white-space: nowrap; }
[data-theme="flugbuch"] .wm.sel { border-color: var(--accent); }

.wm-cluster { background: none; }
.wm-cluster div {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--marker-bg); border: 3px solid var(--v); color: var(--text); font: 700 14px var(--font-num); box-shadow: var(--shadow);
}

.fan-icon { pointer-events: none !important; }
.fan .sec { fill: var(--sector); fill-opacity: 0.13; stroke: var(--sector); stroke-opacity: 0.7; stroke-width: 0.5; }
.fan .sec.active { fill-opacity: 0.3; }
.fan .lbl { font: 600 4.2px var(--font-num); fill: var(--text); paint-order: stroke; stroke: var(--bg); stroke-width: 0.8px; }
.fan .lbl2 { font: 3.4px var(--font-num); fill: var(--text-2); paint-order: stroke; stroke: var(--bg); stroke-width: 0.8px; }
.fan .halo { fill: none; stroke: var(--sector); stroke-opacity: 0.25; stroke-width: 0.6; stroke-dasharray: 1.5 2.5; }
.fan .arrow-line { stroke: var(--v); stroke-width: 1.6; stroke-linecap: round; }
.fan .arrow-head { fill: var(--v); }

/* ---------- Werkzeuge, Legende ---------- */
.map-tools { position: absolute; z-index: 450; top: var(--gap); right: calc(var(--right-w) + var(--gap) * 2); display: flex; flex-direction: column; gap: 6px; }
[data-theme="flugbuch"] .map-tools { top: 20px; right: calc(var(--right-w) + 20px); }
.region-stack { display: flex; flex-direction: column; gap: 6px; }
.tool-btn {
  min-width: 46px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text-2); font: 600 12px var(--font-num); cursor: pointer; box-shadow: var(--shadow);
}
.tool-btn:hover:not(:disabled) { color: var(--text); }
.tool-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.tool-btn:disabled { opacity: 0.4; cursor: default; }

.legend {
  position: absolute; z-index: 450; bottom: 20px;
  left: calc(var(--left-w) + var(--gap) * 2); right: calc(var(--right-w) + var(--gap) * 2 + 60px);
  display: flex; justify-content: center; pointer-events: none;
}
[data-theme="flugbuch"] .legend { left: calc(var(--left-w) + 20px); right: calc(var(--right-w) + 80px); }
.legend-box {
  pointer-events: auto; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 14px;
  padding: 9px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--panel-border); font-size: 12px; color: var(--text-2); box-shadow: var(--shadow);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i { width: 10px; height: 10px; border-radius: 50%; background: var(--v); }
.legend-item .swatch { width: 14px; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--sector) 45%, transparent); border: 1px solid var(--sector); }

.leaflet-bottom.leaflet-right { right: calc(var(--right-w) + var(--gap) * 2 - 10px); }
[data-theme="flugbuch"] .leaflet-bottom.leaflet-right { right: calc(var(--right-w) + 10px); }
.leaflet-bottom.leaflet-left { left: calc(var(--left-w) + var(--gap) * 2 - 10px); }
[data-theme="flugbuch"] .leaflet-bottom.leaflet-left { left: calc(var(--left-w) + 10px); }
.leaflet-top, .leaflet-bottom { z-index: 450; }
.leaflet-control-attribution { font-size: 11px; line-height: 1.5; background: var(--panel) !important; color: var(--faint) !important; border-radius: 6px 0 0 0; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a { background: var(--panel-solid); color: var(--text); border-color: var(--line) !important; width: 40px !important; height: 40px !important; line-height: 40px !important; }
.leaflet-bar a:hover { background: var(--hover); }
.leaflet-bar { border: 1px solid var(--line-strong) !important; box-shadow: var(--shadow) !important; border-radius: 10px !important; overflow: hidden; }

.toast {
  position: absolute; z-index: 900; left: 50%; top: 20px; transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line-strong);
  color: var(--text); font-size: 14px; box-shadow: var(--shadow); transition: opacity 200ms ease, transform 200ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mittlere Breiten ---------- */
@media (max-width: 1180px) and (min-width: 821px) {
  :root, [data-theme="cockpit"] { --left-w: 340px; --right-w: 330px; }
  [data-theme="flugbuch"] { --left-w: 360px; --right-w: 340px; }
  .legend { display: none; }
}

/* ---------- Handy: Karte oben, Liste als Bottom-Sheet ---------- */
@media (max-width: 820px) {
  :root, [data-theme="cockpit"], [data-theme="flugbuch"] { --gap: 0px; --left-w: 100vw; --right-w: 100vw; --sheet-h: 54vh; }
  body { font-size: 15px; }
  .col-left {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; height: var(--sheet-h);
    gap: 0; background: var(--panel-solid); border-top: 1px solid var(--panel-border);
    border-radius: 18px 18px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25); overflow: hidden;
    transition: height 220ms ease; padding-bottom: env(safe-area-inset-bottom);
  }
  .col-left.expanded { height: 86vh; }
  .col-left .panel { border: 0; border-radius: 0; backdrop-filter: none; background: transparent; }
  .sheet-handle { display: flex; justify-content: center; align-items: center; flex: none; height: 22px; border: 0; background: transparent; cursor: pointer; }
  .sheet-handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); }
  .head-panel, [data-theme="flugbuch"] .head-panel { padding: 0 16px 10px; gap: 10px; border-bottom: 1px solid var(--line) !important; }
  [data-theme="flugbuch"] .page-title { display: none; }
  .fly-row, .time-ticks { display: none; }
  .day-tabs button { flex-direction: row; justify-content: center; gap: 5px; padding: 6px 0; }
  .day-tabs .dt, [data-theme="flugbuch"] .day-tabs .dt { font-size: 15px; }
  .quick-row button { height: 34px; }
  .brand-row .icon-btn { width: 34px; height: 34px; }
  .leaflet-control-attribution { font-size: 9px; max-width: 100vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .list-head, [data-theme="flugbuch"] .list-head { padding: 10px 16px 4px; }
  .site-list, [data-theme="flugbuch"] .site-list { padding: 0 6px 6px; }
  .col-right {
    left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 72vh; z-index: 600;
    border-radius: 18px 18px 0 0; border: 0; border-top: 1px solid var(--panel-border); background: var(--panel-solid);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3); padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform 220ms ease;
  }
  .col-right.open { transform: translateY(0); }
  .detail-close { display: inline-flex; position: absolute; right: 12px; top: 12px; }
  .detail-empty { display: none; }
  .map-tools, [data-theme="flugbuch"] .map-tools { top: 12px; right: 12px; }
  .region-stack { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100vw - 24px); }
  .tool-btn { min-width: 38px; height: 34px; padding: 0 6px; font-size: 11px; }
  .map-tools, .region-stack { gap: 4px; }
  .map-tools { flex-direction: row; align-items: flex-start; }
  .legend { display: none; }
  .leaflet-bottom.leaflet-right, [data-theme="flugbuch"] .leaflet-bottom.leaflet-right { right: 0; bottom: var(--sheet-h); }
  .leaflet-bottom.leaflet-left, [data-theme="flugbuch"] .leaflet-bottom.leaflet-left { left: 0; bottom: var(--sheet-h); }
  .leaflet-control-zoom { display: none; }
  [data-theme="flugbuch"] .wm-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Wetter-Symbole ---------- */
.wx { flex: none; display: inline-block; vertical-align: -3px; overflow: visible; }
.wx .wx-sun circle { fill: var(--wx-sun); }
.wx .wx-sun line { stroke: var(--wx-sun); stroke-width: 1.6; stroke-linecap: round; }
.wx .wx-moon { fill: var(--wx-cloud); }
.wx .wx-cloud { fill: var(--wx-cloud); }
.wx .wx-rain line { stroke: var(--wx-rain); stroke-width: 1.8; stroke-linecap: round; }
.wx .wx-snow circle { fill: var(--wx-rain); }
.wx .wx-bolt { fill: var(--wx-sun); }
.wx .wx-fog line, .wx .wx-fog path { stroke: var(--wx-cloud); stroke-width: 1.8; stroke-linecap: round; fill: none; }
.site-speed .wx { margin-right: 6px; vertical-align: -2px; }
.wx-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--hover); }
.wx-title { font-weight: 600; font-size: 14px; }
.wx-sub { font-size: 12px; color: var(--muted); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.hour .h-rain { font-family: var(--font-num); font-size: 9px; color: var(--faint); min-height: 12px; }
.hour .h-rain.wet { color: var(--wx-rain); font-weight: 600; }
.hour .h-bar { height: 44px; }

/* ---------- Regenradar ---------- */
.radar-bar {
  position: absolute; z-index: 460; top: var(--gap);
  left: calc(var(--left-w) + var(--gap) * 2 + 20px); right: calc(var(--right-w) + var(--gap) * 2 + 80px);
  max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 14px; box-shadow: var(--shadow);
}
[data-theme="flugbuch"] .radar-bar { top: 20px; left: calc(var(--left-w) + 20px); right: calc(var(--right-w) + 80px); border-radius: 14px; }
.radar-bar .i-pause { display: none; }
.radar-bar.playing .i-play { display: none; }
.radar-bar.playing .i-pause { display: inline; }
.radar-time { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.radar-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-2); font-family: var(--font-num); }
.radar-scale { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-family: var(--font); white-space: nowrap; }
.radar-scale i { width: 54px; height: 8px; border-radius: 4px; background: linear-gradient(to right, #A6E3FA, #3C9BEB, #2ECC71, #F7E73A, #F39C12, #E74C3C, #B0279E); }
.legend-item .swatch-radar { width: 14px; height: 10px; border-radius: 2px; background: linear-gradient(to right, #3C9BEB, #F7E73A, #E74C3C); }

@media (max-width: 1180px) and (min-width: 821px) {
  .radar-scale { display: none; }
}
@media (max-width: 820px) {
  .radar-bar, [data-theme="flugbuch"] .radar-bar { top: 58px; left: 12px; right: 12px; max-width: none; }
  .radar-scale { display: none; }
}

/* ---------- Werkzeugleiste (Icons) ---------- */
.map-tools { flex-direction: column; align-items: flex-end; gap: 10px; }
.tool-group { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; box-shadow: var(--shadow); overflow: visible; }
[data-theme="flugbuch"] .tool-group { background: #FFFFFF; }
.tool-icon {
  position: relative; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text-2); cursor: pointer;
}
.tool-group .tool-icon:first-child { border-radius: 12px 12px 0 0; }
.tool-group .tool-icon:last-child { border-bottom: 0; border-radius: 0 0 12px 12px; }
.tool-icon:hover { background: var(--hover); color: var(--text); }
.tool-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tool-icon[aria-pressed="true"], .tool-icon[aria-expanded="true"] { background: var(--accent); color: var(--accent-fg); }
.tool-icon.busy svg { animation: spin 1.2s linear infinite; }
.tool-badge { position: absolute; right: 3px; bottom: 2px; font: 600 9px var(--font-num); color: var(--accent); }
.tool-icon[aria-expanded="true"] .tool-badge { color: var(--accent-fg); }
@media (hover: hover) {
  .tool-icon[data-tip]:hover::after {
    content: attr(data-tip); position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    padding: 6px 10px; border-radius: 8px; background: var(--text); color: var(--bg); font: 600 12px var(--font); white-space: nowrap; pointer-events: none;
  }
}
.region-pop {
  position: absolute; right: calc(100% + 10px); top: 0; width: 230px; padding: 6px;
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px;
}
.region-pop button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.region-pop button:hover:not(:disabled), .region-pop button:focus-visible { background: var(--hover); outline: none; }
.region-pop button:disabled { color: var(--faint); cursor: default; }
.region-pop button:disabled .flag { opacity: 0.4; }
.region-pop .flag { flex: none; border-radius: 2px; }
.rp-name { flex: 1; font-size: 14px; }
.rp-count { font: 12px var(--font-num); color: var(--muted); }
.me-dot { fill: #3C9BEB; fill-opacity: 1; stroke: #FFFFFF; stroke-width: 3; }

/* ---------- Landebahnen ---------- */
.wm .rwbar { fill: var(--v-on-dark); fill-opacity: 0.35; }
.rw-poly { stroke: #FFFFFF; stroke-width: 2; fill-opacity: 0.45; }
.rw-gras { fill: #6FBF73; }
.rw-asphalt { fill: #59656A; }
.rw-matte { fill: #3FA37A; }
.rw-center { stroke: #FFFFFF; stroke-width: 2; stroke-dasharray: 8 8; fill: none; }
.rw-desig { display: flex; align-items: center; justify-content: center; }
.rw-desig span { display: block; color: #FFFFFF; font: 700 14px var(--font-num); text-shadow: 0 0 3px #000, 0 0 6px #000; }
.rw-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; align-items: center; padding: 12px; border-radius: 12px; background: var(--hover); }
.rw-dia .rim { fill: none; stroke: var(--line-strong); stroke-width: 0.8; }
.rw-dia .lbl { font: 7px var(--font-num); fill: var(--text-2); }
.rw-dia .rw-strip { fill: #3E6B47; stroke: #9BD3A6; stroke-width: 0.8; }
.rw-dia .rw-line { stroke: #E6EDEF; stroke-width: 0.8; stroke-dasharray: 4 3; }
.rw-dia .arrow-line { stroke: var(--v); stroke-width: 2.6; stroke-linecap: round; }
.rw-dia .arrow-head { fill: var(--v); }
.rw-facts { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rw-start { font: 700 22px var(--font-num); }
.xw-warn { color: var(--v-borderline); }
.xw-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; align-items: end; }
.xw-cell { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.xw-cell i { display: block; border-radius: 2px; background: var(--faint); }
.xw-cell b { font: 400 9px var(--font-num); color: var(--faint); text-align: center; }
.xw-ok i { background: var(--v-good); }
.xw-mid i { background: var(--v-borderline); }
.xw-high i { background: var(--v-strong); }
.xw-none i { opacity: 0.3; }

@media (max-width: 820px) {
  .map-tools { flex-direction: row; align-items: flex-start; }
  .tool-group { flex-direction: row; }
  .tool-icon { width: 42px; height: 42px; border-bottom: 0; border-right: 1px solid var(--line); }
  .tool-group .tool-icon:first-child { border-radius: 12px 0 0 12px; }
  .tool-group .tool-icon:last-child { border-right: 0; border-radius: 0 12px 12px 0; }
  .region-pop { right: 0; top: calc(100% + 8px); }
  .radar-bar, [data-theme="flugbuch"] .radar-bar { top: 64px; }
}
.map-tools { z-index: 480; }
