/*
 * Nordlicht Cockpit - Oberflaeche
 *
 * Handgeschrieben, keine Abhaengigkeit, kein Build-Schritt (Briefing
 * Abschnitt 8). Mobile zuerst: die Grundeinstellungen gelten fuer das
 * Handy, groessere Bildschirme bekommen ab 640px mehr Platz.
 */

:root {
    --grund:        #ffffff;
    --flaeche:      #f6f7f9;
    --flaeche-2:    #eceef2;
    --rahmen:       #d7dbe2;
    --rahmen-stark: #b3bac6;
    --text:         #1b1f27;
    --text-leise:   #5c6473;
    --akzent:       #1d4ed8;
    --akzent-dunkel:#1633a5;
    --akzent-hell:  #e8eeff;
    --ok:           #14682f;
    --ok-hell:      #e4f4e9;
    --warnung:      #8a5300;
    --warnung-hell: #fdf1dd;
    --fehler:       #a51b21;
    --fehler-hell:  #fdeaea;
    --fokus:        #b45309;

    --radius:   8px;
    --schrift:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                "Helvetica Neue", Arial, sans-serif;
    --schrift-fix: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    /* Kleinste Groesse fuer Tippziele am Handy. */
    --tippziel: 44px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --grund:        #14171d;
        --flaeche:      #1b1f27;
        --flaeche-2:    #232833;
        --rahmen:       #333a48;
        --rahmen-stark: #4c5568;
        --text:         #eceef2;
        --text-leise:   #a2abbb;
        --akzent:       #7ea2ff;
        --akzent-dunkel:#a6c0ff;
        --akzent-hell:  #1e2740;
        --ok:           #7bd39a;
        --ok-hell:      #17301f;
        --warnung:      #e0b071;
        --warnung-hell: #33260f;
        --fehler:       #f19a9d;
        --fehler-hell:  #351719;
        --fokus:        #fbbf24;
    }
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--schrift);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--flaeche);
    -webkit-text-size-adjust: 100%;
}

/* --- Tastaturfokus: immer sichtbar, nie wegoptimiert -------------------- */

:focus-visible {
    outline: 3px solid var(--fokus);
    outline-offset: 2px;
    border-radius: 3px;
}
/* Kein Fokusring bei reinen Mausklicks, aber immer bei Tastatur. */
:focus:not(:focus-visible) { outline: none; }

.sprungmarke {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 0.75rem 1rem;
    background: var(--akzent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.sprungmarke:focus {
    left: 0.5rem;
    top: 0.5rem;
}

/* --- Kopf --------------------------------------------------------------- */

.kopf {
    background: var(--grund);
    border-bottom: 1px solid var(--rahmen);
}
.kopf-innen {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.6rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
}
.marke {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    font-size: 1.02rem;
    letter-spacing: -0.01em;
}
.haupt-nav { flex: 1 1 100%; order: 3; }
.haupt-nav ul {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    /* overflow-x macht auch overflow-y wirksam und wuerde den Fokusring
       oben und unten abschneiden. Das Innenmass gibt ihm Platz, das
       negative Aussenmass nimmt die Verschiebung zurueck. */
    padding: 5px 0;
    margin: -5px 0;
    overflow-x: auto;
}
.haupt-nav a {
    display: block;
    padding: 0.55rem 0.8rem;
    min-height: var(--tippziel);
    display: flex;
    align-items: center;
    color: var(--text-leise);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    white-space: nowrap;
}
.haupt-nav a:hover { background: var(--flaeche-2); color: var(--text); }
.haupt-nav a[aria-current="page"] {
    background: var(--akzent-hell);
    color: var(--akzent-dunkel);
    font-weight: 600;
}
.kopf-person {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.person-name {
    color: var(--text-leise);
    text-decoration: none;
    padding: 0.35rem 0.4rem;
    border-radius: var(--radius);
}
a.person-name:hover { color: var(--text); background: var(--flaeche-2); text-decoration: underline; }
.abmelden-form { margin: 0; }

/* --- Inhalt ------------------------------------------------------------- */

.inhalt {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1rem;
}

.seiten-kopf {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.seiten-kopf h1 {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: -0.015em;
}
.seiten-kopf .anzahl { color: var(--text-leise); font-size: 0.9rem; }

h2 { font-size: 1.1rem; margin: 1.5rem 0 0.6rem; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }

.karte {
    background: var(--grund);
    border: 1px solid var(--rahmen);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}
.karte-schmal { max-width: 34rem; margin-inline: auto; }

.leer {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-leise);
    background: var(--grund);
    border: 1px dashed var(--rahmen);
    border-radius: var(--radius);
}

/* --- Meldungen ---------------------------------------------------------- */

.meldungen { max-width: 1180px; margin: 0.75rem auto 0; padding: 0 1rem; }
.meldung {
    margin: 0 0 0.5rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 0.92rem;
}
.meldung-ok      { background: var(--ok-hell);      border-color: var(--ok);      color: var(--ok); }
.meldung-warnung { background: var(--warnung-hell); border-color: var(--warnung); color: var(--warnung); }
.meldung-fehler  { background: var(--fehler-hell);  border-color: var(--fehler);  color: var(--fehler); }

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

.knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: var(--tippziel);
    padding: 0.5rem 1rem;
    border: 1px solid var(--akzent);
    border-radius: var(--radius);
    background: var(--akzent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    cursor: pointer;
}
.knopf:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); }

.knopf-zweit {
    background: var(--grund);
    color: var(--text);
    border-color: var(--rahmen-stark);
}
.knopf-zweit:hover { background: var(--flaeche-2); border-color: var(--text-leise); }

.knopf-schlicht {
    background: transparent;
    color: var(--text-leise);
    border-color: transparent;
    font-weight: 500;
    padding: 0.4rem 0.6rem;
}
.knopf-schlicht:hover { background: var(--flaeche-2); color: var(--text); border-color: transparent; }

.knopf-gefahr { border-color: var(--fehler); background: var(--grund); color: var(--fehler); }
.knopf-gefahr:hover { background: var(--fehler-hell); border-color: var(--fehler); color: var(--fehler); }

.knopf-reihe { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

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

.feld { margin-bottom: 0.9rem; }
.feld label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
    font-size: 0.88rem;
}
.feld .hinweis {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.82rem;
    color: var(--text-leise);
}
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="search"],
select, textarea {
    width: 100%;
    min-height: var(--tippziel);
    padding: 0.5rem 0.65rem;
    font: inherit;
    font-size: 16px; /* verhindert das Hineinzoomen auf iOS */
    color: var(--text);
    background: var(--grund);
    border: 1px solid var(--rahmen-stark);
    border-radius: var(--radius);
}
textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: none; }

.feld-reihe { display: grid; gap: 0.9rem; }
@media (min-width: 640px) {
    .feld-reihe-2 { grid-template-columns: 1fr 1fr; }
    .feld-reihe-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.ankreuz {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: var(--tippziel);
}
.ankreuz input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin: 0; }
.ankreuz label { margin: 0; font-weight: 500; }

/* --- Filterleiste ------------------------------------------------------- */

.filter {
    background: var(--grund);
    border: 1px solid var(--rahmen);
    border-radius: var(--radius);
    padding: 0.85rem;
    margin-bottom: 1rem;
}
/* Am Handy eingeklappt, damit die Liste nicht hinter den Filtern liegt.
   Auf breiten Bildschirmen ist der Aufklapper immer offen und die
   Zusammenfassung verschwindet - dort ist Platz genug. */
.filter-klapp > summary {
    cursor: pointer;
    min-height: var(--tippziel);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.92rem;
    list-style: none;
}
.filter-klapp > summary::-webkit-details-marker { display: none; }
.filter-klapp > summary::before {
    content: "▸";
    color: var(--text-leise);
    transition: none;
}
.filter-klapp[open] > summary::before { content: "▾"; }
.filter-klapp > summary:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

/* Ab 640px ist Platz genug: der Aufklapper verschwindet, die Filter
   stehen offen. Das Skript klappt nur unterhalb dieser Breite zu. */
@media (min-width: 640px) {
    .filter-klapp > summary { display: none; }
}

.filter-felder { display: grid; gap: 0.7rem; }
@media (min-width: 640px)  { .filter-felder { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px)  { .filter-felder { grid-template-columns: repeat(5, 1fr); } }
.filter .feld { margin-bottom: 0; }
.filter-knoepfe { margin-top: 0.7rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }

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

.kunden-gruppe { margin-bottom: 1.5rem; }
.kunden-gruppe > h2 {
    margin: 0 0 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--rahmen);
    font-size: 1.05rem;
}
.kunden-gruppe > h2 a { color: inherit; text-decoration: none; }
.kunden-gruppe > h2 a:hover { text-decoration: underline; }

.projekt-liste { list-style: none; margin: 0; padding: 0; }

.projekt-karte {
    background: var(--grund);
    border: 1px solid var(--rahmen);
    border-radius: var(--radius);
    padding: 0.8rem;
    margin-bottom: 0.5rem;
}
.projekt-karte.ist-teilprojekt {
    margin-left: 0;
    border-left: 3px solid var(--rahmen-stark);
    background: var(--flaeche);
}
@media (min-width: 640px) {
    .projekt-karte.ist-teilprojekt { margin-left: 1.5rem; }
}

.projekt-titel {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    align-items: baseline;
    margin-bottom: 0.3rem;
}
.projekt-titel a {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    font-size: 1rem;
}
.projekt-titel a:hover { color: var(--akzent); text-decoration: underline; }

.projekt-zeilen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    font-size: 0.85rem;
    color: var(--text-leise);
}
.projekt-beschreibung {
    margin: 0.4rem 0 0;
    font-size: 0.88rem;
    color: var(--text-leise);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Marken (Status, Typ, Rolle) ---------------------------------------- */

.marke-klein {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    border: 1px solid var(--rahmen-stark);
    color: var(--text-leise);
    background: var(--flaeche);
}
.status-laeuft { background: var(--ok-hell);      color: var(--ok);      border-color: var(--ok); }
.status-block  { background: var(--fehler-hell);  color: var(--fehler);  border-color: var(--fehler); }
.status-wartet { background: var(--warnung-hell); color: var(--warnung); border-color: var(--warnung); }
.status-fertig { background: var(--flaeche-2);    color: var(--text-leise); }
.status-idee, .status-ruht { background: var(--flaeche); color: var(--text-leise); }

.prio-hoch { background: var(--fehler-hell); color: var(--fehler); border-color: var(--fehler); }

.rolle-marke {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--flaeche-2);
    color: var(--text-leise);
    border: 1px solid var(--rahmen);
}
.rolle-inhaber { background: var(--akzent-hell); color: var(--akzent-dunkel); border-color: var(--akzent); }

.warn-marke { background: var(--warnung-hell); color: var(--warnung); border-color: var(--warnung); }

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

.aufgaben-liste { list-style: none; margin: 0; padding: 0; }

.aufgabe {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--rahmen);
}
.aufgabe:last-child { border-bottom: none; }

.aufgabe-haken { flex: none; padding-top: 0.05rem; }
.aufgabe-haken button {
    width: var(--tippziel);
    height: var(--tippziel);
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-leise);
    margin: -0.5rem 0 -0.5rem -0.5rem;
}
.aufgabe-haken .kasten {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--rahmen-stark);
    border-radius: 4px;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    line-height: 1;
    color: transparent;
}
.aufgabe-haken button:hover .kasten { border-color: var(--akzent); }
.aufgabe.ist-erledigt .kasten { background: var(--ok); border-color: var(--ok); color: #fff; }

.aufgabe-koerper { flex: 1 1 auto; min-width: 0; }
.aufgabe-text { display: block; }
.aufgabe.ist-erledigt .aufgabe-text { text-decoration: line-through; color: var(--text-leise); }
.aufgabe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.8rem;
    margin-top: 0.2rem;
    font-size: 0.82rem;
    color: var(--text-leise);
}
.faellig-ueberfaellig { color: var(--fehler); font-weight: 600; }
.faellig-heute        { color: var(--warnung); font-weight: 600; }
.ohne-zustaendigen    { color: var(--warnung); font-weight: 600; }

/* --- Tabellen: ab 640px Tabelle, darunter Karten ------------------------ */

.tabelle-huelle { overflow-x: auto; }
table.liste {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
table.liste th, table.liste td {
    padding: 0.55rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--rahmen);
    vertical-align: top;
}
table.liste th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-leise);
    border-bottom: 2px solid var(--rahmen);
}
table.liste tbody tr:hover { background: var(--flaeche); }
table.liste a { color: var(--akzent); font-weight: 600; }

@media (max-width: 639px) {
    table.liste, table.liste tbody, table.liste tr, table.liste td { display: block; width: 100%; }
    table.liste thead { display: none; }
    table.liste tr {
        background: var(--grund);
        border: 1px solid var(--rahmen);
        border-radius: var(--radius);
        margin-bottom: 0.5rem;
        padding: 0.6rem;
    }
    table.liste td {
        border: none;
        padding: 0.2rem 0;
        display: flex;
        gap: 0.75rem;
        justify-content: space-between;
    }
    /* Spaltenueberschrift als Beschriftung vor den Wert stellen. */
    table.liste td::before {
        content: attr(data-spalte);
        font-size: 0.78rem;
        font-weight: 600;
        color: var(--text-leise);
        flex: none;
    }
    table.liste td:empty { display: none; }
}

/* --- Detailseiten ------------------------------------------------------- */

.daten-liste { margin: 0; display: grid; gap: 0.5rem 1rem; }
@media (min-width: 640px) { .daten-liste { grid-template-columns: max-content 1fr; } }
.daten-liste dt { font-size: 0.82rem; font-weight: 600; color: var(--text-leise); }
.daten-liste dd { margin: 0 0 0.4rem; }
@media (min-width: 640px) { .daten-liste dd { margin-bottom: 0; } }

.brotkrumen {
    font-size: 0.85rem;
    color: var(--text-leise);
    margin-bottom: 0.5rem;
}
.brotkrumen a { color: var(--text-leise); }

.protokoll { font-size: 0.82rem; color: var(--text-leise); }
.protokoll li { margin-bottom: 0.35rem; }
.protokoll code {
    font-family: var(--schrift-fix);
    font-size: 0.78rem;
    background: var(--flaeche-2);
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    word-break: break-word;
}

.nur-inhaber-hinweis {
    font-size: 0.82rem;
    color: var(--text-leise);
    border-left: 3px solid var(--rahmen-stark);
    padding-left: 0.6rem;
}

/* --- Fuss --------------------------------------------------------------- */

.fuss {
    max-width: 1180px;
    margin: 2rem auto 0;
    padding: 1rem;
    border-top: 1px solid var(--rahmen);
    font-size: 0.82rem;
    color: var(--text-leise);
}
.fuss p { margin: 0; display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* --- System ------------------------------------------------------------- */

.schritt-liste { list-style: none; margin: 0; padding: 0; }
.schritt-liste li {
    display: flex;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--rahmen);
    align-items: baseline;
}
.schritt-marke {
    flex: none;
    font-family: var(--schrift-fix);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}
.schritt-ok    { background: var(--ok-hell);     color: var(--ok); }
.schritt-fehler{ background: var(--fehler-hell); color: var(--fehler); }
.schritt-titel { font-weight: 600; flex: none; }
.schritt-text  { color: var(--text-leise); font-size: 0.9rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
