.topbar-mobile-logo {
    display: none;
    height: 30px;
    width: auto;
}
.topbar-search-mobile-btn { display: none; }
.topbar-search-overlay { display: none; }

.mobile-tab-bar {
    display: none;
}

@media (max-width: 768px) {
    .topbar-nav--links { display: none; }
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 70px;
        background: var(--sidebar-bg);
        border-top: 1px solid var(--border);
        z-index: 400;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: var(--body-text);
        text-decoration: none;
        font-size: .9rem;
        font-weight: 500;
        transition: color .15s;
    }

    .mobile-tab:hover { text-decoration: none; }

    .mobile-tab .ti {
        font-size: 1.4rem;
        line-height: 1;
    }

    .mobile-tab--active,
    .mobile-tab:hover {
        color: var(--accent);
    }

    .mobile-menu-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .75rem;
        padding: .5rem 0 1rem;
    }

    .mobile-menu-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .5rem;
        padding: 1.25rem 1rem;
        background: var(--bg-white);
        border-radius: 12px;
        border: 1px solid var(--border);
        color: var(--body-text);
        text-decoration: none;
        font-size: .9rem;
        font-weight: 500;
        transition: border-color .15s, color .15s;
    }

    .mobile-menu-item .ti {
        font-size: 1.6rem;
        color: var(--accent);
    }

    .mobile-menu-item:hover {
        border-color: var(--accent);
        color: var(--accent);
        text-decoration: none;
    }
}

/* ── Mobile / Responsive ──────────────────────────────────────────────────── */

@media (max-width: 768px) {

    /* Layout */
    .sidebar { display: none; }
    .sidebar-collapse-btn { display: none; }
    .topbar-hamburger { display: none; }
    .topbar-mobile-logo { display: block; }
    .layout { overflow: visible; }
    .main-wrap { width: 100%; overflow-y: auto; }

    .main-content { padding: 0 1rem 5rem; }

    /* Topbar */
    .topbar-actions { display: none; }
    .topbar-inner { padding: 0 .8rem !important; }
    .topbar-nav-item[href="/admin"] { display: none; }
    .topbar-nav-item { padding: .35rem .8rem; }
    .topbar-knd-id { display: none; }
    .topbar-search-mobile-btn { display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--surface); font-size: 1.3rem; padding: .4rem; cursor: pointer; margin-left: auto; }
    .topbar-search-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-white); z-index: 1000; padding: 1rem; flex-direction: column; gap: .5rem; }
    .topbar-search-overlay.open { display: flex; }
    .topbar-search-overlay-inner { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--border); border-radius: 50px; padding: .5rem 1rem; }
    .topbar-search-overlay-inner .ti { color: var(--surface); font-size: 1rem; }
    .topbar-search-overlay-input { flex: 1; background: none; border: none; outline: none; font-size: 1rem; font-family: inherit; color: var(--body-text); }
    .topbar-search-overlay-close { background: none; border: none; font-size: 1.3rem; color: var(--surface); cursor: pointer; padding: .2rem .4rem; }
    .topbar-search-overlay-results { overflow-y: auto; }

    /* Formulare */
    .form-stack { max-width: 100%; }
    .form-row { flex-wrap: wrap; }
    .form-row--nowrap { flex-wrap: wrap; }
    .form-group.grow { flex: 1 1 100%; }

    /* Tabellen */
    .tbl { font-size: .85rem; }
    .tbl th, .tbl td { padding: .5rem .6rem; }
    .tbl td.cell-actions { flex-wrap: wrap; gap: .5rem; }

    /* Statistik: stat-*-Mobilregeln in cockpit.css (lädt nach mobile.css) */
    .page-header-actions { margin-left: 0; flex-basis: 100%; flex-wrap: wrap; }

    /* Objekt-Header */
    .li-box-card-header { flex-wrap: wrap; gap: .5rem; }
    .li-box-card-header-actions { flex-wrap: wrap; gap: .5rem; }

    /* Buttons */
    .btn { font-size: 1rem; padding: .55rem 1.1rem; }

}

@media (max-width: 480px) {

    /* Tabellen: Card-Layout */
    .tbl thead { display: none; }
    .tbl tbody tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas: "actions name del"
                             "actions meta del";
        align-items: center;
        border-bottom: 1px solid var(--border);
        padding: .4rem .6rem;
        gap: .1rem .5rem;
    }
    .tbl td { display: block; border: none; padding: 0; }
    .tbl td.cell-actions { grid-area: actions; display: flex; flex-direction: column; gap: .3rem; }
    .tbl td.cell-name    { grid-area: name; font-size: .95rem; }
    .tbl td.cell-meta    { grid-area: meta; font-size: .8rem; color: var(--muted); }
    .tbl td.cell-del     { grid-area: del; }

    .form-row--nowrap { flex-wrap: wrap; }
    .form-group.form-float.grow { flex: 1 1 100%; }

}

@media (min-width: 1320px) {
    .sidebar { width: 220px; }
    [data-portal="1"] .topbar-logo {
        height: 43px;
        margin-left: 11px;
    }
}

@media (min-height: 650px) {
    .sidebar-nav a { padding: .63rem 1rem !important; }
}

@media (min-height: 700px) {
    .sidebar-nav a { padding: .7rem 1rem !important; }
}

@media (min-height: 720px) {
    .sidebar-nav a { padding: .75rem 1rem !important; }
}

@media (max-width: 1280px) {
    .topbar-inner {
        padding: 8px 1.6rem 0 1.6rem;
    }
    .main-content {
        padding: 1.2rem 1.6rem 3rem 1.6rem;
    }
}

@media (max-width: 768px) {
    .main-content { padding: 1rem .8rem 5rem; }
}

@media (max-width: 768px) {
    .card-grid-3 { grid-template-columns: 1fr 1fr; gap: 1rem; }
    .view-toggle { flex-wrap: wrap; border-radius: 16px; }
    .vt-tab { flex: 1; text-align: center; }
}

@media (max-width: 480px) {
    .card-grid-3 { grid-template-columns: 1fr; }
}

/* ── Hilfe Tabs (mobile) ─────────────────────────────────────────────────── */

.hilfe-mobile-tabs { display: none; }

@media (max-width: 768px) {
    .hilfe-mobile-tabs {
        display: flex;
        gap: 4px;
        padding: .75rem 1rem .5rem;
        background: var(--body-bg);
    }
    .hilfe-mobile-tab {
        flex: 1;
        padding: .45rem .75rem;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--bg-white);
        color: var(--body-text);
        font-size: .875rem;
        font-weight: 500;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: .4rem;
        transition: background .15s, box-shadow .15s;
    }
    .hilfe-mobile-tab--active {
        background: var(--accent, #4a60c9);
        color: #fff;
        border-color: var(--accent, #4a60c9);
    }
    .hilfe-wrap {
        flex-direction: column;
        overflow: visible;
    }
    .hilfe-sidebar {
        width: 100% !important;
        overflow-y: visible;
        padding: .75rem 1rem;
        flex-shrink: 0;
    }
    .hilfe-iframe {
        flex: none;
        height: calc(100dvh - 220px);
        margin: 0 .5rem .5rem;
    }
    .hilfe-wrap--show-inhalt .hilfe-sidebar { display: none; }
    .hilfe-wrap--show-nav .hilfe-iframe { display: none; }
}

@media (max-width: 700px) {
    .auth-right { display: none; }

    .auth-left {
        flex: 1;
        padding: 2rem 1.25rem;
        padding-top: 8vh;
        background: var(--body-bg);
    }

    .auth-left-inner {
        max-width: 100%;
    }

    .auth-logo {
        height: 32px;
        margin-bottom: 1.5rem;
    }

    .auth-card {
        padding: 1.5rem 1.25rem;
    }

    .auth-form .form-input {
        font-size: 1rem;
        padding: .75rem 1rem;
    }

    .btn-block {
        padding: .75rem;
        font-size: 1rem;
    }
}

@media (max-width: 640px) {
    .einst-layout { flex-direction: column; }
    .einst-nav { flex-direction: row; flex-wrap: wrap; flex: none; width: 100%; }

    .app-modal { align-items: flex-end; }
    .app-modal-box {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 92vh;
        overflow-y: auto;
        transform: translateY(24px) scale(1);
    }
    .app-modal--open .app-modal-box { transform: translateY(0) scale(1); }
}