/* Zettelbrett – Gestaltung, helles und dunkles Farbschema */

:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #efebe2;
  --text: #22201c;
  --muted: #6d675d;
  --line: #e2ddd1;
  --line-strong: #cfc8b8;
  --accent: #f0b429;
  --accent-soft: #fbedc6;
  --accent-text: #6b4a00;
  --sel: #2f6fde;
  --danger: #c4372b;
  --shadow: 0 1px 2px rgba(40, 32, 16, .08), 0 2px 8px rgba(40, 32, 16, .06);
  --shadow-lg: 0 8px 30px rgba(40, 32, 16, .18), 0 2px 6px rgba(40, 32, 16, .08);
  --board-bg: #fbfaf6;
  --dot: #d9d3c5;

  /* Notizfarben */
  --n-default: var(--surface);
  --n-red: #f7c6be; --n-orange: #fad3a8; --n-yellow: #fff0a6; --n-green: #d4eec3; --n-teal: #bfe5dc;
  --n-blue: #cfe2f3; --n-indigo: #c1cdf0; --n-purple: #ddcdf1; --n-pink: #f6d0e1; --n-brown: #e7d7c4; --n-gray: #e5e4e0;

  /* Tintenfarben */
  --i-ink: #22201c; --i-red: #d63c2c; --i-orange: #e57f26; --i-yellow: #e0ad0b; --i-green: #2e9c46;
  --i-blue: #2a6edb; --i-purple: #8a4fd1; --i-gray: #8b857a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1b1a18; --surface: #262421; --surface-2: #302e2a; --text: #ece8e0; --muted: #a49d91;
    --line: #3a3732; --line-strong: #4b4740; --accent: #f2b84b; --accent-soft: #4a3b18; --accent-text: #ffd98a;
    --sel: #6ea8ff; --danger: #ff7a6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .25);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
    --board-bg: #1f1e1b; --dot: #3b3832;
    --n-red: #6a2c27; --n-orange: #6a4019; --n-yellow: #615214; --n-green: #2e4c2a; --n-teal: #1f4c47;
    --n-blue: #24425c; --n-indigo: #2e3866; --n-purple: #46335e; --n-pink: #5c2e43; --n-brown: #4b3b2b; --n-gray: #3a3936;
    --i-ink: #efebe4; --i-red: #ff7a6b; --i-orange: #ffa45c; --i-yellow: #ffd54a; --i-green: #6bd17d;
    --i-blue: #6ea8ff; --i-purple: #b98cff; --i-gray: #a8a39a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1a18; --surface: #262421; --surface-2: #302e2a; --text: #ece8e0; --muted: #a49d91;
  --line: #3a3732; --line-strong: #4b4740; --accent: #f2b84b; --accent-soft: #4a3b18; --accent-text: #ffd98a;
  --sel: #6ea8ff; --danger: #ff7a6b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .25);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
  --board-bg: #1f1e1b; --dot: #3b3832;
  --n-red: #6a2c27; --n-orange: #6a4019; --n-yellow: #615214; --n-green: #2e4c2a; --n-teal: #1f4c47;
  --n-blue: #24425c; --n-indigo: #2e3866; --n-purple: #46335e; --n-pink: #5c2e43; --n-brown: #4b3b2b; --n-gray: #3a3936;
  --i-ink: #efebe4; --i-red: #ff7a6b; --i-orange: #ffa45c; --i-yellow: #ffd54a; --i-green: #6bd17d;
  --i-blue: #6ea8ff; --i-purple: #b98cff; --i-gray: #a8a39a;
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--muted);
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.on { color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm .ic { width: 17px; height: 17px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 10px; font-weight: 550;
  transition: background-color .15s;
}
.btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.btn-primary { background: var(--accent); color: #2a1d00; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.input {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); outline: none;
}
.input:focus { border-color: var(--sel); }

/* ---------- Gerüst ---------- */
#app {
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr);
  grid-template-columns: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  min-width: 0;
}
.brand {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
  font-size: 19px; font-weight: 650; letter-spacing: -.01em; padding: 0 6px 0 2px;
  flex: none; width: 200px;
}
.brand img { display: block; }
.search {
  flex: 1; max-width: 680px; height: 44px; display: flex; align-items: center; gap: 4px;
  padding: 0 6px 0 14px; border-radius: 12px; background: var(--surface-2); color: var(--muted);
}
.search:focus-within { background: var(--surface); box-shadow: var(--shadow); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; color: var(--text); padding: 0 6px; }
.search input::-webkit-search-cancel-button { display: none; }
.search #search-clear { visibility: hidden; }
.search.has-q #search-clear { visibility: visible; }
.board-head { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
#board-name {
  flex: 0 1 420px; min-width: 0; height: 40px; padding: 0 10px; border-radius: 10px;
  border: 1px solid transparent; background: none; font-size: 17px; font-weight: 600; outline: none;
}
#board-name:hover { border-color: var(--line); }
#board-name:focus { border-color: var(--sel); background: var(--surface); }
.topbar-actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
#btn-search { display: none; }

.sidebar {
  width: 260px; overflow-y: auto; padding: 8px 10px 24px 8px;
  display: flex; flex-direction: column; gap: 1px;
  background: var(--bg);
}
body.sidebar-collapsed .sidebar { display: none; }
.sb-item {
  display: flex; align-items: center; gap: 14px; min-height: 42px; padding: 0 14px;
  border-radius: 0 22px 22px 0; margin-left: -8px; padding-left: 22px;
  text-decoration: none; color: var(--text); text-align: left; width: calc(100% + 8px);
}
.sb-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-item .ic { color: var(--muted); }
.sb-item:hover { background: var(--surface-2); }
.sb-item.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sb-item.on .ic { color: var(--accent-text); }
.sb-ghost { color: var(--muted); }
.sb-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 14px 0 2px 14px; font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.sb-sep { height: 1px; background: var(--line); margin: 10px 0 10px 14px; }
.sb-foot { margin: 14px 4px 0 14px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.scrim { display: none; }

main { position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; }
#view-board { overflow: hidden; }

/* ---------- Notizen ---------- */
.notes-wrap { max-width: 1600px; margin: 0 auto; padding: 22px 24px 120px; }
.view-title { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 14px; text-align: center; }
.composer {
  max-width: 600px; margin: 0 auto 30px; display: flex; align-items: center; gap: 2px;
  padding: 4px 6px 4px 4px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.composer-input { flex: 1; text-align: left; height: 44px; padding: 0 14px; color: var(--muted); font-weight: 500; border-radius: 8px; }
.composer-input:hover { color: var(--text); }
.sec-title { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 6px 4px 10px; }
.sec-title ~ .sec-title { margin-top: 28px; }
.grid { display: flex; gap: 14px; align-items: flex-start; }
.grid-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.trash-bar { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-style: italic; margin-bottom: 22px; }
.trash-bar .btn { font-style: normal; color: var(--sel); }
.empty { display: grid; place-items: center; gap: 10px; padding: 70px 20px; color: var(--muted); text-align: center; }
.empty .ic { width: 96px; height: 96px; stroke-width: .9; opacity: .45; }
.empty p { margin: 0; font-size: 18px; }

[data-color] { --note-bg: var(--n-default); }
[data-color="red"] { --note-bg: var(--n-red); } [data-color="orange"] { --note-bg: var(--n-orange); }
[data-color="yellow"] { --note-bg: var(--n-yellow); } [data-color="green"] { --note-bg: var(--n-green); }
[data-color="teal"] { --note-bg: var(--n-teal); } [data-color="blue"] { --note-bg: var(--n-blue); }
[data-color="indigo"] { --note-bg: var(--n-indigo); } [data-color="purple"] { --note-bg: var(--n-purple); }
[data-color="pink"] { --note-bg: var(--n-pink); } [data-color="brown"] { --note-bg: var(--n-brown); }
[data-color="gray"] { --note-bg: var(--n-gray); }

.note-card {
  position: relative; background: var(--note-bg);
  border: 1px solid transparent; border-radius: 12px;
  padding: 12px 16px 14px; cursor: default; overflow: hidden;
  transition: box-shadow .15s;
  overflow-wrap: anywhere;
}
.note-card[data-color="default"], .note-card[data-color="none"] { border-color: var(--line-strong); }
#notes-list .note-card { cursor: pointer; padding-bottom: 12px; }
#notes-list .note-card:hover { box-shadow: var(--shadow); }
.nc-title { font-weight: 650; font-size: 16px; line-height: 1.35; margin: 2px 28px 6px 0; }
.nc-text { white-space: pre-wrap; max-height: 22em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 85%, transparent); mask-image: linear-gradient(#000 85%, transparent); }
.cv-card .nc-text { max-height: none; -webkit-mask-image: none; mask-image: none; }
.nc-text a { color: var(--sel); }
.nc-empty { color: var(--muted); font-size: 20px; font-weight: 300; padding: 2px 0; }
.nc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nc-list + .nc-list { margin-top: 6px; }
.nc-list li { display: flex; gap: 8px; align-items: flex-start; }
.nc-list li.done .nc-li { text-decoration: line-through; color: var(--muted); }
.nc-box {
  width: 17px; height: 17px; border-radius: 4px; border: 1.6px solid currentColor; opacity: .7;
  flex: none; margin-top: 2.5px; cursor: pointer; display: grid; place-items: center;
}
.nc-box .ic { width: 13px; height: 13px; stroke-width: 3; }
.nc-li { min-width: 0; }
.nc-more { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.nc-sketch { margin: -12px -16px 10px; background: color-mix(in srgb, var(--surface) 55%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.nc-sketch .sketch-svg { display: block; width: 100%; max-height: 220px; }
.nc-img-wrap { margin: -12px -16px 10px; background: color-mix(in srgb, var(--surface) 55%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.nc-img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.ed-img { position: relative; background: color-mix(in srgb, var(--surface) 55%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.ed-img img { display: block; width: 100%; max-height: 360px; object-fit: contain; }
.ed-img-ai { cursor: pointer; border: 1px solid var(--line-strong); color: var(--text); font-weight: 550; }
.ed-img-ai:hover { background: var(--accent-soft); color: var(--accent-text); }
.cam-dialog { width: min(520px, 100%); }
.cam-video { display: block; width: 100%; max-height: 55vh; border-radius: 10px; background: #000; object-fit: cover; margin-top: 8px; }
.ai-dialog { width: min(540px, 100%); }
.ai-dialog h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.ai-prompt { margin: 10px 0 12px; }
.ai-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ai-btn {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); transition: background-color .15s, border-color .15s;
}
.ai-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.ai-btn strong { font-size: 14.5px; font-weight: 600; color: var(--text); }
.ai-btn span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.ai-status { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); margin-bottom: 10px; }
.nc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12.5px;
  background: color-mix(in srgb, var(--text) 9%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip .ic { width: 14px; height: 14px; }
.chip button { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; margin-right: -5px; }
.chip button:hover { background: color-mix(in srgb, var(--text) 14%, transparent); }
.chip-board:hover { background: color-mix(in srgb, var(--text) 16%, transparent); }
.nc-pin {
  position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted); opacity: 0; transition: opacity .15s;
}
.nc-pin.on { opacity: 1; color: var(--text); }
.nc-pin:hover { background: color-mix(in srgb, var(--text) 9%, transparent); }
.nc-tools { display: flex; gap: 2px; margin: 8px -10px -6px; opacity: 0; transition: opacity .15s; }
.nc-tools button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.nc-tools button:hover { background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); }
.nc-tools .ic { width: 18px; height: 18px; }
@media (hover: hover) {
  .note-card:hover .nc-pin, .note-card:hover .nc-tools, .note-card:focus-within .nc-tools { opacity: 1; }
}
@media (hover: none) {
  .nc-tools { display: none; }
  .nc-pin:not(.on) { display: none; }
}

/* ---------- Editor ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 16, 8, .45);
  display: grid; place-items: center; padding: 16px;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.editor {
  width: min(620px, 100%); max-height: min(86vh, 900px);
  display: flex; flex-direction: column;
  background: var(--note-bg); border-radius: 14px; box-shadow: var(--shadow-lg);
  overflow: hidden; animation: pop .16s ease-out;
}
.editor[data-color="default"], .editor[data-color="none"] { border: 1px solid var(--line); }
.ed-scroll { overflow-y: auto; padding: 0 0 8px; flex: 1; min-height: 0; position: relative; }
.ed-sketch { position: relative; cursor: pointer; background: color-mix(in srgb, var(--surface) 55%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
.ed-sketch .sketch-svg { display: block; width: 100%; max-height: 320px; }
.ed-sketch-hint { position: absolute; left: 12px; bottom: 10px; display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); background: var(--surface); padding: 4px 10px; border-radius: 12px; box-shadow: var(--shadow); opacity: .9; }
.ed-sketch-hint .ic { width: 14px; height: 14px; }
.ed-sketch-del { position: absolute; top: 8px; right: 8px; background: var(--surface); box-shadow: var(--shadow); }
.ed-head { display: flex; align-items: flex-start; gap: 4px; padding: 12px 8px 0 18px; }
.ed-title { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 19px; font-weight: 650; padding: 8px 0; }
.ed-title::placeholder, .ed-text::placeholder, .li-new::placeholder { color: var(--muted); opacity: .8; font-weight: 500; }
.ed-text {
  display: block; width: 100%; border: 0; background: none; outline: none; resize: none;
  padding: 6px 18px 10px; min-height: 4.5em; line-height: 1.5; font-size: 15.5px; overflow: hidden;
}
.ed-list { padding: 4px 10px 8px; }
.li { display: flex; align-items: flex-start; gap: 6px; padding: 2px 4px 2px 8px; border-radius: 8px; border: 1px solid transparent; }
.li:focus-within { border-color: color-mix(in srgb, var(--text) 14%, transparent); }
.li-box {
  width: 20px; height: 20px; border-radius: 5px; border: 1.7px solid currentColor; opacity: .75;
  flex: none; margin-top: 7px; display: grid; place-items: center;
}
.li-box .ic { width: 15px; height: 15px; stroke-width: 3; }
.li-text {
  flex: 1; min-width: 0; border: 0; background: none; outline: none; resize: none; overflow: hidden;
  padding: 6px 0; line-height: 1.45; font-size: 15.5px;
}
.li.done .li-text { text-decoration: line-through; color: var(--muted); }
.li-del { opacity: 0; margin-top: 2px; }
.li:hover .li-del, .li:focus-within .li-del { opacity: 1; }
@media (hover: none) { .li-del { opacity: .6; } }
.li-add { align-items: center; color: var(--muted); padding-left: 8px; }
.li-add .ic { width: 20px; height: 20px; margin: 0; }
.li-new { flex: 1; border: 0; background: none; outline: none; height: 38px; font-size: 15.5px; padding: 0 2px; }
.li-done-title { margin: 12px 12px 4px; font-size: 13px; color: var(--muted); border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent); padding-top: 10px; }
.ed-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 18px 0; }
.ed-chips:empty { display: none; }
.ed-foot {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px 8px;
  border-top: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}
.ed-tools { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.ed-tools::-webkit-scrollbar { display: none; }
.ed-tools .icon-btn { width: 38px; height: 38px; flex: none; }
.ed-tools .icon-btn:hover { background: color-mix(in srgb, var(--text) 9%, transparent); }
.ed-time { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.ed-close { flex: none; }
.ed-pin { flex: none; }
.ed-pin:hover { background: color-mix(in srgb, var(--text) 9%, transparent); }

/* ---------- Popover, Menü, Dialog, Hinweis ---------- */
.popover {
  position: fixed; z-index: 300; background: var(--surface); color: var(--text);
  border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  padding: 6px; animation: pop .12s ease-out; max-width: calc(100vw - 16px);
}
.pop-row { display: flex; gap: 4px; flex-wrap: wrap; }
.pop-row + .pop-row { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.pop-title { font-size: 13px; font-weight: 600; padding: 6px 8px; }
.menu { display: flex; flex-direction: column; min-width: 210px; }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 0; }
.menu-item {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 8px; text-align: left; width: 100%;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item .ic { color: var(--muted); width: 18px; height: 18px; }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.color-pop { display: grid; grid-template-columns: repeat(6, 32px); gap: 6px; padding: 4px; }
.nsw {
  width: 32px; height: 32px; border-radius: 50%; background: var(--note-bg);
  border: 2px solid transparent; display: grid; place-items: center; color: var(--muted);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 14%, transparent);
}
.nsw .ic { width: 16px; height: 16px; }
.nsw:hover { border-color: var(--line-strong); }
.nsw.on { border-color: var(--sel); }
.label-pop { width: 260px; }
.label-pop .input { margin: 0 0 6px; }
.label-list { max-height: 260px; overflow-y: auto; }
.label-list .muted { padding: 6px 8px 8px; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 8px; border-radius: 8px; cursor: pointer; }
.check-row:hover { background: var(--surface-2); }
.check-row input { width: 17px; height: 17px; accent-color: var(--sel); margin: 0; }
.dialog {
  width: min(420px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 20px 20px 14px; animation: pop .15s ease-out;
}
.dialog p { margin: 0 0 18px; line-height: 1.5; }
.dialog h3 { margin: 0 0 14px; font-size: 17px; }
.dialog-btns { display: flex; justify-content: flex-end; gap: 8px; }
.confirm-backdrop { z-index: 400; }
.labels-dialog .lbl-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; max-height: 50vh; overflow-y: auto; }
.lbl-row { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.lbl-row .input { color: var(--text); }
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 500; width: max-content; max-width: calc(100vw - 24px); }
.toast {
  display: flex; align-items: center; gap: 16px; padding: 12px 10px 12px 18px; border-radius: 10px;
  background: #2b2925; color: #f3efe7; box-shadow: var(--shadow-lg); animation: pop .15s ease-out; font-size: 14px;
}
.toast button { color: var(--accent); font-weight: 650; padding: 6px 10px; border-radius: 8px; flex: none; }
.toast button:hover { background: rgba(255, 255, 255, .08); }
body.on-board #toast-root { bottom: 96px; }

/* ---------- Zeichenfläche ---------- */
.cv-host { position: absolute; inset: 0; }
.cv {
  overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; outline: none;
  background-color: var(--board-bg);
  background-image: radial-gradient(circle, var(--dot) 1.1px, transparent 1.4px);
  background-size: var(--gs, 24px) var(--gs, 24px);
  background-position: var(--gx, 0) var(--gy, 0);
  cursor: crosshair;
}
.cv[data-tool="select"] { cursor: text; }
.cv[data-tool="hand"], .cv.is-space { cursor: grab; }
.cv.is-panning { cursor: grabbing; }
.cv[data-tool="note"] { cursor: copy; }
.cv[data-tool="eraser"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Ccircle cx='11' cy='11' r='9' fill='rgba(255,255,255,.5)' stroke='%23555' stroke-width='1.5'/%3E%3C/svg%3E") 11 11, crosshair;
}
.cv-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-svg { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.cv-cards { position: absolute; left: 0; top: 0; }
.cv-card { position: absolute; box-shadow: var(--shadow); cursor: default; }
.cv[data-tool="select"] .cv-card { cursor: move; }
.cv-card .nc-box { cursor: pointer; }
.cv-card.has-peer { outline: 2px solid var(--peer); outline-offset: 3px; }
.cv-card.is-sel { outline: 2px solid var(--sel); outline-offset: 2px; }
/* Live-Cursor der anderen: Strich an der Schreibstelle, darüber der Name */
.peer-caret { position: absolute; width: 2px; margin-left: -1px; background: var(--peer); border-radius: 1px; pointer-events: none; z-index: 6; }
.peer-caret b {
  position: absolute; left: -1px; bottom: 100%; margin-bottom: 1px; padding: 0 5px; border-radius: 5px 5px 5px 0;
  background: var(--peer); color: #fff; font: inherit; font-size: 11px; line-height: 16px; font-weight: 600; white-space: nowrap;
}
.peer-caret.below b { bottom: auto; top: 100%; margin: 1px 0 0; border-radius: 0 5px 5px 5px; }
.cv-card.flash { animation: flash .9s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--sel) 45%, transparent); } }
.cv-selbox { fill: none; stroke: var(--sel); stroke-width: 1.2; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.cv-handle { fill: var(--surface); stroke: var(--sel); pointer-events: all; cursor: nwse-resize; }
.cv-marquee { position: absolute; border: 1px solid var(--sel); background: color-mix(in srgb, var(--sel) 10%, transparent); pointer-events: none; }

.ink { fill: none; stroke: var(--c); stroke-linecap: round; stroke-linejoin: round; }
.ink.t-marker { stroke-opacity: .42; }
.c-ink { --c: var(--i-ink); } .c-red { --c: var(--i-red); } .c-orange { --c: var(--i-orange); } .c-yellow { --c: var(--i-yellow); }
.c-green { --c: var(--i-green); } .c-blue { --c: var(--i-blue); } .c-purple { --c: var(--i-purple); } .c-gray { --c: var(--i-gray); }

/* Werkzeugleiste */
.tb {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 2px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none;
}
.tb::-webkit-scrollbar { display: none; }
.tb-btn {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: grid; place-items: center; color: var(--muted);
}
.tb-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.tb-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.tb-sep { width: 1px; height: 24px; background: var(--line); margin: 0 3px; flex: none; }
.tb-swatch {
  width: var(--d, 10px); height: var(--d, 10px); border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--line-strong);
}
/* Farbknopf für neue Post-its: kleines Post-it mit Eselsohr */
.tb-paper {
  width: 20px; height: 20px; border-radius: 2px 2px 7px 2px; background: var(--note-bg);
  box-shadow: 0 0 0 1px var(--line-strong), 0 2px 4px -1px rgba(0, 0, 0, .25);
}
.tb-paper[data-color="default"] { background: var(--surface); }
.tb-paper.off { opacity: .4; }
.sw { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.sw.on { box-shadow: 0 0 0 2px var(--sel); }
.sz { width: 40px; height: 34px; border-radius: 8px; display: grid; place-items: center; }
.sz span { display: block; border-radius: 50%; background: var(--text); }
.sz:hover { background: var(--surface-2); }
.sz.on { background: var(--accent-soft); }
.style-pop { width: 286px; }
.zoom-ctl {
  position: absolute; right: 16px; bottom: 16px; z-index: 10; display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 3px;
}
.zoom-ctl .tb-btn { width: 34px; height: 34px; }
.zoom-ctl .tb-btn .ic { width: 18px; height: 18px; }
.zoom-val { min-width: 54px; height: 34px; border-radius: 8px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.zoom-val:hover { background: var(--surface-2); }
.sel-bar {
  position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 10;
  display: flex; gap: 6px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.pill-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; font-size: 14px; }
.pill-btn .ic { width: 17px; height: 17px; }
.pill-btn:hover { background: var(--surface-2); }
.pill-btn.danger { color: var(--danger); }
.board-hint {
  position: absolute; left: 50%; top: 28px; transform: translateX(-50%); z-index: 5; pointer-events: none;
  width: min(460px, calc(100% - 32px)); text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5;
  display: flex; flex-direction: column; gap: 4px;
}
.board-hint strong { color: var(--text); font-size: 16px; }

/* Zeichnung in einer Notiz */
.sketch-overlay { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; background: var(--bg); }
.sk-top { height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-bottom: 1px solid var(--line); flex: none; }
.sk-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-stage { position: relative; flex: 1; min-height: 0; }
.sketch-svg { overflow: hidden; }

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 899px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(300px, 84vw);
    padding-top: 16px; background: var(--surface); box-shadow: var(--shadow-lg);
    transform: translateX(-105%); transition: transform .22s ease;
  }
  body.drawer-open .sidebar { transform: none; }
  body.sidebar-collapsed .sidebar { display: flex; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; transition: opacity .22s; }
  body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .brand { width: auto; font-size: 18px; }
  .notes-wrap { padding: 14px 10px 100px; }
  .grid, .grid-col { gap: 10px; }
  .composer { margin-bottom: 20px; }
  .note-card { padding: 10px 12px 12px; }
  .nc-sketch { margin: -10px -12px 8px; }
  .nc-title { font-size: 15px; }
  .search { display: none; }
  #btn-search { display: inline-grid; }
  body.searching .search { display: flex; position: absolute; left: 8px; right: 8px; top: 6px; z-index: 20; background: var(--surface); box-shadow: var(--shadow); }
  body.on-board #btn-search { display: none; }
  body.on-board .brand span { display: none; }
  .modal-backdrop.editor-backdrop { padding: 0; }
  .editor { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .tb { bottom: 10px; }
  .zoom-ctl { top: 10px; right: 10px; bottom: auto; }
  .sel-bar { bottom: 70px; }
  body.on-board #toast-root { bottom: 76px; }
}
@media (max-width: 420px) {
  .tb-btn { width: 36px; height: 38px; }
  .tb-sep { margin: 0 1px; }
}

/* ======================================================================
   Gemeinsam arbeiten: Anmeldung, Teilen, Verlauf, Konto
   ====================================================================== */
.link-btn { color: var(--sel); text-decoration: underline; text-underline-offset: 2px; font: inherit; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff; background: hsl(var(--h, 30) 45% 46%);
}
.head-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px; border-radius: 18px;
  color: var(--muted); flex: none;
}
.head-btn:hover { background: var(--surface-2); color: var(--text); }
.head-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.head-btn span:empty { display: none; }
.head-btn span { font-size: 13px; font-weight: 650; }
#board-name[readonly] { cursor: default; }
#board-name[readonly]:hover { border-color: transparent; }
.sync-state { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; height: 30px; border-radius: 15px; font-size: 12.5px; color: var(--muted); align-self: center; }
.sync-state .ic { width: 18px; height: 18px; }
.sync-state.offline { background: var(--surface-2); }
.sync-state.sync .ic { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* Seitenleiste: Konto */
.sb-spacer { flex: 1; min-height: 12px; }
.sb-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.sb-badge .ic { width: 15px; height: 15px; }
.sb-account { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 12px; text-align: left; width: 100%; }
.sb-account:hover { background: var(--surface-2); }
.sb-acc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sb-acc-text b, .sb-acc-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-acc-text small { color: var(--muted); font-size: 12px; }
.sb-account > .ic { color: var(--muted); }

/* Anmeldung */
body.auth-open #app { visibility: hidden; }
.auth-screen {
  position: fixed; inset: 0; z-index: 600; overflow-y: auto; background: var(--bg);
  display: grid; place-items: center; padding: 24px 16px;
  background-image: radial-gradient(circle, var(--dot) 1.1px, transparent 1.4px); background-size: 24px 24px;
}
.auth-card {
  width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-lg); padding: 28px 26px 22px; display: flex; flex-direction: column; gap: 16px;
}
.auth-brand { display: flex; align-items: center; gap: 14px; }
.auth-brand h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.auth-brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form label { font-size: 14px; font-weight: 600; }
.auth-form p { margin: 2px 0 0; }
.auth-row { display: flex; gap: 8px; }
.auth-row .input { flex: 1; min-width: 0; height: 42px; font-size: 16px; }
.auth-row .btn { height: 42px; flex: none; }
.auth-form > .input { height: 42px; font-size: 16px; }
.auth-form > .btn { justify-content: center; height: 42px; }
.code-input { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.auth-google { justify-content: center; height: 44px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; }
.auth-google .g { width: 20px; height: 20px; }
.auth-msg { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: 14px; }
.auth-err { margin: 0; color: var(--danger); font-size: 14px; }
.auth-join { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.auth-join > .ic { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.auth-join div { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-server { margin: 4px 0 0; text-align: center; }

/* Teilen */
.share-dialog { width: min(520px, 100%); max-height: 88vh; overflow-y: auto; }
.share-sec { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.share-sec h4 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.share-sec p { margin: 0; }
.link-row, .invite-row { display: flex; gap: 8px; }
.link-row .input, .invite-row .input[type="email"] { flex: 1; min-width: 0; }
.sel-sm { width: auto; flex: none; padding: 0 6px; }
.mem-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mem-row { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.mem-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-ctl { display: flex; align-items: center; gap: 4px; flex: none; }
.share-dialog .dialog-btns { margin-top: 18px; }
@media (max-width: 480px) { .invite-row { flex-wrap: wrap; } .invite-row .input[type="email"] { flex-basis: 100%; } }

/* Verlauf */
.hist-head { display: flex; align-items: center; gap: 8px; }
.hist-head strong { flex: 1; font-size: 16px; }
.hist-panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 20; width: 340px; max-width: 100%;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.hist-panel .hist-head { padding: 12px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.hist-scroll { overflow-y: auto; flex: 1; padding: 6px 0 20px; }
.hist-list { list-style: none; margin: 0; padding: 0; }
.hist-row { display: flex; gap: 10px; padding: 9px 14px; }
.hist-row.can-jump { cursor: pointer; }
.hist-row.can-jump:hover { background: var(--surface-2); }
.hist-row .avatar { width: 26px; height: 26px; font-size: 12px; margin-top: 1px; }
.hist-body { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; }
.hist-text { overflow-wrap: anywhere; }
.hist-time { font-size: 12px; color: var(--muted); margin-top: 1px; }
.hist-act { margin-top: 6px; height: 30px; color: var(--sel); border: 1px solid var(--line); }
.hist-empty { padding: 30px 16px; text-align: center; color: var(--muted); }
.hist-more { margin: 8px auto 0; display: flex; }
.hist-dialog { width: min(480px, 100%); max-height: 84vh; display: flex; flex-direction: column; padding: 16px 6px 8px; }
.hist-dialog .hist-head { padding: 0 10px 8px 14px; }
body.on-board.hist-open .zoom-ctl { right: 356px; }
@media (min-width: 900px) {
  body.on-board.hist-open .tb, body.on-board.hist-open .sel-bar, body.on-board.hist-open .board-ro { left: calc(50% - 170px); }
}

/* ======================================================================
   Brett: frei schreiben wie auf Papier, Post-its zum Anfassen
   ====================================================================== */
.cv-card { box-sizing: border-box; }
.cv-text {
  position: absolute; padding: 6px 8px 8px; border-radius: 6px; box-shadow: none;
  border: 1px solid transparent; color: var(--text); font-size: 16px; line-height: 1.45;
  min-width: 60px; cursor: text;
}
.cv[data-tool="select"] .cv-text { cursor: text; }
.cv-text:hover { border-color: color-mix(in srgb, var(--text) 14%, transparent); }
.cv-text.is-editing, .cv-text.is-sel { border-color: var(--sel); background: color-mix(in srgb, var(--board-bg) 70%, transparent); }
/* Beim Ziehen (Größe oder Lage) immer ein deutlicher Rahmen */
.cv-text.is-active { border: 1.5px dashed var(--sel); background: color-mix(in srgb, var(--sel) 6%, var(--board-bg)); }
.cv-note.is-active { box-shadow: 0 0 0 2px var(--sel), 0 14px 28px -10px rgba(40, 30, 0, .45); transform: none; }
.cv-card.is-active .cv-grip, .cv-card.is-active .cv-rs { opacity: 1; }
.cv-edit {
  white-space: pre-wrap; overflow-wrap: anywhere; outline: none; min-height: 1.45em; min-width: 1ch;
  cursor: inherit; -webkit-user-select: text; user-select: text;
}
.is-editing .cv-edit { cursor: text; }
.cv-edit:empty::before { content: attr(data-ph); color: var(--muted); opacity: .7; pointer-events: none; }
/* Griffe liegen halb außerhalb – nie abschneiden. Bei fester Höhe scrollt nur der Inhalt. */
.cv-card.cv-text, .cv-card.cv-note { overflow: visible; }
.cv-text.has-h .cv-edit { height: 100%; overflow: auto; }
.cv-note { display: flex; flex-direction: column; }
.cv-note > .cv-edit, .cv-note > .nc-list { flex: 1 1 auto; min-height: 1.45em; }
.cv-note.has-h > .cv-edit, .cv-note.has-h > .nc-list { min-height: 0; overflow: auto; }

/* Griffleiste oben (zum Verschieben) und Kanten (Breite/Höhe festlegen) */
.cv-grip {
  position: absolute; left: -1px; right: -1px; top: -12px; height: 10px; border-radius: 6px 6px 0 0;
  background: color-mix(in srgb, var(--text) 16%, transparent); cursor: move; opacity: 0; transition: opacity .12s;
}
.cv-rs { position: absolute; opacity: 0; transition: opacity .12s; }
.cv-rs-r { top: 4px; bottom: 10px; right: -7px; width: 12px; cursor: ew-resize; }
.cv-rs-b { left: 4px; right: 10px; bottom: -7px; height: 12px; cursor: ns-resize; }
.cv-rs-c { right: -8px; bottom: -8px; width: 16px; height: 16px; cursor: nwse-resize; }
.cv-rs-r::after, .cv-rs-b::after {
  content: ""; position: absolute; background: var(--sel); border-radius: 3px;
}
.cv-rs-r::after { left: 4px; top: 50%; width: 4px; height: 26px; transform: translateY(-50%); }
.cv-rs-b::after { top: 4px; left: 50%; height: 4px; width: 26px; transform: translateX(-50%); }
.cv[data-tool="select"] .cv-card:hover .cv-grip, .cv-card.is-editing .cv-grip, .cv-card.is-sel .cv-grip,
.cv[data-tool="select"] .cv-card:hover .cv-rs, .cv-card.is-editing .cv-rs, .cv-card.is-sel .cv-rs { opacity: 1; }
.has-w > .cv-rs-r::after, .has-h > .cv-rs-b::after { background: var(--accent); }
.cv.is-readonly .cv-grip, .cv.is-readonly .cv-rs { display: none; }
@media (hover: none) {
  .cv-card.is-editing .cv-rs-r, .cv-card.is-sel .cv-rs-r { width: 22px; right: -12px; }
  .cv-card.is-editing .cv-rs-b, .cv-card.is-sel .cv-rs-b { height: 22px; bottom: -12px; }
  .cv-card.is-editing .cv-grip, .cv-card.is-sel .cv-grip { height: 18px; top: -20px; }
}

/* Post-its: leicht schief, Klebestreifen-Schatten, beim Anfassen geraderückend */
.cv-note {
  padding: 16px 14px 14px; border: 0 !important; border-radius: 3px 3px 10px 3px;
  transform: rotate(var(--tilt, 0deg)); transform-origin: 50% 0;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 0 6px 14px -6px rgba(40, 30, 0, .35);
  font-size: 15.5px; line-height: 1.45; cursor: grab;
  background: linear-gradient(180deg, color-mix(in srgb, var(--note-bg) 92%, #fff) 0%, var(--note-bg) 40%);
}
.cv-note::before {
  content: ""; position: absolute; left: 50%; top: -9px; width: 64px; height: 18px; transform: translateX(-50%) rotate(-2deg);
  background: color-mix(in srgb, var(--surface) 55%, transparent); border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  border-radius: 2px; pointer-events: none;
}
.cv-note.is-editing, .cv-note.is-sel, .cv-note:active { transform: none; }
.cv-note.is-editing { cursor: text; box-shadow: 0 0 0 2px var(--sel), 0 10px 24px -8px rgba(40, 30, 0, .4); }
.cv-note.is-sel { outline: none; box-shadow: 0 0 0 2px var(--sel), 0 6px 14px -6px rgba(40, 30, 0, .35); }
.cv-note .cv-grip { top: -14px; }
.cv-note .nc-title { font-weight: 700; margin: 0 0 4px; }
.cv-note[data-color="default"] { --note-bg: var(--surface); }
/* Post-it, das mit dem Text wächst: nie kleiner als ein kleiner Zettel */
.cv-note:not(.has-w):not(.has-ink) { min-width: 150px; }
.cv-note { min-height: 56px; }
/* Gemaltes liegt immer auf seinem Post-it, genau an der gemalten Stelle */
.cv-sk { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 1; }
.cv-note.has-ink::before { opacity: .55; }
.cv-note.is-inktarget { transform: none; outline: 2px dashed var(--sel); outline-offset: 3px; }
/* Ohne Zettel (Zettel-Schalter aus): Text und Gemaltes stehen direkt auf dem Brett */
.cv-note[data-color="none"] { background: transparent; box-shadow: none; padding: 6px 8px; color: var(--text); }
.cv-note[data-color="none"]::before, .cv-note[data-color="none"] .nc-by { display: none; }
.cv-note[data-color="none"]:not(.has-w):not(.has-ink) { min-width: 60px; }
.cv-note[data-color="none"] { min-height: 0; }
.cv-note[data-color="none"]:hover { outline: 1px dashed color-mix(in srgb, var(--text) 25%, transparent); outline-offset: 2px; }
.cv-note[data-color="none"].is-editing { box-shadow: none; outline: 1px dashed var(--sel); outline-offset: 2px; }
.cv-note[data-color="none"].is-sel { box-shadow: none; outline: 2px solid var(--sel); outline-offset: 2px; }
.cv-note[data-color="none"].is-active { box-shadow: none; }

/* Abhakliste direkt auf dem Post-it: Einträge antippen und schreiben, Kästchen antippen zum Abhaken */
.cv[data-tool="list"] { cursor: copy; }
.cv-note > .nc-list { flex: 0 1 auto; min-height: 0; }
.cv-note .nc-list li { align-items: flex-start; }
.cv-note .nc-box { margin-top: 2px; flex: none; }
.cv-note .nc-li { flex: 1 1 auto; min-width: 2ch; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; -webkit-user-select: text; user-select: text; }
.cv-note .nc-li:empty::before { content: "\00a0"; }
.cv-note.is-editing .nc-li:empty::before { content: attr(data-ph); color: var(--muted); opacity: .7; pointer-events: none; }
.cv-note .nc-li[contenteditable="plaintext-only"], .cv-note .nc-li[contenteditable="true"] {
  border-radius: 3px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--sel) 14%, transparent);
}
.nc-add {
  display: flex; align-items: center; gap: 6px; margin: 4px 0 0; padding: 2px 0; font-size: 13.5px;
  color: color-mix(in srgb, var(--text) 55%, transparent); cursor: pointer; width: max-content;
}
.nc-add .ic { width: 15px; height: 15px; }
.nc-add:hover { color: var(--text); }
.cv-note .nc-done { margin-top: 6px; padding-top: 6px; border-top: 1px dashed color-mix(in srgb, var(--text) 18%, transparent); }

/* Bild-Notizen */
.cv-img { display: block; width: calc(100% + 28px); margin: -16px -14px 10px; max-width: none; border-radius: 3px 3px 0 0; pointer-events: none; user-select: none; }
.cv-note[data-color="default"] { background: var(--surface); }
.cv-note .cv-img + .cv-edit:empty { min-height: 0; }
.cv-note .cv-img + .cv-edit:empty::before { font-size: 13px; }

/* Auswahlmodus: Haken an allen Notizen */
.cv.is-selecting .cv-card::after {
  content: ""; position: absolute; left: -11px; top: -11px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-strong); box-shadow: var(--shadow); z-index: 2; pointer-events: none;
}
.cv.is-selecting .cv-card.is-sel::after {
  border-color: var(--sel);
  background: var(--sel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.cv.is-selecting .cv-card { cursor: pointer; }
.cv.is-selecting .cv-grip, .cv.is-selecting .cv-rs { display: none; }
.cv.is-selecting .cv-text { border-color: color-mix(in srgb, var(--text) 18%, transparent); }
.cv-lasso { fill: color-mix(in srgb, var(--sel) 10%, transparent); stroke: var(--sel); stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }

/* Notiz-Stapel */
.cv-card.in-stack:not(.stack-top) { box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.cv-card.in-stack:not(.stack-top) > * { visibility: hidden; }
.cv-card.in-stack:not(.stack-top).is-editing > * { visibility: visible; }
.cv-card.in-stack.cv-text { background: var(--surface); border-color: var(--line); }
.cv-stackcount {
  position: absolute; right: -10px; top: -10px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px;
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 700; display: grid; place-items: center;
  box-shadow: var(--shadow); z-index: 3; pointer-events: none; transform: rotate(calc(var(--tilt, 0deg) * -1));
}
.sel-extra { display: flex; gap: 6px; }
.sel-extra .pill-btn[hidden] { display: none; }

/* Notizen-Leiste am Brett */
.notes-panel .np-sub { padding: 8px 16px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.notes-panel .np-list { overflow-y: auto; flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.np-card { cursor: pointer; padding-left: 34px; }
.np-card:hover { box-shadow: var(--shadow); }
.np-card .nc-pin, .np-card .nc-tools { display: none; }
.np-drag {
  position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 26px; height: 40px; border-radius: 6px;
  display: grid; place-items: center; color: var(--muted); cursor: grab; touch-action: none;
}
.np-drag:hover { background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); }
.np-ghost {
  position: fixed; z-index: 700; width: 200px; padding: 12px 14px; pointer-events: none; transform: translate(-20px, -20px) rotate(-3deg);
  box-shadow: var(--shadow-lg); font-size: 14px;
}
.sel-banner {
  display: flex; align-items: center; gap: 10px; max-width: 700px; margin: 0 auto 22px; padding: 10px 12px 10px 16px;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent-text);
}
.sel-banner span { flex: 1; }
.sel-banner .btn { background: var(--surface); color: var(--text); }

/* ======================================================================
   Bretter-Übersicht (Startseite)
   ====================================================================== */
#view-boards { background: var(--bg); }
.ov-wrap { max-width: 1400px; margin: 0 auto; padding: 28px 28px 80px; }
.ov-head { margin: 4px 4px 22px; }
.ov-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.ov-head p { margin: 4px 0 0; color: var(--muted); }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.ov-tile {
  display: flex; flex-direction: column; text-decoration: none; color: inherit; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; min-height: 230px;
}
.ov-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ov-prev {
  position: relative; height: 170px; background-color: var(--board-bg);
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.3px); background-size: 14px 14px;
  border-bottom: 1px solid var(--line); overflow: hidden;
}
.ov-svg { display: block; width: 100%; height: 100%; }
.ov-svg .mini-text { font: 16px system-ui, sans-serif; fill: var(--text); }
.ov-svg .mini-note { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .18)); }
.ov-svg .mini-note-text { font: 15px system-ui, sans-serif; fill: #2a261f; }
.ov-svg .mini-img { fill: var(--line-strong); }
.ov-wait { position: absolute; inset: 22px; border-radius: 10px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.ov-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; text-align: center; padding: 0 20px; }
.ov-empty .ic { width: 26px; height: 26px; opacity: .6; }
.ov-meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.ov-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ov-name { font-weight: 650; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.ov-sub { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-sub .ic { width: 15px; height: 15px; flex: none; }
.ov-new { flex: none; font-size: 12px; font-weight: 700; color: #2a1d00; background: var(--accent); padding: 2px 8px; border-radius: 10px; }
.ov-av { display: inline-flex; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.avatar.sm.more { background: var(--surface-2); color: var(--muted); }
.ov-add { align-items: center; justify-content: center; gap: 12px; border-style: dashed; border-width: 2px; background: transparent; box-shadow: none; color: var(--muted); }
.ov-add:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.ov-add .ov-name { flex: none; }
.ov-plus { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #2a1d00; }
.ov-plus .ic { width: 28px; height: 28px; stroke-width: 2.2; }
.ov-stack { display: block; }
.ov-paper {
  position: absolute; left: calc(26px + var(--i) * 34px); top: calc(20px + var(--i) * 14px); width: 150px; height: 110px;
  padding: 10px 12px; font-size: 12px; line-height: 1.35; color: #2a261f; overflow: hidden;
  background: var(--note-bg); border-radius: 4px; box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .3);
  transform: rotate(calc((var(--i) - 1) * 4deg));
}
.ov-paper[data-color="default"] { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.ov-paper b { display: block; margin-bottom: 2px; }
@media (max-width: 600px) {
  .ov-wrap { padding: 18px 12px 80px; }
  .ov-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .ov-tile { min-height: 170px; }
  .ov-prev { height: 120px; }
  .ov-head h1 { font-size: 22px; }
}

/* Neu seit dem letzten Besuch */
.cv-card.is-new { box-shadow: 0 0 0 3px var(--accent), var(--shadow); }
.ink.is-new, image.is-new { filter: drop-shadow(0 0 4px var(--accent)) drop-shadow(0 0 2px var(--accent)); }
.hist-row.hist-new { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.hist-row.hist-new .hist-time::after { content: " · neu"; color: var(--accent-text); font-weight: 650; }

/* Brett: Autor, Nur-Ansehen */
.nc-by { margin-top: 10px; font-size: 11.5px; color: var(--muted); opacity: .85; }
.sel-info { align-self: center; font-size: 12.5px; color: var(--muted); padding: 0 6px 0 8px; white-space: nowrap; }
.sel-info:empty { display: none; }
.board-ro {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 10;
  padding: 8px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 13px; color: var(--muted);
}
.cv.is-readonly .cv-card { cursor: pointer; }
.editor.is-ro .ed-text, .editor.is-ro .ed-title { cursor: default; }

@media (max-width: 899px) {
  .hist-panel { width: 100%; border-left: 0; }
  body.on-board.hist-open .zoom-ctl { right: 10px; }
  .board-head .head-btn { padding: 0 8px; }
  .sync-state span { display: none; }
}
