/* ==========================================================================
   FristenManagement – Layout & Komponenten (layout.css)
   Verwendet ausschließlich Tokens aus theme.css.
   Mobile-first: Basis-Styles gelten fürs Handy, ab 720px Desktop-Raster.
   ========================================================================== */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--schrift);
    font-size: 15px;
    line-height: 1.5;
}

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

/* --- Kopfzeile ---------------------------------------------------------- */
.kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    max-width: 1080px;
    margin: 0 auto;
}

.logo {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text);
}
.logo b { color: var(--akzent); font-weight: 600; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid var(--rand-stark);
    background: var(--karte);
    color: var(--text);
    padding: 7px 14px;
    cursor: pointer;
}
.btn:hover { background: var(--karte-hover); }

.btn-primaer {
    background: var(--akzent);
    border-color: var(--akzent);
    color: var(--auf-akzent);
}
.btn-primaer:hover { background: var(--akzent-hover); }

/* --- Reiter (Tabs) ------------------------------------------------------ */
.reiter {
    display: flex;
    gap: 2px;
    padding: 10px 14px 0;
    border-bottom: 1px solid var(--rand-fein);
    overflow-x: auto;
}
.reiter button {
    font: inherit;
    font-size: 13px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-3);
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
}
.reiter button.aktiv {
    color: var(--akzent);
    font-weight: 600;
    border-bottom-color: var(--akzent);
}

/* --- Mappe (großer Kartencontainer, GF-Ansicht) ------------------------- */
.mappe {
    background: var(--karte);
    border: 1px solid var(--rand-stark);
    border-radius: var(--radius-gross);
    max-width: 1080px;
    margin: 0 auto 24px;
    overflow: hidden;
}

.monat {
    margin: 0;
    padding: 10px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--akzent);
}

/* --- Fristzeile / Fristkarte -------------------------------------------- */
/* BASIS = HANDY: alles untereinander gestapelt, eine Spalte.
   Ab 600px (Tablet) und 900px (Desktop) wird daraus eine Rasterzeile,
   siehe Breakpoints am Ende dieser Datei.                                  */
.frist {
    padding: 12px 16px;
    border-top: 1px solid var(--rand-fein);
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
}

.frist > * { min-width: 0; }
.frist .titel { margin: 0; font-weight: 600; font-size: 14px;
                overflow-wrap: anywhere; }
.frist .meta  { margin: 0; font-size: 12px; color: var(--text-3);
                overflow-wrap: anywhere; }

/* Fälligkeit: auf dem Handy mit Beschriftung, da es keinen Spaltenkopf gibt */
.frist .faellig { font-size: 12px; color: var(--text-2); }
.frist .faellig::before { content: "Fällig: "; color: var(--text-3); }

.frist .gesehen {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
}
.frist .gesehen.leer { color: var(--text-4); }

/* Aktionsbereich (Ampel, Erledigt, Löschen) */
.frist .aktionen {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

/* Mitarbeiter-Ansicht: einzelne Karten statt Mappenzeilen */
.frist-karte {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    margin: 0 auto 8px;
    max-width: 1080px;
}

/* --- Status-Pills -------------------------------------------------------- */
/* Kurze Etiketten (Ampelstufen). Für ganze Sätze .hinweis verwenden!        */
.pill {
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    padding: 3px 12px;
    text-align: center;
    white-space: nowrap;
}
.pill-rot   { background: var(--rot-flaeche);   color: var(--rot-text); }
.pill-gelb  { background: var(--gelb-flaeche);  color: var(--gelb-text); }
.pill-gruen { background: var(--gruen-flaeche); color: var(--gruen-text); }

/* Eskalations-Hinweis ("Jetzt: Sofort") */
.pill-eskaliert {
    background: var(--akzent-flaeche);
    color: var(--akzent);
}

/* --- Hinweisboxen (ganze Sätze: Fehler, Erfolg, Warnung) ----------------- */
/* Im Gegensatz zu .pill linksbündig, mit normalem Radius und Zeilenumbruch */
.hinweis {
    display: block;
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
    border-radius: var(--radius);
    padding: 10px 12px;
    margin: 0;
}
.hinweis-rot   { background: var(--rot-flaeche);   color: var(--rot-text); }
.hinweis-gelb  { background: var(--gelb-flaeche);  color: var(--gelb-text); }
.hinweis-gruen { background: var(--gruen-flaeche); color: var(--gruen-text); }

/* --- Kenntnisnahme-Badges ------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
}
.badge-ok {
    background: var(--gruen-flaeche);
    color: var(--gruen-text);
}
.badge-offen {
    background: var(--bg);
    color: var(--text-4);
    border: 1px dashed var(--rand-stark);
}

/* --- Kenntnisnahme-Haken in der Spalte "Gesehen" -------------------------- */
.kchk {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    font-size: 12px;
    color: var(--text-2);
    cursor: pointer;
    white-space: nowrap;
}
.kchk input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--akzent);
    cursor: pointer;
}
.kchk:hover { color: var(--akzent); }

/* Bereits zur Kenntnis genommen – Zustand, nicht mehr bedienbar */
.kchk-ok {
    color: var(--gruen-text);
    font-weight: 600;
    cursor: default;
}
.kchk-ok:hover { color: var(--gruen-text); }
.kchk-ok input { cursor: default; }

/* --- Kennzahlkacheln ------------------------------------------------------ */
.kacheln {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-width: 1080px;
    margin: 0 auto 12px;
}
.kachel {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 8px 12px;
}
.kachel p  { margin: 0; }
.kachel .label { font-size: 11px; color: var(--text-3); }
.kachel .wert  { font-size: 20px; font-weight: 600; }

/* --- Formulare ------------------------------------------------------------ */
input, select, textarea {
    font: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--karte);
    border: 1px solid var(--rand-stark);
    border-radius: 6px;
    padding: 8px 10px;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--akzent);
    outline-offset: 1px;
    border-color: var(--akzent);
}
label { font-size: 12px; color: var(--text-3); display: block;
        margin: 12px 0 4px; }

/* --- Formularraster (Verwaltung, Admin) ---------------------------------
   Basis Handy: alles untereinander. Ab 600px mehrspaltig, siehe unten.    */
.formraster {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.formraster > button { width: 100%; justify-content: center; }

/* Einzeilige Eingabe mit Knopf daneben (z. B. neue Firma) */
.eingabezeile {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.eingabezeile input { flex: 1 1 180px; }

/* ==========================================================================
   BREAKPOINTS

   Basis (< 600px)  Handy:    alles einspaltig, Kopfzeile zweizeilig
   ab 600px         Tablet:   Fristen als Rasterzeile, Formulare mehrspaltig
   ab 900px         Desktop:  volle Spaltenbreiten wie in den Entwürfen
   ========================================================================== */

/* --- Handy: Kopfzeile in zwei Zeilen ------------------------------------ */
@media (max-width: 599.98px) {
    .kopf {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 16px;
    }
    .kopf > div {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }
    .mappe { border-radius: 10px; }
    .monat { padding-top: 12px; }
}

/* --- Ab 600px: Rasterzeile und mehrspaltige Formulare ------------------- */
@media (min-width: 600px) {
    .spaltenkopf {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 92px 124px 92px;
        gap: 0 10px;
        padding: 8px 16px 6px;
        font-size: 11px;
        color: var(--text-3);
        border-bottom: 1px solid var(--rand-fein);
        max-width: 1080px;
        margin: 0 auto;
    }
    .frist {
        grid-template-columns: minmax(0, 1fr) 92px 124px 92px;
        gap: 0 10px;
        align-items: center;
        padding: 10px 16px;
    }
    .frist > div:first-child { display: flex; flex-direction: column; }
    .frist .faellig::before { content: none; }
    .frist .faellig { font-size: 13px; }
    .frist .aktionen {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
        margin-top: 0;
    }

    .formraster { grid-template-columns: 2fr 1fr 1fr auto; }
    .formraster-person { grid-template-columns: 1fr 1.4fr 1fr auto; }
    .formraster > button { width: auto; }

    .kacheln { grid-template-columns: repeat(4, 1fr); }
}

/* --- Ab 900px: volle Spaltenbreiten ------------------------------------- */
@media (min-width: 900px) {
    .spaltenkopf,
    .frist {
        grid-template-columns: minmax(0, 1fr) 100px 140px 100px;
    }
}

/* Spaltenkopf ohne Rasterzeile ausblenden (Handy) */
@media (max-width: 599.98px) {
    .spaltenkopf { display: none; }
}
