/* Monteur-App «Baustellen» – gebaut fürs 13-Zoll-Tablet im Querformat,
   bedienbar auch auf dem Handy. Regeln: Touch-Ziele ≥ 48 px, zu jeder Geste
   ein Knopf, eine Hauptaufgabe je Bildschirm (MonteureApp STAG/CLAUDE.md §2). */

:root {
  --grund: #F3F4F6;
  --flaeche: #FFFFFF;
  --text: #15191E;
  --leise: #5B6470;
  --linie: #DDE1E6;
  --linie-fein: #F1F2F4;
  --akzent: #1F5FA8;
  --akzent-hell: #E8EEF7;
  --gut: #0E7A3E;
  --gut-hell: #E7F6EC;
  --warn: #B45309;
  --warn-hell: #FFF4E5;
  --rot: #B42318;
  --rot-hell: #FDECEA;
  --heute: #DC2626;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--grund);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--akzent); outline-offset: 2px;
}
a { color: var(--akzent); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { min-height: 100%; display: flex; flex-direction: column; }

/* Kopf */
.kopf {
  position: sticky; top: 0; z-index: 30;
  min-height: 64px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--flaeche); border-bottom: 1px solid var(--linie);
  display: flex; align-items: center; gap: 14px;
}
.kopf-titel { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kopf-titel strong { font-size: 18px; }
.kopf-titel .unter { font-size: 13px; color: var(--leise); }
.kopf-titel .zeilen { display: flex; flex-direction: column; min-width: 0; }
.kopf-titel .zeilen strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: var(--akzent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.kopf-luft { flex: 1; }
.netz { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--gut); white-space: nowrap; }
.netz::before { content: ""; width: 10px; height: 10px; border-radius: 5px; background: currentColor; }
.netz.aus { color: var(--warn); }

.knopf-icon {
  width: 48px; height: 48px; border: 1px solid var(--linie); background: var(--flaeche);
  border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none;
}
.knopf {
  min-height: 48px; padding: 0 18px; border: 1px solid var(--linie); background: var(--flaeche);
  border-radius: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; color: var(--text);
}
.knopf.haupt-knopf { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.warn-knopf { background: var(--warn); border-color: var(--warn); color: #fff; }
.knopf[disabled] { background: #E5E7EB; border-color: #E5E7EB; color: #6B7280; cursor: default; }
.knopf.klein { min-height: 40px; padding: 0 14px; font-size: 14px; }

.haupt { flex: 1; display: flex; min-height: 0; }
.laden, .leer { margin: auto; padding: 40px; color: var(--leise); text-align: center; max-width: 560px; }
.leer h2 { color: var(--text); margin: 0 0 8px; }

/* Startseite */
.start { flex: 1; padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; }
.start h1 { margin: 0; font-size: 28px; }
.start .unterzeile { color: var(--leise); margin: 4px 0 0; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.projekt-kachel {
  text-align: left; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 16px;
  padding: 20px; display: flex; flex-direction: column; gap: 10px; min-height: 190px;
}
.projekt-kachel.meins { box-shadow: 0 0 0 2px var(--akzent); }
.projekt-kachel .oben { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.projekt-kachel .nr { font-weight: 700; color: var(--leise); font-size: 14px; }
.projekt-kachel .name { font-size: 20px; font-weight: 700; line-height: 1.25; }
.projekt-kachel .pl { font-size: 14px; color: var(--leise); }
.projekt-kachel .naechst { margin-top: auto; border-top: 1px solid var(--linie-fein); padding-top: 10px; font-size: 14px; }
.marke { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: #F3F4F6; color: #3F4650; }
.marke.ausfuehrung { background: var(--gut-hell); color: var(--gut); }
.marke.termine_bestaetigt { background: var(--akzent-hell); color: #174A84; }
.marke.nachkontrolle { background: #F3E8FF; color: #6B21A8; }
.marke.antrag { background: var(--warn-hell); color: var(--warn); }
.marke.du { background: var(--akzent); color: #fff; }
.marke.fremd { background: #F3F4F6; color: var(--leise); }

/* Projekt: Navigation links, Inhalt rechts */
.projekt { flex: 1; display: flex; min-height: 0; min-width: 0; }
.start { min-width: 0; }
.leiste {
  width: 96px; flex: none; background: var(--flaeche); border-right: 1px solid var(--linie);
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0;
}
.leiste button {
  width: 80px; min-height: 64px; border: none; border-radius: 12px; background: transparent; color: #3F4650;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 600;
}
.leiste button[aria-current="page"] { background: var(--akzent-hell); color: var(--akzent); }
.leiste .bald { opacity: 0.45; }
.leiste hr { width: 56px; border: 0; border-top: 1px solid var(--linie-fein); margin: 6px 0; }
.inhalt { flex: 1; min-width: 0; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.inhalt h2 { margin: 0; font-size: 20px; }
.zeile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.luft { flex: 1; }

.raster-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.spalte { display: flex; flex-direction: column; gap: 16px; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.ueberschrift { font-size: 12px; font-weight: 700; color: var(--leise); letter-spacing: 0.05em; text-transform: uppercase; }
.adresse { font-size: 22px; font-weight: 700; }
.angaben { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 15px; }
.angaben dt { color: var(--leise); }
.angaben dd { margin: 0; }
.liste-termine { display: flex; flex-direction: column; }
.liste-termine button {
  display: flex; align-items: center; gap: 12px; min-height: 52px; border: 0; border-top: 1px solid var(--linie-fein);
  background: none; text-align: left; padding: 6px 0;
}
.liste-termine .farbe { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.liste-termine .was { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.liste-termine .was span:last-child { font-size: 13px; color: var(--leise); }
.liste-termine .wann { font-size: 14px; font-weight: 600; white-space: nowrap; }
.hinweis { font-size: 14px; color: var(--leise); }

/* Terminplan */
.plan-werkzeug { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.schalter[aria-pressed="true"] { border: 2px solid var(--akzent); background: var(--akzent-hell); }
.antrag-band {
  background: var(--warn-hell); border: 1px solid #F3C58A; border-radius: 12px; padding: 10px 12px 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.antrag-band .text { flex: 1; min-width: 240px; font-size: 14px; }
.plan {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  overflow: auto; position: relative; max-height: calc(100vh - 220px);
}
.plan-gitter { display: grid; position: relative; }
.plan .ecke, .plan .bez {
  position: sticky; left: 0; z-index: 4; background: var(--flaeche); border-right: 1px solid var(--linie);
}
.plan .ecke { top: 0; z-index: 6; border-bottom: 1px solid var(--linie); display: flex; align-items: flex-end; padding: 0 14px 8px; font-size: 12px; font-weight: 700; color: var(--leise); }
.plan .kopf-tage { position: sticky; top: 0; z-index: 5; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.plan .woche { position: absolute; top: 0; height: 22px; border-left: 1px solid #C9CED6; padding: 4px 6px; font-size: 11px; font-weight: 700; color: var(--leise); white-space: nowrap; overflow: hidden; }
.plan .tag { position: absolute; top: 22px; height: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; line-height: 1.1; border-left: 1px solid var(--linie-fein); }
.plan .tag.wochenanfang { border-left-color: #C9CED6; }
.plan .tag b { font-size: 11px; }
.plan .tag.frei { color: #9AA1AB; }
.plan .tag.heute { color: var(--heute); font-weight: 700; }
.plan .bez {
  height: 44px; border-bottom: 1px solid var(--linie-fein); border-top: 0; border-left: 0;
  padding: 0 12px; display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
}
.plan .bez.gewaehlt { background: #EEF4FB; }
.plan .bez .farbe { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.plan .bez .was { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.plan .bez .was span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan .bez .was span:first-child { font-size: 13px; font-weight: 600; }
.plan .bez .was span:last-child { font-size: 11px; color: var(--leise); }
.plan .spur { position: relative; height: 44px; border-bottom: 1px solid var(--linie-fein); }
.plan .grund { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--linie-fein); pointer-events: none; }
.plan .grund.wochenanfang { border-left-color: #C9CED6; }
.plan .grund.frei { background: repeating-linear-gradient(45deg, #E5E7EB 0 4px, #F6F7F8 4px 8px); }
.plan .grund.heute { background: #FEF2F2; }
.plan .heute-linie { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--heute); z-index: 2; pointer-events: none; }
.plan .balken {
  position: absolute; top: 9px; height: 26px; border-radius: 6px; border: 2px solid; padding: 0; z-index: 3;
  min-width: 8px;
}
.plan .balken.gewaehlt { box-shadow: 0 0 0 3px var(--text); }
.plan .balken.provisorisch { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.35) 0 5px, transparent 5px 10px); }
.legende { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--leise); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 22px; height: 12px; border-radius: 3px; border: 2px solid var(--akzent); display: inline-block; }

/* Beteiligte */
.person-karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px; padding: 12px 12px 12px 16px; display: flex; align-items: center; gap: 12px; }
.person-karte .was { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.person-karte .rolle { font-size: 11px; font-weight: 700; color: var(--leise); letter-spacing: 0.05em; text-transform: uppercase; }
.person-karte .name { font-size: 16px; font-weight: 700; }
.person-karte .zusatz { font-size: 13px; color: var(--leise); }
.person-karte .quelle { font-size: 11px; color: var(--leise); background: #F3F4F6; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.person-karte .knopf-icon.tel { color: var(--gut); }
.person-karte .knopf-icon.mail { color: var(--akzent); }

/* Blatt unten */
.blatt-hintergrund { position: fixed; inset: 0; z-index: 40; background: rgba(17, 24, 39, .35); display: flex; align-items: flex-end; justify-content: center; }
.blatt {
  width: min(100%, 1100px); max-height: 85vh; overflow: auto; background: var(--flaeche);
  border-radius: 20px 20px 0 0; padding: 20px 22px; padding-bottom: max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 -8px 32px rgba(17, 24, 39, .2);
}
.blatt .kopfzeile { display: flex; gap: 14px; align-items: flex-start; }
.blatt .kopfzeile .farbe { width: 14px; height: 14px; border-radius: 4px; margin-top: 6px; flex: none; }
.blatt h3 { margin: 0; font-size: 20px; }
.blatt .abschnitt { border-top: 1px solid var(--linie-fein); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid #C9CED6; background: var(--flaeche); font-weight: 600; font-size: 14px; }
.chip[aria-pressed="true"] { border: 2px solid var(--akzent); background: var(--akzent-hell); }
.datum-wahl { display: flex; align-items: center; gap: 10px; }
.datum-wahl output { min-width: 150px; text-align: center; font-size: 17px; font-weight: 700; }
textarea { width: 100%; min-height: 80px; border: 1px solid #C9CED6; border-radius: 12px; padding: 10px 12px; font: inherit; resize: vertical; }
.fehler { color: var(--rot); font-weight: 600; font-size: 14px; }
.status-zeile { font-size: 14px; padding: 10px 12px; border-radius: 10px; background: var(--warn-hell); }
.status-zeile.umgesetzt { background: var(--gut-hell); }
.status-zeile.abgelehnt { background: var(--rot-hell); }

.meldung {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: #fff; border-radius: 14px; padding: 12px 18px; max-width: min(90vw, 760px);
  font-size: 15px; box-shadow: 0 12px 28px rgba(17, 24, 39, .3);
}

/* Handy und schmale Tablets im Hochformat */
@media (max-width: 760px) {
  .start { padding: 20px 16px; }
  .projekt { flex-direction: column; }
  .leiste {
    order: 2; width: 100%; flex-direction: row; justify-content: space-around; position: sticky; bottom: 0;
    border-right: 0; border-top: 1px solid var(--linie); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); z-index: 20;
  }
  .leiste hr, .leiste .bald { display: none; }
  .leiste button { width: auto; flex: 1; min-height: 56px; }
  .inhalt { padding: 16px; }
  .raster-2 { grid-template-columns: minmax(0, 1fr); }
  .plan { max-height: none; }
  .netz span { display: none; }
  .person-karte .quelle { display: none; }
}
