* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f4f6f9;
    color: #1c2733;
}

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: #fff;
    padding: 2rem 2.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    width: min(90vw, 22rem);
}
.login-box h1 { margin: 0 0 .25rem; font-size: 1.3rem; }
.login-box p { margin: 0 0 1rem; color: #5a6a7a; }
.login-box input {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid #c6d0da;
    border-radius: 6px;
    margin-bottom: .8rem;
    font-size: 1rem;
}
.login-box button {
    width: 100%;
    padding: .6rem;
    background: #1f3864;
    color: #fff;
    border: 0;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}

/* ---------- Kopf ---------- */
.kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1f3864;
    color: #fff;
    padding: .7rem 1.2rem;
}
.kopf h1 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.demo-badge {
    background: #e8a93c;
    color: #3a2a00;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    margin-right: 1rem;
}
.logout { color: #c8d4e8; font-size: .9rem; text-decoration: none; }
.logout:hover { color: #fff; }

/* ---------- Layout ---------- */
.layout {
    display: grid;
    grid-template-columns: 20rem 1fr;
    gap: 1.2rem;
    padding: 1.2rem;
    max-width: 75rem;
    margin: 0 auto;
}
@media (max-width: 50rem) {
    .layout { grid-template-columns: 1fr; }
}

/* ---------- Seitenleiste ---------- */
.seitenleiste {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    padding: 1rem;
    align-self: start;
}
#add-form { display: flex; gap: .5rem; }
#add-form input {
    flex: 1;
    min-width: 0;
    padding: .55rem .7rem;
    border: 1px solid #c6d0da;
    border-radius: 6px;
    font-size: .95rem;
}
#add-form button {
    padding: .55rem .8rem;
    background: #1f3864;
    color: #fff;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.firmen-liste { list-style: none; margin: 1rem 0 0; padding: 0; }
.firma {
    display: flex;
    align-items: stretch;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: .4rem;
    border: 1px solid #e2e8ee;
}
.firma.aktiv { border-color: #1f3864; background: #eef2fa; }
.firma-btn {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    text-align: left;
    background: none;
    border: 0;
    padding: .55rem .7rem;
    cursor: pointer;
    font: inherit;
}
.firma-btn:hover { background: #f0f4f9; }
.firma-fnr { font-weight: 600; font-size: .9rem; }
.firma-name {
    font-size: .82rem;
    color: #4a5a6a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.firma-name.unbekannt { color: #9aa8b5; font-style: italic; }
.firma-del {
    background: none;
    border: 0;
    color: #b0bcc8;
    cursor: pointer;
    padding: 0 .7rem;
    font-size: .9rem;
}
.firma-del:hover { color: #c0392b; }

/* ---------- Inhalt ---------- */
.inhalt {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    padding: 1.4rem 1.6rem;
    min-height: 24rem;
    min-width: 0; /* breite Tabellen scrollen im tab-wrap statt das Grid zu sprengen */
}
.hinweis { color: #7a8896; }
.hinweis.gross, .fehler.gross { margin: 4rem auto; text-align: center; max-width: 30rem; }
.fehler { color: #c0392b; }
.demo-hinweis {
    background: #fdf3dd;
    border: 1px solid #ecd49a;
    color: #6b5312;
    border-radius: 8px;
    padding: .6rem .9rem;
    font-size: .88rem;
}

.firma-kopf h2 { margin: .6rem 0 .15rem; font-size: 1.45rem; color: #1f3864; }
.untertitel { margin: 0 0 .8rem; color: #5a6a7a; }

.aktionen { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.btn {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: 6px;
    border: 1px solid #c6d0da;
    background: #fff;
    color: #1c2733;
    text-decoration: none;
    font-size: .92rem;
    cursor: pointer;
}
.btn:hover { background: #f0f4f9; }
.btn.primaer { background: #1e7e34; border-color: #1e7e34; color: #fff; font-weight: 600; }
.btn.primaer:hover { background: #24963e; }
.cache-hinweis { font-size: .8rem; color: #8a97a4; }

.sektion {
    margin: 1.4rem 0 .5rem;
    padding: .35rem .6rem;
    background: #d9e2f3;
    color: #1f3864;
    border-radius: 6px;
    font-size: .95rem;
}

.stammdaten {
    display: grid;
    grid-template-columns: 14rem 1fr;
    gap: .25rem .8rem;
    margin: 0;
}
.stammdaten dt { font-weight: 600; font-size: .9rem; padding: .15rem 0; }
.stammdaten dd { margin: 0; font-size: .93rem; padding: .15rem 0; overflow-wrap: anywhere; }
@media (max-width: 40rem) {
    .stammdaten { grid-template-columns: 1fr; }
    .stammdaten dd { margin-bottom: .4rem; }
}

.tab-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { border: 1px solid #dee5ec; padding: .45rem .6rem; text-align: left; vertical-align: top; }
th { background: #f2f5f9; }

.weitere { margin: .3rem 0; padding-left: 1.2rem; font-size: .92rem; }
.weitere li { margin-bottom: .3rem; }

.quelle { margin-top: 1.6rem; font-size: .78rem; color: #9aa8b5; }

/* ---------- Finanzteil ---------- */
.finanz-controls { margin: .2rem 0 .8rem; font-size: .92rem; color: #52514e; }
.finanz-controls select {
    margin-left: .3rem;
    padding: .3rem .5rem;
    border: 1px solid #c6d0da;
    border-radius: 6px;
    font-size: .92rem;
    background: #fff;
    color: #1c2733;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: .9rem;
    margin-bottom: 1rem;
}
.chart-card {
    background: #fcfcfb;
    border: 1px solid rgba(11, 11, 11, 0.10);
    border-radius: 8px;
    padding: .7rem .8rem .5rem;
}
.chart-card h4 {
    margin: 0 0 .4rem;
    font-size: .88rem;
    font-weight: 600;
    color: #0b0b0b;
}
.chart-box { position: relative; height: 13rem; }

.kennzahlen-tabelle table td:not(:first-child),
.kennzahlen-tabelle table th:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.kennzahlen-tabelle table td:first-child { font-weight: 600; }

.btn.klein { padding: .25rem .6rem; font-size: .82rem; }

.fussnoten {
    margin: .5rem 0 0;
    padding-left: 1.1rem;
    font-size: .78rem;
    color: #8a97a4;
}
.fussnoten li { margin-bottom: .15rem; }

.kennzahlen-tabelle .delta {
    font-size: .72rem;
    color: #8a97a4;
    white-space: nowrap;
}

/* ---------- Überwachungs-Panel ---------- */
.ueberwachung {
    margin-top: 1rem;
    border-top: 1px solid #e2e8ee;
    padding-top: .8rem;
    font-size: .88rem;
}
.ueberwachung summary {
    cursor: pointer;
    font-weight: 600;
    color: #1f3864;
}
.ueberwachung input[type="number"],
.ueberwachung input[type="email"],
.ueberwachung select {
    padding: .3rem .4rem;
    border: 1px solid #c6d0da;
    border-radius: 5px;
    font-size: .85rem;
    background: #fff;
}
.uw-feld { display: block; margin: .6rem 0 0; }
.uw-feld input[type="number"] { width: 4.2rem; }
.uw-feld input[type="email"] { width: 100%; margin-top: .2rem; }
.uw-check { display: block; margin: .6rem 0; }
.uw-titel { font-weight: 600; margin: .8rem 0 .3rem; }
.uw-regel {
    border: 1px solid #e2e8ee;
    border-radius: 7px;
    padding: .4rem .5rem;
    margin-bottom: .4rem;
}
.uw-regel select { max-width: 100%; margin-bottom: .3rem; }
.uw-regel-unten { display: flex; align-items: center; gap: .4rem; }
.uw-regel-unten select { flex: 1; min-width: 0; margin-bottom: 0; }
.uw-wert { width: 4.2rem; }
.uw-aktionen { display: flex; gap: .4rem; margin-top: .7rem; flex-wrap: wrap; }
.uw-status {
    margin-top: .6rem;
    white-space: pre-wrap;
    font-size: .8rem;
    color: #52514e;
    background: #f7f9fb;
    border-radius: 6px;
    padding: .4rem .6rem;
}
.uw-status:empty { display: none; }
