/* Erscheinungsbild nach www.gmg.biz:
   Open Sans, Akzentrot #E65458, fast schwarzer Text, helle Flaechen,
   eckige Kanten ohne Rundungen, sehr fette Ueberschriften. */

:root {
    --rot: #e65458;
    --rot-dunkel: #cf4448;
    --schwarz: #000;
    --text: #1a1a1a;
    --text-leise: #656877;
    --flaeche: #f4f4f7;
    --linie: #d9dbe4;
    --linie-kraeftig: #b3b6c5;
    --weiss: #fff;
    --gruen: #2e7d52;
    --gelb: #b07800;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--weiss);
}

h1, h2, h3 { font-weight: 800; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.3rem; margin: 2.2rem 0 .8rem; }
h3 { font-size: 1.05rem; }

a { color: var(--rot); text-decoration: none; }
a:hover { text-decoration: underline; }

.leise { color: var(--text-leise); }

/* --- Kopfzeile ---------------------------------------------------------- */
.kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0 1.5rem;
    height: 62px;
    background: var(--weiss);
    border-bottom: 3px solid var(--rot);
}
.marke { display: flex; align-items: center; gap: .7rem; }
/* Hoehe fest, Breite aus dem Seitenverhaeltnis (121.843 x 51.087) -> 72 x 30. */
.marke .logo { display: block; height: 30px; width: auto; }
.marke .zusatz { font-weight: 600; font-size: 1.05rem; color: var(--schwarz); }

.kopf nav { display: flex; gap: .25rem; margin-left: auto; overflow-x: auto; }

@media (max-width: 60rem) {
    .kopf { height: auto; flex-wrap: wrap; padding: .5rem 1rem; row-gap: .3rem; }
    .kopf nav { margin-left: 0; order: 3; width: 100%; }
}
.kopf nav a {
    padding: .45rem .9rem;
    color: var(--text);
    font-weight: 600;
    font-size: .92rem;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    /* Ohne das bricht "Monatliche Verrechnung" auf zwei Zeilen und die Leiste
       verliert ihre Hoehe. */
    white-space: nowrap;
}
.kopf nav a:hover { text-decoration: none; background: var(--flaeche); }
.kopf nav a.active { border-bottom-color: var(--rot); }

.benutzer { display: flex; align-items: center; gap: .8rem; font-size: .86rem;
            white-space: nowrap; }

/* --- Inhalt -------------------------------------------------------------- */
main { max-width: 76rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.marke-band {
    display: inline-block;
    background: var(--rot);
    color: var(--weiss);
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .25rem .8rem;
    margin-bottom: .8rem;
}

/* --- Karten und Kennzahlen ---------------------------------------------- */
.karte { border: 1px solid var(--linie); background: var(--weiss); padding: 1.1rem 1.3rem; }
.karte + .karte { margin-top: 1rem; }

.kennzahlen { display: flex; flex-wrap: wrap; gap: 2.5rem; padding: 1rem 1.3rem; background: var(--flaeche); }
.kennzahlen div { font-size: .8rem; color: var(--text-leise); text-transform: uppercase; letter-spacing: .04em; }
.kennzahlen b { display: block; font-size: 1.7rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.hinweis { border-left: 3px solid var(--gelb); background: var(--flaeche); padding: .7rem 1rem; margin: 1rem 0; font-size: .92rem; }
.fehler { border-left: 3px solid var(--rot); background: #fdf2f2; padding: .7rem 1rem; margin: 1rem 0; font-size: .92rem; }

/* --- Bedienelemente ------------------------------------------------------ */
.leiste { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; margin: 1.2rem 0; }
label { display: block; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-leise); margin-bottom: .25rem; }

input, select {
    font: inherit; font-size: .92rem;
    padding: .45rem .6rem;
    border: 1px solid var(--linie-kraeftig);
    background: var(--weiss); color: var(--text);
    border-radius: 0;
}
input:focus, select:focus { outline: 2px solid var(--rot); outline-offset: -1px; border-color: var(--rot); }

button {
    font: inherit; font-weight: 600; font-size: .92rem;
    padding: .48rem 1.2rem;
    border: 1px solid var(--rot);
    background: var(--rot); color: var(--weiss);
    cursor: pointer; border-radius: 0;
}
button:hover:not(:disabled) { background: var(--rot-dunkel); border-color: var(--rot-dunkel); }
button:disabled { opacity: .5; cursor: default; }
button.zweit { background: var(--weiss); color: var(--text); border-color: var(--linie-kraeftig); }
button.zweit:hover:not(:disabled) { background: var(--flaeche); }

/* Verweis, der wie ein Knopf aussieht. Noetig, weil die Anmeldung ein echter
   Seitenwechsel ist und kein Ereignis im Kreislauf. */
a.knopf {
    display: inline-block;
    font-weight: 600; font-size: .95rem;
    padding: .6rem 1.4rem;
    border: 1px solid var(--rot);
    background: var(--rot); color: var(--weiss);
}
a.knopf:hover { background: var(--rot-dunkel); border-color: var(--rot-dunkel); text-decoration: none; }

/* --- Anmeldung ----------------------------------------------------------- */
.anmeldung { max-width: 34rem; margin: 3rem auto 0; }
.anmeldung p { margin: 1rem 0; }

/* --- Tabellen ------------------------------------------------------------ */
.tabelle { overflow-x: auto; border: 1px solid var(--linie); }
table { width: 100%; border-collapse: collapse; font-size: .89rem; }
th, td { padding: .5rem .85rem; text-align: left; border-bottom: 1px solid var(--linie); white-space: nowrap; }
th { background: var(--flaeche); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--linie-kraeftig); }
tbody tr:hover { background: var(--flaeche); }
tbody tr:last-child td { border-bottom: none; }
td.z, th.z { text-align: right; font-variant-numeric: tabular-nums; }
td.name { white-space: normal; font-weight: 600; min-width: 14rem; }

/* --- Merkmale ------------------------------------------------------------ */
.merkmal { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .12rem .5rem; border: 1px solid var(--linie-kraeftig); color: var(--text-leise); }
.merkmal.partner { border-color: var(--rot); color: var(--rot); }
.merkmal.ja { border-color: var(--gruen); color: var(--gruen); }
.merkmal.offen { border-color: var(--gelb); color: var(--gelb); }

.laedt { color: var(--text-leise); font-style: italic; }

/* --- Fortschritt --------------------------------------------------------- */
.fortschritt { margin: 1.2rem 0; }
.fortschritt .zeile {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 1rem; margin-bottom: .4rem; font-size: .9rem;
}
.fortschritt .schritt { font-weight: 600; }
.fortschritt .anteil { color: var(--text-leise); font-variant-numeric: tabular-nums; }

.balken { height: 6px; background: var(--flaeche); border: 1px solid var(--linie); overflow: hidden; }
.balken > span { display: block; height: 100%; background: var(--rot); transition: width .25s ease; }

/* Unbestimmter Zustand: es laeuft etwas, dessen Dauer nicht bezifferbar ist. */
.balken.offen > span {
    width: 34%;
    animation: wandern 1.3s ease-in-out infinite;
}
@keyframes wandern {
    0%   { margin-left: -34%; }
    100% { margin-left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .balken.offen > span { animation: none; width: 100%; opacity: .45; }
}

.protokoll { margin: .8rem 0 0; padding: 0; list-style: none; font-size: .85rem; }
.protokoll li { padding: .18rem 0; color: var(--text-leise); }
.protokoll li.fertig::before { content: "✓ "; color: var(--gruen); font-weight: 700; }
.protokoll li.laeuft::before { content: "› "; color: var(--rot); font-weight: 700; }
.protokoll li.laeuft { color: var(--text); font-weight: 600; }
.protokoll li.schiefgegangen::before { content: "✕ "; color: var(--rot); font-weight: 700; }

/* --- Hierarchie und aufklappbare Positionen ------------------------------ */
button.aufklapp {
    background: none; border: none; color: var(--text-leise);
    font-size: .95rem; line-height: 1; padding: .15rem .3rem; cursor: pointer;
}
button.aufklapp:hover { background: var(--flaeche); color: var(--rot); }

tr.kind td.name { position: relative; }
tr.kind td.name::before {
    content: ""; position: absolute; left: 1rem; top: 0; bottom: 50%;
    border-left: 1px solid var(--linie-kraeftig);
    border-bottom: 1px solid var(--linie-kraeftig);
    width: .7rem;
}

tr.positionen > td { background: var(--flaeche); padding: .3rem .85rem .8rem; }
table.innen { border: 1px solid var(--linie); background: var(--weiss); }
table.innen th { background: var(--weiss); font-size: .72rem; border-bottom: 1px solid var(--linie-kraeftig); }
table.innen th, table.innen td { padding: .3rem .7rem; }
table.innen tbody tr:hover { background: var(--flaeche); }

button.zahl {
    background: none; border: none; color: var(--rot); font: inherit;
    font-weight: 700; font-variant-numeric: tabular-nums;
    padding: .1rem .35rem; cursor: pointer; text-decoration: underline;
    text-underline-offset: 2px;
}
button.zahl:hover { background: var(--flaeche); }

.anzahl {
    display: inline-block; margin-left: .5rem;
    font-size: .72rem; font-weight: 700; color: var(--text-leise);
    background: var(--flaeche); border: 1px solid var(--linie);
    padding: .05rem .4rem; font-variant-numeric: tabular-nums;
}

/* --- Verrechnungsrhythmus je Quelle -------------------------------------- */
.rhythmus, .mandanten { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.rhythmus > div, .mandanten > div {
    flex: 1 1 18rem; padding: .6rem .85rem;
    background: var(--flaeche); border-left: 3px solid var(--linie-kraeftig);
}
.rhythmus > div.zufrueh, .mandanten > div.zufrueh { border-left-color: var(--gelb); }

.rhythmus .titelzeile, .mandanten .titelzeile {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: .3rem;
}
.rhythmus .quelle, .mandanten .quelle { font-weight: 700; font-size: 1rem; }
.rhythmus .art { font-size: .88rem; color: var(--text); margin-bottom: .15rem; }
.rhythmus .klein, .mandanten .klein { font-size: .82rem; line-height: 1.4; }

tr.gewaehlt > td { background: #fdf4f4; }
tr.gewaehlt:hover > td { background: #fbeaea; }
input[type="checkbox"] { accent-color: var(--rot); width: 1rem; height: 1rem; cursor: pointer; }

select.ebene { font-size: .82rem; padding: .2rem .4rem; max-width: 15rem; }
select.ebene.offen { border-color: var(--gelb); color: var(--gelb); font-weight: 600; }

/* Kontaktauswahl in der Zuordnung: breiter als die Ebenenauswahl, weil sie
   Firmennamen samt Kundennummer zeigt. */
select.kontakt { font-size: .82rem; padding: .2rem .4rem; min-width: 16rem; max-width: 24rem; }
select.kontakt.offen { border-color: var(--gelb); }
.klein { font-size: .82rem; }

/* --- Monatsband auf der Uebersicht --------------------------------------- */
/* Zeigt je Quelle, ab welchem Tag des Monats sie verrechenbar wird. Der Balken
   beginnt an diesem Tag - die Breite links davon ist die Wartezeit. */
.monatsband { border: 1px solid var(--linie); background: var(--weiss); padding: .4rem 1.3rem .6rem; }
.monatsband .kopfzeile,
.monatsband > .zeile {
    display: grid; grid-template-columns: 14rem 1fr 11rem; gap: 1rem; align-items: center;
}
.monatsband .kopfzeile {
    align-items: end; padding-bottom: .35rem;
    font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    font-weight: 700; color: var(--text-leise);
}
.monatsband > .zeile { padding: .85rem 0; border-top: 1px solid var(--linie); }
.monatsband .was { display: flex; flex-direction: column; }
.monatsband .z { text-align: right; display: flex; flex-direction: column; gap: .2rem; align-items: flex-end; }

.monatsband .tage { display: flex; }
.monatsband .tage > span {
    flex: 1 1 0; text-align: center; font-size: .68rem;
    font-variant-numeric: tabular-nums; color: var(--text-leise);
}
.monatsband .tage > span.heute { color: var(--rot); font-weight: 700; }

.monatsband .balken-monat { display: flex; height: 30px; }
.monatsband .vorher { background: var(--flaeche); border-right: 1px solid var(--linie); }
.monatsband .nachher {
    display: flex; align-items: center; padding-left: .6rem;
    font-size: .8rem; font-weight: 600; color: var(--weiss); white-space: nowrap; overflow: hidden;
}
.monatsband .nachher.bereit { background: var(--gruen); }
.monatsband .nachher.spaeter { background: var(--gelb); }
/* Nicht angebunden: schraffiert statt farbig - es ist kein Zustand, den ein
   Datum aufloest. */
.monatsband .nachher.gesperrt {
    background: repeating-linear-gradient(135deg, #f4f4f7 0 6px, #eceef4 6px 12px);
    color: var(--text-leise);
}

/* --- Naechste Schritte --------------------------------------------------- */
.schritte { border: 1px solid var(--linie); background: var(--weiss); padding: .2rem 1.3rem .4rem; }
.schritte .schritt {
    display: flex; align-items: baseline; gap: .8rem;
    padding: .6rem 0; border-bottom: 1px solid var(--linie);
}
.schritte .schritt:last-child { border-bottom: none; }
.schritte .nummer {
    flex: 0 0 1.2rem; font-size: .8rem; font-weight: 800; color: var(--rot);
    font-variant-numeric: tabular-nums;
}
.schritte .text { flex: 1 1 auto; }

/* --- Fusszeile ----------------------------------------------------------- */
.fuss {
    display: flex; flex-wrap: wrap; gap: 1.4rem;
    max-width: 76rem; margin: 0 auto; padding: 1rem 1.5rem 2rem;
    border-top: 1px solid var(--linie);
    font-size: .8rem; color: var(--text-leise);
}
.fuss .fassung { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
