/* ===== Notizwerk ===== */
:root {
  --blk-gap: 12px; --blk-gap-lg: 22px; --h1-top: 2.4em; --h2-top: 1.9em; --h3-top: 1.4em; --h-bottom: 10px; --line: 1.6;
  --bg: #ffffff; --bg-2: #f7f7f5; --bg-3: #f1f1ef; --sb-bg: #f7f7f5;
  --text: #37352f; --text-2: rgba(55,53,47,.65); --text-3: rgba(55,53,47,.45);
  --border: rgba(55,53,47,.09); --border-2: rgba(55,53,47,.16);
  --hover: rgba(55,53,47,.06); --hover-2: rgba(55,53,47,.1); --active: rgba(55,53,47,.08);
  --accent: #2383e2; --accent-bg: rgba(35,131,226,.14); --danger: #e03e3e; --sel: rgba(35,131,226,.18);
  --shadow: 0 0 0 1px rgba(15,15,15,.05), 0 3px 6px rgba(15,15,15,.1), 0 9px 24px rgba(15,15,15,.2);
  --pop-bg: #ffffff; --input-bg: rgba(242,241,238,.6);
  --sb-w: 260px; --ind-w: 26px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --serif: "Iowan Old Style", "Apple Garamond", Baskerville, "Times New Roman", "Droid Serif", Times, serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --c-gray: #787774; --c-brown: #9f6b53; --c-orange: #d9730d; --c-yellow: #cb912f; --c-green: #448361; --c-blue: #337ea9; --c-purple: #9065b0; --c-pink: #c14c8a; --c-red: #d44c47;
  --b-default: rgba(227,226,224,.5); --b-gray: #f1f1ef; --b-brown: #f4eeee; --b-orange: #fbecdd; --b-yellow: #fbf3db; --b-green: #edf3ec; --b-blue: #e7f3f8; --b-purple: #f6f3f9; --b-pink: #faf1f5; --b-red: #fdebec;
  --t-default: rgba(227,226,224,.8); --t-gray: #e3e2e0; --t-brown: #eee0da; --t-orange: #fadec9; --t-yellow: #fdecc8; --t-green: #dbeddb; --t-blue: #d3e5ef; --t-purple: #e8deee; --t-pink: #f5e0e9; --t-red: #ffe2dd;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #191919; --bg-2: #202020; --bg-3: #252525; --sb-bg: #202020;
  --text: rgba(255,255,255,.86); --text-2: rgba(255,255,255,.55); --text-3: rgba(255,255,255,.35);
  --border: rgba(255,255,255,.08); --border-2: rgba(255,255,255,.14);
  --hover: rgba(255,255,255,.055); --hover-2: rgba(255,255,255,.09); --active: rgba(255,255,255,.07);
  --accent: #529cca; --accent-bg: rgba(82,156,202,.2); --sel: rgba(82,156,202,.25);
  --shadow: 0 0 0 1px rgba(255,255,255,.08), 0 3px 6px rgba(0,0,0,.3), 0 9px 24px rgba(0,0,0,.45);
  --pop-bg: #252525; --input-bg: rgba(255,255,255,.055);
  --c-gray: #9b9b9b; --c-brown: #ba856f; --c-orange: #c77d48; --c-yellow: #ca9849; --c-green: #529e72; --c-blue: #5e87c9; --c-purple: #9d68d3; --c-pink: #d15796; --c-red: #df5452;
  --b-default: rgba(255,255,255,.06); --b-gray: #2f2f2f; --b-brown: #4a3228; --b-orange: #5c3b23; --b-yellow: #564328; --b-green: #243d30; --b-blue: #143a4e; --b-purple: #3c2d49; --b-pink: #4e2c3c; --b-red: #522e2a;
  --t-default: #373737; --t-gray: #5a5a5a; --t-brown: #603b2c; --t-orange: #854c1d; --t-yellow: #89632a; --t-green: #2b593f; --t-blue: #28456c; --t-purple: #492f64; --t-pink: #69314c; --t-red: #6e3630;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #191919; --bg-2: #202020; --bg-3: #252525; --sb-bg: #202020;
  --text: rgba(255,255,255,.86); --text-2: rgba(255,255,255,.55); --text-3: rgba(255,255,255,.35);
  --border: rgba(255,255,255,.08); --border-2: rgba(255,255,255,.14);
  --hover: rgba(255,255,255,.055); --hover-2: rgba(255,255,255,.09); --active: rgba(255,255,255,.07);
  --accent: #529cca; --accent-bg: rgba(82,156,202,.2); --sel: rgba(82,156,202,.25);
  --shadow: 0 0 0 1px rgba(255,255,255,.08), 0 3px 6px rgba(0,0,0,.3), 0 9px 24px rgba(0,0,0,.45);
  --pop-bg: #252525; --input-bg: rgba(255,255,255,.055);
  --c-gray: #9b9b9b; --c-brown: #ba856f; --c-orange: #c77d48; --c-yellow: #ca9849; --c-green: #529e72; --c-blue: #5e87c9; --c-purple: #9d68d3; --c-pink: #d15796; --c-red: #df5452;
  --b-default: rgba(255,255,255,.06); --b-gray: #2f2f2f; --b-brown: #4a3228; --b-orange: #5c3b23; --b-yellow: #564328; --b-green: #243d30; --b-blue: #143a4e; --b-purple: #3c2d49; --b-pink: #4e2c3c; --b-red: #522e2a;
  --t-default: #373737; --t-gray: #5a5a5a; --t-brown: #603b2c; --t-orange: #854c1d; --t-yellow: #89632a; --t-green: #2b593f; --t-blue: #28456c; --t-purple: #492f64; --t-pink: #69314c; --t-red: #6e3630;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--sel); }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.muted { color: var(--text-2); } .small { font-size: 12px; } .center { text-align: center; } .mono { font-family: var(--mono); }
.grow { flex: 1; } .row { display: flex; align-items: center; } .col { display: flex; flex-direction: column; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; }
.pad { padding: 14px; } .pad-s { padding: 6px; } .wide { width: 100%; justify-content: center; } .left { justify-content: flex-start; }
.label { font-size: 12px; color: var(--text-2); margin: 4px 0; font-weight: 500; }
.error-text, .danger-text { color: var(--danger) !important; }
kbd { font-family: var(--mono); font-size: 11.5px; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }

/* ===== Buttons & Inputs ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--bg); white-space: nowrap; transition: background .12s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { height: 26px; padding: 0 9px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 500; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.glass { background: rgba(255,255,255,.85); color: #37352f; border: 0; }
.btn-ghost { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 8px; border-radius: 5px; color: var(--text-2); white-space: nowrap; }
.btn-ghost:hover { background: var(--hover-2); color: var(--text); }
.btn-ghost.small { height: 26px; font-size: 13px; }
.btn-ghost.on { color: var(--accent); }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 5px; color: var(--text-2); flex: none; }
.btn-icon:hover { background: var(--hover-2); color: var(--text); }
.btn-icon.small { width: 22px; height: 22px; }
.btn-icon.small .ic { width: 14px; height: 14px; }
.btn-icon:disabled { opacity: .3; }
.btn-icon.fav-on { color: #e9a23b; } .btn-icon.fav-on .ic { fill: #e9a23b; }
.input { width: 100%; height: 30px; padding: 4px 9px; border-radius: 5px; border: 1px solid var(--border-2); background: var(--input-bg); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
textarea.input { height: auto; resize: vertical; line-height: 1.5; }
select.input { padding: 2px 6px; }
.input.small { height: 28px; font-size: 13px; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.check-label { cursor: pointer; font-size: 13px; }

/* ===== Layout ===== */
#app { display: flex; height: 100vh; }
#sidebar { width: var(--sb-w); flex: none; background: var(--sb-bg); display: flex; flex-direction: column; overflow: hidden; transition: margin-left .2s ease; user-select: none; }
#resizer { width: 5px; margin-left: -3px; cursor: col-resize; flex: none; z-index: 5; position: relative; }
#resizer:hover, body.resizing #resizer { box-shadow: inset 2px 0 0 var(--border-2); }
body.resizing { cursor: col-resize; user-select: none; }
body.sb-collapsed #sidebar { margin-left: calc(-1 * var(--sb-w)); }
body.sb-collapsed #resizer { display: none; }
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar { height: 45px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 12px; }
#content { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; }

/* ===== Sidebar ===== */
.sb-top { display: flex; align-items: center; padding: 8px 8px 4px 8px; gap: 4px; }
.sb-ws { flex: 1; display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; min-width: 0; font-weight: 600; text-align: left; }
.sb-ws:hover { background: var(--hover-2); }
.sb-ws-icon { width: 22px; height: 22px; border-radius: 5px; background: var(--text-3); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.sb-ws-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sb-collapse { opacity: 0; }
#sidebar:hover .sb-collapse { opacity: 1; }
.sb-actions, .sb-bottom { padding: 2px 6px; }
.sb-bottom { border-top: 1px solid var(--border); padding: 6px; }
.sb-action { display: flex; align-items: center; gap: 9px; width: 100%; padding: 4px 8px; border-radius: 5px; color: var(--text-2); font-weight: 500; text-align: left; min-height: 28px; }
.sb-action:hover { background: var(--hover-2); }
.sb-hint { margin-left: auto; font-size: 11px; color: var(--text-3); font-weight: 400; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 4px 6px 12px; }
.sb-section { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.sb-sec-add { opacity: 0; }
.sb-section:hover .sb-sec-add { opacity: 1; }
.sb-item { display: flex; align-items: center; gap: 4px; min-height: 28px; padding-right: 4px; border-radius: 5px; color: var(--text-2); cursor: pointer; position: relative; }
.sb-item:hover { background: var(--hover-2); }
.sb-item.active { background: var(--hover-2); color: var(--text); font-weight: 500; }
.sb-item.dragging { opacity: .4; }
.sb-item.drop-in { background: var(--accent-bg); }
.sb-item.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.sb-item.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.sb-tog-wrap, .sb-toggle-space { position: relative; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; flex: none; }
.sb-icon { font-size: 15px; display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; }
.sb-toggle { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; border-radius: 4px; }
.sb-toggle .ic { width: 13px; height: 13px; transition: transform .15s; }
.sb-toggle.open .ic { transform: rotate(90deg); }
.sb-toggle:hover { background: var(--hover-2); }
.sb-item.has-toggle:hover .sb-toggle { display: flex; background: var(--sb-bg); }
.sb-item.has-toggle:hover .sb-toggle:hover { background: var(--hover-2); }
.sb-title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sb-item-actions { display: none; gap: 1px; }
.sb-item:hover .sb-item-actions { display: flex; }
.sb-nokids { padding: 3px 0; }
.sb-empty { padding: 4px 10px; }
.sb-rootdrop { height: 24px; border-radius: 5px; }
.sb-rootdrop.over { box-shadow: inset 0 2px 0 var(--accent); }

/* ===== Topbar ===== */
.crumbs { display: flex; align-items: center; min-width: 0; overflow: hidden; gap: 2px; }
.crumb { display: flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: 4px; text-decoration: none; white-space: nowrap; min-width: 0; }
.crumb:hover { background: var(--hover-2); }
.crumb-title { overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.crumb-sep { color: var(--text-3); }
.save-status { font-size: 12.5px; color: var(--text-3); margin-right: 6px; white-space: nowrap; }
.save-status.error { color: var(--danger); }

/* ===== Seite ===== */
.page { padding-bottom: 30vh; }
.cover { height: 30vh; max-height: 280px; min-height: 140px; position: relative; overflow: hidden; z-index: 1; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.repos img { cursor: ns-resize; }
.cover-actions { position: absolute; right: 16px; bottom: 12px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.cover:hover .cover-actions, .cover-actions:focus-within, .cover.repos .cover-actions { opacity: 1; }
@media (hover: none) { .cover-actions { opacity: 1; } }
.page-inner { max-width: 900px; margin: 0 auto; padding: 0 96px; position: relative; }
.page.full-width .page-inner { max-width: none; }
.page-icon { font-size: 72px; line-height: 1.1; margin-top: 60px; cursor: pointer; width: max-content; border-radius: 6px; padding: 2px; }
.page-icon:hover { background: var(--hover); }
.page.has-cover .page-icon { margin-top: -40px; position: relative; z-index: 2; }
.page-controls { display: flex; gap: 4px; height: 28px; margin-top: 64px; opacity: 0; transition: opacity .15s; }
.page-icon[style*="display: none"] + .page-controls { margin-top: 64px; }
.page-icon:not([style*="display: none"]) + .page-controls { margin-top: 8px; }
.page.has-cover .page-icon[style*="display: none"] + .page-controls { margin-top: 16px; }
.page-inner:hover .page-controls, .page-controls:focus-within { opacity: 1; }
.page-title { font-size: 40px; font-weight: 700; line-height: 1.2; margin: 4px 0 8px; outline: none; word-break: break-word; padding: 3px 2px; }
.page-title:empty::before { content: attr(data-ph); color: var(--text-3); }
.page.font-serif .page-title, .page.font-serif .editor { font-family: var(--serif); }
.page.font-mono .page-title, .page.font-mono .editor { font-family: var(--mono); }
.page.small-text .editor { font-size: 14px; }
.page-props { margin: 4px 0 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.pp-row { display: flex; align-items: flex-start; min-height: 34px; gap: 4px; }
.pp-label { display: flex; align-items: center; gap: 8px; width: 170px; flex: none; padding: 6px 8px; border-radius: 4px; color: var(--text-2); text-align: left; overflow: hidden; }
.pp-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-label:hover { background: var(--hover-2); }
.pp-value { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 4px; cursor: pointer; min-height: 32px; }
.pp-value:hover, .pp-value.editing { background: var(--hover); }
.pp-value.ro { cursor: default; }
.pp-add { margin-top: 4px; }
.page-tail { min-height: 120px; cursor: text; }
.backlinks { margin-top: 28px; }
.backlinks summary { cursor: pointer; }
.backlink { display: block; padding: 3px 8px; border-radius: 4px; text-decoration: none; }
.backlink:hover { background: var(--hover); }
.trash-banner { background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px; font-weight: 500; }
.trash-banner .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.empty-state { max-width: 460px; margin: 18vh auto; text-align: center; padding: 20px; }

/* ===== Editor ===== */
.editor { font-size: 16px; line-height: var(--line); position: relative; padding-bottom: 8px; }
.blk { position: relative; padding-left: calc(var(--ind) * var(--ind-w)); margin: var(--blk-gap) 0; }
.blk.hidden { display: none; }
.blk.selected > .blk-main { background: var(--sel); border-radius: 4px; }
.blk.dragging { opacity: .35; }
.blk.uploading { opacity: .5; }
.blk-ctl { position: absolute; top: 2px; left: calc(var(--ind) * var(--ind-w) - 50px); display: flex; opacity: 0; transition: opacity .1s; }
.blk:hover > .blk-ctl { opacity: 1; }
.blk-btn { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--text-3); }
.blk-btn:hover { background: var(--hover-2); color: var(--text-2); }
.blk-drag { cursor: grab; width: 20px; }
.blk[data-type="h1"] > .blk-ctl { top: 12px; } .blk[data-type="h2"] > .blk-ctl { top: 8px; } .blk[data-type="h3"] > .blk-ctl { top: 5px; }
.blk-main { display: flex; align-items: flex-start; min-height: 28px; border-radius: 4px; }
.bt { flex: 1; min-width: 0; outline: none; padding: 3px 2px; white-space: pre-wrap; word-break: break-word; caret-color: var(--text); }
.bt:empty::before { content: attr(data-ph); color: var(--text-3); pointer-events: none; }
.blk[data-type="paragraph"] .bt:empty::before { content: none; }
.blk[data-type="paragraph"] .bt:empty:focus::before, .editor.empty-doc .blk[data-type="paragraph"] .bt:empty::before { content: attr(data-ph); }
.editor.readonly .bt:empty::before { content: none !important; }
.blk[data-type="h1"] { margin-top: var(--h1-top); margin-bottom: var(--h-bottom); } .blk[data-type="h2"] { margin-top: var(--h2-top); margin-bottom: var(--h-bottom); } .blk[data-type="h3"] { margin-top: var(--h3-top); margin-bottom: var(--h-bottom); }
/* Farbige Blöcke: etwas Innenabstand, damit Anfang und Ende klar erkennbar sind */
.blk-main[class*="bg-"] { padding: 2px 6px; }
/* Größere Elemente (Datenbanken, Bilder, Zugangsdaten, Erinnerungen …) bekommen mehr Luft */
.blk[data-type="database"], .blk[data-type="image"], .blk[data-type="video"], .blk[data-type="embed"], .blk[data-type="bookmark"], .blk[data-type="code"], .blk[data-type="table"], .blk[data-type="callout"], .blk[data-type="secret"], .blk[data-type="reminders"], .blk[data-type="divider"] { margin: var(--blk-gap-lg) 0; }
.blk[data-type="h1"] .bt { font-size: 1.875em; font-weight: 700; line-height: 1.3; }
.blk[data-type="h2"] .bt { font-size: 1.5em; font-weight: 650; line-height: 1.3; }
.blk[data-type="h3"] .bt { font-size: 1.25em; font-weight: 600; line-height: 1.3; }
.editor > .blk:first-child, .col > .blk:first-child, .col > .col-group:first-child { margin-top: 2px; }
.col > .blk:last-child, .col > .col-group:last-child { margin-bottom: 2px; }
.marker { flex: none; width: 24px; min-height: 30px; display: flex; align-items: center; justify-content: center; margin-right: 2px; user-select: none; }
.bullet-mark::before { content: "•"; font-size: 1.5em; line-height: 1; }
.blk[data-indent="1"] .bullet-mark::before, .blk[data-indent="4"] .bullet-mark::before { content: "◦"; }
.blk[data-indent="2"] .bullet-mark::before, .blk[data-indent="5"] .bullet-mark::before { content: "▪"; font-size: 1em; }
.num-mark { justify-content: flex-end; padding-right: 4px; width: 26px; font-variant-numeric: tabular-nums; }
.todo-box { cursor: pointer; }
.todo-box .ic { width: 16px; height: 16px; border: 1.5px solid var(--text-2); border-radius: 3px; stroke: transparent; stroke-width: 3; padding: 1px; }
.todo-box:hover .ic { background: var(--hover-2); }
.todo-box.checked .ic { background: var(--accent); border-color: var(--accent); stroke: #fff; }
.blk.done .bt { text-decoration: line-through; color: var(--text-3); }
.toggle-arrow { cursor: pointer; border-radius: 4px; }
.toggle-arrow:hover { background: var(--hover-2); }
.toggle-arrow .ic { width: 12px; height: 12px; fill: currentColor; stroke: none; transition: transform .15s; }
.toggle-arrow.open .ic { transform: rotate(90deg); }
.toggle-empty { margin-left: calc(var(--ind-w) + 26px); color: var(--text-3); font-size: 14px; padding: 3px 4px; cursor: pointer; border-radius: 4px; }
.toggle-empty:hover { background: var(--hover); }
.blk[data-type="quote"] .bt { border-left: 3px solid currentColor; padding-left: 14px; font-size: 1.1em; margin: 2px 0; }
.blk[data-type="callout"] .blk-main { padding: 14px 14px 14px 10px; border-radius: 5px; }
.blk[data-type="callout"] .blk-main.bg-gray, .blk[data-type="callout"] .blk-main:not([class*="bg-"]) { background: var(--b-gray); }
.callout-icon { font-size: 20px; cursor: pointer; width: 30px; min-height: 28px; border-radius: 4px; }
.callout-icon:hover { background: var(--hover-2); }
.divider { border: 0; border-top: 1px solid var(--border-2); margin: 12px 0; width: 100%; }
.blk[data-type="divider"] .blk-main { min-height: 26px; align-items: center; }
.code-blk { width: 100%; background: var(--bg-3); border-radius: 5px; margin: 4px 0; position: relative; }
.code-head { position: absolute; left: 8px; right: 8px; top: 4px; display: flex; justify-content: space-between; opacity: 0; transition: opacity .15s; z-index: 1; }
.code-blk:hover .code-head, .code-blk:focus-within .code-head { opacity: 1; }
.code-lang { background: transparent; border: 0; color: var(--text-2); font-size: 12px; cursor: pointer; outline: none; }
.code-ta { width: 100%; display: block; border: 0; resize: none; background: transparent; font-family: var(--mono); font-size: 13.5px; line-height: 1.55; padding: 30px 18px 18px; outline: none; white-space: pre; overflow-x: auto; tab-size: 2; color: var(--text); }
.code-blk.wrap .code-ta { white-space: pre-wrap; }
.bt code, td code { font-family: var(--mono); font-size: .86em; background: var(--b-default); color: #eb5757; padding: .15em .35em; border-radius: 4px; }
.bt a, td a { color: inherit; text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 2px; cursor: pointer; }
a.mention { text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--text-3); padding: 0 1px; border-radius: 3px; cursor: pointer; }
a.mention:hover { background: var(--hover-2); }
a.mention.broken { color: var(--text-3); text-decoration: line-through; }
.editor-tail { height: 24px; cursor: text; }
.drop-indicator { position: absolute; height: 3px; background: var(--accent); opacity: .6; border-radius: 2px; pointer-events: none; z-index: 3; }
.drop-indicator.vertical { width: 4px !important; }

/* Spalten */
.col-group { display: flex; align-items: stretch; margin: var(--blk-gap) 0; position: relative; }
.col { min-width: 0; padding: 0 2px; position: relative; display: flow-root; cursor: text; }
.col > .blk { cursor: auto; }
.col-resize { flex: 0 0 34px; position: relative; cursor: col-resize; align-self: stretch; }
.col-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; border-radius: 2px; background: transparent; transition: background .12s; }
.col-resize:hover::after, .col-group.resizing > .col-resize::after { background: var(--border-2); }
.editor.readonly .col-resize { cursor: default; pointer-events: none; }
.col-group.resizing, .col-group.resizing * { user-select: none; cursor: col-resize !important; }
.col .blk-ctl { left: calc(var(--ind) * var(--ind-w) - 46px); }
.col .db-inline-holder { overflow-x: auto; }
.col .img-blk { max-width: 100%; }

/* Schaltfläche */
.nw-button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; margin: 2px 0; border-radius: 6px; border: 1px solid var(--border-2); background: var(--bg); color: var(--text); font: inherit; font-size: 14.5px; font-weight: 500; cursor: pointer; box-shadow: 0 1px 2px rgba(15,15,15,.05); transition: background .1s; }
.nw-button:hover { background: var(--hover); }
.nw-button:active { background: var(--hover-2); }
.nwb-icon { font-size: 15px; line-height: 1; }
.media-ph { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border-radius: 5px; background: var(--bg-3); color: var(--text-2); cursor: pointer; margin: 4px 0; }
.media-ph:hover { background: var(--hover-2); }
.img-blk { margin: 6px 0; position: relative; max-width: 100%; width: fit-content; }
.img-blk.align-center { margin-left: auto; margin-right: auto; } .img-blk.align-right { margin-left: auto; }
.blk[data-type="image"] .blk-main { display: block; }
.img-blk img { max-width: 100%; display: block; border-radius: 4px; width: auto; min-width: 24px; }
.img-blk[style*="width"] img { width: 100%; }
.img-resize { position: absolute; right: -6px; top: 50%; width: 8px; height: 48px; margin-top: -24px; border-radius: 4px; background: rgba(15,15,15,.55); border: 1px solid rgba(255,255,255,.8); cursor: ew-resize; opacity: 0; }
.img-blk:hover .img-resize { opacity: 1; }
.bt-cap { font-size: 14px; color: var(--text-2); padding: 6px 2px 0; outline: none; }
.bt-cap:empty::before { content: attr(data-ph); color: var(--text-3); }
.bt-cap:empty:not(:focus) { display: none; }
.img-blk:hover .bt-cap:empty { display: block; }
.file-blk { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: 4px; text-decoration: none; }
.file-blk:hover { background: var(--hover); }
.file-name { font-weight: 500; }
.bookmark { display: flex; align-items: stretch; width: 100%; border: 1px solid var(--border-2); border-radius: 5px; text-decoration: none; margin: 4px 0; overflow: hidden; }
.bookmark:hover { background: var(--hover); }
.bm-text { flex: 1; padding: 12px 14px; min-width: 0; }
.bm-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-url { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.bm-fav { width: 32px; height: 32px; align-self: center; margin-right: 14px; }
.embed-blk { width: 100%; margin: 4px 0; }
.embed-frame { width: 100%; border: 1px solid var(--border); border-radius: 5px; background: var(--bg-3); display: block; }
.embed-link { display: block; margin-top: 4px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-link { display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 4px; border-radius: 4px; text-decoration: none; font-weight: 500; }
.page-link:hover { background: var(--hover); }
.pl-icon { width: 22px; display: flex; justify-content: center; font-size: 1.05em; }
.pl-title { border-bottom: 1px solid var(--border-2); }
.page-link.broken { color: var(--text-3); }
.pl-arrow { color: var(--text-3); }
.toc { width: 100%; padding: 4px 0; }
.toc-item { display: block; padding: 3px 6px; border-radius: 4px; color: var(--text-2); text-decoration: underline; text-decoration-color: var(--border-2); font-size: 14px; }
.toc-item:hover { background: var(--hover); }
.toc-h2 { padding-left: 24px; } .toc-h3 { padding-left: 46px; }
.tbl-wrap { position: relative; width: 100%; padding: 4px 22px 22px 0; }
.tbl-scroll { overflow-x: auto; }
.simple-table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.simple-table td { border: 1px solid var(--border-2); padding: 6px 9px; min-width: 110px; vertical-align: top; outline: none; white-space: pre-wrap; }
.simple-table td:focus { box-shadow: inset 0 0 0 2px var(--accent-bg); }
.simple-table.has-header tr:first-child td { background: var(--bg-2); font-weight: 600; }
.simple-table.has-colheader td:first-child { background: var(--bg-2); font-weight: 600; }
.tbl-add { position: absolute; display: none; align-items: center; justify-content: center; background: var(--bg-3); border-radius: 4px; color: var(--text-2); }
.tbl-add:hover { background: var(--hover-2); }
.tbl-wrap:hover .tbl-add { display: flex; }
.tbl-add-col { right: 0; top: 4px; bottom: 22px; width: 18px; }
.tbl-add-row { left: 0; right: 22px; bottom: 0; height: 18px; }
.db-inline-holder { width: 100%; }
.blk[data-type="database"] .blk-main, .blk[data-type="table"] .blk-main { display: block; }

/* Farben */
.c-gray { color: var(--c-gray); } .c-brown { color: var(--c-brown); } .c-orange { color: var(--c-orange); } .c-yellow { color: var(--c-yellow); } .c-green { color: var(--c-green); } .c-blue { color: var(--c-blue); } .c-purple { color: var(--c-purple); } .c-pink { color: var(--c-pink); } .c-red { color: var(--c-red); }
.bg-gray { background: var(--b-gray); } .bg-brown { background: var(--b-brown); } .bg-orange { background: var(--b-orange); } .bg-yellow { background: var(--b-yellow); } .bg-green { background: var(--b-green); } .bg-blue { background: var(--b-blue); } .bg-purple { background: var(--b-purple); } .bg-pink { background: var(--b-pink); } .bg-red { background: var(--b-red); }
span[class^="bg-"] { border-radius: 3px; padding: 0 2px; }
.color-chip { width: 22px; height: 22px; border: 1px solid var(--border-2); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; }
.color-chip.c-default { color: var(--text); }
.color-sq { width: 16px; height: 16px; border-radius: 3px; flex: none; }
.tagc-default { background: var(--t-default); } .tagc-gray { background: var(--t-gray); } .tagc-brown { background: var(--t-brown); } .tagc-orange { background: var(--t-orange); } .tagc-yellow { background: var(--t-yellow); } .tagc-green { background: var(--t-green); } .tagc-blue { background: var(--t-blue); } .tagc-purple { background: var(--t-purple); } .tagc-pink { background: var(--t-pink); } .tagc-red { background: var(--t-red); }

/* ===== Formatleiste ===== */
.format-toolbar { position: fixed; z-index: 120; display: flex; align-items: center; background: var(--pop-bg); box-shadow: var(--shadow); border-radius: 6px; padding: 3px; gap: 1px; }
.tb-btn { height: 28px; min-width: 28px; padding: 0 7px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.tb-btn:hover { background: var(--hover-2); }
.tb-turn { font-size: 13px; color: var(--text-2); }
.tb-sep { width: 1px; height: 20px; background: var(--border-2); margin: 0 3px; }
.tb-color { text-decoration: underline; text-decoration-thickness: 2px; font-weight: 600; }

/* ===== Popover / Menü ===== */
#layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
#layer > * { pointer-events: auto; }
.popover { position: fixed; background: var(--pop-bg); box-shadow: var(--shadow); border-radius: 7px; max-height: min(70vh, 560px); overflow: auto; z-index: 110; min-width: 180px; }
.popover.cell-pop { border-radius: 4px; max-height: none; overflow: visible; min-width: 0; }
.cell-input { width: 100%; border: 0; outline: none; background: var(--pop-bg); padding: 7px 9px; border-radius: 4px; resize: none; line-height: 1.5; display: block; font-size: 14px; }
.menu { padding: 5px; display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 9px; min-height: 30px; padding: 3px 8px; border-radius: 5px; cursor: pointer; user-select: none; }
.menu-item.active, .menu-item:hover { background: var(--hover-2); }
.menu-item.disabled { opacity: .4; cursor: default; }
.menu-item.danger:hover, .menu-item.danger.active { color: var(--danger); }
.menu-item.faded { color: var(--text-3); }
.menu-item .ic { color: var(--text-2); }
.mi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-hint { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.mi-check { color: var(--accent) !important; }
.mi-emoji { width: 16px; text-align: center; flex: none; }
.mi-space { width: 16px; flex: none; }
.menu-header { font-size: 11.5px; color: var(--text-3); font-weight: 600; padding: 8px 8px 3px; }
.menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.menu-empty { padding: 8px 10px; color: var(--text-3); font-size: 13px; }
.menu-foot { padding: 6px 8px 4px; line-height: 1.6; }
.suggest-item { min-height: 44px; }
.sg-icon { width: 40px; height: 40px; flex: none; border: 1px solid var(--border-2); border-radius: 5px; display: flex; align-items: center; justify-content: center; background: var(--bg); font-size: 20px; }
.sg-icon .ic { width: 20px; height: 20px; }
.sg-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sg-desc { font-size: 12px; color: var(--text-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.font-row { display: flex; gap: 4px; padding: 6px; }
.font-opt { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px; border-radius: 5px; color: var(--text-2); }
.font-opt:hover { background: var(--hover-2); }
.font-opt.on { color: var(--accent); }
.font-ag { font-size: 22px; } .font-serif .font-ag { font-family: var(--serif); } .font-mono .font-ag { font-family: var(--mono); }
.emoji-picker { display: flex; flex-direction: column; max-height: 420px; }
.emoji-scroll { overflow-y: auto; padding: 0 6px 8px; }
.emoji-grid { display: grid; grid-template-columns: repeat(10, 1fr); }
.emoji-btn { font-size: 22px; height: 34px; border-radius: 5px; }
.emoji-btn:hover { background: var(--hover-2); }
.cover-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cover-opt { height: 44px; border-radius: 5px; }
.cover-opt:hover { outline: 2px solid var(--accent); }
.link-pop { gap: 4px; }
.link-pop-url { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--accent); padding: 0 6px; }

/* ===== Modal ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,15,15,.45); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 100; animation: fade .12s; }
.modal-backdrop.side { background: rgba(15,15,15,.25); padding: 0; justify-content: flex-end; align-items: stretch; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg); border-radius: 10px; box-shadow: var(--shadow); max-height: 80vh; overflow: auto; width: 520px; max-width: calc(100vw - 32px); }
.modal.small { width: 400px; } .modal.medium { width: 600px; } .modal.large { width: 900px; max-height: 86vh; }
.modal-backdrop.side .modal { border-radius: 0; max-height: none; height: 100%; width: min(940px, 92vw); animation: slide .18s ease; }
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }
.dialog { padding: 22px 24px; }
.dialog h3 { margin: 0 0 10px; font-size: 17px; } .dialog h2 { margin: 6px 0 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.onboarding .onb-logo img { width: 56px; height: 56px; }
.formula-dialog textarea { margin-bottom: 6px; }
.formula-preview { font-size: 13px; margin-bottom: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.chip { padding: 2px 8px; border-radius: 4px; background: var(--bg-3); font-size: 12.5px; }
.chip:hover { background: var(--hover-2); }

/* Peek */
.peek { display: flex; flex-direction: column; height: 100%; }
.peek-head { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 2; }
.peek-body { flex: 1; overflow-y: auto; }
.page.in-peek .page-inner { padding: 0 60px; max-width: none; }
.page.in-peek .page-icon { margin-top: 30px; font-size: 52px; }
.page.in-peek .page-controls { margin-top: 30px; }
.page.in-peek .page-title { font-size: 32px; }
.page.in-peek { padding-bottom: 120px; }

/* Suche */
.search-modal { width: 680px; overflow: hidden; display: flex; flex-direction: column; }
.search-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.search-bar .ic { width: 18px; height: 18px; color: var(--text-3); }
.search-input { flex: 1; border: 0; outline: none; background: none; font-size: 17px; }
.search-results { overflow-y: auto; max-height: 60vh; padding: 6px; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.search-item.active { background: var(--hover-2); }
.si-icon { width: 24px; text-align: center; font-size: 18px; flex: none; display: flex; justify-content: center; }
.si-text { flex: 1; min-width: 0; cursor: pointer; }
.si-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-snippet, .si-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
mark { background: var(--b-yellow); color: inherit; border-radius: 2px; }
.search-foot { border-top: 1px solid var(--border); padding: 8px 16px; }
.trash-list { margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.trash-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 5px; }
.trash-item:hover { background: var(--hover); }

/* Einstellungen */
.settings { padding: 20px 28px 28px; }
.settings h3 { margin: 0; font-size: 18px; }
.set-sec { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.set-sec h4 { margin: 0 0 10px; font-size: 14px; }
.set-row { display: flex; gap: 20px; align-items: flex-start; margin: 10px 0; }
.set-label { width: 220px; flex: none; font-size: 14px; }
.set-ctl { flex: 1; min-width: 0; }
code.path { display: block; padding: 7px 10px; background: var(--bg-3); border-radius: 5px; font-size: 12.5px; word-break: break-all; }
.backup-list { margin: 8px 0; }
.backup-item { display: flex; align-items: center; gap: 10px; padding: 3px 0; font-size: 13px; }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.sc-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sc-row kbd { min-width: 110px; text-align: center; }

/* Versionsverlauf */
.hist { display: flex; flex-direction: column; height: 80vh; }
.hist-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.hist-head h3 { margin: 0; }
.hist-main { flex: 1; display: flex; min-height: 0; }
.hist-list { width: 230px; border-right: 1px solid var(--border); overflow-y: auto; padding: 6px; flex: none; }
.hist-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; padding: 7px 10px; border-radius: 5px; }
.hist-item:hover { background: var(--hover); } .hist-item.active { background: var(--accent-bg); }
.hist-preview { flex: 1; overflow-y: auto; padding: 16px 48px; }

/* Toasts */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; }
.toast { background: #2f2f2f; color: #fff; padding: 9px 14px; border-radius: 7px; box-shadow: var(--shadow); font-size: 13.5px; display: flex; gap: 14px; align-items: center; transition: opacity .3s, transform .3s; animation: toastIn .2s; }
.toast.error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-action { color: #8ac2ff; font-weight: 600; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ===== Datenbank ===== */
.db { width: 100%; margin: 4px 0; font-size: 14px; }
.db.inline { margin: 10px 0; }
.db-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.db-icon { font-size: 22px; }
.db-title { font-size: 20px; font-weight: 700; outline: none; padding: 2px 2px; min-width: 40px; }
.db-title:empty::before { content: attr(data-ph); color: var(--text-3); }
.db-head .btn-icon { opacity: 0; } .db-head:hover .btn-icon { opacity: 1; }
.db-toolbar { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); min-height: 40px; flex-wrap: wrap; }
.db-tabs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.db-tab { display: flex; align-items: center; gap: 6px; padding: 0 8px; height: 30px; border-radius: 5px; color: var(--text-2); white-space: nowrap; position: relative; font-size: 14px; }
.db-tab:hover { background: var(--hover-2); }
.db-tab.active { color: var(--text); font-weight: 500; }
.db-tab.active::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -6px; height: 2px; background: var(--text); border-radius: 1px; }
.db-addview { opacity: .7; }
.db-actions { display: flex; align-items: center; gap: 2px; }
.db-search { width: 0; padding: 0; border: 0; outline: none; background: none; transition: width .15s; font-size: 13.5px; }
.db-search.open { width: 150px; padding: 3px 6px; }
.db-new { margin-left: 4px; }
.db-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 0 2px; }
.fchip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); font-size: 12.5px; }
.fchip .ic { width: 13px; height: 13px; }
.chip-sep { width: 1px; height: 18px; background: var(--border-2); }
.db-body { padding-top: 2px; }
.db-empty { padding: 30px 10px; text-align: center; color: var(--text-2); }
/* Tabelle */
.dbt-scroll { overflow-x: auto; padding-left: 32px; margin-left: -32px; padding-bottom: 4px; }
.dbt { display: inline-flex; flex-direction: column; min-width: 100%; }
.dbt-row { display: flex; border-bottom: 1px solid var(--border); position: relative; min-height: 34px; }
.dbt-row:not(.dbt-head):not(.dbt-foot):not(.dbt-newrow):hover { background: var(--hover); }
.dbt-head { color: var(--text-2); border-top: 1px solid var(--border); }
.dbt-cell { flex: none; border-right: 1px solid var(--border); padding: 6px 8px; overflow: hidden; position: relative; cursor: default; min-height: 33px; }
.dbt-row .dbt-cell:last-child { border-right: 0; }
.dbt-row:not(.dbt-head) .dbt-cell:not(.ro):not(.dbt-calc) { cursor: pointer; }
.dbt-cell.editing { box-shadow: inset 0 0 0 2px var(--accent-bg); }
.dbt-cell.num { text-align: right; }
.dbt-cell.num .val { justify-content: flex-end; }
.dbt-hcell { display: flex; align-items: center; gap: 6px; font-size: 13.5px; user-select: none; cursor: pointer !important; }
.dbt-hcell:hover { background: var(--hover); }
.hname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbt-add { width: 40px; justify-content: center; border-right: 0; }
.dbt-fill { flex: 1; border-right: 0; min-width: 40px; }
.col-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 2; }
.col-resize:hover { background: var(--accent); opacity: .5; }
.dbt-cell .val { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 21px; }
.dbt-cell .val-text, .dbt-cell .val-title { flex-wrap: nowrap; overflow: hidden; }
.dbt-cell .val-text { white-space: nowrap; text-overflow: ellipsis; display: block; }
.title-text { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbt-cell[data-prop="title"] { padding-right: 78px; }
.open-btn { position: absolute; right: 6px; top: 6px; display: none; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--text-2); background: var(--bg); border: 1px solid var(--border-2); border-radius: 4px; padding: 1px 6px; height: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.open-btn .ic { width: 13px; height: 13px; }
.dbt-row:hover .open-btn { display: flex; }
.open-btn:hover { background: var(--hover-2); color: var(--text); }
.row-ctl { position: fixed; display: none; }
.dbt-row:hover .row-ctl { display: flex; position: absolute; left: -30px; top: 5px; }
.dbt-cell[data-prop="title"] { overflow: visible; }
.dbt-row.dragging { opacity: .4; }
.dbt-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.dbt-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.dbt-newrow { color: var(--text-3); cursor: pointer; }
.dbt-newrow:hover { background: var(--hover); }
.dbt-newrow .dbt-cell { border: 0; display: flex; align-items: center; gap: 6px; width: 300px; }
.dbt-foot { border-bottom: 0; }
.dbt-calc { border-right-color: transparent; font-size: 12px; color: var(--text-3); text-align: right; cursor: pointer !important; }
.dbt-calc:hover { background: var(--hover); }
.calc-ph { opacity: 0; } .dbt-foot:hover .calc-ph { opacity: 1; }
.dbt-calc[style] .calc-ph:only-child:not(:empty) { }
.dbt-foot .dbt-calc:first-child .calc-ph { opacity: 1; float: left; }
.calc-val { color: var(--text); font-weight: 500; }
/* Werte */
.val { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 3px; font-size: 13px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; color: var(--text); line-height: 20px; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .55; flex: none; }
.pill-x { margin-left: 2px; opacity: .55; font-size: 14px; }
.pill-x:hover { opacity: 1; }
.cbx { width: 16px; height: 16px; border: 1.5px solid var(--text-2); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; }
.cbx .ic { width: 12px; height: 12px; stroke: transparent; stroke-width: 3.5; }
.cbx.on { background: var(--accent); border-color: var(--accent); }
.cbx.on .ic { stroke: #fff; }
.val-link { color: inherit; text-decoration: underline; text-decoration-color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-chip { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; border-bottom: 1px solid var(--border-2); font-weight: 500; white-space: nowrap; }
.rel-chip:hover { background: var(--hover-2); }
.file-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; text-decoration: none; background: var(--bg-3); border-radius: 3px; padding: 0 6px; }
.file-thumb { height: 22px; width: 30px; object-fit: cover; border-radius: 3px; }
.row-icon { margin-right: 4px; }
.bar { width: 70px; height: 5px; border-radius: 3px; background: var(--hover-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-num { font-size: 12px; color: var(--text-2); margin-left: 6px; }
.err { color: var(--danger); font-size: 12px; }
.overdue { color: var(--c-red); }
/* Optionseditor */
.opt-editor { width: 100%; }
.opt-top { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 8px; background: var(--input-bg); border-bottom: 1px solid var(--border); min-height: 34px; }
.opt-chips { display: contents; }
.opt-search { flex: 1; min-width: 80px; border: 0; outline: none; background: none; font-size: 14px; }
.opt-list { padding: 4px; max-height: 300px; overflow: auto; }
.opt-row .drag-dots { color: var(--text-3); display: flex; }
.opt-row .btn-icon { opacity: 0; } .opt-row:hover .btn-icon { opacity: 1; }
.filter-editor .filter-row select, .filter-editor .filter-row input { width: auto; flex: 1; min-width: 0; }
.filter-lead { width: 64px; flex: none !important; font-size: 13px; color: var(--text-2); }
.props-panel .menu-item .btn-icon { opacity: .7; }
/* Board */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 10px 0 14px; align-items: flex-start; }
.board-col { width: 264px; flex: none; border-radius: 6px; padding: 4px; }
.board-col.drop { background: var(--hover); }
.board-head { display: flex; align-items: center; gap: 6px; padding: 4px 4px 8px; }
.board-head .btn-icon { opacity: 0; } .board-col:hover .board-head .btn-icon { opacity: 1; }
.board-cards { display: flex; flex-direction: column; gap: 6px; min-height: 8px; }
.card { background: var(--bg); border-radius: 6px; box-shadow: 0 0 0 1px var(--border-2), 0 2px 4px rgba(15,15,15,.06); padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; overflow: hidden; }
:root[data-theme="dark"] .card { background: var(--bg-3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card { background: var(--bg-3); } }
.card:hover { background: var(--bg-2); }
.card.dragging { opacity: .4; }
.card-title { font-weight: 500; word-break: break-word; }
.card-prop .val { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12.5px; color: var(--text-2); align-items: center; }
.card-ph { height: 40px; border-radius: 6px; background: var(--accent-bg); }
.board-new, .board-addgroup { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 8px; border-radius: 5px; color: var(--text-3); margin-top: 4px; }
.board-new:hover, .board-addgroup:hover { background: var(--hover-2); }
.board-addgroup { width: 200px; flex: none; margin-top: 4px; }
/* Liste */
.dblist { display: flex; flex-direction: column; padding-top: 4px; }
.dblist-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 3px; min-height: 36px; }
.dblist-row:hover { background: var(--hover); }
.dblist-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dblist-props { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.dblist-props .val { display: flex; gap: 4px; align-items: center; }
.dblist-new { color: var(--text-3); border-bottom: 0; }
/* Galerie */
.gallery { display: grid; gap: 14px; padding: 12px 0; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gallery.size-s { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.gallery.size-l { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.gallery .card { padding: 0 0 10px; }
.gallery .card > *:not(.card-preview) { margin: 0 10px; }
.card-preview { height: 150px; background: var(--bg-2); border-bottom: 1px solid var(--border); overflow: hidden; margin: 0 !important; }
.size-s .card-preview { height: 110px; } .size-l .card-preview { height: 200px; }
.card-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-preview.text { padding: 12px 14px; font-size: 10.5px; color: var(--text-2); line-height: 1.5; }
.card-new { align-items: center; justify-content: center; flex-direction: row; color: var(--text-3); min-height: 120px; box-shadow: inset 0 0 0 1px var(--border-2); background: transparent !important; }
/* Kalender */
.cal-nav { display: flex; align-items: center; gap: 6px; padding: 10px 0; }
.cal-label { font-weight: 600; font-size: 15px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-dow { font-size: 12px; color: var(--text-2); padding: 4px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: right; }
.cal-cell { min-height: 110px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell.weekend { background: var(--bg-2); }
.cal-cell.other .cal-num { color: var(--text-3); }
.cal-cell.drop { background: var(--accent-bg); }
.cal-day { display: flex; align-items: center; justify-content: flex-end; gap: 2px; height: 24px; }
.cal-num { font-size: 13px; padding: 0 5px; border-radius: 12px; min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cal-cell.today .cal-num { background: var(--c-red); color: #fff; }
.cal-add { opacity: 0; order: -1; margin-right: auto; }
.cal-cell:hover .cal-add { opacity: 1; }
.cal-item { font-size: 12.5px; padding: 3px 6px; border-radius: 4px; background: var(--bg); box-shadow: 0 0 0 1px var(--border-2), 0 1px 2px rgba(15,15,15,.06); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cal-item:hover { background: var(--bg-2); }
.cal-item.has-props, .cal-grid.week .cal-item { white-space: normal; }
.cal-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-grid.week .cal-item-title { white-space: normal; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.cal-grid.week .cal-dow { display: none; }
.cal-prop { font-size: 11.5px; font-weight: 400; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.cal-grid.week .cal-cell { min-height: 170px; }
.cal-grid.week .cal-item { font-size: 13.5px; padding: 6px 8px; }
.cal-wd { font-size: 12px; color: var(--text-2); margin-right: 5px; }
.cal-grid.week .cal-day { justify-content: flex-start; }
.cal-grid.week .cal-add { order: 3; margin-left: auto; margin-right: 0; }
.cal-range { margin-right: 4px; }
.quick-pick .qp-head { font-size: 13px; padding: 2px 4px; }
.quick-pick .qp-list { max-height: min(320px, 45vh); overflow: auto; padding: 0; box-shadow: none; border: 0; background: none; }
.quick-pick .qp-foot { display: flex; gap: 4px; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 6px; }
@media (hover: none) { .cal-add { opacity: .55; } }
.cal-undated { margin-top: 10px; }
.cal-undated summary { cursor: pointer; color: var(--text-2); font-size: 13px; }

/* ===== Druck ===== */
@media print {
  body { overflow: visible; }
  #sidebar, #resizer, #topbar, .page-controls, .blk-ctl, .db-toolbar .db-actions, .cover-actions, .open-btn, .row-ctl, .tbl-add, .backlinks, #layer, #toasts, .page-tail, .editor-tail, .toggle-empty { display: none !important; }
  #app, #main, #content { display: block; height: auto; overflow: visible; }
  .page-inner { padding: 0 !important; max-width: none; }
  .page { padding-bottom: 0; }
  .blk.hidden { display: block; }
}

/* ===== Klein ===== */
@media (max-width: 900px) {
  .page-inner { padding: 0 40px; }
  .page.in-peek .page-inner { padding: 0 24px; }
}
@media (max-width: 640px) {
  .page-inner { padding: 0 18px; }
  #sidebar { position: fixed; z-index: 50; height: 100%; box-shadow: var(--shadow); }
  .set-row { flex-direction: column; gap: 6px; } .set-label { width: auto; }
  .shortcuts { grid-template-columns: 1fr; }
}

/* Spalten auf schmalen Bildschirmen (iPhone) untereinander */
@media (max-width: 720px) {
  .col-group { flex-direction: column; }
  .col { flex: 1 1 auto !important; padding: 0; }
  .col-resize { display: none; }
}
@media print { .col-resize { display: none; } }

/* Passwort-Tresor */
.secret-blk { width: 100%; border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 12px 10px; background: var(--bg-2); }
.sec-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.sec-ic { font-size: 16px; }
.sec-title { font-weight: 600; font-size: 15px; }
.sec-locked { padding: 2px 0 2px 26px; }
.sec-body { padding-top: 4px; }
.sec-lines { display: flex; flex-direction: column; }
.sec-row { display: flex; align-items: center; gap: 8px; min-height: 30px; border-radius: 4px; padding: 0 2px; }
.sec-row:hover { background: var(--hover); }
.sec-key { flex: 0 0 34%; max-width: 220px; color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-val, .sec-text { flex: 1; min-width: 0; font-size: 14.5px; overflow-wrap: anywhere; }
.sec-val.masked { font-family: var(--mono); letter-spacing: 1px; }
.sec-val a, .sec-text a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-2); }
.sec-sp { width: 24px; flex: 0 0 24px; }
.sec-copy { opacity: .55; } .sec-row:hover .sec-copy { opacity: 1; }
.sec-gap { height: 8px; }
.sec-title-in { margin: 4px 0 6px; font-weight: 600; }
.sec-ta { width: 100%; font-family: var(--mono); font-size: 13.5px; line-height: 1.5; resize: vertical; margin-bottom: 8px; }
.vault-dialog input.input { width: 100%; margin: 4px 0; }
.vault-err { color: var(--danger); min-height: 18px; margin-top: 4px; }
.vault-ack { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; line-height: 1.4; }
.mig-dialog .mig-list { max-height: 46vh; overflow: auto; margin: 10px 0; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; }
.mig-page { padding: 8px 0; border-bottom: 1px solid var(--border); }
.mig-page:last-child { border-bottom: 0; }
.mig-title { font-weight: 600; margin-bottom: 4px; }
.mig-group { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0 4px 6px; cursor: pointer; }
.mig-gt { font-size: 14px; }
.mig-lines { overflow-wrap: anywhere; }
.mig-opts { margin: 6px 0; }

/* Vorlagen, Jahreswechsel */
.db-new-split { display: inline-flex; }
.db-new-split .db-new { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.db-new-split .db-new-more { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 4px; margin-left: 1px; }
.db-new-split .db-new-more svg { width: 14px; height: 14px; }
.template-banner { display: flex; align-items: center; gap: 8px; background: var(--b-blue); color: var(--text); padding: 8px 16px; font-size: 14px; }
.carry-dialog .co-row { display: flex; gap: 14px; padding: 8px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.carry-dialog .co-label { flex: 0 0 170px; color: var(--text-2); font-size: 14px; padding-top: 6px; }
.carry-dialog .co-row > :last-child { flex: 1; }
.carry-dialog label.row { padding: 2px 0; }

/* Erinnerungen */
.rem-holder { width: 100%; }
.rem-blk { border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 12px 10px; }
.rem-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.rem-ic { font-size: 16px; } .rem-title { font-weight: 600; }
.rem-empty, .rem-ok { padding: 4px 0 2px 26px; }
.rem-ok { color: var(--text-2); font-size: 14px; }
.rem-sec { margin-top: 6px; }
.rem-sec-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 4px 0 2px; }
.rem-count { background: var(--b-red); color: var(--c-red); border-radius: 10px; padding: 0 7px; font-size: 12px; }
.rem-item { display: flex; align-items: baseline; gap: 10px; padding: 3px 6px; border-radius: 4px; cursor: pointer; font-size: 14.5px; }
.rem-item:hover { background: var(--hover); }
.rem-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-when { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.rem-item.late .rem-when { color: var(--c-red); }
.rem-more { padding-left: 6px; }
.rem-dialog .rem-rule { border: 1px solid var(--border-2); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.rem-dialog .rem-icon-in { width: 56px; flex: 0 0 56px; text-align: center; }
.rem-dialog .rem-days { width: 70px; }
.rem-dialog .row > .input { flex: 1; min-width: 0; }
.rem-dialog .row.small > .input, .rem-dialog .rem-days { flex: 0 0 auto; }
.rem-dialog > .row { margin: 8px 0; }
.rem-dialog > .col { margin: 8px 0; }

/* ===== Bild-Icons (statt Emoji) ===== */
.pi-img { width: 1.15em; height: 1.15em; object-fit: cover; border-radius: 3px; display: inline-block; vertical-align: -0.2em; flex: none; }
.pi-img.inline { margin-right: 2px; }
.sb-icon .pi-img { width: 18px; height: 18px; vertical-align: 0; }
.si-icon .pi-img { width: 20px; height: 20px; }
.mi-emoji .pi-img { width: 16px; height: 16px; vertical-align: -3px; }
.sg-icon .pi-img { width: 26px; height: 26px; }
.crumb-icon .pi-img { width: 16px; height: 16px; vertical-align: -3px; }
.page-icon.is-img { padding: 0; line-height: 0; }
.page-icon .pi-img { width: 104px; height: 104px; border-radius: 8px; vertical-align: 0; }
.page.in-peek .page-icon .pi-img { width: 76px; height: 76px; }
.page.has-cover .page-icon.is-img { margin-top: -52px; }
.page.has-cover .page-icon .pi-img { box-shadow: 0 0 0 3px var(--bg); }
.emoji-img-row { display: flex; gap: 6px; padding: 0 8px 8px; }
.emoji-img-row .input { flex: 1; min-width: 0; }
@media (max-width: 720px) {
  .page-icon .pi-img { width: 76px; height: 76px; }
}

/* ===== Anmeldung (Web-Version) ===== */
.auth-screen { position: fixed; inset: 0; z-index: 1000; background: var(--bg-2); display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); overflow-y: auto; }
.auth-screen.overlay { background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(6px); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--border-2); border-radius: 14px; padding: 28px 26px 24px; box-shadow: 0 10px 40px rgba(0,0,0,.08); margin: auto; }
.auth-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 18px; }
.auth-logo img { width: 34px; height: 34px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form h2 { font-size: 22px; margin: 0 0 2px; }
.auth-form .input { height: 44px; font-size: 16px; }
.auth-form .btn.wide { height: 44px; font-size: 15px; justify-content: center; width: 100%; margin-top: 4px; }
.auth-error { color: var(--danger); font-size: 14px; min-height: 0; }
.auth-error:empty { display: none; }
.pw-meter { height: 4px; border-radius: 2px; background: var(--bg-3); overflow: hidden; margin-top: -4px; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.pw-meter[data-s="2"] span { background: #d9a400; } .pw-meter[data-s="3"] span, .pw-meter[data-s="4"] span { background: #2e9e5b; }
.sec-check { display: flex; flex-direction: column; gap: 6px; }
.sec-check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.4; }
.sc-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 5px; background: #d9a400; }
.sec-check-row.ok .sc-dot { background: #2e9e5b; } .sec-check-row.bad .sc-dot { background: var(--danger); } .sec-check-row.bad { color: var(--danger); font-weight: 600; }
.sess-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.pill-mini { font-size: 11px; background: var(--accent-bg); color: var(--accent); border-radius: 10px; padding: 1px 7px; }
.gap-s { gap: 4px; }
.qr { width: 200px; height: 200px; margin: 4px auto; background: #fff; border-radius: 8px; padding: 4px; }
.qr svg { width: 100%; height: 100%; display: block; }
.twofa-secret { word-break: break-all; user-select: all; }
.twofa-dialog ol { margin: 0; padding-left: 20px; line-height: 1.6; }
.recovery-codes { font-family: var(--mono); font-size: 15px; line-height: 1.8; background: var(--bg-2); border-radius: 8px; padding: 12px 16px; columns: 2; user-select: all; margin: 0; }

/* ===================== Handy & Tablet ===================== */
#sb-backdrop { display: none; }
.mtb { display: none; }

/* Touch-Geräte (Handy, Tablet): Bedienelemente immer sichtbar, größere Tippflächen */
@media (hover: none) and (pointer: coarse) {
  .page-controls { opacity: 1; }
  .open-btn { display: flex; }
  .blk-ctl { display: none; }
  .input, select.input, textarea.input, .cell-input { font-size: 16px; }      /* verhindert automatisches Zoomen auf dem iPhone */
  .sb-item, .sb-action { min-height: 38px; }
  .menu-item { min-height: 40px; }
  .btn-icon { min-width: 36px; min-height: 36px; }
  .dbt-cell[data-prop="title"] { padding-right: 84px; }
  .sec-copy { opacity: 1; }
  /* Werkzeugleiste über der Tastatur */
  .mtb { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: flex; gap: 2px; align-items: center; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--bg-2); border-top: 1px solid var(--border-2); box-shadow: 0 -2px 12px rgba(0,0,0,.06); overflow-x: auto; scrollbar-width: none; visibility: hidden; }
  .mtb.show { visibility: visible; }
  .mtb-btn { flex: none; min-width: 40px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text); font-size: 17px; }
  .mtb-btn:active { background: var(--hover-2); }
  .mtb-btn .ic { width: 20px; height: 20px; }
  .mtb-txt { font-weight: 600; }
  body.mtb-on #content { padding-bottom: 56px; }
}

/* Handy */
@media (max-width: 760px) {
  html, body { overscroll-behavior: none; }
  #app { height: 100dvh; }
  #resizer { display: none !important; }
  #sidebar { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(86vw, 330px); margin-left: 0 !important; transform: translateX(-104%); transition: transform .24s cubic-bezier(.2,.8,.2,1); box-shadow: none; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  body.sb-open #sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.28); }
  body.sb-open #sb-backdrop { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(15,15,15,.38); animation: fade .15s; }
  #topbar { height: calc(50px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0 4px; gap: 2px; border-bottom: 1px solid var(--border); }
  .crumbs { min-width: 0; overflow: hidden; }
  .crumbs > .crumb:not(:last-child), .crumbs > .crumb-sep, .crumbs > .crumb.muted { display: none; }
  .crumb { max-width: 100%; }
  .crumb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .save-status:not(.error) { display: none; }
  .save-status.error { font-size: 12px; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .page-inner, .page.in-peek .page-inner { padding: 0 16px; }
  .page { padding-bottom: 40vh; }
  .cover { height: 22vh; min-height: 120px; }
  .cover-actions { right: 10px; bottom: 8px; }
  .page-icon { font-size: 54px; margin-top: 28px; }
  .page.has-cover .page-icon { margin-top: -32px; }
  .page-controls { margin-top: 20px; flex-wrap: wrap; height: auto; }
  .page-icon:not([style*="display: none"]) + .page-controls { margin-top: 6px; }
  .page-title { font-size: 30px; }
  .editor { font-size: 16px; }
  .blk[data-type="h1"] .bt { font-size: 1.6em; } .blk[data-type="h2"] .bt { font-size: 1.35em; }
  .pp-label { width: 38% !important; max-width: 150px; padding: 6px 4px; }

  /* Dialoge als Vollbild */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal, .modal.small, .modal.medium, .modal.large { width: 100vw; max-width: 100vw; max-height: none; height: var(--vvh, 100dvh); border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .modal.small .dialog, .modal .dialog { padding: 18px 16px; }
  .modal-backdrop.side .modal { width: 100vw; }
  .settings { padding: 14px 16px 28px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .btn { flex: 1 1 auto; justify-content: center; min-height: 40px; }
  .search-modal .search { height: 100%; display: flex; flex-direction: column; }
  .popover { max-width: calc(100vw - 16px); }
  .emoji-picker { max-height: 60vh; }
  .emoji-grid { grid-template-columns: repeat(8, 1fr) !important; }

  /* Datenbanken */
  .db-toolbar { gap: 4px; }
  .db-actions { flex-wrap: wrap; }
  .board { scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; width: 78vw !important; flex: none; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; }
  .cal-cell { min-height: 64px; font-size: 11px; }
  .cal-item { font-size: 11px; padding: 2px 4px; }
  .cal-prop { display: none; }
  .cal-nav { flex-wrap: wrap; }
  .cal-label { flex-basis: 100%; }
  /* Wochenansicht am Handy als Liste: ein Tag pro Zeile */
  .cal-grid.week { grid-template-columns: 1fr; }
  .cal-grid.week .cal-dow { display: none; }
  .cal-grid.week .cal-cell { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; font-size: 14px; }
  .cal-grid.week .cal-day { width: 78px; flex: none; height: auto; }
  .cal-grid.week .cal-add { order: 0; margin: 0; }
  .cal-grid.week .cal-item { flex: 1 1 160px; font-size: 14px; padding: 6px 10px; }
  .cal-grid.week .cal-prop { display: block; font-size: 12px; }
  .cal-grid.week .cal-cell:not(:has(.cal-item))::after { content: 'Tippen zum Auswählen'; color: var(--text-3); font-size: 13px; }
  .rem-item { flex-wrap: wrap; row-gap: 0; }
  .rem-when { font-size: 12px; }

  /* Zugangsdaten */
  .sec-key { flex-basis: 38%; font-size: 13px; }
  .auth-card { padding: 22px 18px; border-radius: 12px; }
}

/* Tablet */
@media (min-width: 761px) and (max-width: 1100px) {
  .page-inner { padding: 0 48px; }
  .page.in-peek .page-inner { padding: 0 28px; }
  .modal-backdrop.side .modal { width: min(760px, 96vw); }
}

/* Freier Klickbereich unter jeder Spalte: dort entsteht ein neuer Block */
.col-tail { min-height: 30px; flex: 1; cursor: text; border-radius: 4px; }
.col-tail:hover { background: linear-gradient(var(--hover), var(--hover)) center / 100% 2px no-repeat; }
.editor.readonly .col-tail { display: none; }
@media (max-width: 760px) { .col-tail { min-height: 22px; } }

/* Abstände (Einstellungen → Darstellung) */
:root[data-density="normal"] { --blk-gap: 7px; --blk-gap-lg: 14px; --h1-top: 2em; --h2-top: 1.5em; --h3-top: 1.15em; --h-bottom: 6px; --line: 1.55; }
:root[data-density="compact"] { --blk-gap: 2px; --blk-gap-lg: 8px; --h1-top: 1.4em; --h2-top: 1.1em; --h3-top: .8em; --h-bottom: 3px; --line: 1.5; }

/* Ausgeblendete Seiten-Eigenschaften */
.page-props .pp-hidden { display: none; }
.page-props.show-hidden .pp-hidden { display: flex; opacity: .75; }
.pp-more { margin-top: 2px; color: var(--text-3); }

/* Aufklappbare Überschriften */
.blk[data-type^="h"] .head-arrow { align-self: center; min-height: 0; height: 26px; margin-right: 2px; }
/* Datums-Erwähnungen (@heute, @15.11.) */
.bt a.mention.date { color: var(--text-2); text-decoration: none; background: var(--b-default); border-radius: 4px; padding: 0 4px; cursor: pointer; white-space: nowrap; }
.bt a.mention.date:hover { background: var(--hover-2); }
.bt a.mention.date.past { color: var(--text-3); }
/* Sprung zu einem Block */
.blk.flash > .blk-main { animation: flash 2.2s ease; }
@keyframes flash { 0%, 30% { background: var(--b-yellow); } 100% { background: transparent; } }

/* ===== Gruppen in Tabelle und Liste ===== */
.dbt-group, .dblist-group { display: flex; align-items: center; gap: 8px; padding: 18px 4px 6px; font-weight: 600; font-size: 14px; position: sticky; left: 0; width: max-content; min-width: min(100%, 360px); }
.dbt-group { border-bottom: 1px solid var(--border); }
.grp-tog .ic { transition: transform .15s; }
.collapsed .grp-tog .ic { transform: rotate(-90deg); }
.grp-count { font-weight: 400; }

/* Erste Spalte bleibt beim seitlichen Scrollen stehen */
.dbt-row > .dbt-cell:first-child { position: sticky; left: 0; z-index: 2; background: var(--bg); }
.dbt-row:not(.dbt-head):not(.dbt-foot):not(.dbt-newrow):hover > .dbt-cell:first-child { background: linear-gradient(var(--hover), var(--hover)), var(--bg); }

/* Umschalter */
.seg { display: inline-flex; background: var(--bg-3); border-radius: 7px; padding: 2px; gap: 2px; }
.seg-btn { padding: 3px 10px; border-radius: 5px; font-size: 13px; color: var(--text-2); }
.seg-btn.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ===== Zeitachse ===== */
.tl-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 0; flex-wrap: wrap; }
.tl { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.tl-scroll { overflow-x: auto; position: relative; }
.tl-canvas { position: relative; }
.tl-row { display: flex; height: 38px; border-bottom: 1px solid var(--border); position: relative; z-index: 1; }
.tl-row:last-child { border-bottom: 0; }
.tl-head { height: 46px; background: var(--bg-2); z-index: 3; }
.tl-name { width: 220px; flex: none; position: sticky; left: 0; z-index: 2; background: var(--bg); border-right: 1px solid var(--border); display: flex; align-items: center; gap: 4px; padding: 0 10px; font-size: 14px; cursor: pointer; overflow: hidden; white-space: nowrap; }
.tl-name span { overflow: hidden; text-overflow: ellipsis; }
.tl-name:hover { background: linear-gradient(var(--hover), var(--hover)), var(--bg); }
.tl-corner { background: var(--bg-2); color: var(--text-2); font-size: 13px; cursor: default; }
.tl-track { position: relative; flex: none; }
.tl-track.undated { cursor: copy; }
.tl-track.undated:hover { background: var(--hover); }
.tl-month { position: absolute; top: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; padding-left: 4px; border-left: 1px solid var(--border-2); }
.tl-day { position: absolute; top: 24px; font-size: 11px; color: var(--text-3); padding-left: 3px; }
.tl-day.we { color: var(--text-3); opacity: .7; }
.tl-bg { position: absolute; top: 46px; bottom: 0; left: 220px; pointer-events: none; z-index: 0; }
.tl-we { position: absolute; top: 0; bottom: 0; background: var(--bg-2); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--danger); opacity: .55; }
.tl-bar { position: absolute; top: 6px; height: 26px; border-radius: 6px; background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); font-size: 13px; display: flex; align-items: center; cursor: grab; touch-action: none; user-select: none; overflow: hidden; }
.tl-bar:hover { border-color: var(--accent); }
.tl-bar.dragging { cursor: grabbing; box-shadow: 0 4px 14px rgba(0,0,0,.15); z-index: 5; }
.tl-label { padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; pointer-events: none; }
.tl-h { width: 8px; align-self: stretch; cursor: ew-resize; flex: none; }
.tl-h:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.tl-new .tl-name { color: var(--text-3); border-right: 0; }

/* ===== Diagramm ===== */
.chart-settings { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 10px 0; }
.cs-field { display: flex; flex-direction: column; gap: 2px; }
.cs-field .input { height: 30px; min-width: 150px; }
.cs-check { padding-bottom: 6px; }
.chart-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px 10px; overflow: hidden; }
.chart-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.chart-title { font-weight: 600; }
.chart-svg { display: block; max-width: 100%; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis, .chart-lbl { fill: var(--text-2); font-size: 12px; }
.chart-val { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart-bar, .chart-seg { transition: opacity .15s; }
.chart-bar:hover, .chart-seg:hover { opacity: .8; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.chart-area { fill: var(--accent-bg); }
.chart-pt { fill: var(--bg); stroke: var(--accent); stroke-width: 2.5; }
.chart-total { fill: var(--text); font-size: 22px; font-weight: 700; }
.chart-sub { fill: var(--text-3); font-size: 12px; }
.chart-donut { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.chart-legend { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.cl-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cl-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.cl-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.cl-pct { width: 44px; text-align: right; }
@media (max-width: 760px) {
  .tl-name, .tl-head .tl-corner { width: 130px; }
  .tl-bg { left: 130px; }
  .chart-settings .cs-field { flex: 1 1 140px; }
}

/* Datenbank-Werkzeugleiste auf dem Handy: Ansichten in eigener Zeile */
@media (max-width: 760px) {
  .db-toolbar { flex-wrap: wrap; }
  .db-tabs { flex: 1 1 100%; }
  .db-actions { flex: 1 1 100%; justify-content: flex-end; flex-wrap: wrap; }
}
@media (hover: none) { .sb-sec-add { opacity: 1; } }
