/* ProPrompt – Stile. Farben als CSS-Variablen, Dunkelmodus über prefers-color-scheme oder data-theme. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --text: #1c2330;
  --muted: #667085;
  --accent: #2f6fdf;
  --accent-hover: #255bb8;
  --accent-soft: #e5eefc;
  --on-accent: #ffffff;
  --danger: #c93838;
  --danger-soft: #fdecec;
  --draft: #d98a0b;
  --final: #1f9d55;
  --star: #e3a008;
  --mark: #fff1a8;
  --shadow: 0 6px 24px rgba(16, 24, 40, 0.12);
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151b;
    --surface: #1a1e26;
    --surface-2: #232834;
    --border: #2f3542;
    --text: #e6e9ef;
    --muted: #98a2b3;
    --accent: #5b8ff0;
    --accent-hover: #7aa5f5;
    --accent-soft: #23314d;
    --on-accent: #0d1220;
    --danger: #f06b6b;
    --danger-soft: #3a2024;
    --draft: #f0a73a;
    --final: #3ccf7f;
    --star: #f5c542;
    --mark: #5a4d12;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151b;
  --surface: #1a1e26;
  --surface-2: #232834;
  --border: #2f3542;
  --text: #e6e9ef;
  --muted: #98a2b3;
  --accent: #5b8ff0;
  --accent-hover: #7aa5f5;
  --accent-soft: #23314d;
  --on-accent: #0d1220;
  --danger: #f06b6b;
  --danger-soft: #3a2024;
  --draft: #f0a73a;
  --final: #3ccf7f;
  --star: #f5c542;
  --mark: #5a4d12;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------- Ordnerfarben (10 Tokens, in hell und dunkel gut lesbar) ---------- */
:root {
  --fc-gray: #8a94a6;
  --fc-red: #e05252;
  --fc-orange: #ee8a3c;
  --fc-amber: #d9a514;
  --fc-green: #3aa665;
  --fc-teal: #1fa3a3;
  --fc-blue: #3b82f6;
  --fc-indigo: #6366f1;
  --fc-purple: #a35bd6;
  --fc-pink: #e0569b;
}

/* ---------- Akzentfarbe (Einstellungen, localStorage pp_accent), Standard = Blau ---------- */
:root[data-accent="violet"] { --accent: #7c4ddb; --accent-hover: #6438c0; --accent-soft: #efe8fc; }
:root[data-accent="teal"]   { --accent: #0f8a8a; --accent-hover: #0b6f6f; --accent-soft: #e0f4f4; }
:root[data-accent="green"]  { --accent: #2a8a4a; --accent-hover: #21703b; --accent-soft: #e3f4e8; }
:root[data-accent="orange"] { --accent: #c9631a; --accent-hover: #a85214; --accent-soft: #fcecdf; }
:root[data-accent="rose"]   { --accent: #c8416f; --accent-hover: #a8345c; --accent-soft: #fbe6ee; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-accent="violet"] { --accent: #a585f2; --accent-hover: #bba2f6; --accent-soft: #2f2650; }
  :root:not([data-theme="light"])[data-accent="teal"]   { --accent: #3cc4c4; --accent-hover: #62d3d3; --accent-soft: #163a3d; }
  :root:not([data-theme="light"])[data-accent="green"]  { --accent: #4fc777; --accent-hover: #72d493; --accent-soft: #183826; }
  :root:not([data-theme="light"])[data-accent="orange"] { --accent: #f09a55; --accent-hover: #f4b07a; --accent-soft: #3d2a19; }
  :root:not([data-theme="light"])[data-accent="rose"]   { --accent: #ee7aa2; --accent-hover: #f398b8; --accent-soft: #3e2030; }
}
:root[data-theme="dark"][data-accent="violet"] { --accent: #a585f2; --accent-hover: #bba2f6; --accent-soft: #2f2650; }
:root[data-theme="dark"][data-accent="teal"]   { --accent: #3cc4c4; --accent-hover: #62d3d3; --accent-soft: #163a3d; }
:root[data-theme="dark"][data-accent="green"]  { --accent: #4fc777; --accent-hover: #72d493; --accent-soft: #183826; }
:root[data-theme="dark"][data-accent="orange"] { --accent: #f09a55; --accent-hover: #f4b07a; --accent-soft: #3d2a19; }
:root[data-theme="dark"][data-accent="rose"]   { --accent: #ee7aa2; --accent-hover: #f398b8; --accent-soft: #3e2030; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
code, kbd { font-family: var(--mono); font-size: 0.9em; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface-2); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Buttons & Felder ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .nav-item:focus-visible, .tag:focus-visible, .prompt-item:focus-visible, .dropzone:focus-visible, .segmented button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-icon { padding: 6px; min-width: 36px; }
.btn-sm { min-height: 28px; padding: 2px 8px; font-size: 13px; }
.btn-sm.btn-icon { min-width: 28px; padding: 4px; }
.btn-link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

input[type="text"], input[type="password"], input[type="search"], input[type="email"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.5; }
textarea.autogrow { overflow: hidden; resize: none; min-height: 80px; }
label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--muted); }
.form-error { color: var(--danger); margin: 8px 0 0; font-size: 14px; }

/* ---------- Login ---------- */
.login-view { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; padding: 28px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.brand-title { display: flex; align-items: center; gap: 10px; font-size: 22px; margin-bottom: 8px; }
.brand-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 16px;
}

/* ---------- App-Gerüst ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
  flex: none;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.mobile-tabs { display: none; }

.layout {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 240px minmax(320px, 400px) 1fr;
}
.pane { min-height: 0; overflow: auto; }
.sidebar { border-right: 1px solid var(--border); padding: 12px 10px; background: var(--surface); }
.list-pane { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.editor-pane { padding: 16px 24px 40px; }

/* ---------- Seitenleiste ---------- */
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  width: 100%; padding: 6px 8px; border: 0; border-radius: 6px;
  background: transparent; text-align: left; cursor: pointer; min-height: 32px;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.nav-item .count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.folder-row { display: flex; align-items: center; }
.folder-row .nav-item { flex: 1; min-width: 0; }
.folder-row .more { opacity: 0; }
.folder-row:hover .more, .folder-row .more:focus-visible { opacity: 1; }
@media (hover: none) { .folder-row .more { opacity: 1; } }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 8px 6px; }
.section-head h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; cursor: pointer;
}
.tag:hover { border-color: var(--accent); }
.tag.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tag .count { opacity: .7; font-size: 11px; }

/* ---------- Liste ---------- */
.list-toolbar { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-wrap input { padding-left: 34px; padding-right: 34px; }
/* sichtbarer Tastenhinweis „/“ (Placeholder wird in schmalen Spalten abgeschnitten) */
.search-kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); font-size: 12px; }
.search-wrap input:focus ~ .search-kbd, .search-wrap input:not(:placeholder-shown) ~ .search-kbd { display: none; }
@media (hover: none) { .search-kbd { display: none; } }
.list-filters { display: flex; gap: 8px; }
.list-filters select { flex: 1; min-width: 0; padding: 6px 8px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.active-filters:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 1; }

.prompt-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; outline: none; }
.prompt-item {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer;
  border-left: 3px solid var(--fc, transparent);
}
.prompt-item:hover { background: var(--surface-2); }
.prompt-item.selected { background: var(--accent-soft); border-left-color: var(--fc, var(--accent)); }
.prompt-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; min-width: 0; }
.prompt-title .t { overflow: hidden; text-overflow: ellipsis; }
.prompt-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12.5px; color: var(--muted); min-width: 0; }
.prompt-meta .mini-tag { background: var(--surface-2); border-radius: 4px; padding: 0 5px; }
.snippet { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin: 2px 0 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.row-actions { display: flex; align-items: center; gap: 2px; }
.row-actions .btn { min-height: 28px; min-width: 28px; padding: 3px; }
.star { color: var(--muted); font-size: 16px; line-height: 1; }
.star.on { color: var(--star); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.status-dot.draft { background: var(--draft); }
.status-dot.final { background: var(--final); }
.status-label { display: inline-flex; align-items: center; gap: 4px; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }
.list-hint { margin: 0; padding: 6px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface); }

/* ---------- Editor ---------- */
.editor { max-width: 900px; display: flex; flex-direction: column; gap: 14px; }
.editor-empty { margin-top: 15vh; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; position: sticky; top: -16px; background: var(--bg); padding: 8px 0; z-index: 2; }
/* fester Platz: Breite/Höhe hängen nicht vom Text ab, sonst springt das Layout beim Wechsel des Speicherstatus */
.save-state { margin-left: auto; font-size: 13px; color: var(--muted); min-width: 14em; min-height: 1.5em; line-height: 1.5em; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state.dirty { color: var(--draft); }
.save-state.ok { color: var(--final); }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.field-row .field { flex: 1 1 160px; }
.field-row .field:last-child { flex: 0 0 auto; }
#f-title { font-size: 18px; font-weight: 600; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.segmented button { border: 0; background: var(--surface); padding: 7px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active[data-status="draft"] { background: var(--draft); color: #fff; font-weight: 600; }
.segmented button.active[data-status="final"] { background: var(--final); color: #fff; font-weight: 600; }
.star-toggle { font-size: 22px; min-width: 44px; color: var(--muted); }
.star-toggle[aria-pressed="true"] { color: var(--star); }
.tag-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 5px 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.tag-input:focus-within { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.tag-chips { display: contents; }
.tag-input input { border: 0; outline: 0 !important; flex: 1; min-width: 140px; padding: 4px; background: transparent; }
.meta { font-size: 12.5px; margin: 0; }

/* ---------- Import ---------- */
.import-view { flex: 1; overflow: auto; padding: 20px 16px 40px; }
.import-inner { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.import-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.import-head h1 { font-size: 22px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 17px; }
.card p { margin: 0; }
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 32px 16px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: border-color .12s, background .12s;
}
.dropzone p { margin: 2px 0; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.result:empty { display: none; }
.result { font-size: 14px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.result ul { margin: 6px 0 0; padding-left: 18px; }
.result.error { background: var(--danger-soft); color: var(--danger); }
.table-wrap { overflow-x: auto; }
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th, .log-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.log-table td:last-child { color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ok-text { color: var(--final); font-weight: 600; }
.fail-text { color: var(--danger); font-weight: 600; }

/* ---------- Dialoge, Menü, Toast ---------- */
.dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 0;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
}
.dialog-wide { width: min(860px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(10, 14, 22, 0.45); }
.dialog form, .dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { font-size: 18px; }
.dialog p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
#ph-fields { display: flex; flex-direction: column; gap: 10px; }
.versions { display: grid; grid-template-columns: 220px 1fr; gap: 12px; min-height: 240px; }
.version-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; max-height: 50vh; }
.version-list li button { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 8px 10px; cursor: pointer; }
.version-list li button:hover { background: var(--surface-2); }
.version-list li button.active { background: var(--accent-soft); }
.version-list small { display: block; color: var(--muted); }
.version-preview { min-width: 0; overflow: auto; max-height: 50vh; }
.version-preview pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 10px; border-radius: var(--radius); margin: 8px 0; }
.menu {
  position: fixed; z-index: 50; min-width: 160px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu button.danger { color: var(--danger); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-weight: 600; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Durchlauf 2: Konto, Ordner-Akzente, Filterzeile, Bausteine, Admin ---------- */
.account-btn { gap: 8px; padding: 4px 8px 4px 4px; }
.avatar {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px;
}
.account-mail {
  display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; color: var(--muted);
}
/* unter 900 px nur die Avatar-Initiale, sonst läuft die Kopfzeile über (727–768 px) */
@media (max-width: 899.98px) { .account-mail { display: none; } }
.menu-head { padding: 6px 10px 8px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; word-break: break-all; }
.menu-sep { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

.folder-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.folder-icon { flex: none; font-size: 14px; line-height: 1; }
.nav-item .folder-dot + .name, .nav-item .folder-icon + .name { margin-left: 2px; }
.nav-item { justify-content: flex-start; }
.nav-item .count { margin-left: auto; }
.nav-item.zero .name, .nav-item.zero .count { opacity: .55; }
.tag.zero { opacity: .45; border-style: dashed; }
.tag.zero:hover { opacity: .8; }
.folder-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; vertical-align: middle; }
.chip .folder-dot, .chip .folder-icon { margin-right: 3px; }
.side-hint { margin: 0 8px; font-size: 12.5px; }
.snippet-item code { font-size: 12.5px; }

/* Filterzeile */
.active-filters { align-items: center; }
.reset-all { font-size: 13px; margin-left: 4px; }

/* Favoriten-Stern: gefüllt gold, kurzes Aufploppen beim Aktivieren */
.star.on, .star-toggle[aria-pressed="true"] { color: var(--star); text-shadow: 0 0 0.5px var(--star); }
.star { display: inline-block; }
.star.pop, .star-toggle.pop { animation: star-pop 260ms ease-out; }
@keyframes star-pop { 0% { transform: scale(1); } 45% { transform: scale(1.45); } 100% { transform: scale(1); } }

/* Kopieren: kurzer Puls + Häkchen für 1 s */
.copy-btn .i-check { display: none; }
.copy-btn.copied .i-copy { display: none; }
.copy-btn.copied .i-check { display: inline-block; }
.copy-btn.copied { animation: copy-pulse 420ms ease-out; }
.btn-primary.copy-btn.copied { background: var(--final); border-color: var(--final); color: #fff; }
.btn-ghost.copy-btn.copied { color: var(--final); }
@keyframes copy-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--final) 55%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

@media (prefers-reduced-motion: reduce) {
  .star.pop, .star-toggle.pop, .copy-btn.copied { animation: none; }
  .btn, .dropzone { transition: none; }
}

/* Baustein-Autovervollständigung */
.ac-wrap { position: relative; }
.snippet-ac {
  position: fixed; z-index: 60; list-style: none; margin: 0; padding: 4px; min-width: 240px; max-width: min(420px, calc(100vw - 16px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.snippet-ac li { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.snippet-ac li .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snippet-ac li.active, .snippet-ac li:hover { background: var(--accent-soft); }
.snippet-intro { margin: 0; font-size: 13.5px; }

/* Capture-Fenster (Bookmarklet) und Einladung */
.capture-card { max-width: 560px; }
.capture-card .field { display: flex; flex-direction: column; }
.hint-warn { margin: 6px 0 0; font-size: 13px; color: var(--draft); }
.cap-done { margin: 0; font-weight: 700; color: var(--final); font-size: 16px; }
.cap-status { padding: 8px 0; }
.login-card input[readonly] { background: var(--surface-2); color: var(--muted); }

/* Ordner-Dialog: Farbfelder und Emoji */
.swatches { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.swatches legend { margin-bottom: 6px; padding: 0; }
.swatch { display: inline-flex; margin: 0; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span:not(.sr-only) { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); display: inline-block; }
.swatch .swatch-none { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface) 4px, var(--surface) 8px); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.emoji-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.emoji-input { width: 72px !important; text-align: center; font-size: 18px; }
.emoji-suggest { display: flex; flex-wrap: wrap; gap: 2px; }
.emoji-btn { border: 0; background: transparent; font-size: 18px; padding: 3px 5px; border-radius: 6px; cursor: pointer; line-height: 1.2; }
.emoji-btn:hover, .emoji-btn:focus-visible { background: var(--surface-2); outline: none; }

/* Einstellungen */
.dialog-mid { width: min(560px, calc(100vw - 32px)); }
.settings-section { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.settings-section h3 { font-size: 15px; }
.accent-choices { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.accent-choice { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; color: var(--text); cursor: pointer; font-size: 14px; }
.accent-choice input { margin: 0; accent-color: var(--accent); }
.accent-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.accent-dot[data-accent-preview="blue"] { background: #2f6fdf; }
.accent-dot[data-accent-preview="violet"] { background: #7c4ddb; }
.accent-dot[data-accent-preview="teal"] { background: #0f8a8a; }
.accent-dot[data-accent-preview="green"] { background: #2a8a4a; }
.accent-dot[data-accent-preview="orange"] { background: #c9631a; }
.accent-dot[data-accent-preview="rose"] { background: #c8416f; }
.bookmarklet-link { border-style: dashed; border-color: var(--accent); color: var(--accent); font-weight: 600; cursor: grab; }
.steps { margin: 0; padding-left: 20px; font-size: 13.5px; display: flex; flex-direction: column; gap: 2px; }
.alert-list { margin: 0; padding-left: 18px; }

/* Benutzerverwaltung */
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form input { flex: 1 1 240px; width: auto; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.compact-select { width: auto; min-width: 200px; padding: 5px 8px; }
.badge { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-admin { background: var(--accent-soft); color: var(--accent); }
.user-table td.actions { display: flex; flex-wrap: wrap; gap: 4px; max-width: none; white-space: normal; overflow: visible; color: inherit; }
.user-table td:last-child { max-width: none; }

/* ---------- Responsiv: unter 1024 px gestapelt mit Tabs ---------- */
@media (max-width: 1023.98px) {
  .mobile-tabs {
    display: flex; gap: 2px; background: var(--surface-2); border-radius: var(--radius); padding: 2px;
  }
  .mobile-tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 14px; }
  .mobile-tabs button.active { background: var(--surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
  .layout { display: block; position: relative; }
  .layout > .pane { display: none; height: 100%; border-right: 0; }
  .layout[data-tab="sidebar"] > .sidebar { display: block; }
  .layout[data-tab="list"] > .list-pane { display: flex; }
  .layout[data-tab="editor"] > .editor-pane { display: block; }
  .editor-pane { padding: 12px 16px 40px; }
}
@media (max-width: 640px) {
  .topbar { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
  .brand-name { display: none; }
  .hide-sm { display: none !important; }
  .mobile-tabs { order: 3; width: 100%; }
  .mobile-tabs button { flex: 1; }
  .versions { grid-template-columns: 1fr; }
  .version-list { max-height: 30vh; }
  .editor-actions { top: -12px; }
  .editor-actions .btn { padding: 6px 9px; }
  .save-state { width: 100%; min-width: 0; margin-left: 0; text-align: left; }
}
