/* Notizwerk – Design-Tokens, Layout, Komponenten */

:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --surface-3: #e9edf3;
  --sidebar: #f2f4f8;
  --border: #e3e7ee;
  --border-strong: #cfd5df;
  --text: #141a2a;
  --text-2: #4a5265;
  --text-3: #858c9c;
  /* heima24-Firmenfarben */
  --brand: #21376c;
  --brand-orange: #f3951b;
  --brand-orange-soft: #fef1de;
  --accent: #21376c;
  --accent-hover: #2c4788;
  --accent-soft: #e8edf7;
  --accent-text: #21376c;
  --on-accent: #ffffff;
  --danger: #d93636;
  --danger-soft: #fdeeee;
  --success: #198a4a;
  --success-soft: #e6f6ec;
  --warn: #b86e00;
  --warn-soft: #fff4e0;
  --ins: #d9f5e3;
  --ins-text: #0f5d32;
  --del: #fde2e2;
  --del-text: #9d1c1c;
  --mark: #fff0a8;
  --check-border: #9a9aa6;
  --check-bg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 16, 32, .06);
  --shadow-md: 0 4px 16px rgba(16, 16, 32, .08), 0 1px 3px rgba(16, 16, 32, .06);
  --shadow-lg: 0 24px 64px rgba(16, 16, 32, .18), 0 4px 12px rgba(16, 16, 32, .08);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --sidebar-w: 256px;
  --list-w: 336px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151d; --surface: #161b25; --surface-2: #1d2330; --surface-3: #262d3c; --sidebar: #0e1219;
    --border: #262d3b; --border-strong: #364053; --text: #eceef3; --text-2: #b3b9c6; --text-3: #7b8395; --brand-orange-soft: #3a2a12;
    --accent: #8ea6e0; --accent-hover: #a5b9e8; --accent-soft: #1f2a44; --accent-text: #a9bdee; --on-accent: #0c1428;
    --danger: #f06464; --danger-soft: #3a1d1f; --success: #4cc985; --success-soft: #16301f; --warn: #f0b04a; --warn-soft: #33270f;
    --ins: #173a25; --ins-text: #8fe3b0; --del: #401c1e; --del-text: #ffaaaa; --mark: #5a4d0f; --check-border: #9aa4b8; --check-bg: #1d2330;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 4px 16px rgba(0, 0, 0, .4); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151d; --surface: #161b25; --surface-2: #1d2330; --surface-3: #262d3c; --sidebar: #0e1219;
  --border: #262d3b; --border-strong: #364053; --text: #eceef3; --text-2: #b3b9c6; --text-3: #7b8395; --brand-orange-soft: #3a2a12;
  --accent: #8ea6e0; --accent-hover: #a5b9e8; --accent-soft: #1f2a44; --accent-text: #a9bdee; --on-accent: #0c1428;
  --danger: #f06464; --danger-soft: #3a1d1f; --success: #4cc985; --success-soft: #16301f; --warn: #f0b04a; --warn-soft: #33270f;
  --ins: #173a25; --ins-text: #8fe3b0; --del: #401c1e; --del-text: #ffaaaa; --mark: #5a4d0f; --check-border: #9aa4b8; --check-bg: #1d2330;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 4px 16px rgba(0, 0, 0, .4); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
kbd {
  font: 500 11px/1 var(--font);
  padding: 3px 5px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--text-2);
}
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.muted { color: var(--text-3); }
.spacer { flex: 1; }

.ico { display: inline-flex; flex-shrink: 0; }
.ico svg { display: block; }

/* ---------- Grundbausteine ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(33, 55, 108, .3); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); background: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 42px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn.loading { color: transparent; position: relative; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--on-accent); border-right-color: transparent; animation: spin .7s linear infinite; }
.danger-text { color: var(--danger); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2);
  cursor: pointer; transition: background .12s, color .12s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn.sm { width: 26px; height: 26px; }

.input, .select {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input:disabled { background: var(--surface-2); color: var(--text-3); }
.select { padding-right: 28px; cursor: pointer; }
.select-sm { height: 32px; width: auto; font-size: 13px; padding: 0 26px 0 10px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-3); }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-error { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 500; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 13.5px; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: 50%;
  background: var(--av, var(--accent));
  color: #fff; font-weight: 700; letter-spacing: .02em;
  user-select: none;
}
.avatar.ring { box-shadow: 0 0 0 2px var(--sidebar); }
.avatar.group { background: var(--surface-3); color: var(--text-2); width: 32px; height: 32px; }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 600; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.chip { display: inline-flex; align-items: center; gap: 4px; max-width: 150px; height: 20px; padding: 0 7px; border-radius: 6px; background: color-mix(in srgb, var(--nb, var(--accent)) 13%, transparent); color: color-mix(in srgb, var(--nb, var(--accent)) 70%, var(--text)); font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-pin { --nb: var(--warn); margin-left: 4px; }
.dot-sep { color: var(--text-3); }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); animation: pulse 2s infinite; flex-shrink: 0; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.boot { height: 100vh; display: grid; place-items: center; }

.nb-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--nb); margin: 0 3px; flex-shrink: 0; }
.nb-emoji {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 6px;
  background: color-mix(in srgb, var(--nb, var(--accent)) 16%, transparent);
  font-size: 13px; line-height: 1;
}
.nb-emoji.sm { width: 20px; height: 20px; font-size: 11px; border-radius: 5px; }
.nb-emoji.lg { width: 52px; height: 52px; font-size: 26px; border-radius: 12px; }

/* ---------- Anmeldung ---------- */
.auth {
  height: 100vh; overflow: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, color-mix(in srgb, var(--brand-orange) 12%, transparent), transparent 60%),
    var(--bg);
}
.auth-corner { position: fixed; top: 14px; right: 14px; }
.auth-card {
  width: 100%; max-width: 410px;
  display: flex; flex-direction: column; gap: 16px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-name { font: 700 19px var(--font-display); letter-spacing: -.01em; }
.auth-title { margin: 0; font: 700 22px/1.25 var(--font-display); letter-spacing: -.015em; }
.auth-sub { margin: -6px 0 4px; color: var(--text-2); }
.auth-foot { margin: 0; font-size: 12.5px; color: var(--text-3); text-align: center; }
.auth-version { color: var(--text-3); font-size: 12px; margin-top: 18px; }
.logo { display: inline-block; flex-shrink: 0; }

/* ---------- App-Layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--list-w) minmax(0, 1fr);
  height: 100vh; height: 100dvh;
}

/* Seitenleiste */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 14px 10px 10px;
}
.sb-head { display: flex; align-items: center; gap: 9px; padding: 2px 6px 14px; }
.sb-brand { font: 700 16px var(--font-display); letter-spacing: -.01em; flex: 1; }
.sb-close { display: none; }
.sb-actions { display: flex; flex-direction: column; gap: 10px; padding: 0 4px 12px; }
.search { position: relative; display: flex; align-items: center; }
.search > .ico { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search-input {
  width: 100%; height: 36px; padding: 0 64px 0 34px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface);
}
.search-input::-webkit-search-cancel-button { display: none; }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.search-kbd { position: absolute; right: 8px; pointer-events: none; }
.search-input:focus + .search-kbd { display: none; }

.sb-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 34px; padding: 0 8px 0 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--text-2); text-align: left; cursor: pointer;
  font-weight: 500; position: relative;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.nav-item .ico { color: var(--text-3); }
.nav-item.active > .ico:first-child { color: var(--accent); }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-orange); }
.logo-img { display: block; flex-shrink: 0; }
.sb-brand small { display: block; font: 600 10.5px/1.1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-flag { color: var(--text-3); display: inline-flex; }
.nav-more { display: none; color: var(--text-3); border-radius: 5px; padding: 2px; margin: 0 -2px; }
.nav-more:hover { background: var(--border); color: var(--text); }
.nav-item:hover .nav-more, .nav-item:focus-within .nav-more { display: inline-flex; }
.nav-item:hover .nav-more ~ .nav-count, .nav-item:hover:has(.nav-more) .nav-count { display: none; }
.sb-section {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 6px 6px 10px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3);
}
.sb-section.static { justify-content: flex-start; gap: 8px; }
.sb-empty { padding: 4px 10px; color: var(--text-3); font-size: 13px; margin: 0; }
.sb-spacer { flex: 1; min-height: 16px; }
.sb-online-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 10px 12px; align-items: center; }
.more-count { font-size: 12px; color: var(--text-3); font-weight: 600; padding-left: 2px; }
.sb-foot { display: flex; flex-direction: column; gap: 1px; border-top: 1px solid var(--border); padding-top: 8px; }
.account {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px; margin-top: 4px;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  text-align: left; cursor: pointer; position: relative;
}
.account:hover { background: var(--surface-3); }
.account-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.account-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-sub { font-size: 12px; color: var(--text-3); }
.account > .ico { color: var(--text-3); }
.conn-dot { position: absolute; left: 31px; top: 30px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); border: 2px solid var(--sidebar); }
.conn-dot.on { background: var(--success); }

/* Notizliste */
.listpane {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.list-head {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 12px 12px 18px;
  border-bottom: 1px solid var(--border);
  min-height: 70px;
}
.list-title-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.list-title-wrap > div { min-width: 0; }
.list-emoji { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; font-size: 18px; background: color-mix(in srgb, var(--nb) 16%, transparent); flex-shrink: 0; }
.list-emoji:empty { display: none; }
.list-title { margin: 0; font: 700 17px/1.25 var(--font-display); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { margin: 1px 0 0; font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-actions { display: flex; gap: 2px; align-items: center; }
.note-list { flex: 1; overflow-y: auto; padding: 6px; }
.list-group { padding: 12px 12px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }

.note-item {
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; padding: 11px 12px;
  border: 0; border-radius: var(--radius);
  background: transparent; text-align: left; cursor: pointer;
  position: relative;
  transition: background .1s;
}
.note-item + .note-item::before { content: ""; position: absolute; top: 0; left: 12px; right: 12px; height: 1px; background: var(--border); }
.note-item:hover { background: var(--surface-2); }
.note-item:hover::before, .note-item:hover + .note-item::before, .note-item.active::before, .note-item.active + .note-item::before { opacity: 0; }
.note-item.active { background: var(--accent-soft); }
.note-item-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.note-item-title { flex: 1; min-width: 0; font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-title.untitled { color: var(--text-3); font-weight: 500; font-style: italic; }
.note-item-snippet {
  margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.note-item-snippet.muted { color: var(--text-3); font-style: italic; }
.note-item-snippet mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.note-item-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); min-width: 0; margin-top: 2px; }
.note-item-meta > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-flag { color: var(--warn); display: inline-flex; }
.note-live { display: inline-flex; align-items: center; gap: 0; }
.note-live .avatar { margin-left: -5px; box-shadow: 0 0 0 2px var(--surface); }
.note-item.active .note-live .avatar { box-shadow: 0 0 0 2px var(--accent-soft); }
.note-live .live-dot { margin-left: 6px; }

.note-skel { padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.skel { height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.w60 { width: 60%; height: 12px; } .w90 { width: 90%; } .w40 { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.list-empty, .editor-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 8px; padding: 32px 28px; color: var(--text-2);
}
.list-empty h3, .editor-empty h3 { margin: 6px 0 0; font: 650 16px var(--font-display); color: var(--text); }
.list-empty p, .editor-empty p { margin: 0 0 10px; max-width: 320px; font-size: 13.5px; line-height: 1.55; }
.list-empty.compact { padding: 24px; }
.empty-ico { color: var(--text-3); opacity: .7; }
.empty-art { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.shortcut-hints { display: flex; gap: 18px; margin-top: 18px; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; justify-content: center; }
.shortcut-hints span { display: inline-flex; align-items: center; gap: 4px; }

.trash-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); }
.trash-item:hover { background: var(--surface-2); }
.trash-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.trash-text span { color: var(--text-3); font-size: 12px; }

/* ---------- Editor-Bereich ---------- */
.editorpane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.editor-loading { flex: 1; display: grid; place-items: center; }
.note-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.note-head {
  display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 14px 0 18px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.crumb { display: inline-flex; align-items: center; gap: 8px; min-width: 0; height: 32px; padding: 0 8px; margin-left: -8px; border: 0; background: transparent; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; cursor: pointer; }
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.head-peers { display: flex; align-items: center; padding-right: 0; }
.head-peers.has { padding-right: 8px; margin-right: 4px; border-right: 1px solid var(--border); }
.peer { border: 0; background: none; padding: 0; margin-left: -6px; cursor: pointer; border-radius: 50%; position: relative; transition: transform .12s; }
.peer:first-child { margin-left: 0; }
.peer:hover { transform: translateY(-1px); z-index: 2; }
.peer .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--peer); }
.peer.idle .avatar { opacity: .5; box-shadow: 0 0 0 2px var(--surface); }
.peer.typing::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--success); border: 2px solid var(--surface); }
.save-state { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; background: transparent; border-radius: 99px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; cursor: pointer; transition: background .12s, color .12s; }
.save-state:not(:disabled):hover { background: var(--surface-2); color: var(--text); }
.save-state:disabled { cursor: default; }
.save-state.pulse { background: var(--success-soft); color: var(--success); }
.save-state.busy { color: var(--text-2); }
.save-state.busy .ico { animation: breathe 1.2s ease-in-out infinite; }
.save-state.warn { color: var(--warn); background: var(--warn-soft); }
.save-state.err { color: var(--danger); background: var(--danger-soft); }
@keyframes breathe { 50% { opacity: .35; } }

.toolbar { flex-shrink: 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.tb-scroll { display: flex; align-items: center; gap: 2px; padding: 6px 14px; overflow-x: auto; scrollbar-width: none; max-width: 860px; margin: 0 auto; }
.tb-scroll::-webkit-scrollbar { display: none; }
.tb-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); cursor: pointer; flex-shrink: 0; }
.tb-btn:hover { background: var(--surface-2); color: var(--text); }
.tb-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.tb-block { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; min-width: 118px; justify-content: space-between; flex-shrink: 0; }
.tb-block:hover { background: var(--surface-2); }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex-shrink: 0; }

.note-banners:empty { display: none; }
.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 18px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; border-bottom: 1px solid var(--border); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner span { flex: 1; min-width: 200px; }

.note-body { flex: 1; display: flex; min-height: 0; }
.note-center { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.editor-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.page { max-width: 820px; margin: 0 auto; padding: 36px 72px 120px; }
.note-title {
  display: block; width: 100%; resize: none; overflow: hidden;
  border: 0; background: transparent; padding: 0; margin: 0;
  font: 750 32px/1.2 var(--font-display); letter-spacing: -.022em;
  color: var(--text);
}
.note-title:focus { outline: none; }
.note-title::placeholder { color: var(--text-3); opacity: .6; }
.note-title.static, .rev-title-diff { min-height: 38px; overflow: visible; margin-bottom: 26px; }
.diff-author { display: inline-flex; align-items: center; margin-left: 8px; padding: 0 7px; height: 19px; border-radius: 99px; background: color-mix(in srgb, var(--av) 16%, transparent); color: color-mix(in srgb, var(--av) 75%, var(--text)); font: 600 11px/19px var(--font); vertical-align: 2px; white-space: nowrap; text-decoration: none; }
li > .diff-author, ul > .diff-author, ol > .diff-author { margin-left: 0; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 26px; font-size: 12.5px; color: var(--text-3); }
.note-meta strong { color: var(--text-2); font-weight: 600; }

.ed-body { position: relative; }
.ed-root {
  min-height: 300px;
  font-size: 15.5px; line-height: 1.7;
  color: var(--text);
  word-wrap: break-word;
  caret-color: var(--accent);
}
.ed-root:focus { outline: none; }
.ed-root > * { margin: 0 0 .55em; position: relative; border-radius: 4px; transition: background .4s; }
.ed-root.is-empty > p:first-child::before { content: "Schreib los … Tippe # für eine Überschrift, - für eine Liste oder [] für eine Checkliste."; color: var(--text-3); position: absolute; pointer-events: none; }
.ed-root h1 { font: 700 26px/1.3 var(--font-display); letter-spacing: -.015em; margin: 1.1em 0 .4em; }
.ed-root h2 { font: 700 21px/1.35 var(--font-display); letter-spacing: -.01em; margin: 1em 0 .35em; }
.ed-root h3 { font: 650 17px/1.4 var(--font-display); margin: .9em 0 .3em; }
.ed-root > :first-child { margin-top: 0; }
.ed-root ul, .ed-root ol { padding-left: 1.6em; }
.ed-root li { margin: .15em 0; }
.ed-root li::marker { color: var(--text-3); }
.ed-root blockquote { border-left: 3px solid var(--border-strong); padding: 2px 0 2px 16px; color: var(--text-2); }
.ed-root pre { font: 13.5px/1.6 var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; tab-size: 2; }
.ed-root code { font: .88em var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: .08em .35em; }
.ed-root pre code { background: none; border: 0; padding: 0; }
.ed-root a { color: var(--accent-text); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }
.ed-root img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 6px 0; box-shadow: var(--shadow-sm); }
.ed-root hr { border: 0; height: 1px; background: var(--border-strong); margin: 1.6em 0; }
.ed-root mark { background: var(--mark); color: inherit; }
.ed-root .callout { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px 12px 42px; }
.ed-root .callout::before { content: "💡"; position: absolute; left: 14px; top: 12px; }
.ed-root ul.checklist { list-style: none; padding-left: 30px; }
.ed-root ul.checklist li { position: relative; }
.ed-root ul.checklist li::before {
  content: ""; position: absolute; left: -28px; top: .3em;
  width: 18px; height: 18px; border-radius: 5px;
  border: 2px solid var(--check-border); background: var(--check-bg);
  cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s;
}
.ed-root[contenteditable="true"] ul.checklist li:hover::before { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.ed-root ul.checklist li[data-checked="true"] { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.ed-root ul.checklist li[data-checked="true"]::before {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/12px no-repeat;
  border-color: var(--accent);
}
.ed-root[contenteditable="false"] ul.checklist li::before { cursor: default; }

/* Live-Präsenz & Sperren */
.ed-root > [data-locked] {
  background: color-mix(in srgb, var(--peer) 8%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--peer) 8%, transparent);
  cursor: not-allowed;
}
.ed-root > [data-locked][data-lock-state="here"]::after { content: attr(data-locked) " ist hier"; }
.ed-root > [data-locked]::after {
  content: attr(data-locked) " schreibt …";
  position: absolute; right: 0; top: -1.55em;
  font: 600 11px/1 var(--font); color: #fff; background: var(--peer);
  padding: 4px 7px; border-radius: 5px 5px 5px 0;
  pointer-events: none; text-decoration: none; letter-spacing: .01em;
  white-space: nowrap;
}
.ed-root > .flash { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.presence-layer { position: absolute; inset: 0; pointer-events: none; }
.pres-bar { position: absolute; left: -16px; width: 3px; border-radius: 2px; background: var(--peer); transition: top .18s, height .18s; }
.pres-chip { position: absolute; right: calc(100% + 24px); display: flex; align-items: center; gap: 6px; flex-direction: row-reverse; transition: top .18s; pointer-events: auto; }
.pres-chip .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--peer); }
.pres-chip.idle { opacity: .45; }
.pres-chip.typing::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--success); border: 2px solid var(--surface); animation: breathe 1s ease-in-out infinite; }
.block-info { position: absolute; left: calc(100% + 18px); opacity: .55; transition: opacity .15s; cursor: help; }
.block-info:hover { opacity: 1; }

/* Verlauf */
.drawer-host:empty { display: none; }
.drawer { width: 340px; height: 100%; display: flex; flex-direction: column; border-left: 1px solid var(--border); background: var(--surface); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 12px 12px 18px; border-bottom: 1px solid var(--border); }
.drawer-title { margin: 0; font: 700 16px var(--font-display); }
.drawer-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.hist-list { flex: 1; overflow-y: auto; padding: 8px; }
.hist-hint { font-size: 12.5px; color: var(--text-3); margin: 4px 10px 8px; line-height: 1.5; }
.hist-day { padding: 14px 10px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.hist-item { display: flex; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius); background: transparent; text-align: left; cursor: pointer; }
.hist-item:hover { background: var(--surface-2); }
.hist-item.active { background: var(--accent-soft); }
.hist-text { flex: 1; min-width: 0; }
.hist-line { display: flex; justify-content: space-between; gap: 8px; }
.hist-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.hist-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.hist-current { display: flex; align-items: center; gap: 6px; width: 100%; padding: 9px 10px; margin-bottom: 6px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: transparent; color: var(--accent-text); font-weight: 600; cursor: pointer; }
.hist-current:hover { background: var(--accent-soft); }

.rev-host { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.rev-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rev-who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; }
.rev-title { font-weight: 650; }
.rev-sub { font-size: 12.5px; color: var(--text-3); }
.rev-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rev-legend { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 18px; border-bottom: 1px solid var(--border); }
.lg { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.lg-add { background: var(--ins); color: var(--ins-text); }
.lg-chg { background: var(--warn-soft); color: var(--warn); }
.lg-del { background: var(--del); color: var(--del-text); }
.rev-root { min-height: 0; }
.rev-root > .diff-added { background: var(--ins); box-shadow: -10px 0 0 var(--ins), 10px 0 0 var(--ins); border-left: 0; }
.rev-root > .diff-added::before, .rev-root > .diff-removed::before, .rev-root > .diff-changed::before { position: absolute; left: -34px; top: 0; width: 18px; text-align: center; font-weight: 700; font-family: var(--mono); }
.rev-root > .diff-added::before { content: "+"; color: var(--ins-text); }
.rev-root > .diff-removed { background: var(--del); color: var(--del-text); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--del-text) 50%, transparent); box-shadow: -10px 0 0 var(--del), 10px 0 0 var(--del); }
.rev-root > .diff-removed::before { content: "−"; color: var(--del-text); }
.rev-root > .diff-changed::before { content: "~"; color: var(--warn); }
.rev-root ins, .rev-title-diff ins { background: var(--ins); color: var(--ins-text); text-decoration: none; border-radius: 3px; padding: 0 1px; }
.rev-root del, .rev-title-diff del { background: var(--del); color: var(--del-text); border-radius: 3px; padding: 0 1px; }
.rev-collapsed { display: block; width: 100%; margin: 4px 0 10px; padding: 6px; border: 1px dashed var(--border-strong); border-radius: 8px; background: transparent; color: var(--text-3); font-size: 12.5px; cursor: pointer; }
.rev-collapsed:hover { color: var(--text); background: var(--surface-2); }
.rev-title-diff { margin-bottom: 26px; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 30px; height: 18px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .15s; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--shadow-sm); }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(12px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Menüs, Dialoge, Toasts ---------- */
.menu {
  position: fixed; z-index: 1000; min-width: 220px; max-width: 320px;
  padding: 5px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; font-size: 13.5px; }
.menu-item:hover, .menu-item:focus { background: var(--surface-2); outline: none; }
.menu-item .ico { color: var(--text-3); }
.menu-item > span:not(.ico) { flex: 1; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .ico { color: var(--danger); }
.menu-item.active { font-weight: 600; }
.menu-hint { flex: 0 !important; color: var(--text-3); font: 12px var(--mono); }
.menu-check { color: var(--accent) !important; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-header { padding: 7px 10px 4px; font-size: 11.5px; color: var(--text-3); font-weight: 600; }

.overlay {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 9vh 16px 16px; overflow-y: auto;
  background: rgba(15, 15, 30, .38);
  backdrop-filter: blur(2px);
  animation: fade .15s ease-out;
}
.overlay.out { opacity: 0; transition: opacity .15s; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  animation: rise .18s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { max-width: 640px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 16px 4px 24px; }
.modal-title { margin: 0; font: 700 18px/1.3 var(--font-display); letter-spacing: -.01em; }
.modal-sub { margin: 4px 0 0; color: var(--text-3); font-size: 13px; }
.modal-body { padding: 16px 24px 8px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 16px 24px 20px; }
.confirm-text { margin: 0; color: var(--text-2); line-height: 1.6; }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 1100; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 14px; border-radius: 11px;
  background: #1e1e26; color: #f2f2f6; box-shadow: var(--shadow-lg);
  font-size: 13.5px; animation: rise .2s ease-out;
}
:root[data-theme="dark"] .toast { background: #2e2e38; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
.toast.error > .ico { color: #ff8f8f; }
.toast.success > .ico { color: #7be3a7; }
.toast-msg { max-width: 460px; }
.toast-action { border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-weight: 600; padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.toast-action:hover { background: rgba(255, 255, 255, .2); }
.toast-x { border: 0; background: none; color: rgba(255, 255, 255, .6); cursor: pointer; display: inline-flex; padding: 4px; border-radius: 6px; }
.toast-x:hover { color: #fff; background: rgba(255, 255, 255, .1); }

/* Freigaben */
.share-add { display: flex; gap: 8px; }
.share-add > .select { width: 140px; flex-shrink: 0; }
.share-search { position: relative; flex: 1; display: flex; align-items: center; }
.share-search > .ico { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.share-search .input { padding-left: 34px; }
.suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); }
.suggest-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; }
.suggest-item.active, .suggest-item:hover { background: var(--surface-2); }
.suggest-text { display: flex; flex-direction: column; line-height: 1.3; font-size: 13px; }
.suggest-text span { color: var(--text-3); font-size: 12px; }
.suggest-empty { padding: 10px; color: var(--text-3); font-size: 13px; }
.share-label { margin: 20px 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.share-list { display: flex; flex-direction: column; }
.share-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.share-row:last-child { border-bottom: 0; }
.share-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.share-who span { color: var(--text-3); font-size: 12.5px; }
.share-fixed { color: var(--text-3); font-size: 13px; padding-right: 8px; }
.share-empty { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; margin: 10px 0 0; }
.owner-transfer summary { cursor: pointer; color: var(--accent-text); font-size: 13px; font-weight: 600; list-style: none; padding: 4px 8px; border-radius: 6px; }
.owner-transfer summary:hover { background: var(--accent-soft); }
.owner-transfer[open] summary { display: none; }
.level-help { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; padding: 12px; border-radius: 10px; background: var(--surface-2); font-size: 12px; color: var(--text-2); line-height: 1.45; }
.level-help strong { display: block; color: var(--text); font-size: 12.5px; margin-bottom: 2px; }

/* Notizbuch-Dialog */
.nb-name-row { display: flex; gap: 14px; align-items: flex-end; }
.nb-name-row .field { flex: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.emoji-opt { aspect-ratio: 1; border: 1px solid transparent; border-radius: 8px; background: var(--surface-2); font-size: 17px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.emoji-opt:hover { background: var(--surface-3); }
.emoji-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.color-opt.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }

.pick-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer; }
.pick-item:hover { background: var(--surface-2); }
.pick-item > span:nth-child(2) { font-weight: 600; flex: 1; }
.pick-meta { font-size: 12px; color: var(--text-3); }

.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head > div { display: flex; flex-direction: column; }

/* Verwaltung */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 14px; }
.tab { border: 0; background: none; padding: 8px 12px 10px; font-weight: 600; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent-text); border-bottom-color: var(--accent); }
.admin { min-height: 260px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.admin-toolbar p { margin: 0; font-size: 13px; line-height: 1.5; }
.table { display: flex; flex-direction: column; max-height: 52vh; overflow-y: auto; margin: 0 -8px; }
.table-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 9px; }
.table-row:hover { background: var(--surface-2); }
.table-row.disabled { opacity: .55; }
.table-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.table-main span { color: var(--text-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-tags { display: flex; gap: 6px; }
.av-stack { display: flex; }
.av-stack .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.member-list { display: flex; flex-direction: column; max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.member { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.member:hover { background: var(--surface-2); }
.member input { accent-color: var(--accent); width: 16px; height: 16px; }
.member .muted { margin-left: auto; font-size: 12px; }

.kbd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.kbd-head { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin: 12px 0 6px; }
.kbd-head:first-child { margin-top: 0; }
.kbd-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.kbd-keys { display: inline-flex; gap: 4px; }

/* Protokoll */
.log-list { max-height: 60vh; overflow-y: auto; margin: 0 -10px; padding: 0 2px; }
.log-item { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 10px; }
.log-item:hover { background: var(--surface-2); }
.log-step { width: 22px; text-align: right; font: 600 11px var(--mono); color: var(--text-3); flex-shrink: 0; }
.log-text { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.4; }
.log-meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.log-link { display: inline; border: 0; background: none; padding: 0; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.log-link:hover { color: var(--accent-text); text-decoration: underline; }
.log-actions { display: flex; align-items: center; gap: 2px; opacity: .55; transition: opacity .12s; }
.log-item:hover .log-actions, .log-actions:focus-within { opacity: 1; }
.log-more { margin-top: 8px; }

/* Ungelesen */
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-orange); flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-orange) 25%, transparent); }
.note-item.unread .note-item-title { font-weight: 750; }
.nav-unread { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 99px; background: var(--brand-orange); color: #1a1205; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* Einstellungen */
.option-list { display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .12s, background .12s; }
.option:hover { background: var(--surface-2); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.option > span { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.option .muted { font-size: 12.5px; }
.info-box { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 13px; line-height: 1.5; }
.info-box > .ico { margin-top: 2px; color: var(--accent-text); }
.info-box > span:not(.ico) { flex: 1; min-width: 200px; }
.info-box a { color: var(--accent-text); font-weight: 600; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 12px; }
.step > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.step p { margin: 0; line-height: 1.55; }
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 12.5px; display: grid; place-items: center; flex-shrink: 0; }
.step code, .info-box code { font: 12.5px var(--mono); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.copy-row { display: flex; gap: 8px; width: 100%; }
a.btn { text-decoration: none; }

.scrim { display: none; }
.only-mobile { display: none; }

/* ---------- Responsiv ---------- */
@media (max-width: 1280px) {
  :root { --list-w: 300px; --sidebar-w: 236px; }
  .page { padding: 30px 56px 120px; }
  .drawer { width: 300px; }
}
@media (max-width: 1080px) {
  .app { grid-template-columns: var(--list-w) minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 800; top: 0; bottom: 0; left: 0; width: 280px;
    transform: translateX(-100%); transition: transform .22s ease, visibility .22s;
    visibility: hidden;
  }
  .sidebar-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); }
  .sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 790; background: rgba(15, 15, 30, .35); }
  .sb-close { display: inline-flex; }
  .list-head .only-mobile { display: inline-flex; }
  .with-drawer .drawer-host { position: absolute; right: 0; top: 0; bottom: 0; z-index: 50; box-shadow: var(--shadow-lg); }
  .note-body { position: relative; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .listpane, .editorpane { grid-column: 1; grid-row: 1; }
  .editorpane { display: none; }
  .show-editor .editorpane { display: flex; }
  .show-editor .listpane { display: none; }
  .only-mobile { display: inline-flex; }
  .note-head { padding: 0 8px; }
  .page { padding: 22px 18px 100px; }
  .note-title { font-size: 26px; }
  .presence-layer .pres-chip { right: auto; left: -10px; transform: translateX(-100%); }
  .pres-chip, .block-info { display: none; }
  .pres-bar { left: -10px; }
  .save-label { display: none; }
  .drawer { width: min(340px, 92vw); }
  .level-help { grid-template-columns: 1fr; }
  .kbd-grid { grid-template-columns: 1fr; }
  .share-add { flex-direction: column; }
  .share-add > .select { width: 100%; }
  .emoji-grid { grid-template-columns: repeat(5, 1fr); }
  .overlay { padding-top: 16px; }
  .rev-who { min-width: 0; }
}

/* ---------- Druck ---------- */
@media print {
  body { overflow: visible; background: #fff; }
  .sidebar, .listpane, .note-head, .toolbar, .note-banners, .drawer-host, .presence-layer, .block-info, #toasts { display: none !important; }
  .app { display: block; height: auto; }
  .editorpane, .note-view, .note-body, .note-center, .editor-scroll { display: block !important; overflow: visible !important; height: auto !important; }
  .page { padding: 0; max-width: none; }
  .ed-root > [data-locked] { background: none; box-shadow: none; }
  .ed-root > [data-locked]::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
