/* Kundenportal - Gestaltung.
   Bewusst ruhig gehalten: Der Kunde soll auf einen Blick den Stand erfassen. */

:root {
  /* Grundton ist das Schwarz aus dem Logo (#0F0F0F). Die Grauwerte sind bewusst
     neutral und nicht blaustichig, damit sie neben dem reinen Schwarz ruhig wirken. */
  --papier:        #ffffff;
  --hintergrund:   #f0f0f0;   /* zweite Hauptfarbe der Marke */
  --linie:         #e0e0e0;
  --linie-stark:   #c6c6c6;
  --text:          #0f0f0f;
  --text-leise:    #6e6e6e;
  --akzent:        #ff4500;   /* Akzentfarbe der Marke */
  --akzent-dunkel: #e63e00;   /* beim Zeigen mit der Maus */
  --akzent-blass:  #ffe8e0;   /* zarte Flaeche hinter Akzenttext */
  /* Auf hellem Grund ist #ff4500 als Text zu kontrastarm (nur 3,4:1). Wo der Akzent
     als Schrift auftritt, kommt deshalb dieser abgedunkelte Ton zum Einsatz (6,0:1). */
  --akzent-text:   #b83200;
  --linie-unter:   rgba(15,15,15,.28);

  /* Die Statusfarben bleiben farbig. Sie tragen Bedeutung und muessen sich
     auf einen Blick unterscheiden lassen - das kann Grau nicht leisten. */
  --gut:           #1c7d51;   /* abgedunkelt auf 4,55:1 - vorher war es zu blass */
  --gut-hell:      #e6f5ed;
  --arbeit:        #9c6006;   /* abgedunkelt auf 4,67:1 */
  --arbeit-hell:   #fdf3e2;
  --neutral:       #5e5e5e;
  --neutral-hell:  #e6e6e6;
  --gefahr:        #c0392b;
  --gefahr-hell:   #fbecea;
  --radius:        10px;
  --schatten:      0 1px 2px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
}

/* Inter, selbst gehostet - nicht ueber Google Fonts, damit keine Besucher-IP
   an einen Drittanbieter geht. Eine Datei deckt alle Schriftstaerken ab. */
@font-face {
  font-family: 'Inter';
  src: url('../schriften/inter-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;   /* Text ist sofort lesbar, auch bevor die Schrift geladen ist */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--hintergrund);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  /* Inter bringt echte Kapitaelchen-Ziffern und Ligaturen mit. */
  font-feature-settings: 'cv05' 1, 'ss03' 1;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: underline; text-decoration-color: var(--linie-unter); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--text); }

/* Flaechige und navigierende Elemente tragen die Unterstreichung nicht -
   dort ist durch Form und Position klar, dass man klicken kann. */
.marke, .hauptmenue a, .konto a, .filterleiste a, .knopf,
.projektkarte-link, .kundenkarte a, .layout-vorschau, .brotkrume a {
  text-decoration: none;
}
.konto a:hover, .brotkrume a:hover { text-decoration: underline; text-decoration-color: var(--linie-unter); }

h1 { font-size: 1.65rem; margin: 0 0 .2rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 0 0 .3rem; }

.klein { font-size: .875rem; }
.grau  { color: var(--text-leise); }
.rechts { margin-left: auto; }
.inline { display: inline; }

/* ---------- Kopf- und Fussleiste ---------- */

.kopfleiste {
  background: var(--papier);
  border-bottom: 1px solid var(--linie);
  position: sticky; top: 0; z-index: 20;
}
.kopfleiste .innen {
  max-width: 1100px; margin: 0 auto; padding: .8rem 1.25rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.marke { font-weight: 650; font-size: 1.05rem; color: var(--text); }
.marke:hover { text-decoration: none; }

.hauptmenue { display: flex; gap: 1.1rem; }
.hauptmenue a { color: var(--text-leise); padding: .2rem 0; border-bottom: 2px solid transparent; }
.hauptmenue a:hover { color: var(--text); text-decoration: none; }
.hauptmenue a.aktiv { color: var(--text); border-bottom-color: var(--akzent); font-weight: 550; }

.konto { margin-left: auto; display: flex; align-items: center; gap: 1rem; font-size: .875rem; }
.konto-name { color: var(--text-leise); }
.marker {
  background: var(--neutral-hell); color: var(--neutral);
  padding: .1rem .45rem; border-radius: 5px; font-size: .75rem; font-weight: 600;
}

.inhalt { max-width: 1100px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }

.fussleiste {
  max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem;
  color: var(--text-leise); font-size: .8rem; border-top: 1px solid var(--linie);
}
/* Auf der Anmeldeseite steht alles auf der Mittelachse - die Trennlinie wird
   dort auf die Breite der Anmeldekarte gekuerzt, sonst zieht sie das Auge
   ueber die ganze Seite. */
.fussleiste-mitte { text-align: center; max-width: 380px; }
/* Der Abmeldehinweis steht auf einer eigenen Zeile - so bleibt die erste Zeile
   die reine Kennzeichnung und der Hinweis wirkt als eigener Gedanke. */
.fuss-zeile { display: block; }
.fuss-zeile + .fuss-zeile { margin-top: .15rem; }

/* ---------- Bausteine ---------- */

.karte {
  background: var(--papier); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: 1.15rem; box-shadow: var(--schatten);
  margin-bottom: 1.25rem;
}
.beschreibung { white-space: normal; }

.schmal { max-width: 620px; }

.seitenkopf {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.unterzeile { color: var(--text-leise); margin: .3rem 0 0; max-width: 62ch; }
.brotkrume { font-size: .875rem; margin: 0 0 .9rem; color: var(--text-leise); }
.kundenname { font-size: .8rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-leise); }

.block { margin-top: 2.25rem; }
.blockkopf {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: .9rem; padding-bottom: .5rem; border-bottom: 1px solid var(--linie);
}
.blockkopf .knopf { margin-left: auto; }
.anzahl {
  background: var(--neutral-hell); color: var(--neutral);
  border-radius: 20px; padding: .05rem .5rem; font-size: .8rem; font-weight: 600;
}

.leer {
  background: var(--papier); border: 1px dashed var(--linie-stark);
  border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--text-leise);
}
.leer p { margin: .25rem 0; }

.hinweis { border-radius: var(--radius); padding: .75rem 1rem; margin: 0 0 1.25rem; font-size: .925rem; }
.hinweis-gut    { background: var(--gut-hell);    color: var(--gut);    border: 1px solid #bfe4d2; }
.hinweis-fehler { background: var(--gefahr-hell); color: var(--gefahr); border: 1px solid #f2c9c4; }

/* ---------- Plaketten ---------- */

.chip {
  display: inline-block; padding: .15rem .55rem; border-radius: 20px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.chip-erstellt       { background: var(--neutral-hell); color: var(--neutral); }
.chip-in_bearbeitung { background: var(--arbeit-hell);  color: var(--arbeit); }
.chip-erledigt       { background: var(--gut-hell);     color: var(--gut); }
.chip-entwurf        { background: var(--gefahr-hell);  color: var(--gefahr); }
/* Hier bleibt es bei dunkler Schrift: Die Plakette ist mit 0,78rem viel kleiner
   als eine Knopfbeschriftung, und bei kleiner Schrift wiegt schwacher Kontrast schwerer. */
.chip-neu            { background: var(--akzent);       color: var(--text); }

/* ---------- Knoepfe ---------- */

.knopf {
  display: inline-block; border: 1px solid var(--linie-stark); background: var(--papier);
  color: var(--text); padding: .48rem .95rem; border-radius: 7px;
  font-size: .925rem; font-weight: 550; cursor: pointer; font-family: inherit;
}
.knopf:hover { background: #f7f8fa; text-decoration: none; border-color: var(--text-leise); }
.knopf-haupt { background: var(--akzent); border-color: var(--akzent); color: #ffffff; font-weight: 700; }
.knopf-haupt:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); }
.knopf-gefahr { color: var(--gefahr); border-color: #f0c4bf; background: var(--papier); }
.knopf-gefahr:hover { background: var(--gefahr-hell); border-color: var(--gefahr); }
.knopf-klein { padding: .28rem .65rem; font-size: .85rem; }
.knopfgruppe { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.knopfgruppe form { margin: 0; }

.alslink {
  background: none; border: none; padding: 0; font: inherit; font-size: .875rem;
  color: var(--akzent-text); cursor: pointer; text-decoration: underline;
}
.alslink.gefahr { color: var(--gefahr); }

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

/* Formularzeilen brauchen Luft: Beschriftung, Feld und Hinweis gehoeren optisch
   zusammen, die naechste Zeile muss sich davon absetzen. */
.formular label { display: block; font-weight: 600; font-size: .875rem; margin: 1.5rem 0 .45rem; }
.formular label:first-of-type { margin-top: 0; }
.karte.formular { padding: 1.5rem; }
.formular input[type=text], .formular input[type=email], .formular input[type=password],
.formular input[type=date], .formular textarea, .formular select,
.anmeldung input, .schmal input, .schmal textarea, .schmal select {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--linie-stark);
  border-radius: 7px; font: inherit; background: var(--papier); color: var(--text);
}
.formular input:focus, .formular textarea:focus, .formular select:focus,
.anmeldung input:focus {
  outline: 2px solid var(--akzent); outline-offset: -1px; border-color: var(--akzent);
}
.formular textarea { resize: vertical; }
/* Der Absendeknopf setzt sich deutlich vom letzten Feld ab - sonst wirkt er,
   als gehoere er noch zur Eingabe. */
.formular button { margin-top: 1.9rem; }
.feldreihe { display: flex; gap: 1rem; flex-wrap: wrap; }
.feldreihe > div { flex: 1 1 180px; }
.feldhinweis { font-size: .82rem; color: var(--text-leise); margin: .45rem 0 0; line-height: 1.45; }
.ankreuz { display: flex; align-items: center; gap: .5rem; font-weight: 550; margin-top: 1.5rem; }
.ankreuz input { width: auto; }
.feststehend {
  padding: .55rem .7rem; background: var(--neutral-hell);
  border-radius: 7px; margin: 0; font-weight: 550;
}

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

.anmeldung { max-width: 380px; margin: 8vh auto 0; }
.anmeldung h1 { text-align: center; margin-bottom: 0; }
/* Etwas Luft zwischen Namenszug und Erklaerzeile - sonst kleben sie aneinander. */
.anmeldung .unterzeile { text-align: center; margin-top: 1rem; margin-bottom: 1.75rem; }
/* Beschriftungen und Abstaende kommen jetzt aus .formular - hier bleibt nur,
   was fuer die Anmeldeseite besonders ist. */
.anmeldung button { width: 100%; }
.anmeldung .klein { text-align: center; color: var(--text-leise); }

/* ---------- Filter ---------- */

.filterleiste { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.filterleiste a {
  padding: .3rem .75rem; border-radius: 20px; font-size: .875rem;
  background: var(--papier); border: 1px solid var(--linie); color: var(--text-leise);
}
.filterleiste a:hover { text-decoration: none; border-color: var(--linie-stark); }
.filterleiste a.aktiv { background: var(--text); border-color: var(--text); color: #fff; }

/* ---------- Projektliste ---------- */

.projektliste, .kundenliste, .aufgabenliste, .layoutliste, .kommentarliste {
  list-style: none; margin: 0; padding: 0;
}
.projektliste { display: grid; gap: .85rem; }

.projektkarte {
  background: var(--papier); border: 1px solid var(--linie);
  border-left: 4px solid var(--linie-stark);
  border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden;
}
.projektkarte.status-in_bearbeitung { border-left-color: var(--arbeit); }
.projektkarte.status-erledigt       { border-left-color: var(--gut); }
.projektkarte:hover { border-color: var(--linie-stark); box-shadow: 0 2px 6px rgba(20,30,50,.1); }

.projektkarte-link { display: block; padding: 1rem 1.15rem; color: inherit; }
.projektkarte-link:hover { text-decoration: none; }
.projektkarte-kopf { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.projektkarte-kopf h2 { margin: .1rem 0 0; }
.projektkarte-status { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.projektkarte-text { color: var(--text-leise); font-size: .9rem; margin: .5rem 0 0; }
.projektkarte-fuss {
  display: flex; align-items: center; gap: .85rem; flex-wrap: wrap;
  margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--linie);
}

.balken {
  display: inline-block; width: 90px; height: 6px; background: var(--neutral-hell);
  border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: .4rem;
}
.balken-fuell { display: block; height: 100%; background: var(--gut); }

/* ---------- Kunden ---------- */

.kundenliste { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.kundenkarte {
  background: var(--papier); border: 1px solid var(--linie);
  border-radius: var(--radius); box-shadow: var(--schatten);
}
.kundenkarte a { display: block; padding: 1.1rem; color: inherit; }
.kundenkarte a:hover { text-decoration: none; }
.kundenkarte:hover { border-color: var(--linie-stark); }
.kundenkarte p { margin: .3rem 0 0; }
.inaktiv { opacity: .6; }

/* ---------- Aufgaben ---------- */

.aufgabenliste { display: grid; gap: .5rem; }
.aufgabe {
  background: var(--papier); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: .85rem 1rem;
}
.aufgabe.status-erledigt .aufgabe-text strong { color: var(--text-leise); text-decoration: line-through; }
.aufgabe-kopf { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.aufgabe-text { flex: 1; }
.aufgabe-text p { margin: .25rem 0 0; }
.aufgabe-status select { padding: .3rem .5rem; border: 1px solid var(--linie-stark); border-radius: 6px; font: inherit; font-size: .85rem; }
.statuswahl { margin: 0; }

details.bearbeiten { margin-top: .6rem; border-top: 1px solid var(--linie); padding-top: .5rem; }
details summary { cursor: pointer; font-size: .85rem; color: var(--text-leise); }
details summary:hover { color: var(--akzent-text); }
details[open] summary { margin-bottom: .75rem; }
/* Das aufgeklappte Panel sitzt in der Aktionsspalte, die fuer die schmale
   "Verwalten"-Zeile auf nowrap steht. Ohne diese Rueckstellung bliebe der Knopf
   neben dem Eingabefeld haengen und wuerde aus der Tabelle herausragen. */
.aufklapp {
  display: grid; gap: 1rem; padding: .75rem 0;
  white-space: normal;
  text-align: left;
  width: 100%;
  min-width: 200px;
  max-width: 100%;
}
.aufklapp form { border-top: 1px solid var(--linie); padding-top: .75rem; margin: 0; }
.aufklapp form:first-child { border-top: none; padding-top: 0; }
/* Im schmalen Panel wirken volle Breiten ruhiger als unterschiedlich breite Knoepfe. */
.aufklapp .knopf { width: 100%; }
.aufklapp input, .aufklapp select { max-width: 100%; }

/* ---------- Layouts ---------- */

.layoutliste { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.layoutkarte {
  background: var(--papier); border: 1px solid var(--linie);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--schatten);
}
.layout-vorschau {
  display: flex; align-items: center; justify-content: center;
  height: 160px; background: var(--neutral-hell); overflow: hidden;
}
.layout-vorschau img { width: 100%; height: 100%; object-fit: cover; }
.pdf-symbol { font-weight: 700; color: var(--text-leise); letter-spacing: .1em; font-size: 1.2rem; }
.layout-angaben { padding: .75rem .9rem; }
.layout-angaben p { margin: .25rem 0 0; }

.layout-buehne {
  background: var(--papier); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 1rem; text-align: center; box-shadow: var(--schatten);
}
/* Die Vorschau bleibt bewusst kompakt: Sie soll zeigen, worum es geht, waehrend
   das Kommentarfeld in Sichtweite bleibt. Zum genauen Pruefen gibt es die
   Grossansicht - bei Bildern die Lupe, bei PDF den eigenen Tab. */
.layout-buehne img {
  max-width: 100%; max-height: 50vh; width: auto; height: auto;
  border-radius: 4px; cursor: zoom-in;
}
.layout-buehne object { width: 100%; height: 50vh; border: none; }
.layout-buehne .voll-hinweis {
  margin: .8rem 0 0; font-size: .85rem; color: var(--text-leise);
  display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap;
}

/* ---------- Lupe (Grossansicht fuer Bilder) ---------- */

.lupe {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,15,15,.94);
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 1.5rem; cursor: zoom-out;
}
.lupe[hidden] { display: none; }
.lupe img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  border-radius: 4px; box-shadow: 0 8px 40px rgba(0,0,0,.5); cursor: default;
}
.lupe-schliessen {
  position: absolute; top: 1rem; right: 1.25rem;
  background: none; border: none; color: #fff; font-size: 2rem; line-height: 1;
  cursor: pointer; padding: .25rem .6rem; border-radius: 6px; font-family: inherit;
}
.lupe-schliessen:hover { background: rgba(255,255,255,.15); }
.lupe-fuss {
  position: absolute; bottom: 1.25rem; left: 0; right: 0; text-align: center;
  color: rgba(255,255,255,.65); font-size: .82rem;
}

/* ---------- Kommentare ---------- */

.kommentarliste { display: grid; gap: .7rem; margin-bottom: 1.25rem; }
.kommentar {
  background: var(--papier); border: 1px solid var(--linie);
  border-left: 3px solid var(--neutral); border-radius: var(--radius); padding: .8rem 1rem;
}
.kommentar-admin { border-left-color: var(--akzent); }
.kommentar-kopf { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; margin-bottom: .35rem; }
.kommentar-kopf .rolle {
  font-size: .75rem; font-weight: 600; color: var(--text-leise);
  background: var(--neutral-hell); padding: .05rem .4rem; border-radius: 4px;
}
.kommentar-admin .kommentar-kopf .rolle { background: var(--akzent-blass); color: var(--akzent-text); }
.kommentar-text { margin-bottom: .3rem; }
.kommentar-formular { margin-top: 0; }

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

/* Auf schmalen Bildschirmen ist die Tabelle breiter als das Fenster. Dann soll
   nur sie selbst seitlich scrollen - nicht die ganze Seite. */
.tabelle-rahmen {
  overflow-x: auto;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

.tabelle {
  width: 100%; border-collapse: collapse; background: var(--papier);
  border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--schatten);
}
.tabelle th, .tabelle td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle th { background: #fafbfc; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-leise); }
.tabelle tr:last-child td { border-bottom: none; }
.tabelle .aktionen { text-align: right; white-space: nowrap; }
/* Sobald jemand aufklappt, wird die Spalte zu einem normalen Block - sonst
   presst nowrap den Inhalt in eine Zeile. */
.tabelle .aktionen details[open] { white-space: normal; }
.tabelle .aktionen details { min-width: 200px; }

/* ---------- Gefahrenzone ---------- */

.gefahrenzone {
  margin-top: 3rem; padding: 1.15rem; border: 1px solid #f0c4bf;
  background: var(--gefahr-hell); border-radius: var(--radius);
}
.gefahrenzone h3 { color: var(--gefahr); }
.gefahrenzone p { margin: 0 0 .75rem; color: #8c3227; }

/* ---------- Schmale Bildschirme ---------- */

@media (max-width: 620px) {
  .kopfleiste .innen { gap: .75rem; }
  .konto { width: 100%; margin-left: 0; justify-content: space-between; }
  .seitenkopf { flex-direction: column; }
  .projektkarte-kopf { flex-direction: column; }
  .projektkarte-status { justify-content: flex-start; }
  .layout-buehne object { height: 45vh; }
  .tabelle th:nth-child(4), .tabelle td:nth-child(4) { display: none; }
  .tabelle { min-width: 460px; }        /* darunter wird es unleserlich - dann lieber scrollen */
  .aufklapp { min-width: 170px; }
}

/* ---------- Markenzeichen ---------- */

.marke { display: flex; align-items: center; gap: .55rem; }
.marke-zeichen { display: block; width: 30px; height: 30px; flex: none; }
.marke-name { font-weight: 650; font-size: 1.05rem; letter-spacing: -.01em; }

.anmelde-zeichen { display: block; width: 64px; height: 64px; margin: 0 auto 1rem; }

@media (max-width: 620px) {
  /* Auf schmalen Bildschirmen traegt das Zeichen allein - der Name wuerde die
     Zeile sprengen und das Menue verdraengen. */
  .marke-name { display: none; }
}

/* ---------- Material ---------- */

.materialliste { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.materialzeile {
  display: flex; align-items: center; gap: .85rem;
  background: var(--papier); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: .7rem .9rem;
}
.datei-kuerzel {
  flex: none; min-width: 52px; text-align: center;
  background: var(--neutral-hell); color: var(--neutral);
  border-radius: 6px; padding: .3rem .4rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .05em;
}
.material-angaben { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.material-angaben > span { overflow-wrap: anywhere; }
.material-aktionen { flex: none; display: flex; align-items: center; gap: .75rem; }

@media (max-width: 620px) {
  /* Auf schmalen Bildschirmen untereinander - nebeneinander wird es zu eng. */
  .materialzeile { flex-wrap: wrap; }
  .material-angaben { flex-basis: 100%; order: 2; }
  .material-aktionen { order: 3; margin-left: auto; }
}
