/* =========================================================
   GRUNDEINSTELLUNGEN
========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, Arial, sans-serif;
    background: #f4f6f8;
    color: #17202a;
}


/* =========================================================
   TOPBAR
========================================================= */

.topbar {
    background: #17202a;
    color: #fff;
    padding: 14px 24px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar strong {
    font-size: 1.05rem;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar a {
    color: #fff;
    text-decoration: none;
}

.topbar a:hover {
    text-decoration: underline;
}


/* =========================================================
   SEITENINHALT
========================================================= */

.container {
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 18px;
}


/* =========================================================
   KARTEN
========================================================= */

.card {
    background: #fff;
    border: 1px solid #dfe4ea;
    border-radius: 10px;

    padding: 20px;
    margin-bottom: 20px;

    box-shadow: 0 2px 8px #0000000b;
}

.card h1,
.card h2,
.card h3 {
    margin-top: 0;
}

.card h2 {
    margin-bottom: 20px;
}


/* =========================================================
   GRID
========================================================= */

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.grid3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}


/* =========================================================
   FORMULARFELDER
========================================================= */

.field {
    min-width: 0;
}

.field label {
    display: block;

    font-weight: 650;

    margin-bottom: 6px;
}


/*
   Normale Eingabefelder.

   Wichtig:
   Checkboxen werden hier ausdrücklich ausgeschlossen.
*/

.field input:not([type="checkbox"]),
.field select,
.field textarea {
    display: block;

    width: 100%;

    padding: 10px;

    border: 1px solid #cbd3da;
    border-radius: 6px;

    background: #fff;
    color: #17202a;

    font: inherit;
}


/* Fokus */

.field input:not([type="checkbox"]):focus,
.field select:focus,
.field textarea:focus {
    outline: none;

    border-color: #1769aa;

    box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.12);
}


/* Deaktivierte Felder */

.field input:disabled {
    background: #f7f8fa;
    color: #68737d;
    cursor: default;
}


/* Textarea */

.field textarea {
    min-height: 90px;
    resize: vertical;
}


/* =========================================================
   CHECKBOXEN
========================================================= */

.field input[type="checkbox"] {
    appearance: auto;

    width: 18px;
    height: 18px;

    min-width: 18px;

    margin: 0;

    padding: 0;

    cursor: pointer;

    flex: 0 0 auto;
}


/*
   Label mit Checkbox:
   Checkbox und Text stehen nebeneinander.
*/

.field label:has(input[type="checkbox"]) {
    display: flex;

    align-items: center;

    gap: 9px;

    min-height: 42px;

    margin: 0;

    cursor: pointer;
}


/* =========================================================
   LEISTUNGEN
========================================================= */

.item {
    display: grid;

    grid-template-columns:
        minmax(280px, 1fr)
        130px
        150px;

    gap: 16px;

    align-items: end;

    margin-bottom: 14px;
}

.item:last-child {
    margin-bottom: 0;
}


/* =========================================================
   ZUSCHLÄGE
========================================================= */

/*
   Jede grid3-Zeile innerhalb der Zuschlagskarte
   bekommt etwas Abstand zur nächsten Zeile.
*/

.card .grid3 {
    margin-bottom: 14px;
}

.card .grid3:last-child {
    margin-bottom: 0;
}


/*
   Damit Checkbox + Zuschlagsbezeichnung
   vertikal sauber mit Faktor und Preis stehen.
*/

.grid3 > .field:first-child {
    align-self: end;
}


/* =========================================================
   BUTTONS
========================================================= */

.btn {
    display: inline-block;

    border: 0;
    border-radius: 6px;

    padding: 10px 15px;

    background: #1769aa;
    color: #fff;

    text-decoration: none;

    font: inherit;
    font-weight: 600;

    cursor: pointer;
}

.btn:hover {
    filter: brightness(0.95);
}

.btn.secondary {
    background: #65727e;
}

.btn.success {
    background: #287d3c;
}


/* Buttonbereich */

.actions {
    display: flex;

    gap: 8px;

    flex-wrap: wrap;

    margin-top: 16px;
}


/* =========================================================
   TABELLEN
========================================================= */

table {
    width: 100%;

    border-collapse: collapse;
}

th,
td {
    padding: 9px;

    border-bottom: 1px solid #e5e7eb;

    text-align: left;
}

th {
    background: #f0f3f5;
    font-weight: 650;
}

.right {
    text-align: right;
}


/* =========================================================
   MELDUNGEN
========================================================= */

.alert {
    padding: 12px;

    border-radius: 7px;

    background: #fff3cd;

    margin-bottom: 15px;
}

.error {
    background: #fde2e1;
}


/* =========================================================
   MUTED / HINWEISTEXT
========================================================= */

.muted {
    color: #68737d;
    font-size: 0.92rem;
}


/* =========================================================
   LOGIN
========================================================= */

.login {
    max-width: 430px;

    margin: 80px auto;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 850px) {

    .container {
        margin-top: 18px;
        padding: 0 12px;
    }


    .card {
        padding: 16px;
    }


    .grid,
    .grid3,
    .item {
        grid-template-columns: 1fr;
    }


    .topbar {
        flex-wrap: wrap;

        gap: 8px;

        padding: 12px 16px;
    }


    .topbar nav {
        flex-wrap: wrap;
    }


    /*
       Auf dem Handy braucht die Checkbox-Zeile
       keine feste Mindesthöhe.
    */

    .field label:has(input[type="checkbox"]) {
        min-height: auto;
    }


    /*
       Zwischen den Feldern einer grid3-Zeile
       etwas zusätzlicher Abstand.
    */

    .grid3 {
        gap: 10px;
    }


    .item {
        gap: 10px;

        padding-bottom: 14px;

        border-bottom: 1px solid #e5e7eb;
    }


    .actions {
        flex-direction: column;
    }


    .actions .btn {
        width: 100%;

        text-align: center;
    }

}


/* =========================================================
   SEHR KLEINE DISPLAYS
========================================================= */

@media (max-width: 480px) {

    body {
        font-size: 15px;
    }


    .container {
        padding: 0 8px;
    }


    .card {
        border-radius: 8px;

        padding: 14px;
    }


    .topbar {
        padding: 11px 12px;
    }

}

/* =========================================================
   BEHANDLUNGSFÄLLE
========================================================= */

.case-card {
    border-left: 4px solid #1769aa;
}

.case-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.case-basic-data {
    margin-bottom: 24px;
}

.case-section-title {
    margin-top: 26px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.case-remove {
    flex: 0 0 auto;
}

.case-add-card {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.case-add-hint {
    margin: 0;
    flex: 1 1 420px;
}


@media (max-width: 850px) {

    .case-header {
        align-items: stretch;
        flex-direction: column;
    }

    .case-remove {
        width: 100%;
    }

    .case-add-card .btn {
        width: 100%;
        text-align: center;
    }
}

.case-remove[hidden] {
    display: none;
}


/* =========================================================
   ADMINISTRATION
========================================================= */

.btn.danger {
    background: #b42318;
}

.admin-logo-box {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin: 16px 0 24px;
    padding: 14px;
    border: 1px solid #dfe4ea;
    border-radius: 8px;
    background: #f8fafb;
}

.admin-logo-preview {
    display: block;
    max-width: 220px;
    max-height: 100px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.admin-delete-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
}

.admin-delete-logo input {
    width: 18px;
    height: 18px;
}

.admin-table-actions {
    white-space: nowrap;
}

.admin-inline-form {
    display: inline-block;
    margin: 0 0 0 6px;
}

.admin-btn-small {
    padding: 7px 10px;
    font-size: 0.9rem;
}

.logo-preview{
    margin-top:12px;
}

.logo-preview img{
    display:block;
    max-width:420px;
    width:100%;
    height:auto;
    object-fit:contain;
}

@media (max-width: 850px) {
    .admin-table-actions {
        white-space: normal;
    }

    .admin-inline-form {
        display: block;
        margin: 6px 0 0;
    }

    .admin-table-actions .btn {
        width: 100%;
        text-align: center;
    }
}
