/* Schrift selbst ausgeliefert: kein Abruf bei Google (DSGVO). IBM Plex Sans, SIL Open Font License. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap;
  src: url("schrift/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap;
  src: url("schrift/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap;
  src: url("schrift/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  --papier: #f4f6f6;      /* Hintergrund, kühles Grau wie Zeichenpapier */
  --flaeche: #ffffff;
  --tinte: #16232b;       /* Text */
  --gedaempft: #56656d;   /* Nebentext */
  --linie: #d3dbde;       /* Trennlinien, Leitungen im Schema */
  --leitung: #2443c4;     /* Hauptfarbe: Aktionen, Leitungen unter Strom */
  --sonne: #e2a000;       /* nur für PV und „Simulation läuft“ */
  --fehler: #b42318;
}

html, body { background: var(--papier); color: var(--tinte); }
body { margin: 0; font-family: "IBM Plex Sans", system-ui, sans-serif; font-feature-settings: "tnum"; }
a { color: var(--leitung); }
:focus-visible { outline: 2px solid var(--leitung); outline-offset: 2px; }

/* --- Anmelden --------------------------------------------------------------------------- */
.anmelden {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}
.anmelden-schema {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 56px; border-right: 1px solid var(--linie);
}
.anmelden-schema h1 { font-size: 2.1rem; font-weight: 600; line-height: 1.15; margin: 0; max-width: 18ch; }
.anmelden-schema p { color: var(--gedaempft); max-width: 46ch; line-height: 1.55; margin: 12px 0 0; }
.anmelden-schema img { width: 100%; max-width: 560px; height: auto; margin: 32px 0; }
.anmelden-formular { display: flex; align-items: center; justify-content: center; padding: 48px 24px;
  background: var(--flaeche); }
.anmelden-formular .formular { width: 100%; max-width: 340px; }
.anmelden-formular h2 { font-size: 1.35rem; font-weight: 600; margin: 0 0 4px; }
.anmelden-formular .hinweis { color: var(--gedaempft); margin: 0 0 24px; }
.marke { font-weight: 600; letter-spacing: 0.01em; }


/* --- Übersicht -------------------------------------------------------------------------- */
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 32px; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.kopf .firma { color: var(--gedaempft); margin-left: 12px; }
.kopf .nutzer { color: var(--gedaempft); display: flex; gap: 16px; align-items: center; }
.inhalt { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px;
  max-width: 1200px; margin: 0 auto; padding: 32px; }
.abschnitt-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 12px; }
.abschnitt-kopf h2 { font-size: 1.25rem; font-weight: 600; margin: 0; }
.abschnitt-kopf .anzahl { color: var(--gedaempft); font-weight: 400; margin-left: 8px; }

.projekte { width: 100%; border-collapse: collapse; background: var(--flaeche);
  border: 1px solid var(--linie); }
.projekte th { text-align: left; font-weight: 500; color: var(--gedaempft); font-size: 0.875rem;
  padding: 10px 14px; border-bottom: 1px solid var(--linie); }
.projekte td { padding: 12px 14px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.projekte tr:last-child td { border-bottom: 0; }
.projekte .name { font-weight: 500; }
.projekte .klein { color: var(--gedaempft); font-size: 0.875rem; }
.leer { background: var(--flaeche); border: 1px dashed var(--linie); padding: 32px; color: var(--gedaempft); }
.leer strong { color: var(--tinte); display: block; margin-bottom: 4px; font-weight: 500; }

.status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gedaempft); }
.status-daten_vollstaendig::before, .status-ergebnis_liegt_vor::before { background: var(--leitung); }
.status-simulation_laeuft::before { background: var(--sonne); }
.status-fehler::before { background: var(--fehler); }
.status-archiviert { color: var(--gedaempft); }

.vorlagen { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--linie); }
.vorlagen li { padding: 14px 0; border-bottom: 1px solid var(--linie); }
.vorlagen .name { font-weight: 500; }
.vorlagen .klein { color: var(--gedaempft); font-size: 0.875rem; margin-top: 2px; }

/* --- Projektseite ---------------------------------------------------------------------- */
.projekte a.name { color: var(--tinte); text-decoration: none; }
.projekte a.name:hover { color: var(--leitung); text-decoration: underline; }
.projekt { max-width: 1240px; margin: 0 auto; padding: 24px 32px 48px; }
.projekt-kopf { margin-bottom: 20px; }
.projekt-kopf h1 { font-size: 1.6rem; font-weight: 600; margin: 6px 0 6px; line-height: 1.2; }
.projekt-meta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.zurueck { color: var(--gedaempft); text-decoration: none; font-size: 0.875rem; }
.zurueck:hover { color: var(--leitung); }
.klein { color: var(--gedaempft); font-size: 0.875rem; }

.system { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.system-schema { background: var(--flaeche); border: 1px solid var(--linie); min-width: 0; overflow: hidden;
  /* Rasterpunkte wie auf Zeichenpapier: das Schema ist eine technische Zeichnung */
  background-image: radial-gradient(var(--linie) 1px, transparent 1px); background-size: 18px 18px; }
.legende { display: flex; gap: 20px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--linie);
  background: var(--flaeche); font-size: 0.8125rem; color: var(--gedaempft); }
.legende span { display: inline-flex; align-items: center; gap: 8px; }
.legende span::before { content: ""; width: 18px; height: 12px; border-radius: 3px; border: 2px solid; }
.legende-fehler::before { border-color: var(--fehler) !important; }
.legende-inaktiv::before { border-style: dashed !important; border-color: var(--gedaempft) !important; }
.legende-fluss::before { height: 0 !important; border-width: 1.5px 0 0 0 !important; border-color: var(--leitung) !important;
  border-radius: 0 !important; }
.offen { padding: 12px 16px; border-top: 1px solid var(--linie); background: var(--flaeche); font-size: 0.875rem; }
.offen strong { font-weight: 500; color: var(--fehler); }
.offen ul { margin: 6px 0 0; padding-left: 18px; }
.offen li { margin: 2px 0; }
.offen .name { font-weight: 500; }
.offen-gut { color: var(--gedaempft); }

.panel { background: var(--flaeche); border: 1px solid var(--linie); padding: 18px 18px 20px; position: sticky; top: 16px; }
.panel h3 { font-size: 1.125rem; font-weight: 600; margin: 4px 0 4px; }
.panel .klein { margin: 0 0 4px; line-height: 1.45; }
.textknopf { background: none; border: 0; padding: 0; color: var(--gedaempft); font: inherit; font-size: 0.8125rem;
  cursor: pointer; }
.textknopf:hover { color: var(--leitung); }
.einheit { color: var(--gedaempft); font-size: 0.8125rem; }
.panel-fehler { margin: 10px 0 0; padding: 8px 10px 8px 26px; background: #fdf1f0; color: var(--fehler);
  font-size: 0.875rem; border-left: 3px solid var(--fehler); }
.panel-daten { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--linie); border-left: 3px solid var(--leitung); }
.panel-daten .name { font-weight: 500; font-size: 0.875rem; }

.projekt-uebersicht { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.projekt-uebersicht h3 { font-size: 1.125rem; font-weight: 600; margin: 0 0 10px; }
.werte { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--linie); }
.werte th { text-align: left; font-weight: 400; color: var(--gedaempft); padding: 10px 14px; width: 45%;
  border-bottom: 1px solid var(--linie); }
.werte td { padding: 10px 14px; border-bottom: 1px solid var(--linie); }
.werte tr:last-child th, .werte tr:last-child td { border-bottom: 0; }


/* --- Bausteine für Daten, Prüfung, Ergebnisse (M9) --------------------------------------- */
.abschnitt { background: var(--flaeche); border: 1px solid var(--linie); padding: 18px 20px; }
.abschnitt + .abschnitt { margin-top: 16px; }
.abschnitt h3, .figur h3, .rolle h3 { font-size: 1.0625rem; font-weight: 600; margin: 0 0 4px; }
.figur-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.figur-kopf .klein { margin: 0; max-width: 70ch; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tabelle th { text-align: left; font-weight: 500; color: var(--gedaempft); padding: 8px 10px; border-bottom: 1px solid var(--linie);
  white-space: nowrap; }
.tabelle td { padding: 8px 10px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle .name { font-weight: 500; }
.tabelle .aktionen { text-align: right; white-space: nowrap; }
.tabelle .aktionen .textknopf + .textknopf { margin-left: 14px; }
.tabelle-rahmen { overflow-x: auto; }
.textknopf-gefahr:hover { color: var(--fehler); }
.werte-eng th, .werte-eng td { padding: 7px 12px; font-size: 0.875rem; }
.werte-eng th { width: 34%; }
.hinweis-box { border-left: 3px solid var(--leitung); background: var(--flaeche); padding: 10px 14px; margin-bottom: 16px;
  font-size: 0.875rem; }
.hinweis-box ul, .liste-hinweise { margin: 6px 0 0; padding-left: 18px; }
.lauf-fehler { margin-top: 10px; padding: 10px 12px; background: #fdf1f0; color: var(--fehler); border-left: 3px solid var(--fehler);
  font-size: 0.875rem; }
.knopf-zweit { height: 36px; padding: 0 16px; border: 1px solid var(--leitung); border-radius: 4px; background: var(--flaeche);
  color: var(--leitung); font: 500 0.875rem/1 "IBM Plex Sans", system-ui, sans-serif; cursor: pointer; }
.knopf-zweit:hover { background: #eef1fd; }
.knopf-zweit:disabled { border-color: var(--linie); color: var(--gedaempft); cursor: not-allowed; background: var(--papier); }
.hochladen { display: inline-block; }

/* Daten */
.rollen { display: grid; gap: 16px; margin-bottom: 24px; }
.rolle { background: var(--flaeche); border: 1px solid var(--linie); border-left: 3px solid var(--leitung); padding: 16px 20px; }
.rolle-fehlt { border-left-color: var(--fehler); }
.rolle-kopf { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.rolle-kopf .klein { margin: 0 0 10px; }
.marke-belegt, .marke-fehlt { font-size: 0.8125rem; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.marke-belegt { background: #eef1fd; color: var(--leitung); }
.marke-fehlt { background: #fdf1f0; color: var(--fehler); }
.rolle-inhalt { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
.rolle-optionen { display: grid; gap: 12px; margin-top: 14px; }
.rolle-knoepfe { display: flex; gap: 8px; flex-wrap: wrap; }
.rolle-aktionen { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rolle-wechsel { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding-top: 12px;
  border-top: 1px solid var(--linie); }
.rolle-bild { min-width: 0; border: 1px solid var(--linie); }
.erkannt { font-size: 0.875rem; margin: 6px 0; }
.mantine-Modal-body h4 { font-size: 0.9375rem; font-weight: 600; margin: 20px 0 8px; }
.import-probe-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.import-spalten td { vertical-align: middle; }

/* Prüfung und Simulation */
.lauf-seite { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.lauf-rechts { position: sticky; top: 16px; display: grid; gap: 16px; }
.lauf-rechts > div:empty { display: none; }
.pruefungen { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--linie); }
.pruefung { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--linie); font-size: 0.875rem; line-height: 1.45; }
.marke-schwere { font-size: 0.75rem; font-weight: 500; padding: 1px 0; text-align: center; border-radius: 3px; align-self: start; }
.pruefung-fehler .marke-schwere { background: #fdf1f0; color: var(--fehler); }
.pruefung-warnung .marke-schwere { background: #fdf3e6; color: #a04a00; }
.pruefung-gut { padding: 10px 12px; border-left: 3px solid var(--leitung); background: #f6f8fe; font-size: 0.875rem; }
.pruefung-zusammenfassung { font-size: 0.875rem; font-weight: 500; }
.lauf-status { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.status-lauf-laeuft::before, .status-lauf-wartend::before { background: var(--sonne); }
.status-lauf-fertig::before { background: var(--leitung); }
.status-lauf-fehler::before { background: var(--fehler); }
.protokoll { margin-top: 14px; font-size: 0.8125rem; }
.protokoll summary { cursor: pointer; color: var(--gedaempft); }
.protokoll pre { margin: 8px 0 0; padding: 10px; background: var(--papier); border: 1px solid var(--linie); max-height: 260px;
  overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 0.75rem; line-height: 1.5; }

/* Ergebnisse */
.ergebnis-kopf { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ergebnis-aktionen { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.figur { background: var(--flaeche); border: 1px solid var(--linie); padding: 18px 20px; margin-bottom: 16px; }
.figur-wahl { margin-bottom: 8px; }
.bericht-schalter { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.unterzeile { font-size: 0.8125rem; color: var(--gedaempft); margin: 8px 0 0; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border-top: 1px solid var(--linie);
  border-left: 1px solid var(--linie); }
.kachel { padding: 14px 16px; border-right: 1px solid var(--linie); border-bottom: 1px solid var(--linie); }
.kachel-name { color: var(--gedaempft); font-size: 0.875rem; }
.kachel-wert { font-size: 1.5rem; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .anmelden { grid-template-columns: 1fr; }
  .anmelden-schema { border-right: 0; border-bottom: 1px solid var(--linie); padding: 32px 20px; }
  .anmelden-schema h1 { font-size: 1.6rem; }
  .inhalt { grid-template-columns: 1fr; padding: 20px 16px; }
  .kopf { padding: 12px 16px; }
  .kopf .firma, .kopf .nutzer span { display: none; }
  .projekte .spalte-optional { display: none; }
  .projekt { padding: 16px; }
  .system, .projekt-uebersicht { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; }
  .lauf-seite, .rolle-inhalt { grid-template-columns: minmax(0, 1fr); }
  .lauf-rechts { position: static; }
  .figur, .abschnitt, .rolle { padding: 14px; }
  .figur-kopf { flex-direction: column; }
  .bericht-schalter { align-items: flex-start; }
  .tabelle .spalte-optional { display: none; }
}

/* Absende-Knopf des Anmeldeformulars (normales HTML, damit Enter und Passwortmanager greifen) */
.knopf { height: 36px; width: 100%; border: 0; border-radius: 4px; background: var(--leitung); color: #fff;
  font: 600 0.875rem/1 "IBM Plex Sans", system-ui, sans-serif; cursor: pointer; }
.knopf:hover { background: #1d38a3; }
