/* Evo Manager - gemeinsames Design für alle Dashboard-Seiten.
   Aufbau: Tokens -> Grundlayout (Sidebar/Topbar) -> Bausteine -> Hilfsklassen -> Handy. */

:root {
    color-scheme: dark;
    --bg: #0d0f13;
    --bg-elev: #13161c;
    --surface: #171a21;
    --surface-2: #1e222b;
    --surface-3: #272c37;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);
    --text: #e8eaef;
    --text-2: #b6bcc8;
    --muted: #868d9c;
    --accent: #5865f2;
    --accent-hover: #6b76f4;
    --accent-soft: rgba(88, 101, 242, 0.15);
    --success: #23a55a;
    --success-soft: rgba(35, 165, 90, 0.15);
    --danger: #f23f43;
    --danger-hover: #f5585b;
    --danger-soft: rgba(242, 63, 67, 0.14);
    --warning: #f0b232;
    --warning-soft: rgba(240, 178, 50, 0.15);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.28);
    --sidebar-w: 252px;
    --topbar-h: 64px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; color: #fff; line-height: 1.25; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- App-Gerüst ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    transition: transform 0.25s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px; height: var(--topbar-h); }
.brand-logo {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), #8b5cf6); color: #fff; font-weight: 800; font-size: 15px;
    box-shadow: 0 6px 18px rgba(88, 101, 242, 0.35);
}
.brand-name { font-weight: 700; font-size: 15px; color: #fff; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.nav-group { margin-top: 14px; }
.nav-label { padding: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 10px; margin: 1px 0; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--surface-2); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: #fff; }
.nav-link.active .icon { color: var(--accent-hover); }
.nav-badge { margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--danger-soft); color: #ff8a8c; }

.sidebar-user { border-top: 1px solid var(--border); padding: 12px; display: flex; align-items: center; gap: 10px; }
.sidebar-user .meta { min-width: 0; flex: 1; }
.sidebar-user .name { font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .role { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 28px;
    background: rgba(13, 15, 19, 0.82);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .menu-toggle { display: none; }

.lang-switch { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; flex-shrink: 0; }
.lang-btn { width: 36px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; cursor: pointer; opacity: 0.45; filter: grayscale(0.6); transition: opacity 0.15s, filter 0.15s, background 0.15s; }
.lang-btn:hover { opacity: 0.85; filter: none; }
.lang-btn.active { opacity: 1; filter: none; background: var(--surface-3); }
.lang-btn svg { width: 22px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); display: block; }
.login-lang { position: fixed; top: 16px; right: 16px; } /* .topbar davor, damit .btn (display:inline-flex) es nicht überschreibt */

.content { padding: 24px 28px 48px; width: 100%; max-width: 1440px; margin: 0 auto; }
.content.narrow { max-width: 960px; }

/* ---------- Bausteine ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.card + .card, .stack > * + * { margin-top: 18px; }
.stat-grid > .card, .grid-2 > .card { margin-top: 0; } /* im Raster regelt "gap" den Abstand */
.card-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-header p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.card-header .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card-header > .grow { flex: 1 1 220px; } /* bei wenig Platz rutschen die Aktionen in die nächste Zeile, statt den Titel zu quetschen */
.card-body { padding: 18px 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 14px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 13.5px; line-height: 1;
    cursor: pointer; white-space: nowrap; user-select: none;
    background: var(--surface-2); color: var(--text); border-color: var(--border-strong);
    transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); background: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: #fff; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: #ff8a8c; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; gap: 5px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-xs { width: 26px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
    width: 100%; height: 38px; padding: 0 12px;
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font: inherit; font-size: 14px; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23868d9c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
input[type="checkbox"].check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; }
input[type="file"].input { padding: 7px 10px; height: auto; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 20px; background: var(--surface-3); position: relative; transition: background 0.15s; flex-shrink: 0; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.toolbar > .field { flex: 1 1 200px; }
.toolbar > .grow { flex: 1 1 260px; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
    border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 600; font-size: 13px;
    height: 32px; padding: 0 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.segmented button:hover { color: #fff; }
.segmented button.active { background: var(--surface-3); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.segmented .count { font-size: 11px; color: var(--muted); font-weight: 600; }

.chip {
    display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    height: 24px; padding: 0 9px; border-radius: 7px;
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap;
}
.chip > span { overflow: hidden; text-overflow: ellipsis; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chip .x { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: -4px; border-radius: 4px; color: var(--muted); cursor: pointer; border: 0; background: none; padding: 0; }
.chip .x:hover { background: var(--danger-soft); color: #ff8a8c; }
.chip-add { border-style: dashed; color: var(--muted); cursor: pointer; background: transparent; font: inherit; font-size: 12px; }
.chip-add:hover { color: #fff; border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge-accent { background: var(--accent-soft); color: #aab1ff; }
.badge-success { background: var(--success-soft); color: #5fd68e; }
.badge-danger { background: var(--danger-soft); color: #ff8a8c; }
.badge-warning { background: var(--warning-soft); color: #f6c868; }

.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-3); }
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 44px; height: 44px; }

.callout { display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid rgba(88, 101, 242, 0.28); color: var(--text-2); font-size: 13px; line-height: 1.6; }
.callout .icon { color: var(--accent-hover); margin-top: 2px; }
.callout b { color: #fff; }
.callout.warning { background: var(--warning-soft); border-color: rgba(240, 178, 50, 0.3); }
.callout.warning .icon { color: var(--warning); }
details.callout-details > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.callout-details > summary::-webkit-details-marker { display: none; }
details.callout-details[open] > summary { margin-bottom: 10px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-hover); flex-shrink: 0; }
.stat-icon.green { background: var(--success-soft); color: #5fd68e; }
.stat-icon.yellow { background: var(--warning-soft); color: var(--warning); }
.stat-icon.red { background: var(--danger-soft); color: #ff8a8c; }
.stat-value { font-size: 22px; font-weight: 700; color: #fff; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
.table .center { text-align: center; }
.table .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: rgba(255, 255, 255, 0.015); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: var(--surface-3); margin-bottom: 10px; }
.empty h3 { color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: 6px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tab:hover { color: #fff; }
.tab.active { color: #fff; border-bottom-color: var(--accent); }

.sticky-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 20px; background: rgba(23, 26, 33, 0.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Popover-Menü (z.B. "Rolle hinzufügen") */
.popover { position: fixed; z-index: 60; min-width: 220px; max-width: min(320px, calc(100vw - 24px)); max-height: 320px; display: flex; flex-direction: column; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); overflow: hidden; }
.popover .popover-search { padding: 8px; border-bottom: 1px solid var(--border); }
.popover .popover-search .input { height: 34px; font-size: 13px; }
.popover .popover-list { overflow-y: auto; padding: 4px; }
.popover-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; border-radius: 6px; cursor: pointer; }
.popover-item:hover, .popover-item.active { background: var(--accent); color: #fff; }
.popover-empty { padding: 12px; font-size: 13px; color: var(--muted); text-align: center; }

/* Toasts + Dialog */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); font-size: 13.5px; animation: toast-in 0.2s ease; }
.toast.success .icon { color: #5fd68e; }
.toast.error .icon { color: #ff8a8c; }
.toast.info .icon { color: var(--accent-hover); }
.toast.hide { opacity: 0; transform: translateY(6px); transition: all 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.6); display: grid; place-items: center; padding: 16px; animation: fade 0.15s ease; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.modal.wide { max-width: 760px; }
.modal-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; }
.modal-header .btn-icon { margin-left: auto; }
.modal-body { padding: 18px 20px; overflow-y: auto; color: var(--text-2); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 8px; background: var(--surface-3); border-radius: 8px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), #8b5cf6); transition: width 0.3s; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
    radial-gradient(900px 500px at 15% -10%, rgba(88, 101, 242, 0.22), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(139, 92, 246, 0.16), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; padding: 36px 32px; text-align: center; }
.login-card .brand-logo { width: 54px; height: 54px; font-size: 22px; border-radius: 15px; margin: 0 auto 18px; }
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-card p { color: var(--muted); margin: 0 0 26px; }
.btn-discord { width: 100%; height: 46px; font-size: 15px; background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-discord:hover { background: var(--accent-hover); }

/* ---------- Hilfsklassen ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; color: #fff; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.mt-0 { margin-top: 0 !important; }
.mb-16 { margin-bottom: 16px; }
.gap-6 { gap: 6px; }

/* ---------- Tablet & Handy ---------- */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, 0.6); }
    .sidebar-backdrop.open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.55); }
    .main { margin-left: 0; }
    .topbar .menu-toggle { display: inline-flex; }
    .topbar { padding: 0 14px; gap: 10px; }
    .content { padding: 16px 14px 40px; }
}

@media (max-width: 640px) {
    body { font-size: 14.5px; }
    .topbar-title p { display: none; }
    .card { border-radius: var(--radius); }
    .card-header, .card-body, .card-footer, .list-row, .pagination, .sticky-actions { padding-left: 14px; padding-right: 14px; }
    .grid-2 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 12px; gap: 10px; }
    .stat-icon { width: 34px; height: 34px; }
    .stat-value { font-size: 19px; }
    .btn { height: 40px; }
    .btn-sm { height: 36px; }
    .input, .select { height: 42px; font-size: 16px; } /* 16px verhindert das Auto-Zoomen auf iOS */
    .segmented { display: flex; width: 100%; }
    .segmented button { flex: 1 0 auto; justify-content: center; padding: 0 7px; font-size: 12.5px; gap: 4px; }
    .card-header .actions { margin-left: 0; width: 100%; }
    .card-header .actions > .input-icon { flex: 1; }
    .textarea { font-size: 16px; }
    .toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; }
    .modal-backdrop { align-items: end; padding: 0; }
    .modal { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }

    /* Tabellen mit .table-stack werden auf dem Handy zu Karten: jede Zeile ein Block,
       jede Zelle mit ihrer Spaltenüberschrift aus data-label davor. */
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
    .table-stack td { padding: 5px 0; border: 0; }
    .table-stack td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 3px; }
}
