/* Cockpit 6b — v5.0 (10.09.2026): schlanke Stundenseite (public/v5.js). Lädt nach v4.css.
   iPad quer (1180 × 820): Kopf in einer Zeile · Vorher-Leiste · links Phasen + Reserve + Rückmeldung · rechts Phasenkarte — ohne Scrollen.
   Handy: Liste → Phase als Vollbild. Hell/Dunkel über die v3-Farben; die Mini-Tafel bleibt in beiden Modi dunkelgrün. */
:root { --v5-tool: rgba(60, 60, 67, .09); --v5-toolink: #3a3a3c; --v5-prep: #fff7e6; --v5-prepline: #f1dfb6; --v5-prepink: #9a6400; --v5-res: #8e8e93; }
@media (prefers-color-scheme: dark) {
  :root { --v5-tool: rgba(235, 235, 245, .12); --v5-toolink: #e5e5ea; --v5-prep: #2a2416; --v5-prepline: #4a3d1e; --v5-prepink: #ffc45c; --v5-res: #7c7c84; }
}

.v3page.v5stunde { display: flex; flex-direction: column; gap: 12px; min-height: 100%; box-sizing: border-box; padding: 14px 20px 18px; max-width: 1400px; }

/* ---- Kopf: eine Zeile ---- */
.v5head { display: flex; align-items: center; gap: 12px; min-height: 44px; min-width: 0; position: relative; }
.v5head .v3back { margin: 0; min-height: 40px; font-size: 15px; flex: none; white-space: nowrap; }
.v5tit { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.v5dot { width: 12px; height: 12px; border-radius: 50%; background: var(--fc); flex: none; }
.v5title { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 0; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v5tools.v3hdr-actions { display: flex; gap: 6px; flex: none; flex-wrap: nowrap; align-items: center; position: relative; }
.v3btn.v5tool { min-height: 34px; padding: 0 11px; border-radius: 8px; background: var(--v5-tool); color: var(--v5-toolink); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; border: 0; }
.v3btn.v5tool:hover, .v3btn.v5tool.on { background: color-mix(in srgb, var(--v5-toolink) 16%, transparent); }
.v3btn.v5tool.v4doku { color: #2e9e63; }
.v3btn.v5tool.v4erg { color: #4a86d0; }

/* Popover (Material · Rückmeldungen) */
.v5pop { position: absolute; z-index: 50; background: var(--v3-card); border-radius: 14px; box-shadow: 0 10px 34px rgba(0,0,0,.2), 0 0 0 1px var(--v3-line); padding: 8px 6px 6px; max-height: min(60vh, 460px); overflow-y: auto; }
.v5pophd { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 8px 6px; font-size: 13px; color: var(--v3-ink2); }
.v5popx { border: 0; background: var(--v5-tool); color: var(--v3-ink2); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 12px; }
.v5matpop { top: calc(100% + 6px); right: 0; width: min(420px, 86vw); }
.v5matrow { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--v3-ink); min-height: 44px; box-sizing: border-box; }
.v5matrow:hover { background: var(--v3-card2); }
.v5matsym { flex: none; width: 22px; text-align: center; font-size: 16px; line-height: 1.4; }
.v5mattxt { min-width: 0; display: flex; flex-direction: column; }
.v5mattxt b { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.v5mattxt small { font-size: 12px; color: var(--v3-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Vorher-Leiste ---- */
.v5prep { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--v5-prep); border: 1px solid var(--v5-prepline); border-radius: 12px; padding: 7px 10px; }
.v5preplbl { font-size: 11px; font-weight: 700; letter-spacing: .07em; color: var(--v5-prepink); margin-right: 2px; }
.v5pc { display: inline-flex; align-items: center; gap: 8px; background: var(--v3-card); border: 1px solid var(--v5-prepline); border-radius: 9px; padding: 4px 10px; min-height: 32px; box-sizing: border-box; font-size: 14px; cursor: pointer; user-select: none; -webkit-user-select: none; max-width: 100%; }
.v5pc .v5box { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--v3-ink3); display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex: none; box-sizing: border-box; }
.v5pc.done .v5box { background: var(--v3-ok); border-color: var(--v3-ok); }
.v5pc.done .v5pct { color: var(--v3-ink3); text-decoration: line-through; }
.v5pct { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v5pcl { color: var(--v3-accent); text-decoration: none; font-weight: 700; padding: 2px 2px 2px 4px; margin-right: -4px; }
.v5pc:focus-visible { outline: 2px solid var(--v3-accent); }

/* ---- Körper: links Liste, rechts Karte ---- */
.v5body { flex: 1 1 auto; display: flex; gap: 16px; min-height: 0; align-items: stretch; }
.v5left { width: 270px; flex: none; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.v5list { display: flex; flex-direction: column; gap: 8px; }
.v5spacer { flex: 1 1 0; min-height: 4px; }
.v5mark { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--v3-ink3); padding: 4px 12px; border-top: 1px dashed var(--v3-line2); border-bottom: 1px dashed var(--v3-line2); font-variant-numeric: tabular-nums; }
.v5ph { display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box; background: var(--v3-card); color: var(--v3-ink); border: 2px solid transparent; border-radius: 14px; padding: 9px 14px 9px 12px; min-height: 58px; font: inherit; text-align: left; cursor: pointer; box-shadow: 0 1px 2px rgba(20,20,40,.05); }
.v5ph.on { border-color: var(--fc); }
.v5ph:focus-visible { outline: 2px solid var(--v3-accent); outline-offset: 1px; }
.v5num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--bc, #8e8e93); color: #fff; font-weight: 700; font-size: 15px; flex: none; }
.v5ph .t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.v5ph .t b { font-size: 16.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v5ph .t small { font-size: 12.5px; color: var(--v3-ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.v5ph .d { font-size: 15px; font-weight: 600; color: var(--v3-ink2); flex: none; font-variant-numeric: tabular-nums; }
.v5ph.res { background: transparent; border: 2px dashed var(--v3-line2); box-shadow: none; }
.v5ph.res.on { border-style: solid; border-color: var(--v5-res); background: var(--v3-card); }
.v5ph.res .v5num { background: var(--v5-res); }
.v5leer { color: var(--v3-ink3); font-size: 15px; padding: 18px 4px; }
.v5leer.klein { font-size: 13.5px; padding: 8px 4px; }

/* Rückmeldung kompakt + Gehalten */
.v5fb { position: relative; background: var(--v3-card); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 1px 2px rgba(20,20,40,.05); }
.v5fbrow { display: flex; gap: 8px; align-items: stretch; }
.v5fbin { flex: 1 1 auto; min-width: 0; position: relative; display: flex; }
.v5fbta { flex: 1; width: 100%; box-sizing: border-box; border: 0; background: var(--v3-card2); color: var(--v3-ink); border-radius: 9px; padding: 12px 10px 8px 10px; font: inherit; font-size: 16px; line-height: 1.3; resize: none; height: 46px; min-height: 46px; }
.v5fbta:focus { outline: 2px solid color-mix(in srgb, var(--v3-accent) 55%, transparent); }
.v5fbsend { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--v3-accent); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .15s; }
.v5fbsend.an { opacity: 1; pointer-events: auto; }
.v5fbin.an .v5fbta { padding-right: 38px; }
.v5held { flex: none; min-width: 106px; border: 0; border-radius: 9px; background: var(--v3-accent); color: #fff; font: inherit; font-size: 14px; padding: 0 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.15; }
.v5held b { font-weight: 700; }
.v5held.on { background: color-mix(in srgb, var(--v3-ok) 15%, var(--v3-card)); color: var(--v3-ok); }
.v5held small { font-size: 11px; font-weight: 600; opacity: .85; }
.v5fbn { align-self: flex-start; border: 0; background: none; color: var(--v3-ink3); font: inherit; font-size: 12.5px; font-weight: 600; padding: 2px 4px 0; cursor: pointer; min-height: 22px; }
.v5fbpop { left: 0; bottom: calc(100% + 8px); width: min(420px, 86vw); }
.v5fbe { padding: 8px 10px; border-top: 1px solid var(--v3-line); font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.v5fbe .ts { display: block; font-size: 11.5px; color: var(--v3-ink3); font-weight: 600; margin-bottom: 2px; }

/* ---- Phasenkarte ---- */
.v5card { flex: 1 1 auto; min-width: 0; background: var(--v3-card); border-radius: 18px; box-shadow: var(--v3-shadow); border-top: 5px solid var(--fc); padding: 18px 20px 18px; display: flex; flex-direction: column; gap: 14px; box-sizing: border-box; container-type: inline-size; }
.v5ptop { display: none; }
.v5ch { display: flex; align-items: center; gap: 8px; min-width: 0; }
.v5ch h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.v5chip { flex: none; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 8px; background: var(--v5-tool); color: var(--v5-toolink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.v5chip.form { color: var(--bc); background: color-mix(in srgb, var(--bc) 13%, var(--v3-card)); }
.v5auftrag { font-size: 23px; font-weight: 700; line-height: 1.3; background: color-mix(in srgb, var(--fc) 10%, var(--v3-card)); color: var(--v3-ink); border-radius: 12px; padding: 12px 16px; overflow-wrap: anywhere; }
.v5auftrag.soft { font-size: 18px; font-weight: 600; line-height: 1.4; }
.v5grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 16px; align-items: start; min-width: 0; }
.v5grid.ohne, .v5grid.nurtafel { grid-template-columns: minmax(0, 1fr); }
.v5links { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.v5rechts { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.v5rows { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 8px 10px; font-size: 17px; line-height: 1.35; }
.v5k { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--v3-ink3); padding-top: 4px; overflow-wrap: anywhere; }
.v5v { min-width: 0; overflow-wrap: anywhere; }
.v5v b, .v5auftrag b { font-weight: 800; }
a.v5a { color: var(--v3-accent); text-decoration: none; font-weight: 600; }
a.v5a:hover { text-decoration: underline; }
.v5ext { font-size: .8em; margin-left: 2px; }
.v5loes { align-self: flex-start; background: var(--v3-card2); border-radius: 12px; padding: 9px 14px 10px; }
.v5loes .v5k { padding: 0 0 4px; }
.v5loesg { display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--r, 5), auto); grid-template-columns: repeat(2, max-content); gap: 3px 26px; font-size: 15px; font-variant-numeric: tabular-nums; }
.v5l span { color: var(--v3-ink3); display: inline-block; min-width: 1.6em; }
.v5tafel { background: var(--v3-tafel); color: var(--v3-tafelink); border-radius: 12px; padding: 11px 16px 12px; font-size: 14.5px; line-height: 1.4; min-width: 200px; max-width: 270px; box-sizing: border-box; }
.v5tafel > div { padding-left: 0; }
.v5grid.nurtafel .v5tafel { max-width: 460px; }
.v5tzone { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--v3-tafelhead); margin-bottom: 4px; }
.v5tz.kopf { font-weight: 700; font-size: 17px; }
.v5tz.rot { color: #ff8a80; font-weight: 700; }
.v5tz.gelb { color: #ffd966; }
.v5tz.leer { height: 6px; }
hr.v5tz.strich { border: 0; border-top: 1px solid #4a6357; margin: 6px 0; }
.v5tt { border-collapse: collapse; margin: 2px 0; }
.v5tt td { padding: 1px 12px 1px 0; vertical-align: top; }
.v5tt td:last-child { font-weight: 700; padding-right: 0; }
.v5end { margin-top: auto; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; font-size: 15px; color: var(--v3-ink2); border-top: 1px solid var(--v3-line); padding-top: 12px; }
.v5end b { color: var(--v3-ink); }
/* schmale Karte (iPad hoch): Tafel unter die Zeilen */
@container (max-width: 520px) {
  .v5grid { grid-template-columns: minmax(0, 1fr); }
  .v5tafel { max-width: none; }
  .v5auftrag { font-size: 21px; }
}

/* ---- iPad hoch / kleine Tablets ---- */
@media (min-width: 744px) and (max-width: 1024px) {
  .v3page.v5stunde { padding: 14px 18px 18px; }
  .v5left { width: 250px; }
  .v5body { gap: 14px; }
  .v5title { font-size: 22px; }
  .v3btn.v5tool { padding: 0 9px; }
}

/* ---- Handy: Liste → Phase als Vollbild ---- */
@media (max-width: 743px) {
  .v3page.v5stunde { padding: calc(10px + env(safe-area-inset-top)) 16px calc(86px + env(safe-area-inset-bottom)); gap: 12px; }
  .v5head { flex-wrap: wrap; gap: 6px 10px; }
  .v5head .v3back { order: 0; }
  .v5tools.v3hdr-actions { order: 1; flex: 1 1 0; min-width: 0; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
  .v5tit { order: 3; flex: 1 1 100%; gap: 10px; }
  .v5title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 23px; }
  .v5tools.v3hdr-actions { gap: 5px; }
  .v3btn.v5tool { padding: 0 8px; font-size: 12.5px; }
  .v5matpop { right: 0; }
  .v5pct { white-space: normal; }
  .v5body { flex-direction: column; gap: 12px; }
  .v5left { width: 100%; }
  .v5spacer { display: none; }
  .v5stunde:not(.detail) .v5card { display: none; }
  .v5stunde.detail .v5head, .v5stunde.detail .v5prep, .v5stunde.detail .v5left { display: none; }
  .v5fbpop { width: 100%; box-sizing: border-box; }
  /* Vollbild */
  .v5stunde.detail .v5card { position: fixed; inset: 0; z-index: 60; border-radius: 0; border-top: 0; box-shadow: none; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: calc(6px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom)); gap: 12px; background: var(--v3-card); }
  .v5stunde.detail .v5card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(4px + env(safe-area-inset-top)); background: var(--fc); }
  .v5ptop { display: flex; align-items: center; gap: 6px; min-height: 44px; margin-bottom: -2px; }
  .v5pback { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; color: var(--v3-accent); font: inherit; font-weight: 600; font-size: 16px; padding: 0; margin: 0 auto 0 -4px; min-height: 44px; cursor: pointer; }
  .v5pback svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  .v5pcount { font-size: 13px; font-weight: 600; color: var(--v3-ink3); margin-right: 4px; font-variant-numeric: tabular-nums; }
  .v5pnavb { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--v5-tool); color: var(--v3-ink); font-size: 22px; line-height: 1; cursor: pointer; }
  .v5pnavb:disabled { opacity: .3; cursor: default; }
  .v5ch h2 { font-size: 24px; }
  .v5chip { font-size: 12.5px; padding: 4px 8px; }
  .v5auftrag { font-size: 20px; padding: 10px 14px; }
  .v5auftrag.soft { font-size: 16.5px; }
  .v5grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .v5links { gap: 12px; }
  .v5rows { font-size: 16px; grid-template-columns: 68px minmax(0, 1fr); gap: 6px 10px; }
  .v5loesg { font-size: 14.5px; gap: 2px 22px; }
  .v5tafel { max-width: none; min-width: 0; font-size: 14.5px; line-height: 1.38; padding: 10px 14px; }
  .v5tz.kopf { font-size: 16px; }
  .v5end { font-size: 14px; margin-top: 0; }
  body.v4phase-open .v3tabbar, body.v4phase-open .v3side { display: none; }
}

/* ---- Editor (v5-Stunden) ---- */
.v5ed .v5edgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 0 10px; }
.v5ed .ed-row-top { flex-wrap: wrap; }
.v5ed .ed-row-top input:not(.mini) { flex: 1 1 160px; min-width: 0; }
.v5ed select.mini { flex: 0 0 64px; }
.v5edbeob { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--v3-ink2); white-space: nowrap; }
.v5edbeob input { width: auto; }
.v5edtag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--v3-ink3); padding: 0 4px; }
.v5ed-marker { background: transparent; border: 1px dashed var(--v3-line2); }
.v5edtafel { display: flex; gap: 6px; align-items: flex-start; }
.v5edtafel select { flex: 0 0 150px; }
.v5edtafel textarea { flex: 1 1 auto; min-width: 0; background: var(--v3-tafel) !important; color: var(--v3-tafelink) !important; }
.v5edadd { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 743px) {
  .v5ed .v5edgrid { grid-template-columns: minmax(0, 1fr); }
  .v5edtafel { flex-direction: column; align-items: stretch; }
  .v5edtafel select { flex: none; }
}
@media (prefers-color-scheme: dark) {
  .v5tafel { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); }
}
