/* Navigation und Aufteilung (R3 Etappe 1, Epic #43; R2-Befunde 4, 7 und Navigation aus 2).
   iPhone (≤ 767 px): eine einzige feste Leiste, deckend, unten: vier Bereiche Übersicht, Route, Beladung, Karte
   (im Leerzustand „Eingeben“ und „Karte“), darüber bei Bedarf die Statuszeile. Inhalt und Fokus liegen nie darunter
   (scroll-padding-bottom und Abstand am Seitenende aus --leiste-h, ui-mobil.js; WCAG 2.4.11).
   iPad und Desktop (≥ 768 px): Toolbar oben (rahmen.css), links die Seitenleiste mit den Eingaben (scrollt für sich),
   rechts das Ergebnis; iPad hoch und schmale Fenster: Seitenleiste ein- und ausblendbar (ui-rahmen.js).
   Reihenfolge des Inhalts: Übersicht, Vorschläge, Karte, Profil, Starts & Landungen, Etappen & Kraftstoff, Werkzeuge;
   am iPhone stehen Starts & Landungen und Etappen direkt unter der Übersicht, danach die Eingaben. */

/* ---------- Statuszeile (Aussehen auf allen Breiten) ---------- */
.status-chip { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; margin: 0; padding: 8px 12px;
  border: 0; border-radius: var(--r-group); background: var(--t-surface); color: var(--t-label); box-shadow: none; text-align: left;
  font: 600 calc(var(--schrift-text, 15px) * var(--fs, 1))/1.25 var(--font); letter-spacing: 0; text-transform: none; }
.status-chip:hover:not(:disabled) { color: var(--t-label); border: 0; }
.status-chip .status-sym { --sym: 22px; }
.status-chip .status-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-chip .status-n { padding: 2px 8px; border-radius: var(--r-pill); background: var(--t-fill); font-weight: 600; }
.status-chip .status-ziel { color: var(--t-accent); font-weight: 400; font-size: calc(var(--schrift-neben, 13px) * var(--fs, 1)); white-space: nowrap; }
.status-chip.bad { color: var(--t-bad-text); }
.status-chip.warn { color: var(--t-label); }
.status-chip.ok { color: var(--t-ok-text); }
.status-chip.uebung .status-ziel { display: none; }   /* Platz für „· n offen“ */
/* iPad und Desktop: Statuszeile in der Toolbar vor den Knöpfen (ui-rahmen.js), solange das Urteil aus dem Bild ist */
@media (min-width: 768px) {
  .site-head .status-chip { flex: 0 1 auto; width: auto; max-width: min(440px, 40vw); min-height: 36px; padding: 4px 12px 4px 8px; gap: 8px;
    border-radius: var(--r-pill); background: var(--t-surface); box-shadow: inset 0 0 0 1px var(--t-sep); font-size: calc(var(--schrift-neben, 14px) * var(--fs, 1)); }
  .site-head .status-chip:hover:not(:disabled) { background: var(--t-surface-2); }   /* weiße Fläche: Statustext ≥ 5:1 */
  .site-head .status-chip .status-sym { --sym: 18px; }
  /* R5 P12: auch der lange grüne Satz bleibt bei „Aa“ 1,3 ganz lesbar. */
  .site-head .status-chip { flex-wrap: wrap; row-gap: 0; border-radius: var(--r-group); }
  .site-head .status-chip .status-text { white-space: normal; overflow: visible; text-overflow: clip; }
  .site-head .status-chip .status-ziel { margin-left: auto; }
  .site-head .status-chip[hidden] { display: none; }
  html[data-planstand="leer"]:not([data-befund]) .site-head .status-chip { display: none; }
}
@media (min-width: 768px) and (pointer: coarse) { .site-head .status-chip { min-height: 44px; } }
/* iPad hoch: Status in einer eigenen Zeile, samt Platz unter dem klebenden Kopf, auch mit großer Schrift. */
@media (min-width: 768px) and (max-width: 1099px) {
  /* Beim Sprung ist die Statuszeile oft noch verborgen; ihren Platz vorher freihalten. */
  :root { scroll-padding-top: 112px; }
  html:has(.site-head .status-chip:not([hidden])) { --toolbar-h: 104px; }
  .site-head:has(.status-chip:not([hidden])) .site-head__inner { flex-wrap: wrap; align-content: center; }
  .site-head .status-chip { order: 2; flex: 0 0 100%; max-width: none; min-height: 44px; }
}

/* ---------- iPhone: Tab-Leiste unten ---------- */
.mobil-leiste { display: none; }
@media screen and (max-width: 767px) {
  html { scroll-padding-bottom: calc(var(--leiste-h, 120px) + 12px); }
  .mobil-leiste { display: grid; gap: 6px; position: fixed; z-index: 850; left: 0; right: 0; bottom: 0;
    padding: 6px max(8px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-right));
    background: var(--t-bar); border-top: 1px solid var(--t-bar-edge); }
  .mobil-leiste .status-chip { background: var(--t-surface); box-shadow: 0 0 0 1px var(--t-sep); }
  .mobil-leiste .status-chip[hidden] { display: none; }
  .abschnitte ul { display: flex; margin: 0; padding: 0; list-style: none; }
  .abschnitte li { flex: 1 1 0; min-width: 0; }
  .abschnitte a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; padding: 2px 2px 4px;
    border-radius: var(--r-control); color: var(--t-label-2); text-decoration: none; font: 500 calc(12px * var(--fs, 1))/1.15 var(--font); white-space: nowrap; }
  .abschnitte a[aria-current="location"] { color: var(--t-accent); }
  .abschnitte a:focus-visible { outline: 2px solid var(--t-accent); outline-offset: -2px; }
  .tab-sym { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  /* Marker am Symbol: Rot oder Offen in diesem Bereich (ui-mobil.js), nie Grün */
  .abschnitte a .tab-marke { position: absolute; top: 0; left: calc(50% + 9px); --sym: 15px; box-shadow: 0 0 0 2px var(--t-bar); }
  .abschnitte a .tab-marke.warn { box-shadow: none; }
  body:has(.workspace-side.expanded) .mobil-leiste, html.pf-vollbild-offen .mobil-leiste, html[data-ansicht="briefing"] .mobil-leiste { display: none; }
  /* Sprungziele knapp unter dem oberen Rand; die Leiste liegt unten */
  [id^="abschnitt-"], #sheet { scroll-margin-top: 12px; }
  body { padding-bottom: var(--leiste-h, 120px); }
}

/* ---------- iPhone: eine Spalte, Ergebnis vor den Eingaben ---------- */
@media (max-width: 767px) {
  .wrap { padding: 12px var(--gutter) 24px; gap: 12px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; gap: 12px; }
  .inhalt { display: contents; }
  /* benannte Flächen aus uebersicht.css aufheben (eine Spalte, Reihenfolge über order) */
  .workspace :is(.planner, .overview, .map-card, .profil-card, #vorschlaege, #abschnitt-wetter, #abschnitt-etappen, #export, .bereiche-zeile) { grid-area: auto; }
  .workspace .overview { order: 1; }
  .workspace #vorschlaege { order: 2; }
  .workspace #abschnitt-wetter { order: 3; }
  .workspace #abschnitt-etappen { order: 4; }
  .workspace .planner { order: 5; }
  .workspace .map-card { order: 6; }
  .workspace .profil-card { order: 7; }
  .workspace .bereiche-zeile { order: 8; }
  .workspace .inhalt > :is(#export, section.hangar, section.orte) { order: 9; }
  html[data-planstand="leer"]:not([data-befund]) .workspace .bereiche-zeile { order: 8; }
  /* Leer: Zielvorschläge nach Willkommen und Datenzeile (die Datenzeile setzt die Willkommenskarte fort, planstand.css) */
  html[data-planstand="leer"]:not([data-befund]) .workspace #vorschlaege { order: 3; }
}

/* ---------- iPad und Desktop: Seitenleiste mit den Eingaben, Ergebnis rechts ---------- */
@media (min-width: 768px) {
  :root { --seitenleiste-b: clamp(320px, 30vw, 400px); }
  html { scroll-padding-top: calc(var(--toolbar-h) + 8px); }   /* Sprungziele nie unter der klebenden Toolbar (WCAG 2.4.11) */
  .wrap { max-width: none; margin: 0; padding: 0; display: block; }
  .workspace { grid-template-columns: var(--seitenleiste-b) minmax(0, 1fr); gap: 0; align-items: start; }
  html[data-schrift="gross"]:not([data-ansicht="briefing"]) .workspace { grid-template-columns: clamp(360px, 36vw, 460px) minmax(0, 1fr); }
  .workspace > #sheet.planner { position: sticky; top: var(--toolbar-h); height: calc(100dvh - var(--toolbar-h)); overflow-y: auto; overscroll-behavior: contain;
    padding: 12px 16px 40px; border: 0; border-right: 1px solid var(--t-sep); border-radius: 0; background: var(--t-bg); box-shadow: none; scrollbar-width: thin; }
  .inhalt { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; min-width: 0; padding: 20px var(--gutter) 40px; }
  .inhalt > .workspace-side:not(.expanded) { display: contents; }
  .inhalt .overview { order: 1; }
  .inhalt #vorschlaege { order: 2; }
  .inhalt .map-card { order: 3; }
  .inhalt .profil-card { order: 4; }
  .inhalt #abschnitt-wetter { order: 5; }
  .inhalt #abschnitt-etappen { order: 6; }
  .inhalt .bereiche-zeile { order: 7; }
  .inhalt > :is(#export, section.hangar, section.orte) { order: 8; }
  .workspace-side:not(.expanded) .route-map, html[data-planstand="leer"]:not([data-bereiche]) .workspace-side:not(.expanded) .route-map { height: clamp(340px, 52vh, 620px); min-height: 340px; }
  /* R5 P6: Urteil, Abhilfe, Ergebnisleiste und Streckenband teilen sich das erste Bild mit der Karte.
     Nur die Karte schrumpft; längere Texte behalten ihren Platz (auch iPad quer und „Aa“ 1,3). */
  html:not([data-ansicht="briefing"]) .workspace-side:not(.expanded) .map-card:has(> .ergebnisleiste:not([hidden])) {
    display: flex; flex-direction: column; max-height: calc(100dvh - var(--toolbar-h) - 40px); }
  .workspace-side:not(.expanded) .map-card:has(> .ergebnisleiste:not([hidden])) > :not(.route-map) { flex-shrink: 0; }
  .workspace-side:not(.expanded) .map-card:has(> .ergebnisleiste:not([hidden])) > .route-map { flex: 1 1 auto; min-height: 220px; }
  html[data-ansicht="briefing"] .workspace > .planner { display: none; }
  /* Platz für die Flugzeugwahl vor dem Zeichnen (gegen Layoutsprung, #12): in der Seitenleiste zwei Kacheln je Reihe,
     Kachel 72 px (gemessen 11.11.2026: frei 72 px, edrh 151 px) */
  #ac-picker:empty { min-height: 72px; }
  /* Untertitel im Leerzustand: im Verein länger („Start in …“), in der schmalen Seitenleiste zwei Zeilen – Platz vorher
     reservieren (gemessen 11.11.2026: sonst rutschen alle Gruppen 23 px, CLS edrh 0,11) */
  html[data-planstand="leer"] .leer-unter { min-height: calc(2 * 1.45em); }
  html[data-flotte-reihen="2"] #ac-picker:empty { min-height: 151px; }
  html[data-flotte-reihen="3"] #ac-picker:empty { min-height: 230px; }
  /* Die Seitenleiste ist schmal wie ein Telefon: Nummer, Rolle und Entfernen in einer Zeile, das Feld darunter (wie ≤ 480 px) */
  .workspace > .planner .stop-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "nr rolle weg" "feld feld feld"; align-items: center; gap: 6px 8px; }
  .workspace > .planner .stop-head .stop-no { grid-area: nr; }
  .workspace > .planner .stop-head .stop-role { grid-area: rolle; }
  .workspace > .planner .stop-head .icon-btn { grid-area: weg; }
  .workspace > .planner .stop-head input[data-f="ad"] { grid-area: feld; width: 100%; }
  .workspace > .planner .stop .info, .workspace > .planner .stop-meta, .workspace > .planner .stop-times { margin-left: 0; }
  html[data-planstand="leer"] .workspace > .planner .stop-head { grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "nr rolle feld"; }
  html[data-ansicht="briefing"] .inhalt { padding: 0; }
  /* Briefing-Ansicht: eigene Aufteilung aus ausbildung.css (Karte und Profil nebeneinander), Folien in der Reihenfolge der Seite */
  html[data-ansicht="briefing"] .inhalt > .workspace-side:not(.expanded) { display: grid; }
  html[data-ansicht="briefing"] .inhalt :is(.overview, #vorschlaege, .map-card, .profil-card, #abschnitt-wetter, #abschnitt-etappen, .bereiche-zeile, #export) { order: 0; }
}
@media (min-width: 1200px) { .inhalt { padding-inline: 28px; } }
/* Seitenleiste ausgeblendet (iPad hoch, ui-rahmen.js): Ergebnis über die ganze Breite; im Leerzustand nie, und nur dort,
   wo es den Knopf zum Einblenden gibt (bis 1099 px) – sonst wären die Eingaben nach dem Drehen unerreichbar */
@media (min-width: 768px) and (max-width: 1099px) {
  html[data-seitenleiste="zu"]:not([data-planstand="leer"]) .workspace { grid-template-columns: minmax(0, 1fr); }
  html[data-seitenleiste="zu"]:not([data-planstand="leer"]) .workspace > .planner { display: none; }
}
/* Schmale Inhaltsspalte neben der Seitenleiste (iPad hoch, Fenster unter 1024 px: ~450–650 px): dieselben Umbrüche wie am
   Telefon. Bewusst Bildschirmbreite statt Container-Abfrage: ein Abfrage-Container wäre in älterem Safari der Bezugsrahmen
   der großen Karte (position: fixed in .workspace-side.expanded) */
@media (min-width: 768px) and (max-width: 1023px) {
  html:not([data-seitenleiste="zu"]) .mv-bars { grid-template-columns: minmax(0, 1fr); }
  html:not([data-seitenleiste="zu"]) .mv-head .mv-time { order: 5; flex-basis: 100%; }
  html:not([data-seitenleiste="zu"]) :is(.pf-inhalt.mit-wind, .profil.gross .pf-inhalt.mit-wind) { grid-template-columns: minmax(0, 1fr); }
  html:not([data-seitenleiste="zu"]) .pf-inhalt.mit-wind .pf-wind { grid-column: 1; grid-row: 2; grid-template-rows: auto 150px auto; }
  html:not([data-seitenleiste="zu"]) .profil.gross .pf-inhalt.mit-wind .pf-wind { grid-template-rows: auto 210px auto; }
  html:not([data-seitenleiste="zu"]) .pf-inhalt.mit-wind .pf-fuss { grid-row: 3; }
}
/* Seitenleiste (320–400 px): Startzeit und Reiseflughöhe untereinander, nichts abgeschnitten (Slop-Audit R3-1) */
@media (min-width: 768px) {
  .workspace > .planner #trip-basics { grid-template-columns: minmax(0, 1fr); }
  .workspace > .planner #trip-basics .basis-hoehe { max-width: 12rem; }
}
/* Toolbar schmal (iPad hoch): erscheint die Statuszeile, weicht ihr der Titel der Planung (beide passen nicht nebeneinander) */
@media (min-width: 768px) and (max-width: 1099px) { .site-head:has(.status-chip:not([hidden])) .kopf-titel { display: none; } }

/* R5-3b: Statuszeile am iPhone bleibt im Bild (die Grid-Spalte wuchs mit dem Text über den Rand); Text bricht um statt zu kürzen */
@media (max-width: 767px) {
  .mobil-leiste { grid-template-columns: minmax(0, 1fr); }
  .mobil-leiste .status-chip { height: auto; max-width: 100%; flex-wrap: wrap; row-gap: 0; }
  /* Bild von ci-01 (320 px, „Aa“ 1,3): „Start/Land-ung“ mitten im Wort getrennt. Der Text behält seine Wörter (min-content), reicht
     der Platz nicht, rückt „zur Übersicht“ in die nächste Zeile; getrennt wird ein Wort nur, wenn es allein nicht passt. */
  .mobil-leiste .status-chip .status-text { flex: 1 1 0; min-width: min-content; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; }
  .mobil-leiste .status-chip .status-ziel { flex: none; margin-left: auto; }
}
