:root {
    --gap: 16px;
    --panel-bg: #f7f9fc;
    --accent: #0b63d6
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
    margin: 0;
    padding: 18px;
    background: #eef3fb;
    color: #111
}

.container {
    display: grid;
    /*grid-template-columns: 1fr 1fr;  Beide Seiten gleich breit */
    grid-template-columns: 520px 1fr;
    gap: 24px;
}

.card {
    background: var(--panel-bg);
    padding: 14px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(10,20,40,0.06);
}

h2 {
    margin: 4px 0 12px;
    font-size: 18px;
}

label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.times {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

    .times .cell {
        background: #fff;
        padding: 8px;
        border-radius: 6px;
        border: 1px solid rgba(0,0,0,0.06);
        text-align: center;
    }

table {
    width: 100%;
    border-collapse: collapse;
}

td, th {
    padding: 6px;
    border: 1px solid rgba(0,0,0,0.06);
    vertical-align: middle;
    text-align: center; /* Zentriert alle Tabellenzahlen */
}

textarea {
    resize: none;
    overflow-y: auto;
    border-color: lightgray;
    border-radius: 5px;
    padding: 5px;
    width: 98%;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    display: flex;
    gap: 8px;
    align-items: center;
}

input[type=number] {
    width: 100%;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.12);
    box-sizing: border-box;
    text-align: center; /* Zahlen im Eingabefeld zentrieren */
}

    input[type=number]::-webkit-inner-spin-button,
    input[type=number]::-webkit-outer-spin-button {
        opacity: 1;
    }

select, input[type=text] {
    padding: 6px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.12);
}

.btn {
    background: var(--accent);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    width: 200px;
}

.muted {
    color: #555;
    font-size: 13px;
}

.right-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.small-btn {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.08);
    background: #fff;
    cursor: pointer;
}

.nowrap {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr; /* Mobile: untereinander */
    }
}

/* Neue, spezifische Regeln für die linke Eingabetabelle */
#left table {
    /* Erzwingt eine Breitenverteilung durch den Browser, unabhängig vom Inhalt */
    table-layout: fixed;
}

    #left table th,
    #left table td {
        /* Alle Spalten (auch th/td) werden gleich breit gemacht */
        width: 14.28%; /* 100% / 7 Spalten (1 Label + 6 Zeitpunkte) */
    }

        /* Die erste Spalte (Label) braucht mehr Platz, daher machen wir sie breiter */
        #left table th:first-child,
        #left table td:first-child {
            width: 20%; /* Beispiel: 20% Breite für die erste Spalte */
            text-align: left; /* Besser lesbar */
        }

        /* Die 6 Zeitspalten teilen sich den Rest (80% / 6) */
        #left table th:not(:first-child),
        #left table tbody tr:first-child td:not(:first-child) {
            width: 13.33%; /* 80% / 6 */
        }

    /* Die speziellen Zeilen mit colspan="6" müssen den Rest der Breite einnehmen */
    #left table tbody tr td[colspan="6"] {
        width: 80%;
        text-align: left;
    }

#planArea table.insulin-table {
    table-layout: fixed;
    width: 100%;
}

    #planArea table.insulin-table th:first-child,
    #planArea table.insulin-table td:first-child {
        width: 90px;
        min-width: 90px;
        max-width: 90px;
        text-align: left;
    }

    #planArea table.insulin-table th:last-child,
    #planArea table.insulin-table td:last-child {
        width: 50px;
        min-width: 50px;
        max-width: 50px;
    }

    #planArea table.insulin-table th,
    #planArea table.insulin-table td {
        overflow: hidden;
        text-overflow: ellipsis;
    }

.fontanpassung {
    font-size: small;
}

/* Visuelle Darstellung von deaktivierten Input-Feldern */
input[type=number]:disabled {
    background: #eee; /* Hellgrauer Hintergrund für deaktivierte Felder */
    cursor: not-allowed;
    color: #888;
}

/* Visuelle Darstellung der umgebenden Zelle, wenn der Input deaktiviert ist */
.disabled-cell {
    background-color: #f7f7f7; /* Noch helleres Grau für die Zelle selbst */
    opacity: 0.7; /* Leicht durchscheinend */
}

#printPlan {
    display: none;
}


#printOverlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

#overlayBg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(60,60,80,0.32);
    backdrop-filter: blur(1.2px);
    z-index: 101;
}

#overlayContent {
    position: relative;
    z-index: 102;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    width: 100vw;
    height: 100vh;
}

#printPaper {
    background: #fff;
    border-radius: 18px;
    margin: 30px 0;
    box-shadow: 0 4px 32px rgba(40,40,60,0.16);
    position: relative;
    /*            padding: 38px 48px 34px 48px;*/
    padding: 12px;
    min-width: 270px;
    /* Seitenverhältnis A4: 1:1.414 (210:297)
            width: calc(1vh * 100 / 1.414 - 60px);*/
    width: 100vh;
    max-width: calc(100vw - 300px);
    height: calc(100vh - 120px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#overlayActions {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/*
#overlayClose {
    position: absolute;
    right: 60px;
    top: 40px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.98);
    border: 2.5px solid #0b63d6;
    box-shadow: 0 2px 8px rgba(0,0,20,0.09);
    border-radius: 21px;
    font-size: 21px;
    color: #0b63d6;
    cursor: pointer;
    z-index: 110;
    line-height: 34px;
    text-align: center;
    padding: 0;
}
    */

@media (max-width: 600px) {
    #overlayContent {
        flex-direction: column;
        gap: 12px;
    }

    #printPaper {
        min-width: unset;
        width: 100vw;
        max-width: 100vw;
        margin: 16px 0;
        padding: 12px;
        border-radius: 8px;
    }
}

@media print {
    body > *:not(#printOverlay) {
        display: none !important;
    }

    #printOverlay {
        display: flex !important;
    }

    #overlayBg, #overlayClose, #overlayActions {
        display: none !important;
    }

    #printPaper {
        box-shadow: none;
        margin: 0;
        padding: 0 0 0 0;
        width: 100vw;
        min-width: 0;
        border-radius: 0;
    }
}

.druckTabelle, .druckTabelle td, .druckTabelle th {
    font-family: 'Arial', 'Helvetica', sans-serif;
    text-align: center;
    border:1px solid black;
}

    .druckTabelle th {
        background-color: lightgray;
        font-weight: bold;
        width: 260px;
    }

    .druckTabelle td {
        width: 260px;
    }

    .druckTabelle tbody tr:nth-child(even) {
        background-color: #f2f2f2;
    }

    .druckTabelle tbody tr:nth-child(odd) {
        background-color: #fff;
    }


.license-menu {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #e6e6e6; /*#333*/
    color: #333;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    max-width: 260px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    z-index: 9999;
}

.license-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.license-body {
    margin-top: 8px;
    border-top: 1px solid #555;
    padding-top: 8px;
    display: none;
}

.license-menu.open .license-body {
    display: block;
}

.license-button {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    font-size: 0.85rem;
    background: #555;
    color: #fff;
    border: 1px solid #777;
    border-radius: 3px;
    cursor: pointer;
    width: 100%;
}

.license-button-klein {
    display: inline-block;
    margin: 6px 0 12px 0;
    padding: 4px 8px;
    font-size: 0.85rem;
    background: #555;
    color: #fff;
    border: 1px solid #777;
    border-radius: 3px;
    cursor: pointer;
    width: 49%;
}


.license-button:hover {
    background: #666;
}

.license-input-area input {
    width: 100%;
    padding: 4px;
    margin-bottom: 4px;
}

#licenseInput {
    width: 90%;
    margin: 5px 5px 0px 10px;
    padding: 5px;
    border-radius: 7px;
}

#btnNowBuy {
    background-color: #0b63d6;
    padding: 10px;
    border-radius: 7px;
}

    #btnNowBuy:hover {
        background-color: #257ef4;
    }

.agb-container {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    line-height: 1.1;
    cursor: pointer;
}

    .agb-container input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-top: 2px;
    }

.agb-text .link {
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
    color: #0066cc;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 99999;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 28px;
    cursor: pointer;
}
