/* Kamano AI – Admin. Nach «Kamano AI – Design-Richtlinien». Einziges Stylesheet des Admins. */

@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(fonts/Inter-Regular.woff) format("woff"); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(fonts/Inter-Medium.woff) format("woff"); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(fonts/Inter-SemiBold.woff) format("woff"); }
@font-face { font-family: Inter; font-weight: 700; font-display: swap; src: url(fonts/Inter-Bold.woff) format("woff"); }

/* ─── 2. Tokens ─────────────────────────────────────────────────────── */
:root {
  --brand: #3C94AC; --brand-hover: #2E7D93; --brand-soft: #E8F6F8; --k-primary-700: #2E7D93;
  --surface-hover: #F3F9FA; --card-hover-border: #BFE3E8;
  --bg-page: #F8FAFC; --bg-surface: #FFFFFF; --bg-muted: #F1F5F9;
  --text-strong: #0F172A; --text-body: #334155; --text-muted: #64748B; --text-faint: #94A3B8;
  --border-base: #E2E8F0; --border-hover: #CBD5E1;
  --k-slate-900: #0F172A;
  --ok-text: #15803D; --ok-bg: #DCFCE7; --warn-text: #B45309; --warn-bg: #FEF3C7; --err-text: #B91C1C; --err-bg: #FEE2E2; --err-border: #FECACA;
  --sidebar-bg: #0F172A; --text-on-sidebar: #E2E8F0; --text-on-sidebar-muted: #8391A7;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-7: 28px; --space-8: 32px;
  --radius-sm: 4px; --radius-md: 8px; --radius-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(15,23,42,.05); --shadow-md: 0 8px 24px rgba(15,23,42,.12);
  --ring: 0 0 0 3px rgba(60,148,172,.25);
  --duration-fast: 150ms;
  color-scheme: light;
}
[data-theme="dark"] {
  --brand: #45A3BB; --brand-hover: #5DB4CA; --brand-soft: rgba(45,160,175,.16); --k-primary-700: #7CC6D8;
  --surface-hover: rgba(45,160,175,.12); --card-hover-border: #2B6576;
  --bg-page: #0B1220; --bg-surface: #111A2B; --bg-muted: #1A2539;
  --text-strong: #F1F5F9; --text-body: #CBD5E1; --text-muted: #94A3B8; --text-faint: #64748B;
  --border-base: #243049; --border-hover: #33415C;
  --ok-text: #4ADE80; --ok-bg: rgba(34,197,94,.14); --warn-text: #FBBF24; --warn-bg: rgba(245,158,11,.14); --err-text: #F87171; --err-bg: rgba(239,68,68,.14); --err-border: rgba(239,68,68,.35);
  --sidebar-bg: #080E1A;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.3); --shadow-md: 0 8px 24px rgba(0,0,0,.45);
  color-scheme: dark;
}

/* ─── Grundlage, 3. Typografie ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5; color: var(--text-body); background: var(--bg-page); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11"; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; color: var(--text-strong); }
h2 { font-size: 17px; font-weight: 600; line-height: 1.2; color: var(--text-strong); }
h3 { font-size: 14px; font-weight: 600; color: var(--text-strong); }
a { color: var(--brand); text-decoration: none; transition: color var(--duration-fast); }
a:hover { color: var(--brand-hover); }
img { max-width: 100%; display: block; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.small { font-size: 13px; }
.mini { font-size: 12px; font-weight: 600; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.strong { color: var(--text-strong); font-weight: 600; }
.overline { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex-shrink: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-md); }
[hidden] { display: none !important; }

/* ─── 12. Rahmen: Sidebar, Topbar ───────────────────────────────────── */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar-bg); color: var(--text-on-sidebar); display: flex; flex-direction: column; padding: var(--space-5) var(--space-3); }
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: #fff; font-weight: 700; font-size: 14px; }
.sidebar__brand img { height: 22px; width: auto; filter: brightness(0) invert(1); }
.sidebar__brand span { font-size: 12px; font-weight: 600; color: var(--text-on-sidebar-muted); text-transform: uppercase; letter-spacing: .06em; }
.sidebar__group { margin-top: var(--space-4); }
.sidebar__label { padding: 0 10px 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-on-sidebar-muted); }
.sidebar__link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); color: var(--text-on-sidebar); font-size: 14px; font-weight: 500; }
.sidebar__link .ic { color: var(--text-on-sidebar-muted); }
.sidebar__link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar__link.is-active { background: rgba(255,255,255,.10); color: #fff; }
.sidebar__link.is-active .ic { color: #7CC6D8; }
.sidebar__badge { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: var(--radius-sm); background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.sidebar__foot { margin-top: auto; padding-top: var(--space-5); display: grid; gap: 4px; }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-md); background: rgba(255,255,255,.04); color: var(--text-on-sidebar); }
.sidebar__avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.sidebar__user small { display: block; color: var(--text-on-sidebar-muted); font-size: 12px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); padding: 0 var(--space-8); background: color-mix(in srgb, var(--bg-page) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border-base); }
.topbar__menu { display: none; margin-right: auto; }
.theme-toggle { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-md); border: 1px solid var(--border-base); background: var(--bg-surface); color: var(--text-body); cursor: pointer; }
.theme-toggle:hover { border-color: var(--border-hover); }
.theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: var(--space-8); }

/* ─── 5. Seitenkopf ─────────────────────────────────────────────────── */
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); margin-bottom: var(--space-2); }
.back-link:hover { color: var(--text-strong); }
.dsh-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.dsh-head__suffix { font-weight: 400; }
.dsh-head__actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.stack { display: grid; gap: var(--space-6); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-6); align-items: start; }
.cols > aside { display: grid; gap: var(--space-6); position: sticky; top: 84px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-6); }
.data-stand { margin-top: 10px; font-size: 13px; color: var(--text-muted); }

/* ─── 8. Cards ──────────────────────────────────────────────────────── */
.dsh-card { background: var(--bg-surface); border: 1px solid var(--border-base); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); padding: var(--space-6); min-width: 0; }
.dsh-card--flush { padding: 0; overflow: hidden; }
.dsh-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.dsh-card__meta { font-size: 13px; color: var(--text-faint); }
.dsh-card--flush > .dsh-card__head { padding: var(--space-5) var(--space-6) 0; margin-bottom: var(--space-4); }
[data-card-href] { cursor: pointer; transition: background var(--duration-fast), border-color var(--duration-fast); }
[data-card-href]:hover { background: var(--surface-hover); border-color: var(--card-hover-border); }
[data-card-href]:hover h2 { color: var(--k-primary-700); }
.kpi__label { font-size: 14px; color: var(--text-body); }
.kpi__value { font-size: 34px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 6px; }
.kpi__desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ─── 6. Buttons ────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius-md); border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); color: #fff; }
.btn--secondary { background: var(--bg-surface); border-color: var(--border-base); color: var(--text-strong); }
.btn--secondary:hover { background: var(--bg-muted); color: var(--text-strong); }
.btn--danger { background: var(--bg-surface); border-color: var(--err-border); color: var(--err-text); }
.btn--danger:hover { background: var(--err-bg); color: var(--err-text); }
.btn--ghost { background: transparent; color: var(--brand); padding-left: 8px; padding-right: 8px; }
.btn--ghost:hover { color: var(--brand-hover); background: var(--brand-soft); }
.btn--icon { width: 32px; padding: 0; }
.btn:disabled, .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

/* ─── 10. Formulare ─────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; min-width: 0; }
.field + .field, .field + .grid-2, .grid-2 + .field, .grid-3 + .field, .field + .grid-3, .grid-2 + .grid-2 { margin-top: var(--space-4); }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-strong); display: flex; align-items: center; gap: 6px; }
.field__label .req { color: var(--err-text); }
.field__help { font-size: 13px; color: var(--text-muted); }
.field__error { font-size: 13px; color: var(--err-text); }
.field__count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.field__count.is-over { color: var(--warn-text); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--text-strong); background: var(--bg-surface); border: 1px solid var(--border-base); border-radius: var(--radius-md); transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.textarea { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.textarea--code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; min-height: 360px; white-space: pre; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-hover); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--bg-muted); color: var(--text-muted); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='%2364748B' stroke-width='1.6'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.is-invalid .input, .is-invalid .textarea, .is-invalid .select { border-color: var(--err-text); }
.input-group { display: flex; gap: var(--space-2); }
.input-group .input { flex: 1; }
.form-max { max-width: 880px; }
.form-actions { display: flex; gap: var(--space-2); padding-top: var(--space-5); margin-top: var(--space-5); border-top: 1px solid var(--border-base); }
.sticky-actions { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) 0; margin-top: var(--space-6); background: var(--bg-page); border-top: 1px solid var(--border-base); }
.sticky-actions .muted { margin-left: auto; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--text-body); }
.check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; color: var(--text-body); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--border-hover); transition: background var(--duration-fast); flex-shrink: 0; }
.switch__track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform var(--duration-fast); }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }
.switch__state { color: var(--text-muted); }
.switch input:checked ~ .switch__state { color: var(--brand); font-weight: 600; }
.toggles { display: flex; flex-wrap: wrap; gap: 32px; }
.hr { height: 1px; background: var(--border-base); border: 0; margin: var(--space-5) 0; }

/* ─── 9. Tabellen ───────────────────────────────────────────────────── */
.table-wrap { border: 1px solid var(--border-base); border-radius: var(--radius-xl); overflow-x: auto; background: var(--bg-surface); box-shadow: var(--shadow-xs); }
.dsh-card .table-wrap { border-radius: var(--radius-md); box-shadow: none; }
.dsh-card--flush .table-wrap { border: 0; border-radius: 0; border-top: 1px solid var(--border-base); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); background: var(--bg-muted); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-top: 1px solid var(--border-base); vertical-align: middle; }
.tbl tbody tr:hover td { background: var(--bg-muted); }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { text-align: right; white-space: nowrap; }
.tbl .actions .btn + .btn, .tbl .actions .btn + form, .tbl .actions form + .btn { margin-left: 8px; }
.tbl .actions form { display: inline; }
.tbl tfoot td { font-weight: 600; border-top: 2px solid var(--border-base); }
.tbl .w-check { width: 44px; }
.tbl .empty-row td { text-align: center; color: var(--text-muted); padding: 24px; }
.tbl .t-title { color: var(--text-strong); font-weight: 600; }
.tbl .t-sub { font-size: 13px; color: var(--text-muted); }
.tbl .thumb { width: 48px; height: 32px; border-radius: var(--radius-sm); object-fit: cover; background: var(--bg-muted); }
.dash { color: var(--text-faint); }

/* ─── 11. Badges, Chips ─────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; background: var(--bg-muted); color: var(--text-muted); }
.badge--success { background: var(--ok-bg); color: var(--ok-text); }
.badge--warn { background: var(--warn-bg); color: var(--warn-text); }
.badge--danger { background: var(--err-bg); color: var(--err-text); }
.badge--info { background: var(--brand-soft); color: var(--k-primary-700); }
.badge--score { min-width: 52px; justify-content: center; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-md); background: var(--bg-muted); color: var(--text-body); font-size: 14px; font-weight: 600; border: 0; cursor: pointer; font-family: inherit; }
.chip:hover { color: var(--text-strong); }
.chip.is-active { background: var(--text-strong); color: var(--bg-surface); }
.chip__count { font-size: 12px; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chip.is-active .chip__count { color: var(--text-faint); }

/* ─── 13. Filterbox ─────────────────────────────────────────────────── */
.lf { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) var(--space-4); background: var(--bg-surface); border: 1px solid var(--border-base); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); margin-bottom: 15px; }
.lf__cap { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.lf__sep { width: 1px; height: 24px; background: var(--border-base); }
.lf__right { margin-left: auto; display: flex; gap: var(--space-2); align-items: center; }
.lf .input, .lf .select { height: 36px; }
.search { position: relative; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search .input { padding-left: 34px; width: 260px; }
.tabs { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); flex-wrap: wrap; }

/* ─── 14. Meldungen ─────────────────────────────────────────────────── */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; margin-bottom: var(--space-6); }
.flash--success { background: var(--ok-bg); color: var(--ok-text); }
.flash--error { background: var(--err-bg); color: var(--err-text); }
.flash--info { background: var(--brand-soft); color: var(--k-primary-700); }
.alert { padding: 12px 16px; border-radius: var(--radius-md); background: var(--warn-bg); color: var(--warn-text); font-size: 13px; }
.alert--info { background: var(--brand-soft); color: var(--k-primary-700); }

/* ─── 15. Leerzustand ───────────────────────────────────────────────── */
.empty { text-align: center; padding: var(--space-8) var(--space-4); }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--text-muted); margin-bottom: var(--space-4); }

/* ─── 16. Tooltips ──────────────────────────────────────────────────── */
.info-tip { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-hover); color: var(--text-muted); font-size: 11px; font-weight: 700; font-style: normal; cursor: help; }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 50; width: max-content; max-width: 280px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--k-slate-900); color: #fff; font-size: 13px; font-weight: 400; line-height: 1.4; text-transform: none; letter-spacing: 0; white-space: normal; pointer-events: none; box-shadow: var(--shadow-md); }
[data-theme="dark"] [data-tip]:hover::after { background: #334155; }

/* ─── Modal ─────────────────────────────────────────────────────────── */
dialog.modal { width: min(820px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border-base); border-radius: var(--radius-xl); background: var(--bg-surface); color: var(--text-body); box-shadow: var(--shadow-md); }
dialog.modal--wide { width: min(1120px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15,23,42,.5); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border-base); position: sticky; top: 0; background: var(--bg-surface); z-index: 2; }
.modal__body { padding: var(--space-6); }
.modal__foot { display: flex; gap: var(--space-2); justify-content: flex-end; padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border-base); position: sticky; bottom: 0; background: var(--bg-surface); }
.modal__close { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text-muted); border-radius: var(--radius-md); cursor: pointer; }
.modal__close:hover { background: var(--bg-muted); color: var(--text-strong); }

/* ─── Login ─────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4); }
.login-card { width: 100%; max-width: 400px; background: var(--bg-surface); border: 1px solid var(--border-base); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); padding: var(--space-8); }
.login-card__logo { height: 26px; width: auto; margin-bottom: var(--space-6); }
[data-theme="dark"] .login-card__logo { filter: brightness(0) invert(1); }
.login-card h1 { margin-bottom: var(--space-6); }
.login-card .btn { width: 100%; margin-top: var(--space-5); }

/* ─── Seitenbaum, Menü-Editor (Drag & Drop) ─────────────────────────── */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 32px; min-height: 2px; }
.tree__row { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border: 1px solid var(--border-base); border-radius: var(--radius-md); background: var(--bg-surface); margin-bottom: 6px; }
.tree__row:hover { border-color: var(--border-hover); }
.tree__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-3); }
.tree__title { font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree__path { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree__actions { display: flex; gap: var(--space-2); align-items: center; flex-shrink: 0; }
.handle { display: grid; place-items: center; width: 24px; height: 28px; color: var(--text-faint); cursor: grab; border-radius: var(--radius-sm); flex-shrink: 0; touch-action: none; }
.handle:hover { color: var(--text-strong); background: var(--bg-muted); }
.handle--off { cursor: default; opacity: .35; }
.sort-ghost { opacity: .35; }
.sort-drag { position: fixed; z-index: 1000; pointer-events: none; box-shadow: var(--shadow-md); opacity: .95; }
.sort-ph { border: 2px dashed var(--brand); border-radius: var(--radius-md); background: var(--brand-soft); margin-bottom: 6px; }
.menu-item__fields { flex: 1; display: grid; grid-template-columns: 1.2fr .8fr 1fr 1.4fr auto; gap: var(--space-2); align-items: center; min-width: 0; }
.menu-item__fields .input, .menu-item__fields .select { height: 34px; font-size: 13px; }

/* ─── Block-Editor ──────────────────────────────────────────────────── */
.be { display: grid; gap: var(--space-3); }
.be-block { background: var(--bg-surface); border: 1px solid var(--border-base); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); }
.be-block.is-hidden { opacity: .6; }
.be-block__head { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px 10px 8px; cursor: pointer; user-select: none; }
.be-block__icon { width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.be-block__name { font-weight: 600; color: var(--text-strong); }
.be-block__sum { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.be-block__tools { display: flex; gap: 2px; flex-shrink: 0; }
.be-block__tools .btn { color: var(--text-muted); }
.be-block__tools .btn:hover { color: var(--text-strong); background: var(--bg-muted); }
.be-block__chev { transition: transform var(--duration-fast); color: var(--text-faint); }
.be-block.is-open .be-block__chev { transform: rotate(90deg); }
.be-block__body { display: none; padding: var(--space-5) var(--space-6) var(--space-6); border-top: 1px solid var(--border-base); }
.be-block.is-open .be-block__body { display: block; }
.be-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-4); }
.be-fields > .field { grid-column: span 6; margin: 0 !important; }
.be-fields > .w-half { grid-column: span 3; }
.be-fields > .w-third { grid-column: span 2; }
.be-fields > .w-twothird { grid-column: span 4; }
.be-note { grid-column: span 6; }
.be-list { display: grid; gap: var(--space-2); }
.be-row { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3); border: 1px solid var(--border-base); border-radius: var(--radius-md); background: var(--bg-page); }
.be-row > .handle { margin-top: 22px; }
.be-row__fields { flex: 1; min-width: 0; }
.be-row__fields .be-fields { gap: var(--space-3); }
.be-row__del { margin-top: 22px; color: var(--text-faint); }
.be-row__del:hover { color: var(--err-text); background: var(--err-bg); }
.be-add { justify-self: start; }
.be-addbar { display: flex; justify-content: center; padding: var(--space-2) 0; }
.be-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.be-type { display: flex; gap: var(--space-3); align-items: flex-start; text-align: left; padding: var(--space-4); border: 1px solid var(--border-base); border-radius: var(--radius-md); background: var(--bg-surface); cursor: pointer; font: inherit; color: var(--text-body); }
.be-type:hover { border-color: var(--card-hover-border); background: var(--surface-hover); }
.be-type strong { display: block; color: var(--text-strong); font-weight: 600; margin-bottom: 2px; }
.be-type span.small { color: var(--text-muted); }
.be-group-title { grid-column: 1 / -1; margin-top: var(--space-2); }

/* Bildfeld */
.imgfield { display: flex; gap: var(--space-3); align-items: center; }
.imgfield__prev { width: 96px; height: 64px; border-radius: var(--radius-md); border: 1px solid var(--border-base); background: var(--bg-muted) center/contain no-repeat; flex-shrink: 0; display: grid; place-items: center; color: var(--text-faint); overflow: hidden; }
.imgfield__prev img { width: 100%; height: 100%; object-fit: contain; }
.imgs { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.imgs__item { position: relative; width: 88px; height: 56px; border: 1px solid var(--border-base); border-radius: var(--radius-md); background: var(--bg-surface); display: grid; place-items: center; padding: 6px; }
.imgs__item img { max-height: 100%; object-fit: contain; }
.imgs__item button { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border-base); background: var(--bg-surface); color: var(--text-muted); display: grid; place-items: center; cursor: pointer; padding: 0; }

/* Rich-Text */
.rte { border: 1px solid var(--border-base); border-radius: var(--radius-md); background: var(--bg-surface); }
.rte:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.rte__bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border-base); background: var(--bg-muted); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.rte__bar button { height: 30px; min-width: 30px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-body); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-grid; place-items: center; }
.rte__bar button:hover { background: var(--bg-surface); color: var(--text-strong); }
.rte__sep { width: 1px; margin: 4px 4px; background: var(--border-base); }
.rte__area { min-height: 220px; max-height: 70vh; overflow-y: auto; padding: 14px 16px; outline: none; font-size: 15px; line-height: 1.65; color: var(--text-strong); }
.rte__area h2 { font-size: 20px; margin: 18px 0 8px; } .rte__area h3 { font-size: 17px; margin: 14px 0 6px; }
.rte__area p { margin: 0 0 10px; } .rte__area ul, .rte__area ol { margin: 0 0 10px; padding-left: 22px; }
.rte__area blockquote { border-left: 3px solid var(--brand); margin: 0 0 10px; padding-left: 14px; color: var(--text-body); }
.rte__area a { text-decoration: underline; }

/* SERP-Vorschau */
.serp { padding: var(--space-4); border: 1px solid var(--border-base); border-radius: var(--radius-md); background: var(--bg-surface); font-family: Arial, sans-serif; }
.serp__url { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.serp__title { font-size: 18px; line-height: 1.3; color: #1a0dab; margin: 4px 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
[data-theme="dark"] .serp__title { color: #8ab4f8; }
.serp__desc { font-size: 13px; line-height: 1.5; color: var(--text-body); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ─── Medien ────────────────────────────────────────────────────────── */
.drop { display: grid; place-items: center; gap: 6px; padding: var(--space-8); border: 2px dashed var(--border-hover); border-radius: var(--radius-xl); background: var(--bg-surface); text-align: center; color: var(--text-muted); cursor: pointer; transition: border-color var(--duration-fast), background var(--duration-fast); }
.drop.is-over, .drop:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--k-primary-700); }
.drop strong { color: var(--text-strong); font-weight: 600; }
.progress { height: 6px; border-radius: 3px; background: var(--bg-muted); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-4); }
.mitem { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border-base); border-radius: var(--radius-md); background: var(--bg-surface); overflow: hidden; cursor: pointer; text-align: left; padding: 0; font: inherit; color: inherit; }
.mitem:hover { border-color: var(--card-hover-border); }
.mitem.is-selected { border-color: var(--brand); box-shadow: var(--ring); }
.mitem__img { aspect-ratio: 4/3; background: var(--bg-muted) repeating-conic-gradient(var(--bg-page) 0 25%, transparent 0 50%) 0 0/16px 16px; display: grid; place-items: center; }
.mitem__img img { width: 100%; height: 100%; object-fit: contain; }
.mitem__name { padding: 8px 10px 2px; font-size: 13px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mitem__meta { padding: 0 10px 8px; font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.mitem .badge { position: absolute; top: 6px; left: 6px; }
.mdetail { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--space-6); }
.mdetail__img { background: var(--bg-muted) repeating-conic-gradient(var(--bg-page) 0 25%, transparent 0 50%) 0 0/16px 16px; border-radius: var(--radius-md); display: grid; place-items: center; min-height: 280px; padding: var(--space-3); }
.mdetail__img img { max-height: 60vh; object-fit: contain; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; color: var(--text-strong); font-variant-numeric: tabular-nums; word-break: break-word; }

/* Zuschnitt */
.crop { position: relative; display: inline-block; max-width: 100%; user-select: none; touch-action: none; line-height: 0; }
.crop img { max-width: 100%; max-height: 62vh; display: block; }
.crop__box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(15,23,42,.55); cursor: move; }
.crop__box::before, .crop__box::after { content: ""; position: absolute; border: 0 dashed rgba(255,255,255,.6); inset: 33.33% 0; border-width: 1px 0; pointer-events: none; }
.crop__box::after { inset: 0 33.33%; border-width: 0 1px; }
.crop__h { position: absolute; width: 14px; height: 14px; background: #fff; border: 2px solid var(--brand); border-radius: 3px; }
.crop__h[data-h="nw"] { left: -8px; top: -8px; cursor: nwse-resize; } .crop__h[data-h="ne"] { right: -8px; top: -8px; cursor: nesw-resize; }
.crop__h[data-h="sw"] { left: -8px; bottom: -8px; cursor: nesw-resize; } .crop__h[data-h="se"] { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-wrap { display: grid; place-items: center; background: var(--bg-muted); border-radius: var(--radius-md); padding: var(--space-4); }

/* ─── Leads ─────────────────────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.timeline li { display: grid; grid-template-columns: 28px 1fr; gap: var(--space-3); }
.timeline__ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-muted); }
.timeline__ic--mail { background: var(--brand-soft); color: var(--brand); }
.timeline__ic--note { background: var(--warn-bg); color: var(--warn-text); }
.timeline__meta { font-size: 13px; color: var(--text-muted); }
.timeline__body { margin-top: 2px; color: var(--text-strong); white-space: pre-wrap; word-break: break-word; }
.crit { display: grid; gap: var(--space-3); }
.crit__row { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border-base); }
.crit__row:last-child { border: 0; padding: 0; }
.crit__txt { grid-column: 1 / -1; font-size: 13px; color: var(--text-muted); }

/* ─── 21. Responsive ────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .cols > aside { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .be-types { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-md); }
  .topbar__menu { display: grid; }
  .menu-item__fields { grid-template-columns: 1fr 1fr; }
  .mdetail { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .content { padding: var(--space-4); }
  .topbar { padding: 0 var(--space-4); }
  .dsh-card { padding: var(--space-4); }
  .dsh-head { flex-direction: column; align-items: stretch; }
  .dsh-head__actions .btn { flex: 1; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .be-fields > .w-half, .be-fields > .w-third, .be-fields > .w-twothird { grid-column: span 6; }
  .be-types { grid-template-columns: 1fr; }
  .search .input { width: 100%; }
  .lf__right { margin-left: 0; width: 100%; }
  .tree ul { padding-left: 16px; }
  .tree__path { display: none; }
  .menu-item__fields { grid-template-columns: 1fr; }
  dialog.modal { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; margin: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.sidebar__link--btn { width: 100%; border: 0; background: none; cursor: pointer; font: inherit; text-align: left; }
.select--auto { height: 36px; width: auto; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mt-2 { margin-top: 8px; }
.cols > *, .be, .be-block, .be-block__body, .be-fields > .field { min-width: 0; }
.theme-toggle.topbar__menu { display: none; }
@media (max-width: 900px) { .theme-toggle.topbar__menu { display: grid; } }
.crop { overflow: hidden; }
.grid-2 > .field, .grid-3 > .field, .grid-4 > .field { margin-top: 0 !important; }
.mitem__img { overflow: hidden; }
.mitem__img img { max-height: 100%; }
.login-card--wide { max-width: 560px; }
