:root {
    --brand: #0b6e4f;
    --brand-dark: #084f39;
    --bread: #c4693a;
    --bg: #f7f6f2;
    --surface: #ffffff;
    --border: #e2e0d8;
    --text: #1b1f1a;
    --muted: #6b6f68;
    --danger: #a4311a;
    --info: #1f5f8f;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    /* fixed statt sticky – sticky hat sich auf breiten Displays in
       Kombination mit FullCalendar als unzuverlässig erwiesen. fixed
       ist garantiert sichtbar, der body bekommt unten padding-top zum
       Ausgleich. */
    position: fixed; top: 0; left: 0; right: 0; z-index: 1500;
    gap: 12px;
}
body.app-body {
    /* Höhe des fixierten App-Headers (Default-Logo 32 px + 12 px Padding
       oben/unten + 1 px Border = ca. 57 px). Etwas Reserve für höhere
       Logos. */
    padding-top: 60px;
}
@media (max-width: 840px) {
    body.app-body { padding-top: 56px; }
}
.app-header .brand {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--brand);
    font-weight: 700;
    text-decoration: none;
}
.app-nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.app-nav a { color: var(--text); text-decoration: none; font-weight: 500; padding: 6px 2px; }
.app-nav a:hover { color: var(--brand); }

.nav-toggle {
    display: none;
    background: transparent;
    border: 0;
    font-size: 1.7em;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    color: var(--text);
}

.user-menu { position: relative; }
.user-menu summary {
    list-style: none; cursor: pointer; padding: 6px 10px;
    border-radius: var(--radius); background: var(--bg);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .menu-panel {
    position: absolute; right: 0; top: 100%; margin-top: 4px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    min-width: 200px; padding: 8px;
    z-index: 1600;
}
/* Leaflet-Tiles dürfen nicht über die Sticky-Navigation rutschen */
.leaflet-pane, .leaflet-top, .leaflet-bottom { z-index: 400 !important; }
.map-canvas { position: relative; z-index: 1; }
.user-menu .menu-panel a, .user-menu .menu-panel button {
    display: block; padding: 8px 10px; text-decoration: none;
    color: var(--text); border-radius: 6px; width: 100%; text-align: left;
}
.user-menu .menu-panel a:hover, .user-menu .menu-panel button:hover {
    background: var(--bg);
}
.linklike { border: 0; background: transparent; cursor: pointer; font: inherit; }

.app-main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.app-footer { text-align: center; color: var(--muted); padding: 24px; }

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

.auth-card {
    max-width: 420px; margin: 40px auto; padding: 28px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.auth-card h1 { margin-top: 0; }

form label { display: block; margin-bottom: 12px; font-weight: 500; }
form input, form select, form textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface); font: inherit;
}
form input[type=color] {
    width: 80px; height: 44px; padding: 4px;
    cursor: pointer;
}
form input:focus, form select:focus, form textarea:focus {
    outline: 2px solid var(--brand); outline-offset: 1px;
}
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 0 0 12px 0; }
fieldset legend { font-weight: 600; padding: 0 6px; }
label.checkbox { font-weight: 400; display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; }
label.checkbox input { width: auto; }

.btn {
    display: inline-block; padding: 10px 16px; border: 1px solid var(--border);
    background: var(--surface); border-radius: 8px; text-decoration: none;
    color: var(--text); cursor: pointer; font: inherit;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #862815; color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 0.9em; }

.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.stacked { max-width: 520px; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.alert-error { background: #fbe7e1; color: var(--danger); border: 1px solid #f1b8a8; }
.alert-info  { background: #e3eef9; color: var(--info);   border: 1px solid #b9d2e9; }
.alert ul { margin: 0; padding-left: 20px; }

.muted { color: var(--muted); }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.news-list, .event-list, .location-list { list-style: none; margin: 0; padding: 0; }
.news-list li, .event-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.news-list li:last-child, .event-list li:last-child { border-bottom: 0; }
.news-list h3, .event-list h3 { margin: 4px 0; }
.news-list time, .event-list time { color: var(--muted); font-size: 0.9em; }

.data-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.data-table th, .data-table td {
    padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top;
}
.data-table th { background: var(--bg); }

/* Wrapper für horizontale Scrollbarkeit auf Handy. Auf Wide ohne
   Effekt – das umschlossene Table behält seine 100%-Breite.
   Innerhalb der mobilen Breakpoints lassen wir das Table seine
   natürliche Breite annehmen, sodass overflow-x echte Spalten
   nach rechts scrollen lässt. */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-scroll .data-table {
    min-width: 720px;
    white-space: nowrap;
}
.table-scroll .data-table th,
.table-scroll .data-table td { white-space: nowrap; }
/* Opt-in: Spalten / Zellen, die längere Beschreibungstexte enthalten und
   in der Tabelle umbrechen sollen, statt seitlich rauszuwachsen. */
.table-scroll .data-table th.cell-wrap,
.table-scroll .data-table td.cell-wrap,
.data-table th.cell-wrap,
.data-table td.cell-wrap {
    white-space: normal;
    max-width: 360px;
}
.data-table .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.data-table .actions form { margin: 0; }

.role-tag {
    display: inline-block; margin: 1px 2px; padding: 2px 8px;
    border-radius: 999px; background: #e6efe9; color: var(--brand-dark);
    font-size: 0.8em; font-weight: 600;
}

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75em; font-weight: 700; vertical-align: middle; }
.badge-bread { background: var(--bread); color: #fff; }
.badge-snack { background: #1f5f8f; color: #fff; }

.map-canvas { height: 420px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px; }

.code-block {
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
    padding: 16px; border: 2px dashed var(--brand);
    background: #ecf5f0; border-radius: var(--radius); margin: 16px 0;
}
.code-block code {
    font-size: 1.7em; font-weight: 700; letter-spacing: 2px;
    color: var(--brand-dark); font-family: "SF Mono", Menlo, monospace;
}

/* Brot / Bäckerei */
.bread-grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.bread-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.bread-card.bread-inactive { opacity: 0.55; }
.bread-card-wide { flex-direction: row; align-items: center; gap: 16px; padding-right: 20px; }
.bread-card-wide .bread-image { max-width: 200px; border-right: 1px solid var(--border); }
.bread-image {
    width: 100%; height: 160px; object-fit: contain;
    background: #f6ecd6;
}
.bread-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; }
.bread-body h2 { margin: 0; }
.bread-price { font-size: 1.2em; font-weight: 700; color: var(--bread); margin: 4px 0; }

.card-link { display: block; text-decoration: none; color: var(--text); }
.card-link:hover { box-shadow: 0 3px 8px rgba(0,0,0,0.1); }

.filter-row {
    display: flex; gap: 12px; align-items: end; flex-wrap: wrap;
    margin: 0 0 16px 0;
}
.filter-row label { margin: 0; }
.filter-row label input[type=date] { min-width: 170px; }

.image-picker {
    display: grid; gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.image-option {
    border: 2px solid var(--border); border-radius: 8px; padding: 6px;
    text-align: center; cursor: pointer; background: var(--surface); font-weight: 400;
    display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0;
}
.image-option.selected { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,110,79,0.2); }
.image-option input { display: none; }
.image-option img { width: 100%; height: 70px; object-fit: contain; background: #f6ecd6; border-radius: 4px; }
.image-option span { font-size: 0.8em; }

.row-cancelled td { text-decoration: line-through; color: var(--muted); }

/* Bild-Galerie für Admin und Public-Detail */
.image-grid {
    display: grid; gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    margin: 0 0 12px 0;
}
.image-tile {
    margin: 0; padding: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; overflow: hidden;
    display: flex; flex-direction: column;
}
.image-tile img {
    width: 100%; height: 140px; object-fit: contain; background: var(--bg);
}
.image-tile figcaption {
    padding: 6px 8px; font-size: 0.85em; color: var(--text);
    border-top: 1px solid var(--border);
}
.image-tile form { padding: 0 8px 8px 8px; }
.image-tile form button { width: 100%; }

/* Spalten-Header mit Sort-Link + Filter-Popover */
.colhead-table th { position: relative; }
.col-head-row { display: inline-flex; align-items: center; gap: 4px; }
.col-sort {
    color: var(--text); text-decoration: none; font-weight: 600;
}
.col-sort:hover { color: var(--brand); text-decoration: underline; }
.col-filter-btn {
    background: transparent; border: 0; padding: 2px 6px; cursor: pointer;
    color: var(--muted); border-radius: 4px; font-size: 0.95em;
}
.col-filter-btn:hover { background: var(--bg); color: var(--text); }
.col-filter-btn.active {
    background: var(--brand); color: #fff;
}
.col-filter-pop {
    position: absolute; top: 100%; left: 0; z-index: 1500;
    margin-top: 4px;
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    padding: 12px; min-width: 220px; font-weight: 400;
}
.col-filter-pop label { display: block; margin: 0 0 8px 0; font-size: 0.9em; }
.col-filter-pop input,
.col-filter-pop select { width: 100%; padding: 6px 8px; }
.filter-pop-actions { display: flex; gap: 6px; align-items: center; }

[x-cloak] { display: none !important; }

/* Dashboard-Kacheln (Challenges, Tippspiele …) – einheitliche Maße,
   damit Bike-to-Work + WM + CL untereinander gleich breit sind. */
.wm-tile-row {
    display: grid;
    gap: 16px;
    /* Auf Desktop: bis zu drei Kacheln nebeneinander, jede gleich breit
       (1fr) statt fester max-Breite – sonst springt die Bike-Kachel auf
       1100px und die WM/CL-Kacheln bleiben bei 320px. */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    margin-bottom: 18px;
}
@media (max-width: 720px) {
    .wm-tile-row { grid-template-columns: 1fr; }
}
.wm-tile {
    --tile-c1: #0b6e4f;
    --tile-c2: #14a273;
    --tile-emoji: "⚽";
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--tile-c1) 0%, var(--tile-c2) 100%);
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    padding: 16px 18px;
    min-height: 240px;
    transition: transform 0.12s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}
.wm-tile::after {
    content: var(--tile-emoji);
    position: absolute;
    right: -10px; bottom: -16px;
    font-size: 110px; opacity: 0.10;
    line-height: 1; pointer-events: none;
}
.wm-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.18); color: #fff; }
.wm-tile-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px; margin-bottom: 10px;
}
.wm-tile-title { font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.9; }
.wm-tile-points {
    font-size: 1.5em; font-weight: 800; line-height: 1;
}
.wm-tile-points small { font-size: 0.55em; font-weight: 500; opacity: 0.85; display: block; }
.wm-tile-section { margin-top: 10px; }
.wm-tile-section h4 {
    margin: 0 0 2px 0; font-size: 0.75em; text-transform: uppercase;
    letter-spacing: 0.5px; opacity: 0.8;
}
.wm-tile-match { font-size: 0.97em; line-height: 1.3; }
.wm-tile-when { font-size: 0.78em; opacity: 0.78; }
.wm-tile-leaders {
    margin: 4px 0 0 0; padding: 0; list-style: none;
    font-size: 0.85em;
}
.wm-tile-leaders li {
    display: flex; gap: 6px; padding: 1px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.18);
}
.wm-tile-leaders li:last-child { border-bottom: 0; }
.wm-tile-leaders .pts { margin-left: auto; opacity: 0.9; }
.wm-tile .muted { color: rgba(255,255,255,0.7); }

/* Sub-Navigation auf den Tippspiel-Unterseiten */
.wm-subnav {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin: 0 0 18px 0; padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

/* Allgemeine Sub-Navigation für Backoffice-Seiten (Vendor-Backoffice etc.) */
.subnav {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin: 4px 0 18px 0; padding: 6px 0 10px 0;
    border-bottom: 1px solid var(--border);
}
.subnav a { color: var(--text); text-decoration: none; padding: 4px 6px; }
.subnav a.is-active { font-weight: 700; border-bottom: 2px solid var(--brand); }
.subnav a:hover { text-decoration: underline; }

/* Vorrundentabellen */
.group-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    margin-bottom: 24px;
}
.group-table {
    width: 100%; border-collapse: collapse;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.group-table caption {
    caption-side: top; padding: 6px 10px;
    background: var(--brand); color: #fff; font-weight: 700;
    text-align: left;
}
.group-table th, .group-table td {
    padding: 4px 6px; font-size: 0.88em; text-align: center;
    border-bottom: 1px solid var(--border);
}
.group-table th { background: var(--bg); }
.group-table td:nth-child(2) { text-align: left; }
.group-table tr.rank-1 { background: rgba(11,110,79,0.10); }
.group-table tr.rank-2 { background: rgba(11,110,79,0.05); }

/* Trichter-Spielbaum von oben nach unten */
.bracket-funnel {
    display: flex; flex-direction: column; gap: 14px;
    align-items: stretch;
}
.bracket-funnel .funnel-row { width: 100%; }
.bracket-funnel .funnel-row h3 {
    text-align: center; margin: 0 0 8px 0;
    font-size: 0.95em; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--muted);
}
.funnel-matches {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.funnel-cell {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 10px; min-width: 160px;
    box-shadow: var(--shadow); text-align: center; font-size: 0.9em;
}
.funnel-cell.is-done { border-color: var(--brand); }
.funnel-when { font-size: 0.75em; color: var(--muted); margin-bottom: 4px; }
.funnel-team { line-height: 1.3; }
.funnel-slot { color: var(--muted); font-style: italic; font-size: 0.92em; }
.funnel-score { margin-top: 4px; color: var(--brand-dark); font-size: 1.05em; }

/* Mannschaftspfad-Hervorhebung */
.bracket-team-picker {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
    margin: 0 0 16px 0; padding: 10px 14px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.bracket-team-picker label { margin: 0; }
.path-legend { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.legend-pill {
    padding: 2px 10px; border-radius: 999px; font-size: 0.82em; font-weight: 600;
    color: #fff;
}
.legend-pill.path-first  { background: #d1495b; }
.legend-pill.path-second { background: #2e86ab; }
.legend-pill.path-third  { background: #e29c3b; }

.funnel-cell.path-first  { box-shadow: 0 0 0 3px #d1495b inset, var(--shadow); }
.funnel-cell.path-second { box-shadow: 0 0 0 3px #2e86ab inset, var(--shadow); }
.funnel-cell.path-third  { box-shadow: 0 0 0 3px #e29c3b inset, var(--shadow); }
/* Wenn ein Match in mehreren Pfaden liegt: kombinierte Border über mehrere Insets. */
.funnel-cell.path-first.path-second {
    box-shadow: 0 0 0 3px #d1495b inset, 0 0 0 6px #2e86ab inset, var(--shadow);
}
.funnel-cell.path-first.path-third {
    box-shadow: 0 0 0 3px #d1495b inset, 0 0 0 6px #e29c3b inset, var(--shadow);
}
.funnel-cell.path-second.path-third {
    box-shadow: 0 0 0 3px #2e86ab inset, 0 0 0 6px #e29c3b inset, var(--shadow);
}
.funnel-cell.path-first.path-second.path-third {
    box-shadow:
        0 0 0 3px #d1495b inset,
        0 0 0 6px #2e86ab inset,
        0 0 0 9px #e29c3b inset,
        var(--shadow);
}

/* Letzte Reihe: Spiel um Platz 3 links außen, Finale zentriert. */
.funnel-row-final {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    align-items: start;
}
.funnel-row-final .funnel-side h3 {
    text-align: center; margin: 0 0 8px 0;
    font-size: 0.95em; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--muted);
}
.funnel-row-final .funnel-side-left { justify-self: start; }
.funnel-row-final .funnel-side-center { justify-self: center; }
.funnel-row-final .funnel-side-right { /* Platzhalter für Symmetrie */ }
@media (max-width: 720px) {
    .funnel-row-final { grid-template-columns: 1fr; }
    .funnel-row-final .funnel-side-left,
    .funnel-row-final .funnel-side-center { justify-self: stretch; }
}

/* Eingebettete externe Anwendungen (z. B. Minijob-Zeitapp) */
.iframe-wrap {
    position: relative;
    width: 100%;
    height: calc(100vh - 240px);
    min-height: 500px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}
.iframe-wrap iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: 0;
}

/* ----------------------------------------------------------
 * Mobile-Layout (schmale Displays, z. B. Handy)
 * Desktop-first: nur hier überschreiben
 * ---------------------------------------------------------- */
@media (max-width: 840px) {
    .app-header { padding: 10px 14px; }
    .nav-toggle { display: block; }

    .app-nav {
        display: none;
        flex-direction: column;
        /* WICHTIG: flex-wrap explizit auf nowrap. Der Desktop-Default
           ist 'wrap' – in Kombination mit flex-direction:column und
           max-height führt das dazu, dass das Menü in eine zweite
           Spalte rechts daneben umbricht, sobald die Inhalte zu
           hoch werden (z. B. Verwaltungs-Submenü mit vielen Items). */
        flex-wrap: nowrap;
        align-items: stretch;
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 10px 16px 16px;
        gap: 4px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    .app-nav.nav-open { display: flex; }

    .app-nav > a,
    .app-nav > details > summary {
        padding: 10px 6px;
        border-bottom: 1px solid var(--border);
    }
    .app-nav > a:last-child,
    .app-nav > details:last-child summary { border-bottom: 0; }

    .user-menu { width: 100%; display: block; }
    .user-menu summary { list-style: revert; }
    .user-menu .menu-panel {
        position: static !important;
        right: auto !important;
        top: auto !important;
        left: auto !important;
        display: block !important;
        width: 100%;
        box-shadow: none;
        border: 0;
        margin: 0;
        padding: 0 0 0 14px;
        background: transparent;
        min-width: 0;
    }
    .user-menu .menu-panel a,
    .user-menu .menu-panel button {
        display: block;
        padding: 8px 6px;
        width: 100%;
    }
}

@media (max-width: 720px) {
    .app-main { padding: 16px 12px 60px; }
    .page-header { gap: 10px; }
    .page-header h1 { font-size: 1.45em; margin: 0; }
    .auth-card { margin: 20px 4px; padding: 20px; }

    /* Tabellen horizontal scrollbar statt Seite sprengen.
       Wenn die Tabelle nicht in einem .table-scroll-Wrapper steht,
       greift hier display:block; sonst übernimmt der Wrapper die
       Scroll-Logik (siehe oben). */
    .data-table:not(.table-scroll *) {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .data-table:not(.table-scroll *) thead,
    .data-table:not(.table-scroll *) tbody,
    .data-table:not(.table-scroll *) tr {
        display: table; width: 100%; table-layout: auto;
    }
    .data-table td.actions { white-space: normal; }

    /* Landkarte + Kalender kleiner */
    .map-canvas { height: 320px; }
    #calendar { font-size: 0.9em; }

    /* Karten-Abstände enger */
    .card { padding: 14px 16px; }
    .filter-row { gap: 8px; }
    .filter-row label input[type=date] { min-width: 0; width: 100%; }

    /* Bestellformular: Bild über Beschreibung auf Handy */
    .bread-card-wide { flex-direction: column; align-items: stretch; padding: 0; gap: 0; }
    .bread-card-wide .bread-image {
        max-width: 100%;
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    /* Actions in Listen stapeln */
    .data-table .actions { flex-direction: column; gap: 4px; align-items: stretch; }
    .data-table .actions .btn-sm { text-align: center; }

    /* Code-Block (Recovery-Code) mittig + umbrechen */
    .code-block { justify-content: center; flex-direction: column; text-align: center; }
    .code-block code { font-size: 1.4em; word-break: break-all; }

    /* Brand-Schrift dezenter, damit Platz bleibt */
    .app-header .brand span { font-size: 0.95em; }

    .grid-2 .data-table th,
    .grid-2 .data-table td { padding: 8px 6px; }
}

@media (max-width: 420px) {
    .app-header .brand span { display: none; } /* nur Icon, Platz sparen */
    .btn { padding: 10px 14px; } /* größere Touch-Ziele */
    .btn-sm { padding: 8px 12px; font-size: 0.95em; }
}
