/* MietMan - Oberflaeche */

:root {
    --grund: #f4f6f9;
    --karte: #ffffff;
    --rand: #dbe1ea;
    --text: #1d2733;
    --leise: #66727f;
    --haupt: #1f6feb;
    --haupt-dunkel: #1858bd;
    --gut: #1d7a4a;
    --warn: #a86b00;
    --fehler: #c0392b;
    --schatten: 0 1px 3px rgba(20, 30, 45, .09), 0 4px 14px rgba(20, 30, 45, .05);
    --radius: 10px;
}

* { box-sizing: border-box; }

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

h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
a { color: var(--haupt); }

.leise { color: var(--leise); font-size: .87rem; }
.mittig { text-align: center; }
.rechts { text-align: right; }
.abstand { margin-top: 1rem; }
.versteckt { display: none !important; }

/* --- Kopfzeile --- */

.kopf {
    background: var(--karte);
    border-bottom: 1px solid var(--rand);
    position: sticky;
    top: 0;
    z-index: 20;
}
.kopf-inhalt {
    max-width: 1180px;
    margin: 0 auto;
    padding: .6rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.marke { font-weight: 700; font-size: 1.1rem; }
.marke .version { font-weight: 400; color: var(--leise); font-size: .8rem; margin-left: .35rem; }
.kopf .schieber { margin-left: auto; }

.reiter { display: flex; gap: .25rem; flex-wrap: wrap; }
.reiter button {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: .5rem .8rem;
    font: inherit;
    color: var(--leise);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
}
.reiter button:hover { background: var(--grund); color: var(--text); }
.reiter button.aktiv { color: var(--haupt); border-bottom-color: var(--haupt); font-weight: 600; }

main { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }

/* --- Bausteine --- */

.karte {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    padding: 1.1rem;
    margin-bottom: 1.1rem;
}

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=search], input[type=tel], input[type=date], select, textarea {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--rand);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--haupt);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, .15);
}
textarea { resize: vertical; min-height: 70px; }

.feld { margin-bottom: .8rem; }
.raster { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

button, .knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1rem;
    border: 1px solid var(--rand);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .knopf:hover { background: var(--grund); }
button:disabled { opacity: .55; cursor: not-allowed; }

.haupt-knopf { background: var(--haupt); border-color: var(--haupt); color: #fff; font-weight: 600; }
.haupt-knopf:hover { background: var(--haupt-dunkel); }
.gefahr { color: var(--fehler); border-color: #eccac5; }
.gefahr:hover { background: #fdf1ef; }
.klein { padding: .3rem .6rem; font-size: .85rem; }

.knopfreihe { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Auge im Passwortfeld */
.passwort-feld { position: relative; }
.passwort-feld input { padding-right: 2.6rem; }
.passwort-feld .auge {
    position: absolute;
    right: .3rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    padding: .35rem .5rem;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}
.passwort-feld .auge:hover { background: var(--grund); border-radius: 6px; }

/* --- Meldungen --- */

.meldung {
    padding: .7rem .9rem;
    border-radius: 8px;
    margin-bottom: .9rem;
    border: 1px solid;
    font-size: .92rem;
    white-space: pre-line;
}
.meldung.gut    { background: #eaf7f0; border-color: #b8e2cb; color: var(--gut); }
.meldung.warn   { background: #fdf5e5; border-color: #f0dcae; color: var(--warn); }
.meldung.fehler { background: #fdeeec; border-color: #f2c4bd; color: var(--fehler); }
.meldung.info   { background: #eaf1fd; border-color: #c2d6f8; color: var(--haupt-dunkel); }

/* --- Tabellen --- */

.tabelle-rahmen { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--rand); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--leise); }
tbody tr:hover { background: #fafbfd; }

.plakette {
    display: inline-block;
    padding: .1rem .45rem;
    border-radius: 20px;
    font-size: .74rem;
    font-weight: 600;
    border: 1px solid;
    white-space: nowrap;
}
/* --- Status --- */

.p-entwurf    { background: #eef2f7; border-color: #d5dde7; color: #56626f; }
.p-gueltig    { background: #eaf7f0; border-color: #b8e2cb; color: var(--gut); }
.p-ersetzt    { background: #f4f1fa; border-color: #dcd3ee; color: #6b5a92; }
.p-storniert  { background: #fdeeec; border-color: #f2c4bd; color: var(--fehler); }
.p-test       { background: #fdf5e5; border-color: #f0dcae; color: var(--warn); }

tr.klickbar { cursor: pointer; }
.nowrap { white-space: nowrap; }

/* --- Vertragsformular --- */

.haken { display: flex; align-items: center; gap: .45rem; font-weight: 400; font-size: .92rem; cursor: pointer; }
.haken input { width: auto; margin: 0; }

.unterkarte {
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: .9rem;
    background: #fbfcfe;
    margin-bottom: .8rem;
}

.mieter-kasten {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .8rem;
    flex-wrap: wrap;
    border: 1px solid #b8e2cb;
    background: #f3fbf7;
    border-radius: var(--radius);
    padding: .7rem .9rem;
    margin-bottom: .8rem;
}

.treffer-liste { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .8rem; }
.treffer { justify-content: flex-start; text-align: left; flex-wrap: wrap; gap: .1rem .6rem; }

.feld.markiert input, .feld.markiert select { border-color: var(--fehler); background: #fff8f7; }
input.fehlt { border-color: var(--warn); background: #fffbf2; }

.betraege {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .6rem;
    margin-bottom: .8rem;
}
.betraege > div {
    border: 1px solid var(--rand);
    border-radius: 8px;
    padding: .5rem .7rem;
    display: flex;
    flex-direction: column;
}
.betraege b { font-size: 1.1rem; }
.betraege .leise { font-size: .78rem; }

.meldung ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* --- Belegungsplan --- */

.legende { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .82rem; color: var(--leise); margin-bottom: .6rem; }
.legende i { display: inline-block; width: 1.1rem; height: .7rem; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }

/* Nur der Plan scrollt seitlich, nie die ganze Seite. */
.plan-rahmen { overflow-x: auto; border: 1px solid var(--rand); border-radius: 8px; margin-bottom: .6rem; }
.plan { position: relative; font-size: .78rem; }
.plan-zeile { display: flex; border-bottom: 1px solid var(--rand); }
.plan-zeile:last-child { border-bottom: none; }
.plan-zeile.gesperrt .plan-zimmer { color: var(--leise); text-decoration: line-through; }
.plan-zimmer {
    position: sticky; left: 0; z-index: 3;
    flex: 0 0 70px; width: 70px;
    background: var(--karte);
    border-right: 1px solid var(--rand);
    padding: .5rem .45rem;
    display: flex; align-items: center;
}
.plan-spur { position: relative; height: 38px; flex: 0 0 auto; cursor: copy; }
.plan-kopf .plan-spur { height: 46px; cursor: default; }
.plan-kopf .plan-zimmer { background: #f7f9fc; }
.plan-tag {
    position: absolute; top: 0; bottom: 0; width: 26px;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    padding-bottom: 3px; color: var(--leise); line-height: 1.1;
    border-left: 1px solid #eef1f5;
}
.plan-tag b { color: var(--text); font-weight: 600; }
.plan-tag small { font-size: .66rem; }
.plan-tag.we { background: #f4f6f9; }
.plan-tag.heute b { color: #fff; background: var(--haupt); border-radius: 50%; width: 19px; text-align: center; }
.plan-monat { position: absolute; top: 2px; left: 2px; white-space: nowrap; font-size: .7rem; color: var(--text); font-weight: 600; }
.plan-we { position: absolute; top: 0; bottom: 0; background: #f7f8fb; }
.plan-linie { position: absolute; top: 0; bottom: 0; width: 0; z-index: 2; pointer-events: none; }
.plan-linie.heute { border-left: 2px solid var(--haupt); }
.plan-linie.bau { border-left: 2px dashed var(--fehler); }

.plan-balken {
    position: absolute; top: 5px; height: 28px; z-index: 1;
    padding: 0 .4rem; border-radius: 6px;
    font-size: .74rem; line-height: 26px;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    display: block; text-align: left; justify-content: flex-start;
    cursor: pointer;
}
.bl-gueltig      { background: #2e8b57; border: 1px solid #237045; color: #fff; }
.bl-entwurf      { background: #eef2f7; border: 1px dashed #8a97a6; color: #3d4955; }
.bl-test         { background: repeating-linear-gradient(135deg, #fdf0d2 0 6px, #f7e0a8 6px 12px); border: 1px solid #e0b650; color: #7a5200; }
.bl-reservierung { background: #dbe8fd; border: 1px solid #7aa7ef; color: #1b4f9c; }
.bl-sperre       { background: repeating-linear-gradient(135deg, #d9dde3 0 6px, #c3c9d1 6px 12px); border: 1px solid #99a2ae; color: #2f3842; }
.bl-heute-muster { border-left: 2px solid var(--haupt); height: .9rem !important; width: 0 !important; border-radius: 0 !important; }
.bl-bau-muster   { border-left: 2px dashed var(--fehler); height: .9rem !important; width: 0 !important; border-radius: 0 !important; }
.plan-balken.bl-gueltig:hover { background: #237045; }

.belegungsliste { display: flex; flex-direction: column; gap: .3rem; }
.beleg-eintrag {
    display: grid; grid-template-columns: .8rem 3.2rem auto 1fr; gap: .5rem; align-items: center;
    justify-content: stretch; text-align: left; padding: .45rem .6rem; font-size: .88rem;
}
.beleg-marke { width: .8rem; height: .8rem; border-radius: 3px; }
.klein-auswahl { width: auto; padding: .3rem .5rem; font-size: .85rem; }

/* --- Verwaltung --- */

.unterreiter { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.unterreiter button.aktiv { background: var(--haupt); border-color: var(--haupt); color: #fff; }

.punkt { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; }
.punkt.an { background: var(--gut); }
.punkt.aus { background: #c3ccd7; }

code, .kode {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: .86rem;
    background: #eef1f6;
    padding: .12rem .35rem;
    border-radius: 5px;
    word-break: break-all;
}
pre.kode { display: block; padding: .7rem .8rem; overflow-x: auto; white-space: pre-wrap; }

/* --- Anmeldeseite --- */

.anmeldung { max-width: 420px; margin: 8vh auto; padding: 0 1rem; }
.anmeldung .marke { font-size: 1.6rem; text-align: center; margin-bottom: .2rem; }
.anmeldung .untertitel { text-align: center; color: var(--leise); margin-bottom: 1.4rem; }

@media (max-width: 640px) {
    .beleg-eintrag { grid-template-columns: .8rem 3.2rem 1fr; }
    .beleg-eintrag > span:last-child { grid-column: 2 / -1; }

    /* Vertragsliste als Karten statt Tabelle - sonst bricht die Nummer
       zeichenweise um und der Rest liegt rechts ausserhalb des Bildschirms. */
    #vertrag-tabelle thead { display: none; }
    #vertrag-tabelle tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: .1rem .6rem;
        padding: .6rem .2rem;
        border-bottom: 1px solid var(--rand);
    }
    #vertrag-tabelle td { border: none; padding: 0; text-align: left; }
    #vertrag-tabelle td:nth-child(1) { grid-column: 1; }
    #vertrag-tabelle td:nth-child(6) { grid-column: 2; grid-row: 1; text-align: right; }
    #vertrag-tabelle td:nth-child(2), #vertrag-tabelle td:nth-child(3),
    #vertrag-tabelle td:nth-child(4) { grid-column: 1 / -1; }
    #vertrag-tabelle td:nth-child(5), #vertrag-tabelle td:nth-child(7) { grid-column: auto; }
    #vertrag-tabelle td[colspan] { grid-column: 1 / -1; }

    .kopf-inhalt { padding: .5rem .7rem; }
    main { padding: .9rem .7rem 3rem; }
    .karte { padding: .9rem; }
}
