* {
    box-sizing: border-box;
}

/* --- 2.4.0 Layout-Überarbeitung: Desktop und Mobil ------------------- */
@media (min-width: 701px) {
    body.app-body .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        height: 100svh;
        overflow: hidden;
    }

    body.app-body .sidebar nav {
        flex: 1 1 auto;
        min-height: 0;
        padding-right: 3px;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, .22) transparent;
    }

    body.app-body .sidebar nav::-webkit-scrollbar { display: block; width: 5px; }
    body.app-body .sidebar nav::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: rgba(255, 255, 255, .22);
    }

    body.app-body .sidebar-footer {
        flex: 0 0 auto;
        margin-top: 12px;
        background: inherit;
    }
}

.settings-category-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid var(--pp-line);
    border-radius: 16px;
    background: var(--pp-surface);
    box-shadow: var(--pp-shadow);
}

.settings-category-tabs a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 9px 12px;
    color: var(--pp-muted);
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
    border-radius: 11px;
}

.settings-category-tabs a:hover { color: var(--pp-ink); background: color-mix(in srgb, var(--pp-olive) 9%, transparent); }
.settings-category-tabs a.active {
    color: #fff;
    background: linear-gradient(110deg, var(--pp-olive-dark), var(--pp-olive));
}

body.app-body .settings-tabs {
    border-color: var(--pp-line);
    background: var(--pp-surface);
    box-shadow: var(--pp-shadow);
}

.calendar-mobile-toolbar { display: none; }
.calendar-legend-details > summary { display: none; }

@media (max-width: 700px) {

    .settings-category-tabs {
        position: relative;
        grid-template-columns: repeat(4, minmax(76px, 1fr));
        gap: 5px;
        margin: 8px 0;
        padding: 6px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .settings-category-tabs::-webkit-scrollbar { display: none; }
    .settings-category-tabs a {
        flex-direction: column;
        gap: 2px;
        min-height: 52px;
        padding: 6px 5px;
        font-size: 10px;
        line-height: 1.15;
    }

    .settings-category-tabs a span { font-size: 16px; }

    body.app-body .settings-tabs {
        position: relative;
        margin-bottom: 12px;
        padding: 7px;
        border-radius: 14px;
    }

    body.app-body .settings-tabs::after {
        content: "";
        position: sticky;
        right: -7px;
        flex: 0 0 20px;
        margin: -7px;
        pointer-events: none;
        background: linear-gradient(90deg, transparent, var(--pp-surface));
    }

    body.app-body .settings-tabs a {
        min-height: 39px;
        padding: 8px 11px;
        font-size: 12px;
    }

    body.app-body .calendar-toolbar { display: none; }
    .calendar-mobile-toolbar {
        display: grid;
        gap: 9px;
        margin: 0 0 12px;
        padding: 10px;
        border: 1px solid var(--pp-line);
        border-radius: 16px;
        background: var(--pp-surface);
        box-shadow: var(--pp-shadow);
    }

    .calendar-mobile-month {
        display: grid;
        grid-template-columns: 42px 1fr 42px;
        align-items: center;
        gap: 8px;
    }

    .calendar-mobile-month strong {
        color: var(--pp-ink);
        font-size: 17px;
        text-align: center;
    }

    .calendar-mobile-month a,
    .calendar-mobile-more > summary {
        display: grid;
        place-items: center;
        min-width: 42px;
        min-height: 42px;
        color: var(--pp-ink);
        font-size: 27px;
        font-weight: 750;
        text-decoration: none;
        border: 1px solid var(--pp-line);
        border-radius: 11px;
        background: color-mix(in srgb, var(--pp-ink) 4%, var(--pp-surface));
    }

    .calendar-mobile-actions {
        display: grid;
        grid-template-columns: 1fr 1.35fr 42px;
        gap: 8px;
    }

    body.app-body .calendar-mobile-actions > a,
    body.app-body .calendar-mobile-actions > button {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 42px;
        margin: 0;
        padding: 8px 10px;
        font-size: 13px;
        border-radius: 11px;
    }

    .calendar-mobile-more { position: relative; }
    .calendar-mobile-more > summary {
        min-width: 0;
        font-size: 17px;
        cursor: pointer;
        list-style: none;
    }
    .calendar-mobile-more > summary::-webkit-details-marker { display: none; }
    .calendar-mobile-more[open] > summary {
        color: #fff;
        background: var(--pp-olive-dark);
    }
    .calendar-mobile-more > div {
        position: absolute;
        z-index: 80;
        top: calc(100% + 7px);
        right: 0;
        display: grid;
        width: 205px;
        padding: 7px;
        border: 1px solid var(--pp-line);
        border-radius: 13px;
        background: var(--pp-surface);
        box-shadow: 0 16px 35px rgba(0, 0, 0, .2);
    }
    .calendar-mobile-more > div a,
    .calendar-mobile-more > div button {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 42px;
        margin: 0;
        padding: 9px 11px;
        color: var(--pp-ink);
        font: inherit;
        font-size: 13px;
        font-weight: 700;
        text-align: left;
        text-decoration: none;
        border: 0;
        border-radius: 9px;
        background: transparent;
        box-shadow: none;
    }
    .calendar-mobile-more > div a:hover,
    .calendar-mobile-more > div button:hover {
        background: color-mix(in srgb, var(--pp-olive) 10%, transparent);
    }

    body.app-body .calendar-headline > button { display: none; }
    body.app-body .calendar-headline { margin-bottom: 10px; }

    .calendar-legend-details {
        margin-bottom: 12px;
        border: 1px solid var(--pp-line);
        border-radius: 12px;
        background: color-mix(in srgb, var(--pp-ink) 3%, var(--pp-surface));
    }
    .calendar-legend-details > summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 44px;
        padding: 10px 12px;
        color: var(--pp-ink);
        font-size: 13px;
        font-weight: 750;
        cursor: pointer;
        list-style: none;
    }
    .calendar-legend-details > summary::-webkit-details-marker { display: none; }
    .calendar-legend-details > summary::after { content: "⌄"; font-size: 18px; }
    .calendar-legend-details[open] > summary::after { transform: rotate(180deg); }
    .calendar-legend-details .pro-legend {
        margin: 0;
        padding: 2px 12px 12px;
    }
}

@media print {
    .calendar-mobile-toolbar,
    .calendar-legend-details > summary { display: none !important; }
    .calendar-legend-details .pro-legend { display: grid !important; }
}

