* { box-sizing: border-box; }
body { font-family: Arial, sans-serif; margin: 0; background: #f4f6f9; color: #222; }
.container { max-width: 1200px; margin: 0 auto; padding: 16px 20px; }
.topbar { background: #fff; border-bottom: 1px solid #dce1e8; position: sticky; top: 0; z-index: 50; }
.topbar-inner { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: #0f172a; margin-right: auto; }
.brand-mark { font-size: 22px; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.1; }
.nav-primary { display: flex; align-items: center; gap: 4px; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; text-decoration: none; color: #334155; font-size: 14px; font-weight: 600; transition: background .15s ease, color .15s ease; }
.nav-link:hover { background: #eff6ff; color: #1d4ed8; }
.nav-link.is-active { background: #1d4ed8; color: #fff; }
.nav-link.is-active:hover { background: #1e40af; color: #fff; }
.nav-icon { font-size: 16px; line-height: 1; }
.topbar-badge-link { position: relative; display: inline-flex; align-items: center; padding: 8px; border-radius: 999px; text-decoration: none; color: #334155; }
.topbar-badge-link:hover { background: #f1f5f9; }
.topbar-badge-link .nav-badge { position: absolute; top: 2px; right: 2px; margin: 0; }
.nav-badge { display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 4px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; vertical-align: middle; }
.menu-toggle { width: 40px; height: 40px; padding: 0; margin: 0; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; border-radius: 10px; font-size: 20px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.menu-toggle:hover { background: #f1f5f9; }
.menu-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); opacity: 0; transition: opacity .2s ease; z-index: 60; }
.menu-overlay.is-visible { opacity: 1; }
.menu-drawer { position: fixed; top: 0; right: 0; width: 280px; max-width: 85vw; height: 100vh; background: #fff; box-shadow: -10px 0 30px rgba(15, 23, 42, 0.15); transform: translateX(100%); transition: transform .2s ease; z-index: 70; display: flex; flex-direction: column; }
.menu-drawer.is-open { transform: translateX(0); }
.menu-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #e2e8f0; }
.menu-drawer-title { font-weight: 700; font-size: 16px; color: #0f172a; }
.menu-close { width: 36px; height: 36px; padding: 0; margin: 0; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; border-radius: 8px; font-size: 16px; cursor: pointer; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.menu-close:hover { background: #f1f5f9; }
.menu-list { display: flex; flex-direction: column; padding: 8px; gap: 2px; overflow-y: auto; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: #0f172a; font-size: 15px; font-weight: 500; }
.menu-item:hover { background: #f1f5f9; }
.menu-item.is-active { background: #eff6ff; color: #1d4ed8; font-weight: 700; }
.menu-item.menu-item-danger { color: #b91c1c; margin-top: 6px; border-top: 1px solid #e2e8f0; padding-top: 12px; border-radius: 0 0 10px 10px; }
.menu-item.menu-item-danger:hover { background: #fee2e2; }
.menu-icon { font-size: 18px; width: 24px; text-align: center; }
.menu-label { flex: 1; }
.menu-badge { margin-left: auto; }
body.has-open-menu { overflow: hidden; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.profile-card { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05); }
h1 { font-size: 22px; margin: 0 0 10px; }
h2 { font-size: 18px; margin: 0 0 10px; }
label { display: block; margin: 10px 0 6px; font-weight: 600; }
input, select, button { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #cbd5e1; }
button { background: #2563eb; color: #fff; border: none; font-weight: 600; margin-top: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { border-bottom: 1px solid #e5e7eb; padding: 8px 6px; text-align: left; }
.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap .table { min-width: 620px; }
.table-wrap .table thead th { position: sticky; top: 0; background: #fff; z-index: 2; }
/* Tagesbilanz: beide Tabellen mit identischer Spaltenaufteilung, damit Werte bündig untereinander stehen. */
.balance-table { table-layout: fixed; }
.balance-table th, .balance-table td { white-space: nowrap; }
.balance-table th:first-child, .balance-table td:first-child { width: 34%; }
.balance-table th:not(:first-child), .balance-table td:not(:first-child) { width: 22%; }
.balance-subheading { margin: 16px 0 6px; font-size: 14px; font-weight: 700; color: #0f172a; }
.table-wrap-sticky { max-height: 360px; overflow: auto; border: 1px solid #e5e7eb; border-radius: 8px; }
.table-wrap-sticky .table { margin: 0; }
.table-wrap-sticky .table thead th { box-shadow: inset 0 -1px 0 #e5e7eb; }
.alert { padding: 10px; border-radius: 8px; margin-bottom: 10px; }
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.success { background: #dcfce7; color: #166534; }
.alert.info { background: #dbeafe; color: #1e40af; }
.muted { color: #64748b; font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
/* Auf Desktop (ab 992px) werden grid-2-Formulare dreispaltig dargestellt. */
@media (min-width: 992px) {
    .grid-2 { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.stat-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px; }
.stat-card .value { font-weight: 700; font-size: 15px; }
.chart-wrap { position: relative; width: 100%; height: 280px; }
.recipe-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; margin-top: 10px; }
.recipe-legend-item { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #475569; cursor: pointer; user-select: none; }
.recipe-legend-item.is-hidden { text-decoration: line-through; color: #94a3b8; }
.recipe-legend-item.is-hidden .recipe-legend-color { opacity: 0.35; }
.recipe-legend-color { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px; }
@media (max-width: 700px) {
    .recipe-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.filter-form { align-items: end; }
.filter-actions { align-self: end; }
.no-top-margin { margin-top: 0; }
.inline-form { display: flex; align-items: center; gap: 6px; }
.inline-form input { min-width: 90px; max-width: 120px; padding: 6px 8px; }
.btn-small { width: auto; margin-top: 0; padding: 6px 10px; font-size: 12px; }
.btn-danger { background: #dc2626; }
.full-width { grid-column: 1 / -1; }
.field-help { margin-top: 0; margin-bottom: 4px; color: #475569; font-size: 13px; }
.profile-form { gap: 12px; }
.profile-section { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; }
.profile-section + .profile-section { margin-top: 28px; }
.profile-section h2 { margin-bottom: 8px; }
.profile-grid { gap: 10px; }
.activity-section { padding-top: 20px; }
.activity-table-wrap { margin-top: 10px; border: 1px solid #dbe6f3; border-radius: 12px; overflow: hidden; background: #fff; }
.activity-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.activity-table thead th { text-align: left; padding: 10px 18px; color: #64748b; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; background: #f1f5f9; border-bottom: 1px solid #dbe6f3; }
.activity-table thead th:nth-child(1) { width: 33%; }
.activity-table thead th:nth-child(2) { width: 49%; }
.activity-table thead th:nth-child(3) { width: 18%; text-align: center; }
.activity-table tbody td { padding: 10px 18px; border-bottom: 1px solid #e2e8f0; vertical-align: middle; }
.activity-table thead th:nth-child(1),
.activity-table tbody td:nth-child(1) { padding-right: 26px; }
.activity-table thead th:nth-child(2),
.activity-table tbody td:nth-child(2) { padding-left: 26px; padding-right: 26px; }
.activity-table thead th:nth-child(3),
.activity-table tbody td:nth-child(3) { padding-left: 26px; }
.activity-table tbody tr:last-child td { border-bottom: none; }
.activity-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.activity-name label { margin: 0; }
.pal-badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #1d4ed8; background: #dbeafe; border: 1px solid #bfdbfe; }
.field-help-block { color: #475569; font-size: 13px; line-height: 1.35; }
.activity-value { text-align: center; }
.activity-input { width: 78px; min-width: 78px; max-width: 78px; padding: 6px 4px; text-align: center; margin: 0 auto; }
.profile-actions { margin-top: 8px; }
.profile-sum { margin-bottom: 6px; }
.photo-position-form { margin-top: 10px; }
.photo-position-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.compact-input { padding: 6px 8px; min-width: 80px; }
.search-form { display: flex; gap: 8px; align-items: center; margin: 8px 0 12px; }
.search-form input { margin: 0; }
.summary-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.summary-subtitle { margin: 0; }
.ingredient-header { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 10px; }
.back-link { display: inline-block; padding: 5px 10px; border-radius: 6px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; text-decoration: none; font-size: 13px; }
.ingredient-meta { display: grid; gap: 4px; margin-bottom: 10px; padding: 8px 10px; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0; color: #334155; font-size: 14px; }
.meta-label { font-weight: 600; color: #0f172a; }
.consumption-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.consumption-group { margin-bottom: 14px; }
.consumption-group-title { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: #1d4ed8; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px; }
.consumption-entry { border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; background: #f8fafc; }
.consumption-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; margin-top: 4px; font-size: 13px; }
.consumption-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.consumption-actions form { margin: 0; }
.consumption-actions button { margin-top: 0; }
.consumption-entry .summary-header strong { font-size: 14px; }
.consumption-actions .btn-small { padding: 4px 10px; font-size: 12px; }
.kcal-positive { color: #166534; font-weight: 700; }
.kcal-negative { color: #991b1b; font-weight: 700; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.history-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease; }
.history-card:hover { border-color: #94a3b8; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08); }
.history-card:active { transform: translateY(1px); }
.history-card-active { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.history-card-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.history-card-header strong { font-size: 16px; color: #0f172a; }
.history-card-rest { font-size: 13px; }
.history-progress { display: flex; flex-direction: column; gap: 4px; }
.history-progress-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.history-progress-fill { height: 100%; background: #2563eb; transition: width .3s ease; }
.history-progress-text { font-size: 12px; color: #475569; text-align: right; }
.history-meals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.history-meal { background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; padding: 6px 8px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.history-meal-name { font-weight: 700; color: #0f172a; margin-bottom: 2px; font-size: 13px; }
.history-meal-row { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: #334155; }
.history-meal-label { color: #64748b; }
.consumption-form-grid > .full-width { grid-column: 1 / -1; }
.goal-form { gap: 10px; }
.goal-form .filter-actions { grid-column: 1 / -1; }
.goal-section { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; }
.goal-section h2 { margin-bottom: 8px; }
.goal-assistant { background: #eff6ff; border-color: #bfdbfe; }
.goal-assistant .btn-row { margin: 8px 0 4px; }
.goal-assistant .card-intro { color: #1e3a8a; }
.goal-grid { gap: 10px; }
.goal-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 10px; }

@media (max-width: 900px) {
    .profile-form,
    .profile-grid { grid-template-columns: 1fr; }
    .activity-table thead { display: none; }
    .activity-table,
    .activity-table tbody,
    .activity-table tr,
    .activity-table td { display: block; width: 100%; }
    .activity-table tbody td { border-bottom: none; padding: 6px 10px; }
    .activity-table tbody tr { border-bottom: 1px solid #e2e8f0; padding: 8px 0; }
    .activity-table tbody tr:last-child { border-bottom: none; }
    .activity-value { text-align: left; }
    .activity-input { margin: 0; width: 120px; min-width: 120px; max-width: 120px; }
    .field-help-block { margin-top: 0; }
    .photo-position-grid { grid-template-columns: 1fr; }
    .goal-grid { grid-template-columns: 1fr; }
}

#zutat_search { margin-bottom: 6px; }

@media (max-width: 700px) {
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .goal-stats-grid { grid-template-columns: 1fr; }
    .chart-wrap { height: 240px; }
    .search-form { flex-direction: column; align-items: stretch; }
    .consumption-list { grid-template-columns: 1fr; }
    .consumption-meta { grid-template-columns: 1fr; }
    .consumption-form-grid { grid-template-columns: 1fr; gap: 10px; }
    .consumption-form-grid > div { grid-column: 1 / -1; }
    .consumption-form-grid .filter-actions { align-self: stretch; }
    .consumption-form-grid .filter-actions button { width: 100%; }
    .profile-grid { grid-template-columns: 1fr; }
    .table-wrap .table { min-width: 0; font-size: 13px; }
    .table-wrap .table th,
    .table-wrap .table td { padding: 6px 4px; }
    .history-grid { grid-template-columns: 1fr; }
}

/* Desktop-Layout: breitere Karten und großzügigere Kachel-Grids ab ausreichender Breite. */
@media (min-width: 1024px) {
    .card { padding: 18px 20px; margin-bottom: 16px; }
}
@media (min-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}

/* Menü-Verhalten: primäre Links auf großen Screens, Hamburger auf kleineren Screens. */
.menu-toggle { display: inline-flex; }
@media (max-width: 900px) {
    .nav-primary { display: none; }
    .brand-name { font-size: 15px; }
}
@media (max-width: 480px) {
    .brand-name { display: none; }
}

/* Admin-Benutzer-Tabelle: Karten-Layout bis inkl. schmaler Desktops (bis 900px). */
@media (max-width: 900px) {
    .admin-users-table { min-width: 0; display: block; }
    .admin-users-table thead { display: none; }
    .admin-users-table tbody,
    .admin-users-table tr,
    .admin-users-table td { display: block; width: 100%; }
    .admin-users-table tbody tr {
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #f8fafc;
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    .admin-users-table tbody tr:last-child { margin-bottom: 0; }
    .admin-users-table td {
        border: none;
        padding: 4px 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        font-size: 13px;
    }
    .admin-users-table td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .02em;
        flex: 0 0 auto;
    }
    .admin-users-table td > * { text-align: right; }
    .admin-users-table td[data-label="Benutzer"] {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding-bottom: 8px;
        border-bottom: 1px solid #e2e8f0;
        margin-bottom: 4px;
    }
    .admin-users-table td[data-label="Benutzer"]::before { display: none; }
    .admin-users-table td[data-label="Benutzer"] strong { font-size: 15px; color: #0f172a; }
    .admin-users-table td.admin-users-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding-top: 8px;
        border-top: 1px solid #e2e8f0;
        margin-top: 4px;
    }
    .admin-users-table td.admin-users-actions::before {
        align-self: flex-start;
        margin-bottom: 2px;
    }
    .admin-users-table td.admin-users-actions .btn-row { width: 100%; }
    .admin-users-table td.admin-users-actions .btn-row .btn,
    .admin-users-table td.admin-users-actions .btn-row button {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }
    .admin-users-table td.admin-users-actions form { flex: 1 1 calc(50% - 4px); display: flex; }
    .admin-users-table td.admin-users-actions form .btn { width: 100%; }
}

/* Admin-Nachrichten-Tabelle: Karten-Layout am Handy (bis 900px).
   Am Desktop bleibt sie eine normale Tabelle – dort wurde keine
   Optikänderung gewünscht. */
@media (max-width: 900px) {
    .admin-notifications-table { min-width: 0; display: block; }
    .admin-notifications-table thead { display: none; }
    .admin-notifications-table tbody,
    .admin-notifications-table tr,
    .admin-notifications-table td { display: block; width: 100%; }
    .admin-notifications-table tbody tr {
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #f8fafc;
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    .admin-notifications-table tbody tr:last-child { margin-bottom: 0; }
    .admin-notifications-table td {
        border: none;
        padding: 4px 0;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        font-size: 13px;
    }
    .admin-notifications-table td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .02em;
        flex: 0 0 auto;
    }
    .admin-notifications-table td > * { text-align: right; }
    /* Titel darf mehrzeilig sein und wird bewusst nicht rechtsbündig gezwungen. */
    .admin-notifications-table td[data-label="Titel"] {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding-top: 6px;
        padding-bottom: 6px;
    }
    .admin-notifications-table td[data-label="Titel"] > * {
        text-align: left;
        word-break: break-word;
    }
    /* Aktionen unten in der Kachel, volle Breite. */
    .admin-notifications-table td[data-label="Aktionen"] {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding-top: 8px;
        border-top: 1px solid #e2e8f0;
        margin-top: 4px;
    }
    .admin-notifications-table td[data-label="Aktionen"]::before {
        align-self: flex-start;
        margin-bottom: 2px;
    }
    .admin-notifications-table td[data-label="Aktionen"] form { width: 100%; }
    .admin-notifications-table td[data-label="Aktionen"] .btn { width: 100%; }
}

/* Admin-Benutzer-Tabelle: Desktop-Kachel-Layout (ab 901px).
   Statt einer schmalen Tabelle mit vielen Spalten wird die Liste als
   zweispaltiges Kachelgitter angezeigt – gleiche Optik wie die
   Handy-Karten, nur zwei nebeneinander. Zwischen 901–1100 px fällt
   das Grid auf eine Spalte zurück, damit die Kachel nicht gequetscht
   wirkt. Das Markup (Table mit data-label pro Zelle) bleibt unverändert. */
@media (min-width: 901px) {
    /* Wrapper: kein horizontales Scrollen, volle Breite nutzen. */
    .admin-users-wrap { overflow-x: visible; }
    .table-wrap:has(.admin-users-table) { overflow-x: visible; }

    /* Tabelle wird optisch aufgelöst – wir zeichnen selbst Kacheln. */
    .admin-users-table {
        width: 100%;
        min-width: 0;
        display: block;
        border: none;
        background: transparent;
        box-shadow: none;
    }
    .admin-users-table thead { display: none; }

    /* Der Tabellen-Body wird zum Kachelgitter (2 Spalten). */
    .admin-users-table tbody {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        width: 100%;
    }

    /* Jede Zeile ist eine Kachel. */
    .admin-users-table tr {
        display: block;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #f8fafc;
        padding: 12px 14px;
        box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    }

    /* Jede Zelle wird zu einer Label-/Wert-Zeile in der Kachel. */
    .admin-users-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        border: none;
        padding: 4px 0;
        font-size: 13px;
        line-height: 1.35;
        white-space: normal;
    }
    .admin-users-table td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .02em;
        flex: 0 0 auto;
    }
    .admin-users-table td > * { text-align: right; }

    /* Kopfzeile der Kachel: Benutzername + Badges links, ohne Label. */
    .admin-users-table td[data-label="Benutzer"] {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding-bottom: 8px;
        border-bottom: 1px solid #e2e8f0;
        margin-bottom: 4px;
    }
    .admin-users-table td[data-label="Benutzer"]::before { display: none; }
    .admin-users-table td[data-label="Benutzer"] strong {
        font-size: 15px;
        font-weight: 700;
        color: #0f172a;
    }
    .admin-users-table td[data-label="Benutzer"] > * { text-align: left; }

    /* Kompaktere Badges in Kacheln. */
    .admin-users-table .pal-badge {
        padding: 1px 7px;
        font-size: 11px;
        font-weight: 600;
    }

    /* Aktionen-Fußzeile: volle Kachelbreite, Buttons wickelnd. */
    .admin-users-table td.admin-users-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding-top: 8px;
        border-top: 1px solid #e2e8f0;
        margin-top: 4px;
    }
    .admin-users-table td.admin-users-actions::before {
        align-self: flex-start;
        margin-bottom: 2px;
    }
    .admin-users-table td.admin-users-actions .btn-row {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
        margin: 0;
        width: 100%;
    }
    .admin-users-table td.admin-users-actions .btn-row .btn,
    .admin-users-table td.admin-users-actions .btn-row button {
        flex: 0 0 auto;
        width: auto;
        margin-top: 0;
        padding: 4px 10px;
        font-size: 12px;
        line-height: 1.2;
        border-radius: 6px;
    }
    .admin-users-table td.admin-users-actions form {
        display: inline-flex;
        margin: 0;
    }
}

/* Zwischenbereich 901–1100 px: eine Spalte, damit die Kacheln nicht zu eng werden. */
@media (min-width: 901px) and (max-width: 1100px) {
    .admin-users-table tbody {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .history-meals { grid-template-columns: 1fr; }
}

/* === Einheitliches UI-System (Tooltips, Buttons, Hilfetexte) === */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; background: #2563eb; color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.btn:hover { background: #1d4ed8; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .35); }
.btn[disabled], .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: #fff; color: #1d4ed8; border-color: #bfdbfe; }
.btn-secondary:hover { background: #eff6ff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: #1d4ed8; }
.btn-ghost:hover { background: #eff6ff; }
.btn.is-disabled, a.btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.range-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-nav .btn-small { min-width: 38px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row .btn, .btn-row button { margin-top: 0; }

.card-intro { margin: -2px 0 12px; color: #475569; font-size: 14px; line-height: 1.45; }
.card-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.card-title-row h1, .card-title-row h2 { margin: 0; }

.label-row { display: inline-flex; align-items: center; gap: 6px; }
.field-help { display: block; margin: 4px 0 0; color: #475569; font-size: 12.5px; line-height: 1.35; }

.info-tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: #dbeafe; color: #1d4ed8; font-size: 11px; font-weight: 700; border: 1px solid #bfdbfe; cursor: help; user-select: none; line-height: 1; }
.info-tip:hover, .info-tip:focus { background: #bfdbfe; outline: none; }
.info-tip .info-tip-text { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); min-width: 200px; max-width: 280px; padding: 8px 10px; background: #0f172a; color: #f8fafc; border-radius: 6px; font-size: 12px; font-weight: 400; line-height: 1.4; text-align: left; box-shadow: 0 6px 16px rgba(15, 23, 42, .25); opacity: 0; pointer-events: none; transition: opacity .15s ease; z-index: 50; white-space: normal; }
.info-tip .info-tip-text::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #0f172a; }
.info-tip:hover .info-tip-text,
.info-tip:focus .info-tip-text,
.info-tip:focus-within .info-tip-text { opacity: 1; pointer-events: auto; }
.info-tip[data-tip-pos="right"] .info-tip-text { left: auto; right: 0; transform: none; }
.info-tip[data-tip-pos="right"] .info-tip-text::after { left: auto; right: 8px; transform: none; }

.help-block { margin-top: 6px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; }
.help-block > summary { list-style: none; cursor: pointer; padding: 8px 10px; font-size: 13px; color: #1d4ed8; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.help-block > summary::-webkit-details-marker { display: none; }
.help-block > summary::before { content: "ⓘ"; font-size: 14px; }
.help-block[open] > summary { border-bottom: 1px solid #e2e8f0; }
.help-block > .help-body { padding: 10px; font-size: 13px; color: #334155; line-height: 1.5; }
.help-block > .help-body p { margin: 0 0 6px; }
.help-block > .help-body p:last-child { margin-bottom: 0; }
.help-block > .help-body ul { margin: 4px 0 0; padding-left: 18px; }

.value-with-unit { display: flex; align-items: center; gap: 6px; }
.value-with-unit input { flex: 1 1 auto; }
.value-with-unit .unit { color: #64748b; font-size: 13px; }

/* === Tagesdetail-Karte (weight.php) === */
.day-detail-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 4px; }
.chart-share-row { margin-top: 8px; justify-content: flex-end; }
@media (max-width: 700px) {
    .day-detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-share-row { justify-content: stretch; }
}

/* === Garmin-CSV-Import: Hilfe-Block === */
.garmin-export-hint { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 12px 14px; margin: 12px 0 16px; }
.garmin-export-hint-head { display: flex; align-items: center; gap: 6px; color: #1d4ed8; font-size: 15px; margin-bottom: 4px; }
.garmin-export-hint-note { margin: 4px 0 8px; color: #1e3a8a; font-size: 13.5px; line-height: 1.4; }
.garmin-export-hint-note strong { color: #1e3a8a; }
.garmin-export-hint-steps { margin: 0 0 10px; padding-left: 20px; color: #334155; font-size: 13.5px; line-height: 1.5; }
.garmin-export-hint-steps li { margin-bottom: 2px; }
.garmin-export-hint-steps li:last-child { margin-bottom: 0; }

@media (max-width: 700px) {
    .info-tip .info-tip-text { min-width: 160px; max-width: 220px; font-size: 11.5px; }
    .btn-row { gap: 6px; }
    .btn { width: 100%; }
    .btn-row .btn { flex: 1 1 100%; }
}

@media (hover: none) {
    .info-tip { cursor: pointer; }
}

/* === Empfehlungs-Ampel (analog zur Forms-App: grüner Balken mit Bewertungszahl) === */
.empfehlung-balken {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    line-height: 1;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    user-select: none;
}
.empfehlung-balken__label {
    font-weight: 600;
    opacity: 0.85;
    font-size: 0.85em;
}
.empfehlung-balken__wert {
    font-variant-numeric: tabular-nums;
}
.empfehlung-balken--full {
    width: 100%;
    padding: 10px 14px;
    font-size: 18px;
    margin: 10px 0 14px;
}
.empfehlung-balken--pill {
    padding: 2px 10px;
    font-size: 12.5px;
    border-radius: 999px;
}
.empfehlung-balken--gruen  { background: #22c55e; color: #0f172a; }
.empfehlung-balken--gelb   { background: #facc15; color: #1f2937; }
.empfehlung-balken--orange { background: #f97316; color: #1f2937; }
.empfehlung-balken--rot    { background: #dc2626; color: #ffffff; border-color: rgba(0, 0, 0, 0.15); }

/* Zubereitungsschritte */
.steps-list {
    list-style: decimal inside;
    padding: 0;
    margin: 0;
}
.steps-list .step-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0 0 10px;
    list-style-position: outside;
    margin-left: 18px;
}
.steps-list .step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Zielintensitäts-Slider (goal.php)
   Cross-Browser-Style für <input type="range"> + Touch-Fixes fürs Handy.
   Ohne diesen Block ist der Slider auf iOS/Android schwer bis gar nicht
   bedienbar (fehlende Breite, kein touch-action, zu kleiner Thumb,
   Legende überlagert den Regler).
-------------------------------------------------------------------------- */
.goal-preset-slider {
    margin: 12px 0 4px;
}
.goal-preset-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    height: 36px;             /* großzügige Trefferfläche für Finger */
    padding: 0;
    margin: 0;
    background: transparent;
    touch-action: manipulation; /* Slider gewinnt vor Seiten-Scroll */
    cursor: pointer;
}
.goal-preset-slider input[type="range"]:focus {
    outline: none;
}
/* Track */
.goal-preset-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
}
.goal-preset-slider input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
}
/* Thumb */
.goal-preset-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    margin-top: -11px;        /* zentriert den Thumb über der 6px-Track */
    cursor: pointer;
}
.goal-preset-slider input[type="range"]::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    cursor: pointer;
}
/* Legende soll Touch-Events zum Slider durchreichen. */
.goal-preset-slider .slider-legend {
    pointer-events: none;
}

/* === Aufklappbare Bereiche (Accordion-Karten) ===
   Wird benutzt, um lange Seiten (Profil, Zutaten, ...) in kompakte,
   ausklappbare Abschnitte zu unterteilen. Reduziert das Scrollen.
   Verwendung: <details class="section-accordion" [open]>
                 <summary class="section-summary">
                    <span class="section-icon">👤</span>
                    <span class="section-title">Titel</span>
                 </summary>
                 <div class="section-body"> ... </div>
               </details>
*/
details.section-accordion {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
    overflow: hidden;
}
details.section-accordion > summary.section-summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
    user-select: none;
}
details.section-accordion > summary.section-summary::-webkit-details-marker { display: none; }
details.section-accordion > summary.section-summary::after {
    content: "▾";
    margin-left: auto;
    color: #64748b;
    font-size: 14px;
    transition: transform .15s ease;
}
details.section-accordion[open] > summary.section-summary::after { transform: rotate(180deg); }
details.section-accordion > summary.section-summary:hover { background: #f8fafc; }
details.section-accordion[open] > summary.section-summary { border-bottom: 1px solid #e5e7eb; }
details.section-accordion .section-icon {
    font-size: 20px;
    line-height: 1;
    width: 24px;
    text-align: center;
    flex: 0 0 24px;
}
details.section-accordion .section-title { flex: 1 1 auto; }
details.section-accordion .section-body { padding: 14px 16px; }
/* Info-Tooltip im Summary neutralisieren, damit er nicht als Titel formatiert wird. */
details.section-accordion > summary.section-summary .info-tip { font-weight: 400; font-size: 11px; }
@media (min-width: 1024px) {
    details.section-accordion .section-body { padding: 18px 20px; }
}

/*
 * Unterbereich-Accordion innerhalb einer section-accordion (z. B. Aktivitätsniveau im Profil).
 * Dezenter als section-accordion: kein Schatten, dünnere Border, hellerer Header.
 */
details.subsection-accordion {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
    margin: 12px 0;
    overflow: hidden;
}
details.subsection-accordion > summary.subsection-summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    position: relative;
    padding-right: 34px;
}
details.subsection-accordion > summary.subsection-summary::-webkit-details-marker { display: none; }
details.subsection-accordion > summary.subsection-summary::after {
    content: "▾";
    position: absolute;
    right: 12px;
    color: #6b7280;
    transition: transform 0.15s ease;
}
details.subsection-accordion[open] > summary.subsection-summary::after { transform: rotate(180deg); }
details.subsection-accordion > summary.subsection-summary:hover { background: #e5e7eb; }
details.subsection-accordion[open] > summary.subsection-summary { border-bottom: 1px solid #e5e7eb; }
details.subsection-accordion > summary.subsection-summary .info-tip { font-weight: 400; font-size: 11px; }
details.subsection-accordion .field-help,
details.subsection-accordion .help-block,
details.subsection-accordion .activity-table-wrap {
    margin-left: 14px;
    margin-right: 14px;
}
details.subsection-accordion .activity-table-wrap { margin-top: 10px; margin-bottom: 12px; }

/* "Bitte warten"-Overlay beim Speichern (verhindert Doppel-Submits) */
.busy-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.45); opacity: 0; transition: opacity .15s ease; z-index: 9999; }
.busy-overlay.is-visible { opacity: 1; }
.busy-box { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px 28px; background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25); max-width: 85vw; }
.busy-spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid #dbeafe; border-top-color: #1d4ed8; animation: busy-spin .8s linear infinite; }
.busy-text { font-size: 15px; font-weight: 600; color: #0f172a; text-align: center; }
body.has-busy-overlay { overflow: hidden; }
button.is-busy, input.is-busy { opacity: .65; cursor: progress; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .busy-spinner { animation-duration: 1.6s; } }

/* Dashboard-Coach: Hinweiskarten */
.coach-card { border-left: 4px solid #1d4ed8; }
.coach-card.coach-hint { border-left-color: #2563eb; background: #f8fbff; }
.coach-card.coach-motivate { border-left-color: #d97706; background: #fffbeb; }
.coach-card.coach-plan { border-left-color: #7c3aed; background: #faf8ff; }
.coach-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.coach-icon { font-size: 20px; line-height: 1; }
.coach-title { font-size: 16px; color: #0f172a; }
.coach-text { margin: 8px 0 12px; font-size: 14px; line-height: 1.5; color: #334155; }
.coach-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.coach-inline-form { display: inline; margin: 0; }
.coach-hint { margin: 10px 0 0; font-size: 12px; }
@media (max-width: 600px) {
	.coach-actions { flex-direction: column; align-items: stretch; }
	.coach-actions .btn, .coach-inline-form, .coach-inline-form .btn { width: 100%; }
}

