*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
    font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 6px; font-weight: 700; }
h2 { font-size: 18px; letter-spacing: -.01em; margin: 28px 0 12px; font-weight: 650; }
h3 { font-size: 15px; margin: 0 0 8px; font-weight: 650; }
p { margin: 0 0 12px; }
small, .muted { color: var(--text-2); }
code, pre { font-family: var(--font-mono); font-size: 13px; }
pre { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-input); padding: 12px 14px; overflow: auto; margin: 0 0 12px; white-space: pre-wrap; word-break: break-all; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 20px 0; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-width); flex: 0 0 var(--sidebar-width); background: var(--surface);
    border-right: 1px solid var(--hairline); display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; padding: 20px 14px;
}
.main { flex: 1; min-width: 0; padding: 32px 40px 60px; max-width: 1180px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { color: var(--text-2); margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-avatar {
    width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-text);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: 0 0 auto;
}
.brand-logo { max-height: 36px; max-width: 120px; border-radius: 6px; }
.brand-name { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 16px 12px 6px; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text);
    font-weight: 500; transition: background .15s var(--ease);
}
.nav-item:hover { background: var(--accent-soft); text-decoration: none; }
.nav-item.is-active { background: var(--accent); color: var(--accent-text); }
.nav-item .icon { color: inherit; opacity: .85; }
.nav-badge { margin-left: auto; background: var(--info); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: var(--radius-pill); }
.nav-item.is-active .nav-badge { background: rgba(255,255,255,.25); }
.sidebar-footer { border-top: 1px solid var(--hairline); padding-top: 10px; margin-top: 10px; }
.sidebar-user { font-size: 12px; color: var(--text-3); padding: 8px 12px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.impersonation-bar {
    position: sticky; top: 0; z-index: 20; background: var(--warning); color: #fff; padding: 8px 16px; font-size: 14px; text-align: center;
}
.impersonation-bar a { color: #fff; text-decoration: underline; margin-left: 10px; }

/* Eingeklappte Seitenleiste (nur Desktop): nur Icons, Zustand in localStorage */
.sidebar-toggle { width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; color: var(--text-3); }
.sidebar-toggle .icon { transition: transform .2s var(--ease); }
.sidebar { transition: width .2s var(--ease), flex-basis .2s var(--ease); }
@media (min-width: 861px) {
    body.sidebar-collapsed .sidebar { width: 68px; flex-basis: 68px; padding-left: 10px; padding-right: 10px; }
    body.sidebar-collapsed .brand-name, body.sidebar-collapsed .nav-item span, body.sidebar-collapsed .nav-section,
    body.sidebar-collapsed .sidebar-user, body.sidebar-collapsed .brand-logo { display: none; }
    body.sidebar-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
    body.sidebar-collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
    body.sidebar-collapsed .nav-badge { position: absolute; top: 4px; right: 4px; margin: 0; }
    body.sidebar-collapsed .nav-item { position: relative; }
    body.sidebar-collapsed .sidebar-toggle .icon { transform: rotate(180deg); }
}
@media (max-width: 860px) { .sidebar-toggle { display: none; } }

/* ---------- Cards, grids */
.card {
    background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card);
    border: 1px solid var(--hairline); padding: 20px 22px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.is-link { transition: transform .2s var(--ease), box-shadow .2s var(--ease); display: block; color: inherit; }
.card.is-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); text-decoration: none; }
.card.is-link:active { transform: scale(.995); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius-card); border: 1px solid var(--hairline); box-shadow: var(--shadow-card); padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.stat .hint { font-size: 12px; color: var(--text-3); }
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty .icon { width: 36px; height: 36px; color: var(--text-3); margin-bottom: 8px; }

/* ---------- Buttons, badges, pills */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-pill);
    font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid transparent; line-height: 1.2;
    transition: background .15s var(--ease), transform .1s var(--ease); white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--accent); border-color: var(--hairline-strong); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn .icon { width: 16px; height: 16px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-blue { background: var(--info-soft); color: var(--info); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-orange { background: var(--warning-soft); color: var(--warning); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-gray { background: var(--gray-soft); color: var(--gray); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 6px 14px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--hairline-strong); font-size: 13px; font-weight: 600; color: var(--text-2); }
.pill:hover { text-decoration: none; background: var(--accent-soft); }
.pill.is-active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.stars { color: var(--stars); letter-spacing: 1px; font-size: 14px; }
.stat.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pill-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.pill-btn .icon { width: 14px; height: 14px; }
.pill-btn.has-filter, .pill-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.pill-count { background: var(--accent); color: var(--accent-text); font-size: 11px; padding: 0 6px; border-radius: var(--radius-pill); line-height: 16px; }
[hidden] { display: none !important; }
.pill-group { display: inline-flex; align-items: center; }
/* Löschen-Knopf gespeicherter Filter nur, wenn die Filterdetails offen sind */
.pills .pill-x { display: none; }
.pills.filter-open .pill-x { display: inline-block; }
.pills:not(.filter-open) .pill-group .pill { border-top-right-radius: var(--radius-pill); border-bottom-right-radius: var(--radius-pill); border-right: 1px solid var(--hairline-strong); }
.pill-group .pill { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.pill-x { font: inherit; font-size: 14px; line-height: 1; padding: 6px 9px; border-radius: 0 var(--radius-pill) var(--radius-pill) 0; border: 1px solid var(--hairline-strong); background: var(--surface); color: var(--text-3); cursor: pointer; }
.pill-x:hover { color: var(--danger); background: var(--danger-soft); }
.filter-card { padding: 12px 16px; }
/* Schnellfilter-Zeilen (Facetten) */
.facets { padding: 10px 16px; margin: -4px 0 16px; }
.facet-row { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0; }
.facet-row + .facet-row { border-top: 1px solid var(--hairline); }
.facet-label { flex: 0 0 130px; font-size: 12px; font-weight: 600; color: var(--text-2); padding-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-pills { flex: 1; gap: 6px; }
.facet-pills .pill { font-weight: 500; }
.facet-pills .pill.is-active { font-weight: 600; }
.pill-count-soft { opacity: .6; font-weight: 500; margin-left: 2px; }
.pill.is-active .pill-count-soft { opacity: .8; }
.facet-more { font: inherit; font-size: 13px; cursor: pointer; color: var(--accent); border-style: dashed; }
@media (max-width: 560px) { .facet-row { flex-direction: column; gap: 4px; } .facet-label { flex: none; padding-top: 4px; } }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.filter-row:last-child { margin-bottom: 0; }
.condition { padding-left: 10px; border-left: 2px solid var(--accent-soft); }

/* ---------- Forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 12px 0 5px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
label.check input { width: auto; margin: 0; }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=password], input[type=date], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--hairline-strong); border-radius: var(--radius-input);
    font: inherit; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 100px; resize: vertical; }
.form-actions { margin-top: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.help { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 12px; }

/* ---------- Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.is-link { cursor: pointer; transition: background .12s; }
tr.is-link:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
th.is-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.is-sortable:hover { color: var(--text); }
th.is-sortable::after { content: "↕"; opacity: .35; margin-left: 4px; font-size: 10px; }
th[aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--accent); }
th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; color: var(--accent); }
th[aria-sort] { color: var(--accent); }
.bar { height: 6px; background: var(--accent-soft); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- Ladebalken beim Seitenwechsel */
body.is-loading::before { content: ""; position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 200; animation: fp-loading 2.5s ease-out forwards; }
@keyframes fp-loading { 0% { width: 0; } 30% { width: 45%; } 70% { width: 80%; } 100% { width: 94%; } }
body.is-loading .pills .pill.is-active, body.is-loading .tabs a.is-active { opacity: .7; }

/* ---------- Flash */
.flash { padding: 12px 16px; border-radius: var(--radius-input); margin-bottom: 16px; font-weight: 500; }
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--info-soft); color: var(--info); }

/* ---------- Snippets */
.snippet { position: relative; }
.snippet pre { padding-right: 90px; margin: 0; }
.snippet .btn-copy { position: absolute; top: 8px; right: 8px; }

/* ---------- Chart */
.chart { width: 100%; height: 220px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Modal / Sheet (mobile first: von unten, ab 560px zentriert) */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.42); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 100; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s var(--ease); }
.modal-backdrop.is-open { opacity: 1; }
.modal { background: var(--surface); border-radius: 20px 20px 0 0; width: 100%; max-height: 88vh; overflow: auto; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); transform: translateY(24px); transition: transform .25s var(--ease); box-shadow: var(--shadow-hover); }
.modal-backdrop.is-open .modal { transform: none; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head h3 { margin: 4px 0 6px; font-size: 17px; word-break: break-all; }
.modal-close { border: 0; background: var(--accent-soft); color: var(--text); width: 32px; height: 32px; border-radius: 50%; font-size: 18px; cursor: pointer; flex: 0 0 auto; }
.modal-rows { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 14px; }
.modal-rows dt { color: var(--text-2); margin: 0; }
.modal-rows dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
/* URL/Pfad im Sheet-Titel: wirkt wie ein Wert, ist aber ein Link (dezenter Chip mit Pfeil) */
.modal-url { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; color: var(--accent); text-decoration: none; word-break: break-all; }
.modal-url svg { width: 14px; height: 14px; flex: 0 0 auto; }
.modal-url span { border-bottom: 1px dotted currentColor; }
.modal-url:hover span { border-bottom-style: solid; }
.modal-section { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: 16px 0 6px; }
.modal-delta { display: block; font-weight: 500; font-size: 11px; color: var(--text-3); }
.modal-delta.good { color: var(--success); }
.modal-delta.bad { color: var(--danger); }
.modal-hint { margin: 14px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-input); font-size: 13px; color: var(--text-2); }
.modal-links { display: flex; flex-direction: column; gap: 2px; }
.modal-links a { display: flex; align-items: center; justify-content: space-between; padding: 13px 12px; border-radius: 10px; color: var(--text); font-weight: 500; font-size: 15px; }
.modal-links a:hover { background: var(--accent-soft); text-decoration: none; }
.modal-links a.is-active { background: var(--accent); color: var(--accent-text); }
@media (min-width: 560px) {
    .modal-backdrop { align-items: center; padding: 24px; }
    .modal { border-radius: 20px; max-width: 460px; padding: 24px; transform: scale(.96); }
}
@media (prefers-reduced-motion: reduce) { .modal, .modal-backdrop { transition: none; } }

/* ---------- Quellen-/Kanal-Icons */
.src { display: inline-flex; align-items: center; gap: 10px; }
.src-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; font-size: 13px; font-weight: 700; flex: 0 0 auto; letter-spacing: -.02em; }
.src-icon[data-len="2"] { font-size: 11px; }
.src-icon svg { width: 16px; height: 16px; }
.src-icon-channel { background: var(--accent-soft); color: var(--accent); }
.src-icon-flag { background: var(--surface-2); font-size: 18px; border: 1px solid var(--hairline); }
.src-icon-channel.is-paid { background: var(--warning-soft); color: var(--warning); }

/* ---------- Seiten-Grafik */
.page-chart svg { width: 100%; height: auto; display: block; }
.page-chart circle { transition: opacity .15s; cursor: pointer; outline: none; }
.page-chart circle:focus-visible { stroke: var(--accent); stroke-width: 3; }
.page-chart circle:hover { opacity: 1; }

/* ---------- Funnel + Tabs in Karten */
.tabs.tabs-inline { border-bottom: 0; margin: 0; gap: 2px; overflow: visible; flex-wrap: wrap; }
.tabs.tabs-inline a { padding: 6px 12px; border-radius: var(--radius-pill); border-bottom: 0; margin: 0; font-size: 13px; }
.tabs.tabs-inline a.is-active { background: var(--accent); color: var(--accent-text); }
.tabs.tabs-inline a:hover:not(.is-active) { background: var(--accent-soft); color: var(--text); }
.funnel-vis { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: 20px; align-items: start; }
.funnel-vis svg { width: 100%; display: block; }
.funnel-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--hairline); }
.funnel-row:last-child { border-bottom: 0; }
.funnel-name { font-weight: 600; font-size: 14px; }
.funnel-sub { font-size: 12px; color: var(--text-2); }
.funnel-num { font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
@media (max-width: 560px) { .funnel-vis { grid-template-columns: 1fr; } .funnel-vis svg { height: 120px !important; } }

/* ---------- Lead detail */
.lead-fields { margin: 0; }
.lead-fields dt { font-size: 12px; color: var(--text-2); font-weight: 600; margin-top: 10px; }
.lead-fields dd { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.lead-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 20px; }
.lead-grid > div { min-width: 0; }
.lead-grid dt { margin-top: 8px; }
@media (max-width: 560px) { .lead-grid { grid-template-columns: 1fr; } }
.status-select { display: flex; gap: 6px; flex-wrap: wrap; }
.status-select button { border: 1px solid var(--hairline-strong); }
.status-select button.is-active { border-color: transparent; }

/* ---------- Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-hover); padding: 32px; }
.login-card .brand { padding: 0 0 20px; }

/* ---------- Prose (Markdown-Seiten) */
.prose { max-width: 760px; }
.prose h1 { margin-top: 0; }
.prose h2 { margin-top: 32px; }
.prose img { max-width: 100%; border-radius: var(--radius-input); }
.prose blockquote { border-left: 3px solid var(--accent); margin: 0 0 12px; padding: 4px 16px; color: var(--text-2); }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 12px; }
.prose li { margin-bottom: 4px; }

/* ---------- Seiten mit eigenem HTML */
.page-frame { width: 100%; border: 0; display: block; min-height: 320px; background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
body.page-full { background: var(--surface); }
.page-full-bar { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 8px 12px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--hairline); font-size: 14px; }
.page-full-bar strong { text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-frame-full { min-height: calc(100vh - 50px); border-radius: 0; box-shadow: none; }
.page-full-content { padding: 24px 16px; max-width: 900px; margin: 0 auto; }
.page-inline { min-width: 0; }
.prompt-box { font-size: 12px; white-space: pre-wrap; max-height: 260px; }

/* ---------- Admin */
.admin .sidebar .brand-avatar { background: #111; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
details.card > summary { cursor: pointer; font-weight: 650; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+"; float: right; color: var(--text-3); }
details.card[open] > summary::after { content: "–"; }
.placeholder-list { font-size: 13px; }
.placeholder-list code { display: inline-block; margin-bottom: 2px; }

/* ---------- Untere Tab-Leiste (nur Mobile) */
.tabbar { display: none; }
@media (max-width: 860px) {
    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--hairline); padding-bottom: env(safe-area-inset-bottom);
    }
    .tabbar-item {
        flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        height: 56px; color: var(--text-2); font: inherit; font-size: 11px; font-weight: 500; background: none; border: 0;
        text-decoration: none; position: relative; -webkit-tap-highlight-color: transparent;
    }
    .tabbar-item .icon { width: 22px; height: 22px; }
    .tabbar-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tabbar-item.is-active { color: var(--accent); font-weight: 600; }
    .tabbar-item:hover { text-decoration: none; }
    .tabbar-badge { position: absolute; top: 6px; left: calc(50% + 6px); background: var(--info); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: var(--radius-pill); line-height: 15px; }
}

/* ---------- Mobile */
@media (max-width: 860px) {
    .layout { flex-direction: column; }
    /* Kopf: nur noch der Kunde, die Navigation liegt unten */
    .sidebar { width: auto; flex: none; height: auto; position: static; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--hairline); flex-direction: row; align-items: center; }
    .brand { padding: 0; }
    .brand-avatar { width: 32px; height: 32px; font-size: 13px; }
    .nav, .sidebar-footer, .nav-section, .sidebar-user { display: none; }
    .main { padding: 18px 16px calc(72px + env(safe-area-inset-bottom)); }
    .pills-scroll { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
    .pills-scroll::-webkit-scrollbar { display: none; }
    .pills-scroll .pill { flex: 0 0 auto; }
    .card-head .tabs.tabs-inline { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
    .card-head .tabs.tabs-inline::-webkit-scrollbar { display: none; }
    .card-head .tabs.tabs-inline a { flex: 0 0 auto; }
    .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
    h1 { font-size: 22px; }
    .stat .value { font-size: 24px; }
    .snippet pre { padding-right: 14px; padding-top: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
