/* Portfolio-Cockpit – Gestaltung. Bewusst helles, ruhiges Erscheinungsbild. */

:root {
  --flaeche: #f9f9f7;          /* Seitenebene */
  --karte: #fcfcfb;            /* Kartenoberfläche */
  --tinte: #0b0b0b;
  --tinte-2: #52514e;
  --gedimmt: #898781;
  --linie: #e1e0d9;
  --rand: rgba(11, 11, 11, 0.10);
  --akzent: #2a78d6;           /* Serie 1 */
  --akzent-hell: #86b6ef;
  --akzent-wash: rgba(42, 120, 214, 0.08);
  --rot: #e34948;              /* Serie 8, für Divergenz */
  --gut: #0ca30c;
  --gut-text: #006300;
  --warnung: #fab219;
  --ernst: #ec835a;
  --kritisch: #d03b3b;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(11, 11, 11, 0.04);
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--flaeche);
  color: var(--tinte);
  font-size: 14px;
  line-height: 1.45;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: rgba(42, 120, 214, 0.18); }

/* ---------------------------------------------------------- Grundgerüst */

#app { min-height: 100vh; }

.geruest { display: flex; min-height: 100vh; }

.seitenleiste {
  width: 230px; flex: 0 0 230px;
  border-right: 1px solid var(--rand);
  background: var(--karte);
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  position: sticky; top: 0; height: 100vh;
}

.wortmarke { padding: 2px 10px 20px; }
.wortmarke .titel { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.wortmarke .untertitel { font-size: 11.5px; color: var(--gedimmt); margin-top: 1px; }
.wortmarke .punkt { color: var(--akzent); }

.portfolio-wahl { padding: 0 6px 14px; }
.portfolio-wahl select {
  width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--rand);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--tinte);
}
.portfolio-name {
  padding: 0 10px 14px; font-size: 12.5px; font-weight: 600; color: var(--akzent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nutzer-zeile {
  padding: 4px 10px 8px; font-size: 11.5px; color: var(--gedimmt);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.navi { display: flex; flex-direction: column; gap: 2px; }
.navi a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--tinte-2); font-weight: 500; font-size: 13.5px;
  transition: background 120ms ease, color 120ms ease;
}
.navi a svg { width: 17px; height: 17px; stroke: currentColor; flex: 0 0 17px; }
.navi a:hover { background: rgba(11, 11, 11, 0.045); }
.navi a.aktiv { background: var(--akzent-wash); color: var(--akzent); }

.seitenleiste .fuss { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rand); }
.seitenleiste .fuss button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 8px; color: var(--gedimmt);
  font-size: 13px; font-weight: 500;
}
.seitenleiste .fuss button:hover { background: rgba(11, 11, 11, 0.045); color: var(--tinte-2); }
.seitenleiste .fuss svg { width: 16px; height: 16px; stroke: currentColor; }

.inhalt { flex: 1; min-width: 0; padding: 28px 36px 64px; }
.inhalt-innen { max-width: 1240px; margin: 0 auto; }

/* Sanfter Einstieg je Ansicht */
.ansicht { animation: erscheinen 240ms cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes erscheinen {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ansicht, .balken-fuellung, .modal-karte { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------- Kopfzeilen */

.kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.kopf h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.015em; }
.kopf .unterzeile { color: var(--gedimmt); font-size: 13px; margin-top: 3px; }
.kopf .aktionen { display: flex; gap: 8px; flex-wrap: wrap; }

.abschnitt { margin-top: 30px; }
.abschnitt-titel {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--gedimmt); margin-bottom: 10px;
}

/* ---------------------------------------------------------- Knöpfe */

.knopf {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px;
  border: 1px solid var(--rand); background: var(--karte); color: var(--tinte-2);
  box-shadow: var(--schatten);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.knopf:hover { background: #f3f2ee; color: var(--tinte); }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.primaer:hover { background: #256abf; }
.knopf svg { width: 15px; height: 15px; stroke: currentColor; }
.knopf:disabled { opacity: 0.5; cursor: default; }

/* ---------------------------------------------------------- Kacheln */

.kachelzeile { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.kachelzeile.dreier { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .kachelzeile.dreier { grid-template-columns: 1fr; }
  /* Am Handy nach Spalten gruppieren: erst alle IST-, dann SOLL-, dann ZIEL-Kacheln */
  .kachelzeile.dreier > :nth-child(3n+2) { order: 1; }
  .kachelzeile.dreier > :nth-child(3n) { order: 2; }
}

.kachel {
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 14px 16px 13px; box-shadow: var(--schatten);
}
.kachel .beschriftung { font-size: 12px; color: var(--gedimmt); font-weight: 500; }
.kachel .wert { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin-top: 3px; }
.kachel .wert .jahr { font-size: 13px; font-weight: 500; color: var(--gedimmt); letter-spacing: 0; }
.einheiten-liste { margin-top: 6px; font-size: 13px; color: var(--tinte-2); }
.einheiten-liste > div { display: flex; gap: 8px; padding: 1.5px 0; }
.einheiten-liste span { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; color: var(--tinte); }
.einheiten-liste.mit-strich { border-top: 1px solid var(--linie); margin-top: 7px; padding-top: 6px; }
.einheiten-liste.breite-zahlen span { min-width: 52px; }
.kachel .zusatz { font-size: 12px; color: var(--tinte-2); margin-top: 3px; }
.kachel .zusatz.gut { color: var(--gut-text); }
.kachel .zusatz.schlecht { color: var(--kritisch); }
.kachel.gross .wert { font-size: 32px; }
.kachel.hervorgehoben { border-color: rgba(42, 120, 214, 0.35); background: linear-gradient(180deg, rgba(42, 120, 214, 0.05), rgba(42, 120, 214, 0.0) 70%), var(--karte); }

/* ---------------------------------------------------------- Karten */

.karte-block {
  background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 18px 20px;
}
.karte-block h3 { font-size: 14px; font-weight: 650; margin-bottom: 2px; }
.karte-block .karten-unterzeile { font-size: 12px; color: var(--gedimmt); margin-bottom: 14px; }

.zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .zweispaltig { grid-template-columns: 1fr; } }
.dreispaltig { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 1280px) { .dreispaltig { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------- Tabellen */

.tabelle-huelle { overflow-x: auto; }
table.daten { width: 100%; border-collapse: collapse; font-size: 13px; }
table.daten th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--gedimmt);
  padding: 8px 10px; border-bottom: 1px solid var(--linie); white-space: nowrap;
  position: sticky; top: 0; background: var(--karte); z-index: 1;
}
table.daten td { padding: 9px 10px; border-bottom: 1px solid var(--linie); vertical-align: middle; }
table.daten tr:last-child td { border-bottom: none; }
table.daten td.zahl, table.daten th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.daten th.sortierbar { cursor: pointer; user-select: none; }
table.daten th.sortierbar:hover { color: var(--tinte); }
table.daten tr.klickbar { cursor: pointer; transition: background 100ms ease; }
table.daten tr.klickbar:hover { background: rgba(11, 11, 11, 0.03); }
table.daten tr.summe td { font-weight: 700; border-top: 2px solid var(--tinte); background: var(--karte); }
table.daten td.gut { color: var(--gut-text); }
table.daten td.schlecht { color: var(--kritisch); }
table.daten .nebenwert { color: var(--gedimmt); font-size: 12px; }

/* ---------------------------------------------------------- Statuschips */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 99px;
  white-space: nowrap;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.chip.vermietet { color: var(--gut-text); background: rgba(12, 163, 12, 0.10); }
.chip.leerstand { color: var(--kritisch); background: rgba(208, 59, 59, 0.10); }
.chip.gekuendigt { color: #8a6100; background: rgba(250, 178, 25, 0.16); }
.chip.sanierung { color: #a34f2c; background: rgba(236, 131, 90, 0.14); }
.chip.neutral { color: var(--tinte-2); background: rgba(11, 11, 11, 0.06); }
.chip.blau { color: var(--akzent); background: var(--akzent-wash); }
.chip.reserviert { color: var(--akzent); background: var(--akzent-wash); }

/* ---------------------------------------------------------- Diagramme */

.diagramm { width: 100%; }
.diagramm text { font-family: inherit; }
.diagramm .achse { font-size: 11px; fill: var(--gedimmt); }
.diagramm .wertlabel { font-size: 12px; fill: var(--tinte-2); font-variant-numeric: tabular-nums; }
.diagramm .namelabel { font-size: 12.5px; fill: var(--tinte); }
.diagramm .gitter { stroke: var(--linie); stroke-width: 1; shape-rendering: crispEdges; }
.diagramm .nulllinie { stroke: #c3c2b7; stroke-width: 1; shape-rendering: crispEdges; }

.legende { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.legende .eintrag { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--tinte-2); }
.legende .punkt { width: 9px; height: 9px; border-radius: 99px; }
.legende .strich { width: 14px; height: 3px; border-radius: 2px; }

.balken-fuellung { transition: width 500ms cubic-bezier(0.2, 0.7, 0.2, 1); }

/* Balken-, Divergenz- und Hantel-Diagramme (HTML-basiert) */
.bd { display: flex; flex-direction: column; }
.bd-zeile {
  display: grid; grid-template-columns: minmax(90px, 220px) minmax(60px, 1fr) 92px;
  align-items: center; gap: 12px; padding: 5px 4px; border-radius: 7px; min-height: 26px;
}
.bd-zeile:hover { background: rgba(11, 11, 11, 0.03); }
.bd-klick { cursor: pointer; }
.bd-name {
  font-size: 12.5px; color: var(--tinte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bd-wert { font-size: 12.5px; color: var(--tinte-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bd-wert.negativ-text { color: var(--kritisch); }
.bd-spur { position: relative; height: 18px; }
.bd-balken {
  position: absolute; left: 0; top: 0; height: 18px; background: var(--akzent);
  border-radius: 0 4px 4px 0; min-width: 2px;
}
.bd-spur.divergenz .dv-mitte {
  position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: #c3c2b7;
}
.dv-balken { position: absolute; top: 0; height: 18px; }
.dv-balken.positiv { background: var(--akzent); border-radius: 0 4px 4px 0; }
.dv-balken.negativ { background: var(--rot); border-radius: 4px 0 0 4px; }
.bd-zeile.breit { grid-template-columns: minmax(90px, 220px) minmax(60px, 1fr) 152px; }
.bd-balken.ohne-abschluss { border-radius: 0; }
.bd-plus {
  position: absolute; top: 0; height: 18px; background: var(--akzent-hell);
  border-radius: 0 4px 4px 0;
}
.bd-wert .klein { font-size: 11px; line-height: 1.3; }
.legende .kaestchen { width: 10px; height: 10px; border-radius: 3px; }
.gut-text { color: var(--gut-text); }

.werkzeugtipp {
  position: fixed; z-index: 50; pointer-events: none;
  background: #21201e; color: #fff; font-size: 12.5px; line-height: 1.5;
  padding: 8px 11px; border-radius: 8px; box-shadow: 0 4px 14px rgba(11, 11, 11, 0.25);
  max-width: 300px; opacity: 0; transition: opacity 100ms ease;
}
.werkzeugtipp.sichtbar { opacity: 1; }
.werkzeugtipp .tt-titel { font-weight: 650; margin-bottom: 2px; }
.werkzeugtipp .tt-zeile { display: flex; justify-content: space-between; gap: 14px; }
.werkzeugtipp .tt-zeile span:last-child { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- Filterzeile */

.filterzeile { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filterzeile select {
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--rand);
  background: var(--karte); font-size: 13px; color: var(--tinte);
}
.schalter {
  padding: 5px 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--rand); background: var(--karte); color: var(--tinte-2);
  transition: all 120ms ease;
}
.schalter:hover { background: #f3f2ee; }
.schalter.aktiv { background: var(--akzent); border-color: var(--akzent); color: #fff; }

/* ---------------------------------------------------------- Formulare */

.feld { margin-bottom: 13px; }
.feld label { display: block; font-size: 12px; font-weight: 600; color: var(--tinte-2); margin-bottom: 4px; }
.feld input, .feld select, .feld textarea {
  width: 100%; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--rand);
  background: #fff; font-size: 13.5px;
}
.feld input:focus, .feld select:focus, .feld textarea:focus {
  outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px rgba(42, 120, 214, 0.15);
}
.feld .hinweis { font-size: 11.5px; color: var(--gedimmt); margin-top: 3px; }
.feldzeile { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.fehlermeldung {
  background: rgba(208, 59, 59, 0.08); border: 1px solid rgba(208, 59, 59, 0.25);
  color: var(--kritisch); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px;
}
.erfolgsmeldung {
  background: rgba(12, 163, 12, 0.08); border: 1px solid rgba(12, 163, 12, 0.25);
  color: var(--gut-text); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px;
}

/* ---------------------------------------------------------- Anmeldung */

.anmelde-buehne {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--flaeche); padding: 20px;
}
.anmelde-karte {
  width: 380px; max-width: 100%; background: var(--karte);
  border: 1px solid var(--rand); border-radius: 14px; box-shadow: 0 10px 40px rgba(11, 11, 11, 0.07);
  padding: 34px 34px 30px;
  animation: erscheinen 300ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.anmelde-karte .titel { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.anmelde-karte .untertitel { color: var(--gedimmt); font-size: 13px; margin: 3px 0 22px; }

/* ---------------------------------------------------------- Modal */

.modal-hintergrund {
  position: fixed; inset: 0; background: rgba(11, 11, 11, 0.35); z-index: 40;
  display: flex; align-items: flex-start; justify-content: center; padding: 7vh 20px 20px;
  overflow-y: auto;
}
.modal-karte {
  width: 560px; max-width: 100%; background: var(--karte); border-radius: 14px;
  border: 1px solid var(--rand); box-shadow: 0 18px 60px rgba(11, 11, 11, 0.22);
  padding: 24px 26px 22px;
  animation: modal-auf 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes modal-auf {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.modal-karte h2 { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.modal-karte .modal-unterzeile { font-size: 12.5px; color: var(--gedimmt); margin-bottom: 18px; }
.modal-fuss { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------------------------------------------------------- Import */

.ablagezone {
  border: 2px dashed var(--linie); border-radius: 14px; background: var(--karte);
  padding: 54px 30px; text-align: center; color: var(--gedimmt);
  transition: all 150ms ease; cursor: pointer;
}
.ablagezone:hover, .ablagezone.aktiv { border-color: var(--akzent); background: var(--akzent-wash); color: var(--akzent); }
.ablagezone .gross-symbol svg { width: 34px; height: 34px; stroke: currentColor; margin-bottom: 10px; }
.ablagezone .zeile-1 { font-size: 15px; font-weight: 650; color: var(--tinte-2); }
.ablagezone.aktiv .zeile-1, .ablagezone:hover .zeile-1 { color: var(--akzent); }
.ablagezone .zeile-2 { font-size: 12.5px; margin-top: 4px; }

.hinweisliste { list-style: none; }
.hinweisliste li {
  padding: 7px 0 7px 22px; position: relative; font-size: 13px; color: var(--tinte-2);
  border-bottom: 1px solid var(--linie);
}
.hinweisliste li:last-child { border-bottom: none; }
.hinweisliste li::before {
  content: ""; position: absolute; left: 4px; top: 13px;
  width: 7px; height: 7px; border-radius: 99px; background: var(--warnung);
}

/* ---------------------------------------------------------- Sonstiges */

.leer-zustand {
  text-align: center; padding: 60px 20px; color: var(--gedimmt);
}
.leer-zustand .gross { font-size: 15px; font-weight: 600; color: var(--tinte-2); margin-bottom: 5px; }

.laden { display: flex; align-items: center; justify-content: center; padding: 80px 0; color: var(--gedimmt); gap: 10px; font-size: 13px; }
.laden .kreisel {
  width: 16px; height: 16px; border-radius: 99px;
  border: 2px solid var(--linie); border-top-color: var(--akzent);
  animation: drehen 700ms linear infinite;
}
@keyframes drehen { to { transform: rotate(360deg); } }

.hauch { color: var(--gedimmt); }
.klein { font-size: 12px; }

/* ---------------------------------------------------------- Handy */

@media (max-width: 860px) {
  .geruest { flex-direction: column; }
  .seitenleiste {
    width: 100%; flex: none; height: auto; position: static;
    flex-direction: row; align-items: center; padding: 10px 14px; gap: 6px;
    overflow-x: auto;
  }
  .wortmarke { padding: 0 10px 0 0; white-space: nowrap; }
  .wortmarke .untertitel { display: none; }
  .navi { flex-direction: row; }
  .navi a { white-space: nowrap; padding: 7px 10px; }
  .navi a svg { display: none; }
  .seitenleiste .fuss { margin: 0 0 0 auto; padding: 0; border: none; }
  .seitenleiste .fuss button span { display: none; }
  .inhalt { padding: 18px 16px 48px; }
}

/* ---------------------------------------------------------- Druck */

@media print {
  .seitenleiste, .kopf .aktionen, .filterzeile, .modal-hintergrund { display: none !important; }
  body { background: #fff; }
  .inhalt { padding: 0; }
  .karte-block, .kachel { box-shadow: none; break-inside: avoid; }
  .ansicht { animation: none; }
}

/* ---------------------------------------------------------- Baustellen */

.baustellen-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.baustelle-karte { cursor: pointer; transition: border-color 120ms ease; }
.baustelle-karte:hover { border-color: rgba(42, 120, 214, 0.4); }
.baustelle-karte .fortschritt { margin-top: 12px; }

.fortschritt { height: 6px; background: var(--linie); border-radius: 99px; overflow: hidden; }
.fortschritt > div { height: 100%; background: var(--akzent); border-radius: 99px; transition: width 300ms ease; }

.todo-zeile { display: flex; gap: 10px; align-items: flex-start; padding: 9px 4px; border-bottom: 1px solid var(--linie); }
.todo-zeile:last-child { border-bottom: none; }
.todo-zeile input[type="checkbox"] { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--akzent); cursor: pointer; flex: 0 0 17px; }
.todo-zeile.erledigt .todo-text { text-decoration: line-through; color: var(--gedimmt); }
.todo-meta { font-size: 11.5px; color: var(--gedimmt); margin-top: 1px; }
.todo-meta .ueberfaellig { color: var(--kritisch); font-weight: 600; }

.todo-neu { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.todo-neu input[type="text"] { flex: 1; min-width: 180px; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--rand); font: inherit; }
.todo-neu input[type="date"] { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--rand); background: #fff; font: inherit; }
