@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&display=swap');

:root {
    --az-schwarz: #000000;
    --az-weiss: #ffffff;
    --az-grau-dunkel: #1a1a1a;
    --az-grau: #9d9d9c;
    --az-grau-hell: #f2f2f2;
    --az-grau-rand: #dcdcdc;
    --az-header-hoehe: 96px;
    --az-status-neu: #9d9d9c;
    --az-status-eingeplant: #5b7a9d;
    --az-status-in-arbeit: #000000;
    --az-status-extern: #b06a1e;
    --az-status-fertig: #2f7d4f;
    --az-status-ausgeliefert: #6b6b6b;
}

* { box-sizing: border-box; }

html {
    background: var(--az-schwarz);
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: "Roboto Condensed", Arial, Helvetica, sans-serif;
    background: var(--az-weiss);
    color: var(--az-schwarz);
    padding-top: var(--az-header-hoehe);
}

a { color: inherit; }

h1, h2, h3 { font-weight: 700; margin: 0 0 0.5em; }

.az-topbar {
    background: var(--az-grau-dunkel);
    color: var(--az-grau);
    font-size: 0.8rem;
    padding: 4px 16px;
    text-align: center;
}

.az-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--az-weiss);
    border-bottom: 1px solid var(--az-grau-rand);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
}

.az-marke {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--az-schwarz);
}

.az-marke img { height: 40px; }

.az-marke-text { display: flex; flex-direction: column; line-height: 1.1; }
.az-marke-text .haupt { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.03em; }
.az-marke-text .sub { font-weight: 400; font-size: 0.65rem; color: var(--az-grau); letter-spacing: 0.08em; }

.az-nav { display: flex; gap: 4px; align-items: center; }
.az-nav a {
    text-decoration: none;
    color: var(--az-schwarz);
    font-weight: 500;
    padding: 10px 14px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
}
.az-nav a:hover, .az-nav a.aktiv { background: var(--az-grau-hell); }

.az-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 8px;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.az-flash {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-left: 4px solid var(--az-schwarz);
    background: var(--az-grau-hell);
}
.az-flash.fehler { border-color: #a3312c; background: #fbeceb; }
.az-flash.erfolg { border-color: var(--az-status-fertig); background: #eaf5ee; }

.az-kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 28px; }
.az-kachel { background: var(--az-grau-hell); padding: 16px; border: 1px solid var(--az-grau-rand); }
.az-kachel .zahl { font-size: 2rem; font-weight: 700; display: block; }
.az-kachel .label { font-size: 0.8rem; color: var(--az-grau); text-transform: uppercase; letter-spacing: 0.03em; }

.az-btn {
    display: inline-block;
    background: var(--az-schwarz);
    color: var(--az-weiss);
    border: 1px solid var(--az-schwarz);
    padding: 10px 18px;
    text-decoration: none;
    font-family: inherit;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    min-height: 44px;
    line-height: 1.2;
}
.az-btn:hover { background: var(--az-grau-dunkel); }
.az-btn-sekundaer { background: var(--az-weiss); color: var(--az-schwarz); }
.az-btn-sekundaer:hover { background: var(--az-grau-hell); }
.az-btn-klein { padding: 6px 12px; font-size: 0.75rem; min-height: 38px; }

.az-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--az-weiss);
    border-radius: 2px;
}
.az-badge.neu { background: var(--az-status-neu); }
.az-badge.eingeplant { background: var(--az-status-eingeplant); }
.az-badge.in_arbeit { background: var(--az-status-in-arbeit); }
.az-badge.extern { background: var(--az-status-extern); }
.az-badge.fertig { background: var(--az-status-fertig); }
.az-badge.ausgeliefert { background: var(--az-status-ausgeliefert); }

table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--az-grau-rand); }
th { font-size: 0.75rem; text-transform: uppercase; color: var(--az-grau); letter-spacing: 0.03em; }
tr:hover td { background: var(--az-grau-hell); }

.az-tabelle-wrapper { overflow-x: auto; }

form.az-form { max-width: 560px; }
.az-feld { margin-bottom: 16px; }
.az-feld label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 0.9rem; }
.az-feld input, .az-feld select, .az-feld textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--az-grau-rand);
    font-family: inherit;
    font-size: 1rem;
    min-height: 44px;
}
.az-feld textarea { min-height: 90px; }
.az-feld-checkbox { display: flex; align-items: center; gap: 8px; }
.az-feld-checkbox input { width: auto; min-height: auto; }

.az-suchleiste { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.az-suchleiste input, .az-suchleiste select { padding: 10px; border: 1px solid var(--az-grau-rand); min-height: 44px; }

/* Zeitstrahl / Gantt */
.az-zeitstrahl-legende { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; font-size: 0.8rem; color: var(--az-grau); }
.az-zeitstrahl-legende span { display: inline-flex; align-items: center; gap: 6px; }
.az-zeitstrahl-legende .muster { width: 14px; height: 14px; display: inline-block; border: 1px solid var(--az-grau-rand); }
.az-zeitstrahl-legende .muster.laeuft { background: var(--az-schwarz); border-color: var(--az-schwarz); }
.az-zeitstrahl-legende .muster.abgeschlossen { background: var(--az-grau); border-color: var(--az-grau); }
.az-zeitstrahl-legende .muster.offen { background: linear-gradient(90deg, var(--az-schwarz), rgba(0,0,0,0)); border-color: var(--az-schwarz); }
.az-zeitstrahl-legende .muster.jetzt { background: #a3312c; border-color: #a3312c; width: 2px; }

.az-zeitstrahl-wrapper { overflow-x: auto; margin-bottom: 24px; }

.az-gantt { display: grid; grid-template-columns: 180px 1fr; min-width: 780px; border: 1px solid var(--az-grau-rand); }

.az-solo-zeitstrahl { min-width: 640px; border: 1px solid var(--az-grau-rand); }
.az-solo-zeitstrahl .az-gantt-kopf-zeile { border-right: none; }
.az-solo-zeitstrahl .az-gantt-lane { border-right: none; border-bottom: none; height: 56px; }
.az-solo-zeitstrahl .az-balken { top: 16px; height: 24px; }
.az-solo-zeitstrahl .az-balken-label { line-height: 56px; }

.az-gantt-eckfeld {
    position: sticky; left: 0; z-index: 3;
    background: var(--az-weiss);
    border-bottom: 1px solid var(--az-grau-rand);
    border-right: 1px solid var(--az-grau-rand);
}
.az-gantt-kopf-zeile {
    position: relative;
    height: 26px;
    border-bottom: 1px solid var(--az-grau-rand);
}
.az-gantt-kopf-zeile.mit-stunden { height: 40px; }
.az-tag-zelle {
    position: absolute;
    top: 0; bottom: 0;
    border-right: 1px solid var(--az-grau-rand);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--az-schwarz);
    padding: 3px 6px;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
}
.mit-stunden .az-tag-zelle { height: 22px; }
.az-tag-zelle .kw { color: var(--az-grau); font-weight: 400; margin-left: 4px; }
.az-stunden-marke {
    position: absolute;
    top: 22px; height: 18px;
    border-left: 1px solid var(--az-grau-rand);
    font-size: 0.6rem;
    color: var(--az-grau);
    padding: 1px 0 0 3px;
    box-sizing: border-box;
}

.az-gantt-name {
    position: sticky; left: 0; z-index: 2;
    background: var(--az-weiss);
    border-bottom: 1px solid var(--az-grau-rand);
    border-right: 1px solid var(--az-grau-rand);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 6px 12px 6px 0;
}
.az-gantt-name a { font-weight: 700; text-decoration: none; font-size: 0.9rem; }
.az-gantt-name .naechstes { font-size: 0.7rem; color: var(--az-grau); }

.az-gantt-lane {
    position: relative;
    height: 44px;
    border-bottom: 1px solid var(--az-grau-rand);
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

.az-balken {
    position: absolute;
    top: 12px; height: 20px;
    background: var(--az-grau);
    min-width: 3px;
    z-index: 1;
}
.az-balken.laeuft { background: var(--az-schwarz); }
.az-balken.offen {
    background: linear-gradient(90deg, var(--az-schwarz), rgba(0,0,0,0));
}

.az-balken-label {
    position: absolute;
    top: 0;
    line-height: 44px;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--az-schwarz);
    z-index: 1;
}
.az-balken-label .zeit { color: var(--az-grau); margin-left: 6px; }

.az-jetzt-linie {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: #a3312c;
    z-index: 2;
    pointer-events: none;
}

.az-frei-hinweis { color: var(--az-status-fertig); }

.az-vorschlagsliste { list-style: none; padding: 0; margin: 0 0 16px; border: 1px solid var(--az-grau-rand); }
.az-vorschlagsliste li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; border-bottom: 1px solid var(--az-grau-rand);
}
.az-vorschlagsliste li:last-child { border-bottom: none; }
.az-vorschlagsliste .frei { color: var(--az-status-fertig); font-weight: 500; }
.az-vorschlagsliste .belegt { color: var(--az-grau); }

.az-aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }

.az-reihenfolge-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--az-grau-rand);
    background: var(--az-weiss);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
}
.az-reihenfolge-btn:hover { background: var(--az-grau-hell); }
.az-reihenfolge-btn:disabled { opacity: 0.3; cursor: default; }
.az-reihenfolge-btn:disabled:hover { background: var(--az-weiss); }

.az-stammdaten { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 20px; margin-bottom: 20px; }
.az-stammdaten .label { font-size: 0.75rem; text-transform: uppercase; color: var(--az-grau); }
.az-stammdaten .wert { font-size: 1rem; }

/* Liefertermin-Karte (Hero) */
.az-liefertermin-karte {
    border: 1px solid var(--az-grau-rand);
    border-left: 5px solid var(--az-grau);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
    align-items: baseline;
}
.az-liefertermin-karte.ok { border-left-color: var(--az-status-fertig); }
.az-liefertermin-karte.gefahr { border-left-color: #a3312c; background: #fbeceb; }
.az-liefertermin-karte .lt-label { font-size: 0.75rem; text-transform: uppercase; color: var(--az-grau); width: 100%; }
.az-liefertermin-karte .lt-datum { font-size: 1.6rem; font-weight: 700; }
.az-liefertermin-karte .lt-rest { font-size: 0.95rem; color: var(--az-grau); }
.az-liefertermin-karte.gefahr .lt-rest { color: #a3312c; font-weight: 500; }
.az-liefertermin-karte .lt-hinweis { flex-basis: 100%; font-size: 0.85rem; color: var(--az-grau); margin-top: 4px; }
.az-liefertermin-karte.gefahr .lt-hinweis { color: #7a2521; }

/* Arbeitsgänge als vertikaler Stepper */
.az-stepper { list-style: none; padding: 0; margin: 0 0 8px; }
.az-step { display: flex; align-items: stretch; }
.az-step-marker { display: flex; flex-direction: column; align-items: center; margin-right: 16px; }
.az-step-kreis {
    flex-shrink: 0;
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 2px solid var(--az-grau-rand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
    color: var(--az-grau);
    background: var(--az-weiss);
}
.az-step-linie { flex: 1; width: 2px; background: var(--az-grau-rand); min-height: 16px; margin: 2px 0; }
.az-step:last-child .az-step-linie { display: none; }
.az-step.laeuft .az-step-kreis { background: var(--az-schwarz); border-color: var(--az-schwarz); color: var(--az-weiss); }
.az-step.fertig .az-step-kreis { background: var(--az-status-fertig); border-color: var(--az-status-fertig); color: var(--az-weiss); }
.az-step.fertig .az-step-linie { background: var(--az-status-fertig); }

.az-step-inhalt { flex: 1; padding-bottom: 28px; min-width: 0; }
.az-step-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.az-step-kopf strong { font-size: 1rem; }
.az-step-pfeile { margin-left: auto; display: flex; gap: 4px; }
.az-step-meta { font-size: 0.85rem; color: var(--az-grau); margin-bottom: 8px; }
.az-step-meta .termin { color: var(--az-schwarz); }
.az-step-aktionen { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Dauer-Eingabe: 3 Felder mit sichtbarer Einheit */
.az-dauer-eingabe { display: flex; gap: 10px; }
.az-dauer-feld { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.az-dauer-feld input { width: 64px; text-align: center; padding: 8px 4px; min-height: 40px; }
.az-dauer-feld span { font-size: 0.7rem; color: var(--az-grau); }

/* Aufklappbare Mini-Formulare (Starten/Anpassen/Neu anlegen) */
details.az-aufklappbar { margin-top: 6px; }
details.az-aufklappbar summary {
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 8px 0;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
details.az-aufklappbar summary::-webkit-details-marker { display: none; }
details.az-aufklappbar summary::before { content: "+"; font-weight: 700; }
details.az-aufklappbar[open] summary::before { content: "–"; }
details.az-aufklappbar .az-aufklappbar-inhalt { padding: 12px 16px; background: var(--az-grau-hell); margin-top: 4px; }

footer.az-footer { text-align: center; padding: 20px; color: var(--az-grau); font-size: 0.8rem; }

.az-karten-tabelle { display: none; }

@media (max-width: 640px) {
    .az-nav { display: none; position: fixed; top: var(--az-header-hoehe); left: 0; right: 0; background: var(--az-weiss); flex-direction: column; border-bottom: 1px solid var(--az-grau-rand); z-index: 99; }
    .az-nav.az-nav-offen { display: flex; }
    .az-nav a { padding: 14px 20px; width: 100%; border-bottom: 1px solid var(--az-grau-rand); }
    .az-menu-toggle { display: block; }

    .az-tabelle-karten thead { display: none; }
    .az-tabelle-karten tr { display: block; border: 1px solid var(--az-grau-rand); margin-bottom: 10px; padding: 8px; }
    .az-tabelle-karten tr:has(th) { display: none; }
    .az-tabelle-karten td { display: flex; justify-content: space-between; border-bottom: none; padding: 6px 4px; }
    .az-tabelle-karten td::before { content: attr(data-label); font-weight: 500; color: var(--az-grau); margin-right: 12px; }
}
