/* ==========================================================================
   Bredex Whiteboard – modernes UI in der BREDEX-Markenwelt
   Petrol (#008971) als Hauptakzent, Indigo (#2b329b) für primäre Aktionen,
   Magenta (#d60648) als Highlight, Verlauf Indigo->Petrol für die Marke.
   ========================================================================== */
:root {
    --topbar-h: 56px;
    --toolbar-w: 52px;

    --accent: #008971;        /* BREDEX-Petrol (Hauptakzent) */
    --accent-dark: #00715d;
    --accent-soft: #e1f1ee;   /* helle Petrol-Tönung */

    --cta: #2b329b;           /* Indigo – primäre Buttons */
    --cta-dark: #222a82;
    --highlight: #d60648;     /* Magenta – Highlights */

    --ink: #2b2f36;
    --muted: #79818f;
    --bg: #f5f6f8;
    --panel: #ffffff;
    --border: #e7e9ee;
    --grid-dot: #d4d8e0;

    --brand-grad: linear-gradient(135deg, #2b329b 0%, #008971 100%);

    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(20, 28, 46, .06), 0 1px 3px rgba(20, 28, 46, .08);
    --shadow-md: 0 6px 18px rgba(20, 28, 46, .12);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ----------------------------------------------------------- Topbar ------ */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 20px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
    z-index: 20;
}
.topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -.02em;
    color: var(--ink);
}
.topbar .brand::before {
    content: "";
    width: 26px; height: 26px;
    background: url("/img/logo-690d8a7e42a02dc556e0425f7dcebeac.svg") center/contain no-repeat;
}
.topbar .board-id { color: var(--muted); font-size: 14px; }
.topbar .board-id strong { color: var(--ink); font-weight: 600; }
.topbar .hint {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .01em;
}
.topbar .back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background .15s;
}
.topbar .back-link:hover { background: var(--accent-soft); }

/* --------------------------------------------------------- Werkzeuge ----- */
/* Linke Spalte: Werkzeugleiste + Aktionsleiste gestapelt */
.left-rail {
    position: fixed;
    top: calc(var(--topbar-h) + 16px);
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 15;
}
.toolbar {
    width: var(--toolbar-w);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
}
.toolbar .tool {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 18px;
    color: var(--ink);
    cursor: pointer;
    transition: background .15s, color .15s, transform .08s;
}
.toolbar .tool svg { width: 18px; height: 18px; display: block; }
.toolbar .tool:hover { background: var(--accent-soft); }
.toolbar .tool:active { transform: scale(.94); }
.toolbar .tool.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 137, 113, .35);
}
.toolbar .color-picker {
    width: 26px;
    height: 26px;
    margin: 6px auto 2px;
    display: block;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    background: none;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: 0 1px 2px rgba(20, 28, 46, .12);
}
/* den farbigen Innenbereich des nativen Color-Inputs randlos & rund füllen */
.toolbar .color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.toolbar .color-picker::-webkit-color-swatch { border: none; border-radius: 50%; }
.toolbar .color-picker::-moz-color-swatch { border: none; border-radius: 50%; }

/* --------------------------------------------------- Schwebende Leisten -- */
.floating-bar {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 7px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    z-index: 18;
}
.action-bar {
    position: static;
    flex-direction: column;
    width: var(--toolbar-w);
    gap: 2px;
    padding: 6px;
}
.action-bar .fmt-btn { width: 100%; }
.text-toolbar { top: 0; left: 0; flex-wrap: nowrap; }
.fmt-sep { width: 1px; align-self: stretch; margin: 2px 3px; background: var(--border); }
.fmt-group { display: inline-flex; gap: 2px; }

/* Reaktionen: Zähler-Chip + Auslöse-Button unten links an der Sticky Note */
.reaction-ui {
    position: fixed; z-index: 18;
    display: inline-flex; align-items: center; gap: 6px;
}
.reaction-count {
    align-items: center;
    padding: 5px 10px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 999px; box-shadow: var(--shadow-md);
    font-size: 13px; line-height: 1; white-space: nowrap;
    color: var(--ink);
}
.reaction-add {
    display: inline-flex; align-items: center; gap: 1px;
    padding: 5px 10px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 999px; box-shadow: var(--shadow-md);
    font-size: 15px; line-height: 1; cursor: pointer;
    transition: background .12s, transform .06s;
}
.reaction-add:hover { background: var(--accent-soft); }
.reaction-add:active { transform: scale(.94); }
.reaction-add .ra-plus { font-size: 12px; font-weight: 700; color: var(--accent-dark); }

/* Emoji-Auswahl (nur sichtbar, wenn über den Button geöffnet) */
.reaction-bar { top: 0; left: 0; gap: 2px; }
.reaction-btn {
    position: relative;
    min-width: 34px; height: 34px;
    border: none; background: transparent; border-radius: 9px;
    font-size: 18px; line-height: 1; cursor: pointer;
    transition: background .12s, transform .06s;
}
.reaction-btn:hover { background: var(--accent-soft); }
.reaction-btn:active { transform: scale(.9); }
.reaction-btn.reacted { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.reaction-btn[data-count]:not([data-count=""])::after {
    content: attr(data-count);
    position: absolute; top: -3px; right: -3px;
    min-width: 15px; height: 15px; padding: 0 3px; box-sizing: border-box;
    background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
    line-height: 15px; border-radius: 999px; text-align: center;
}

/* Zoom-Steuerung (rechts) */
.zoom-control {
    position: fixed; right: 16px; top: calc(var(--topbar-h) + 16px);
    z-index: 16;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 10px 8px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-md);
}
.zoom-btn {
    width: 30px; height: 30px; border: 1px solid var(--border);
    background: var(--panel); color: var(--ink); border-radius: 8px;
    font-size: 18px; line-height: 1; cursor: pointer;
    transition: background .12s;
}
.zoom-btn:hover { background: var(--accent-soft); }
.zoom-btn:active { transform: scale(.92); }
/* „Alles zeigen" (Target) – abgesetzt unter der Prozentanzeige */
.zoom-fit {
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--accent); margin-top: 4px;
}
.zoom-fit svg { width: 18px; height: 18px; display: block; }
.zoom-fit:hover { color: var(--accent-dark); }
.zoom-slider {
    writing-mode: vertical-lr; direction: rtl; /* vertikal, oben = mehr Zoom */
    width: 6px; height: 140px; cursor: pointer; accent-color: var(--accent);
}
.zoom-pct { font-size: 11px; font-weight: 600; color: var(--muted); min-width: 34px; text-align: center; }
.floating-bar .align-btn svg, .floating-bar .valign-btn svg {
    width: 15px; height: 15px; display: block; fill: currentColor;
}
.floating-bar #lock-btn svg { width: 16px; height: 16px; display: block; }

.mind-bar { z-index: 20; padding: 4px; }
.mind-bar .mind-btn {
    height: 30px; padding: 0 12px;
    border: none; background: var(--accent, #2b329b); color: #fff; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: filter .15s;
}
.mind-bar .mind-btn:hover { filter: brightness(1.1); }
.table-bar { gap: 4px; z-index: 20; flex-wrap: wrap; max-width: 96vw; justify-content: center; }
.table-bar .color-swatch { width: 30px; height: 28px; }
.table-bar #tbl-font-size { width: 46px; }
.table-bar .tbl-btn {
    height: 30px; padding: 0 10px;
    border: 1px solid var(--border); background: var(--panel); border-radius: 8px;
    font-size: 13px; color: var(--ink); cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.table-bar .tbl-btn:hover { background: var(--accent-soft); border-color: var(--accent); }

.floating-bar .fmt-btn {
    min-width: 32px; height: 32px;
    border: none; background: transparent; border-radius: 8px;
    font-size: 16px; color: var(--ink); cursor: pointer;
    transition: background .15s, color .15s;
}
.floating-bar .fmt-btn:hover { background: var(--accent-soft); }
.floating-bar .fmt-btn.active { background: var(--accent); color: #fff; }
.floating-bar .fmt-field { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); padding: 0 4px; }
.floating-bar .fmt-field input[type="number"] {
    width: 50px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; color: var(--ink);
}
.floating-bar .fmt-field input[type="number"]:focus { outline: none; border-color: var(--accent); }
.floating-bar .fmt-field input[type="color"] {
    width: 30px; height: 28px; padding: 0; border: 1px solid var(--border);
    border-radius: 8px; background: none; cursor: pointer;
}

/* Eigener Farbwähler (ersetzt <input type=color>): Farbfeld + Popup mit Fläche, Regenbogen,
   Hex und integrierter Pipette. */
.color-swatch {
    width: 30px; height: 28px; padding: 0; border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; background: #ffd966;
}
.cp-popup {
    position: fixed; z-index: 200; display: none; width: 220px; padding: 10px;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow-md); user-select: none;
}
.cp-area { position: relative; width: 100%; height: 130px; border-radius: 8px; cursor: crosshair; touch-action: none; }
.cp-area-cursor {
    position: absolute; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); transform: translate(-50%, -50%); pointer-events: none;
}
.cp-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.cp-eyedrop {
    width: 30px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--ink); cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex: none;
}
.cp-eyedrop:hover { background: var(--accent-soft); }
.cp-eyedrop svg { width: 16px; height: 16px; display: block; }
.cp-preview { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); flex: none; }
.cp-hue {
    position: relative; flex: 1; height: 14px; border-radius: 7px; cursor: pointer; touch-action: none;
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
.cp-hue-cursor {
    position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); transform: translate(-50%, -50%); pointer-events: none;
}
.cp-presets { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 10px; }
.cp-preset {
    width: 100%; height: 18px; padding: 0; border-radius: 5px;
    border: 1px solid rgba(0, 0, 0, .18); cursor: pointer; transition: transform .08s ease;
}
.cp-preset:hover { transform: scale(1.15); }
.cp-hexrow { display: flex; align-items: center; gap: 4px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.cp-hex {
    flex: 1; padding: 5px 6px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; color: var(--ink); text-transform: uppercase;
}
.cp-hex:focus { outline: none; border-color: var(--accent); }
.cp-hidden-eyedrop { display: none !important; }

/* ----------------------------------------------------------- Canvas ------ */
#board-container {
    position: fixed;
    top: var(--topbar-h);
    left: 0; right: 0; bottom: 0;
    touch-action: none; /* Touch-Gesten an Konva geben (nicht an den Browser-Scroll/Zoom) */
    background:
        radial-gradient(circle at 18% 0%, rgba(0, 137, 113, .05), transparent 42%),
        var(--bg);
}

/* Rich-Text-Overlays: liegen über der Konva-Leinwand, werden per Transform mit der
   Stage mitgezoomt/-verschoben (siehe syncRichRoot). pointer-events:none lässt Klicks/
   Ziehen zur Leinwand durch – nur Links sind anklickbar. */
#rich-root {
    position: absolute; left: 0; top: 0; width: 0; height: 0;
    transform-origin: 0 0; pointer-events: none; z-index: 1;
}
.rich-overlay {
    position: absolute; box-sizing: border-box; overflow: hidden;
    display: flex; flex-direction: column;
    pointer-events: none;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
    line-height: 1.2; color: #1b1f26;
}
.rich-overlay .rich-inner {
    width: 100%;
    white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word;
    outline: none;
}
.rich-overlay a { color: #2d6cdf; text-decoration: underline; pointer-events: auto; cursor: pointer; }
/* Beim Bearbeiten Klicks/Karet zulassen und Überlauf sichtbar lassen. */
.rich-overlay.editing { overflow: visible; pointer-events: auto; }
.rich-overlay.editing .rich-inner { pointer-events: auto; }

.marquee {
    position: absolute;
    border: 1.5px solid var(--accent);
    background: rgba(0, 137, 113, .10);
    border-radius: 3px;
    pointer-events: none;
    z-index: 5;
}

/* Overlay-Editor (textarea): horizontal zentriert, vertikal per JS-Padding */
.text-editor {
    position: absolute;
    margin: 0;
    border: none;
    padding: 0 8px;
    background: transparent;
    outline: none;
    overflow: hidden;
    resize: none;
    box-sizing: border-box;
    text-align: center;
    line-height: 1.25;
    font-family: var(--font);
    z-index: 30;
}

/* Rich-Text-Editor (contenteditable): wie .text-editor, aber mit sichtbarem Überlauf-Scroll
   und Umbruch für formatierten Inhalt/Links. */
.rich-editor {
    position: absolute;
    margin: 0;
    border: none;
    padding: 0 8px;
    background: transparent;
    outline: none;
    overflow: auto;
    box-sizing: border-box;
    line-height: 1.2;
    font-family: var(--font);
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
    z-index: 30;
}
.rich-editor a { color: #2d6cdf; text-decoration: underline; }

/* -------------------------------------------------- Radial-Werkzeugmenü -------
   Mittlere Maustaste öffnet einen kreisrunden Werkzeug-Wähler um den Zeiger. */
.radial-overlay { position: fixed; inset: 0; z-index: 150; background: transparent; }
.radial-menu {
    position: absolute; width: 0; height: 0;
    animation: radial-pop .12s ease-out;
}
@keyframes radial-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.radial-center {
    position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--panel); color: var(--muted); border: 1px solid var(--border);
    font-size: 15px; box-shadow: var(--shadow-sm); pointer-events: none;
}
.radial-item {
    position: absolute; transform: translate(-50%, -50%);
    width: 62px; height: 62px; border-radius: 50%; padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: var(--panel); border: 1px solid var(--border); color: var(--ink);
    box-shadow: var(--shadow-md); cursor: pointer; font-family: inherit;
    transition: transform .08s ease, background .08s ease, color .08s ease;
}
.radial-item .ri-ic { font-size: 20px; line-height: 1; }
.radial-item .ri-label { font-size: 9.5px; color: var(--muted); }
.radial-item.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-md); }
.radial-item.hover, .radial-item:hover {
    background: var(--accent); border-color: var(--accent); color: #fff;
    transform: translate(-50%, -50%) scale(1.14); z-index: 1;
}
.radial-item.hover .ri-label, .radial-item:hover .ri-label { color: rgba(255, 255, 255, .92); }

/* -------------------------------------------------- Nutzer / Teilen ------ */
.topbar .user {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
}
.presence { display: inline-flex; align-items: center; cursor: default; }
.presence-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 11px; font-weight: 700;
    border: 2px solid var(--panel); margin-left: -7px;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
    overflow: hidden;
}
.presence-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.presence-avatar:first-child { margin-left: 0; }
.presence-more {
    margin-left: 4px; font-size: 12px; color: var(--muted); font-weight: 600;
}
.topbar .user .logout {
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--ink);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
}
.topbar .user .logout:hover { background: var(--accent-soft); }

.share-add { max-width: 560px; }
/* Autovervollständigung Nutzer */
.ac-wrap { position: relative; flex: 1; }
.ac-wrap input { width: 100%; }
.ac-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px);
    margin: 0; padding: 4px; list-style: none;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow-md);
    z-index: 30; max-height: 260px; overflow: auto;
}
.ac-item {
    display: flex; flex-direction: column; gap: 1px;
    padding: 7px 10px; border-radius: 8px; cursor: pointer;
}
.ac-item:hover { background: var(--accent-soft); }
.ac-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.ac-mail { font-size: 12px; color: var(--muted); }
.share-list { list-style: none; padding: 0; margin: 18px 0 0; max-width: 560px; }
.share-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; background: var(--panel);
    border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
}
.share-row .share-email { flex: 1; font-weight: 600; font-size: 14px; }
.share-row .share-level {
    font-size: 12px; color: var(--accent); background: var(--accent-soft);
    padding: 3px 8px; border-radius: 999px;
}
.share-remove {
    border: none; background: transparent; color: var(--muted);
    cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 6px;
}
.share-remove:hover { background: #fde3ea; color: var(--highlight); }
.share-subhead { font-size: 16px; font-weight: 700; margin: 28px 0 4px; }
.share-row.inherited { background: #f5f6f8; border-style: dashed; }
.share-row.inherited .share-email { color: var(--muted); font-weight: 500; }
.inherited-tag { font-size: 12px; color: var(--muted); }

.card-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
/* Alle drei Aktionen (Link + Buttons) mit identischer Box, damit sie exakt auf einer Linie
   sitzen – gleiche Schrift/Zeilenhöhe und inline-flex zentriert (kein inline-block-Versatz). */
.card-actions a,
.card-actions .rename-card-btn,
.card-actions .delete-board-btn {
    display: inline-flex; align-items: center;
    font-size: 13px; font-weight: 500; line-height: 1;
    font-family: inherit; text-decoration: none; cursor: pointer;
    padding: 0; border: none; background: none;
}
.card-actions a, .card-actions .rename-card-btn { color: var(--accent); }
.card-actions .delete-board-btn { color: #d92020; } /* „Löschen": schlicht, aber rot (destruktiv) */
.delete-board-form { display: none; } /* nur Träger fürs Absenden (Button ist per form-Attribut verknüpft) */
.card-actions a:hover,
.card-actions .rename-card-btn:hover,
.card-actions .delete-board-btn:hover { text-decoration: underline; background: none; }
.folder-share { margin-left: 4px; color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 500; }
.folder-share:hover { text-decoration: underline; }

/* ------------------------------------------------------------- Login ----- */
.auth-page {
    height: 100%;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    position: relative;
    background:
        radial-gradient(900px 500px at 12% -8%, rgba(43, 50, 155, .16), transparent 60%),
        radial-gradient(900px 520px at 108% 112%, rgba(0, 137, 113, .18), transparent 58%),
        var(--bg);
}
.auth-page::before {                 /* dezentes Logo-Wasserzeichen */
    content: "";
    position: absolute; inset: 0;
    background: url("/img/logo-690d8a7e42a02dc556e0425f7dcebeac.svg") no-repeat right -90px bottom -90px;
    background-size: 440px;
    opacity: .05;
    pointer-events: none;
}
.auth-card {
    position: relative; z-index: 1;
    width: 100%; max-width: 400px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    padding: 36px 32px;
    text-align: center;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.auth-brand img { width: 42px; height: 42px; }
.auth-brand span { font-size: 23px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.auth-title { font-size: 22px; font-weight: 800; margin: 24px 0 6px; }
.auth-sub { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 22px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input[type="email"] {
    padding: 13px 15px; border: 1px solid var(--border); border-radius: 11px;
    font-size: 15px; background: #fbfbfd; transition: border-color .15s, box-shadow .15s;
}
.auth-form input[type="email"]:focus {
    outline: none; border-color: var(--cta); background: #fff;
    box-shadow: 0 0 0 3px rgba(43, 50, 155, .12);
}
.auth-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 13px 18px; border: none; border-radius: 11px; cursor: pointer;
    background: var(--cta); color: #fff; font-size: 15px; font-weight: 600;
    text-decoration: none; transition: background .15s, transform .08s;
}
.auth-btn:hover { background: var(--cta-dark); }
.auth-btn:active { transform: scale(.985); }
.auth-btn .ms-logo { background: #fff; border-radius: 3px; padding: 2px; flex: none; }
.auth-msg { font-size: 14px; border-radius: 10px; padding: 9px 12px; margin-bottom: 16px; }
.auth-msg.error { color: var(--highlight); background: #fde3ea; }
.auth-msg.info { color: var(--accent-dark); background: var(--accent-soft); }
.auth-features {
    display: flex; gap: 10px 16px; justify-content: center; flex-wrap: wrap;
    margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
}
.auth-feature { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.auth-feature::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.auth-foot { position: relative; z-index: 1; margin-top: 22px; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------- Fehlerseite --- */
.error-status {
    font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -.03em;
    margin: 20px 0 4px;
    background: var(--brand-grad);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-code-box {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    margin: 20px 0 22px; padding: 14px 16px;
    background: #fbfbfd; border: 1px solid var(--border); border-radius: 12px;
}
.error-code-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.error-code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: .02em;
    user-select: all; /* Ein-Klick-Auswahl zum Kopieren */
}
.error-code-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* Flash-Meldung im Admin-Bereich */
.login-error { color: var(--highlight); font-size: 14px; margin-top: 10px; }
.login-info { color: var(--accent); font-size: 14px; margin-top: 10px; }

/* ------------------------------------------------------ Board-Übersicht -- */
.boards-page { overflow: auto; background: var(--bg); }
.boards-main {
    max-width: 920px;
    margin: 0 auto;
    padding: calc(var(--topbar-h) + 48px) 24px 64px;
}
.boards-main h1 {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -.03em;
    margin: 0 0 6px;
}
.boards-main .subtitle {
    color: var(--muted);
    font-size: 15px;
    margin: 0 0 28px;
}

/* Kopfzeile: Titel links, Erstell-Buttons rechts */
.boards-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}
.boards-header .boards-intro h1 { margin: 0; }
.boards-header .subtitle { margin: 6px 0 0; }
.boards-actions { display: flex; gap: 10px; flex: none; }
.hbtn {
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .08s;
}
.hbtn.primary { background: var(--cta); color: #fff; }
.hbtn.primary:hover { background: var(--cta-dark); }
.hbtn.ghost { background: var(--panel); color: var(--accent-dark); border-color: var(--border); }
.hbtn.ghost:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.hbtn:active { transform: scale(.97); }
.hbtn.active { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent); }

/* Board-Suche (Startseite): filtert die Übersicht live */
.board-search-wrap { margin-bottom: 20px; }
.board-search {
    width: 100%; max-width: 440px;
    padding: 11px 15px;
    border: 1px solid var(--border); border-radius: 12px;
    font-size: 14px; color: var(--ink);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s;
}
.board-search:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 137, 113, .12);
}
.search-empty { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

/* Erstell-Panel (nur sichtbar, wenn ausgeklappt) – kein display im Grundzustand,
   damit das hidden-Attribut greift */
.create-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    padding: 14px;
    margin-bottom: 28px;
}
.new-board, .new-folder { display: flex; gap: 10px; }
.new-board { flex: 1 1 440px; }
.new-board input, .new-folder input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    background: var(--panel);
    transition: border-color .15s, box-shadow .15s;
}
.new-board input:focus, .new-folder input:focus {
    outline: none;
    border-color: var(--cta);
    box-shadow: 0 0 0 3px rgba(43, 50, 155, .12);
}
.folder-select {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    font-size: 14px;
    color: var(--ink);
    cursor: pointer;
}
.new-board button, .new-folder button {
    padding: 12px 22px;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, transform .08s;
}
.new-board button { background: var(--cta); }
.new-board button:hover { background: var(--cta-dark); }
.new-folder button { background: var(--accent); }
.new-folder button:hover { background: var(--accent-dark); }
.new-board button:active, .new-folder button:active { transform: scale(.97); }

/* Ordner-Abschnitte */
.folder-section { margin-bottom: 34px; }
.folder-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.folder-ico {
    width: 22px; height: 17px; border-radius: 4px;
    background: var(--brand-grad);
    position: relative; flex: none;
}
.folder-ico::before {
    content: ""; position: absolute; top: -4px; left: 0;
    width: 10px; height: 5px; border-radius: 3px 3px 0 0;
    background: inherit;
}
.folder-ico.ungrouped { background: #c9ced8; }
.folder-ico.shared { background: linear-gradient(135deg, #d60648, #ff7aa6); }
.folder-ico.public { background: linear-gradient(135deg, #1e88e5, #64b5f6); }
.public-tag { margin-left: 8px; font-size: 11px; font-weight: 600; color: #1565c0; white-space: nowrap; }
.readonly-badge {
    font-size: 12px; color: var(--highlight);
    background: #fde3ea; border-radius: 999px; padding: 3px 10px;
}
.public-badge {
    font-size: 12px; font-weight: 700; color: #fff;
    background: #d92020; border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.folder-head h2 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.folder-count { color: var(--muted); font-size: 13px; }
.delete-folder { margin-left: 8px; }
.delete-folder button {
    border: none; background: transparent; color: var(--muted);
    width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 13px;
    transition: background .15s, color .15s;
}
.delete-folder button:hover { background: #fde3ea; color: var(--highlight); }

/* Board-Karten */
.board-list {
    list-style: none; padding: 0; margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.board-card {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    padding: 16px;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.board-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #d8dbe2;
}
.board-open {
    display: block;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
}
.board-open::before {
    content: "";
    display: block;
    width: 38px; height: 38px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: var(--brand-grad);
    opacity: .9;
}
.board-open::after {
    content: "Board öffnen →";
    display: block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
}
/* Inline-Umbenennen: Eingabefeld ersetzt den Titel direkt auf der Karte */
.rename-inline {
    width: 100%; box-sizing: border-box;
    font-weight: 600; font-size: 16px; color: var(--ink);
    padding: 4px 8px;
    border: 1px solid var(--accent); border-radius: 8px;
    outline: none;
}
.rename-inline:focus { box-shadow: 0 0 0 3px var(--accent-soft); }

.move-form { margin-top: 12px; }
.move-form select {
    width: 100%;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--muted);
    background: #fafbfc;
    cursor: pointer;
}
.move-form select:focus { outline: none; border-color: var(--accent); }

.board-list li.empty {
    grid-column: 1 / -1;
    color: var(--muted);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 22px;
    text-align: center;
    font-size: 14px;
}

/* ---------------------------------------------------------------- Admin -- */
.admin-section { margin-top: 36px; }
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 12px;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 20px 16px;
    text-align: center;
}
.stat-num { display: block; font-size: 32px; font-weight: 800; letter-spacing: -.02em; color: var(--cta); }
.stat-label { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }

.export-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 12px 18px;
    background: var(--cta);
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}
.export-btn:hover { background: var(--cta-dark); }

.link-btn {
    background: none;
    border: 1px solid var(--cta);
    color: var(--cta);
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.link-btn:hover { background: var(--accent-soft); }

/* ------------------------------------------------------ Board-Historie -- */
.topbar-btn {
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--ink);
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap; /* mehrwortige Beschriftungen (z. B. „Alles zeigen") nicht umbrechen */
    cursor: pointer;
    transition: background .15s;
}
.topbar-btn:hover { background: var(--accent-soft); }
.topbar-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* hidden-Attribut muss gegen das display der Klasse gewinnen (höhere Spezifität) */
.history-panel[hidden], .preview-banner[hidden] { display: none; }
.history-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    right: 16px;
    width: 320px;
    max-height: calc(100vh - var(--topbar-h) - 28px);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    z-index: 30;
    overflow: hidden;
}
.history-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.history-head strong { font-size: 15px; }
.icon-btn {
    border: none; background: transparent; color: var(--muted);
    width: 28px; height: 28px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--ink); }
.history-save {
    margin: 12px 16px 4px;
    padding: 9px 12px;
    border: none; border-radius: 9px;
    background: var(--cta); color: #fff;
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.history-save:hover { background: var(--cta-dark); }
.history-save:disabled { opacity: .6; cursor: default; }
.history-hint { margin: 4px 16px 8px; color: var(--muted); font-size: 12px; }
.history-list {
    list-style: none; margin: 0; padding: 4px 10px 12px;
    overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.history-empty { color: var(--muted); font-size: 13px; padding: 12px 6px; }
.history-item {
    display: flex; align-items: stretch; gap: 4px;
    border-radius: 10px;
}
.history-item:hover { background: var(--accent-soft); }
.history-open {
    flex: 1; text-align: left; border: none; background: transparent; cursor: pointer;
    display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border-radius: 10px;
}
.history-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.history-meta { font-size: 12px; color: var(--muted); }
.history-sub { font-size: 11px; color: var(--muted); }
.history-del {
    border: none; background: transparent; color: var(--muted);
    width: 30px; border-radius: 8px; cursor: pointer; font-size: 12px; flex: none;
}
.history-del:hover { background: #fde3ea; color: var(--highlight); }

.preview-banner {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px;
    padding: 8px 10px 8px 14px;
    background: #2b2f36; color: #fff;
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    z-index: 40;
    font-size: 13px;
}
.preview-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: #ffb020; box-shadow: 0 0 0 3px rgba(255,176,32,.25); flex: none;
}
.preview-exit {
    border: none; border-radius: 999px; cursor: pointer;
    background: #fff; color: #2b2f36; font-size: 12px; font-weight: 600; padding: 6px 12px;
}
.preview-exit:hover { background: #e9ebf0; }

/* ---------------------------------------------------- Objekt-Kommentare -- */
.comment-panel[hidden] { display: none; }
.comment-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    right: 16px;
    width: 320px;
    max-height: calc(100vh - var(--topbar-h) - 28px);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    z-index: 31;
    overflow: hidden;
}
.comment-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.comment-head strong { font-size: 15px; }
.comment-threads { overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 12px; }
.comment-empty { color: var(--muted); font-size: 13px; padding: 8px 4px; }
.comment-thread {
    border: 1px solid var(--border); border-radius: 12px; padding: 10px;
    display: flex; flex-direction: column; gap: 8px;
}
.comment-thread.resolved { background: #f5f6f8; opacity: .85; }
.comment { display: flex; flex-direction: column; gap: 2px; }
.comment.reply { margin-left: 14px; padding-left: 8px; border-left: 2px solid var(--border); }
.comment-by { font-size: 12px; color: var(--muted); font-weight: 600; }
.comment-text { font-size: 14px; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.comment-actions { display: flex; gap: 10px; margin-top: 2px; }
.comment-link {
    border: none; background: none; cursor: pointer; padding: 0;
    font-size: 12px; color: var(--accent); font-weight: 600;
}
.comment-link:hover { text-decoration: underline; }
.comment-link.danger { color: var(--muted); }
.comment-link.danger:hover { color: var(--highlight); }
.comment-resolved-tag {
    margin-left: 6px; font-size: 11px; color: #fff; background: #7a8194;
    border-radius: 999px; padding: 1px 7px;
}
.comment-reply { display: flex; gap: 6px; }
.comment-reply input {
    flex: 1; padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.comment-reply button {
    border: 1px solid var(--border); background: var(--panel); border-radius: 8px;
    padding: 0 10px; cursor: pointer; font-size: 14px;
}
.comment-compose {
    border-top: 1px solid var(--border); padding: 10px 12px;
    display: flex; flex-direction: column; gap: 8px;
}
.comment-compose textarea {
    border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px;
    font-size: 14px; font-family: inherit; resize: vertical;
}
.comment-compose button {
    align-self: flex-end; border: none; border-radius: 8px;
    background: var(--cta); color: #fff; font-size: 13px; font-weight: 600;
    padding: 7px 16px; cursor: pointer;
}
.comment-compose button:hover { background: var(--cta-dark); }

/* -------------------------------------------- Aktionsleisten (Voting/Präs.) -- */
.action-banner[hidden] { display: none; }
.action-banner {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 12px;
    padding: 8px 10px 8px 14px;
    background: #2b2f36; color: #fff;
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    z-index: 40; font-size: 13px;
    max-width: 92vw;
}
.action-banner.present { top: calc(var(--topbar-h) + 56px); background: #1f2733; }
.action-banner .ab-dot {
    width: 9px; height: 9px; border-radius: 50%; flex: none;
    background: #d6336c; box-shadow: 0 0 0 3px rgba(214,51,108,.25);
}
.action-banner.present .ab-dot { background: #ffb020; box-shadow: 0 0 0 3px rgba(255,176,32,.25); }
.action-banner .ab-btn {
    border: none; border-radius: 999px; cursor: pointer;
    background: #fff; color: #2b2f36; font-size: 12px; font-weight: 600; padding: 6px 12px;
}
.action-banner .ab-btn:hover { background: #e9ebf0; }
.action-banner .ab-btn.ghost {
    background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4);
}
.action-banner .ab-btn.ghost:hover { background: rgba(255,255,255,.12); }

/* ------------------------------------------------ Support: Board-Suche -- */
.support-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.support-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow-sm); padding: 14px 16px;
}
.support-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.support-head strong { font-size: 15px; }
.support-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; padding: 3px 0; }
.support-key {
    display: inline-block; min-width: 140px; color: var(--muted); font-weight: 600;
}
.support-tag {
    font-size: 11px; color: #fff; background: #7a8194; border-radius: 999px; padding: 1px 8px;
}
.support-card .muted { color: var(--muted); }
.share-chip {
    font-size: 12px; background: var(--accent-soft); color: var(--accent-dark);
    border-radius: 999px; padding: 2px 10px;
}
.share-chip.owner { background: rgba(43,50,155,.10); color: var(--cta); font-weight: 600; }

/* ------------------------------------------------------- Admin: Tabs ------ */
.admin-tabs { display: flex; gap: 6px; margin: 4px 0 26px; border-bottom: 1px solid var(--border); }
.admin-tab {
    padding: 9px 16px; font-size: 14px; font-weight: 600;
    color: var(--muted); text-decoration: none;
    border: 1px solid transparent; border-bottom: none;
    border-radius: 10px 10px 0 0; margin-bottom: -1px;
}
.admin-tab:hover { color: var(--ink); background: var(--accent-soft); }
.admin-tab.active {
    color: var(--ink); background: var(--panel);
    border-color: var(--border); border-bottom: 1px solid var(--panel);
}

/* --------------------------------------- Admin: Ordner-&-Boards-Übersicht -- */
.inventory-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lock-toggle {
    border: 1px solid var(--border); background: var(--panel); color: var(--ink);
    border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.lock-toggle:hover { background: var(--accent-soft); }
.lock-toggle.unlocked { background: #ffe2e0; border-color: #d92020; color: #b71c1c; }
.danger-hint { color: #b71c1c; }
/* Lösch-Buttons erst nach dem Öffnen des Schlosses sichtbar */
.board-delete { display: none; margin: 0; }
.delete-unlocked .board-delete { display: inline-flex; }
.delete-board-btn {
    border: none; background: #d92020; color: #fff;
    font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 8px;
    cursor: pointer; white-space: nowrap; transition: background .15s;
}
.delete-board-btn:hover { background: #b71c1c; }
/* Öffentlichen Zugriff beenden (immer sichtbar – reversibel, mit Bestätigungsdialog) */
.public-end { display: inline-flex; margin: 0; }
.public-end-btn {
    border: 1px solid #90caf9; background: #e3f2fd; color: #1565c0;
    font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
    cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.public-end-btn:hover { background: #ffe2e0; border-color: #d92020; color: #b71c1c; }

.admin-folder-meta { display: inline-flex; align-items: center; gap: 12px; font-size: 13px; }
.admin-board-list {
    list-style: none; margin: 8px 0 0; padding: 0;
    border-top: 1px solid var(--border);
}
.admin-board-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 2px; font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.admin-board-list > li:last-child { border-bottom: none; }
.admin-board-list > li.muted { padding: 8px 2px; font-size: 13px; }
.admin-board-name {
    font-weight: 600; color: var(--ink); text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-board-name:hover { color: var(--accent-dark); text-decoration: underline; }
.admin-board-meta { margin-left: auto; white-space: nowrap; }
.export-link {
    font-size: 12px; font-weight: 600; color: var(--cta); text-decoration: none;
    white-space: nowrap; padding: 2px 8px; border: 1px solid var(--border); border-radius: 8px;
    transition: background .15s;
}
.export-link:hover { background: var(--accent-soft); }

/* ============================================================ Mobil ===== */
@media (max-width: 680px) {
    /* Topbar einzeilig, kompakt und bei Bedarf horizontal scrollbar
       (Höhe bleibt fix, damit die Canvas-Position stimmt) */
    .topbar {
        gap: 8px;
        padding: 0 10px;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .topbar .brand { font-size: 0; gap: 0; flex: none; }   /* nur das Logo-Icon */
    .topbar .board-id { display: none; }                    /* Board-Name steht im Tab-Titel */
    .topbar .back-link { margin: 0; padding: 5px 8px; font-size: 12px; white-space: nowrap; }
    .topbar .user { gap: 6px; margin-left: auto; flex: none; }
    .topbar .user > span:not(.presence) { display: none; }  /* Anzeigename ausblenden */
    .topbar .user .logout,
    .topbar .topbar-btn,
    .topbar .folder-share {
        padding: 5px 9px; font-size: 12px; white-space: nowrap;
    }

    /* Floating-Panels über die volle Breite */
    .history-panel, .comment-panel {
        left: 12px; right: 12px; width: auto;
        max-height: calc(100vh - var(--topbar-h) - 24px);
    }
    .action-banner { left: 12px; right: 12px; transform: none; max-width: none; }
    .action-banner.present { top: calc(var(--topbar-h) + 60px); }

    /* Board-Übersicht: Kopfzeile stapeln, Erstell-Felder umbrechen, eine Spalte */
    .boards-main { padding: calc(var(--topbar-h) + 24px) 16px 48px; }
    .boards-header { flex-direction: column; align-items: stretch; }
    .boards-actions { justify-content: flex-start; }
    .new-board, .new-folder { flex-wrap: wrap; }
    .new-board input, .new-board .folder-select, .new-board button,
    .new-folder input, .new-folder button { flex: 1 1 100%; }
    .board-list { grid-template-columns: 1fr; }

    /* Support-Suche: Schlüssel-Spalte nicht erzwingen */
    .support-key { min-width: 0; width: 100%; }
}

/* ------------------------------------------------- Gefahrenzone (öffentlich) --- */
.danger-zone {
    margin-top: 40px;
    padding: 16px 18px;
    border: 2px solid #ff4d4f;
    border-radius: 12px;
    background: #fff1f0;
}
.danger-zone.danger-active {
    background: #ffe2e0;
    border-color: #d92020;
    box-shadow: 0 0 0 3px rgba(217, 32, 32, 0.15);
}
.danger-title { margin: 0 0 8px; color: #b71c1c; font-size: 15px; font-weight: 800; }
.danger-text { margin: 0 0 12px; color: #7a1113; font-size: 13px; line-height: 1.5; }
.danger-strong { font-weight: 600; }
.danger-label { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; color: #7a1113; font-size: 13px; }
.danger-btn {
    border: none;
    background: #d92020;
    color: #fff;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, transform .05s;
}
.danger-btn:hover { background: #b71c1c; }
.danger-btn:active { transform: scale(.97); }

/* Zugriffszahl-Abzeichen oben rechts auf der Board-Karte (Personen mit Zugriff) */
.board-access {
    position: absolute; top: 14px; right: 14px;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px 3px 7px;
    background: var(--accent-soft); color: var(--accent-dark);
    border-radius: 999px; font-size: 12px; font-weight: 700;
    line-height: 1.4; cursor: default;
}
.board-access::before { content: "👥"; font-size: 12px; font-weight: 400; }

/* Öffentlich-Abzeichen oben rechts auf der Board-Karte (Weltkugel + 👓/✏️) – bewusst in
   einem Warnton, damit man den öffentlichen Zustand sofort sieht. */
.board-public {
    position: absolute; top: 14px; right: 14px;
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 999px;
    font-size: 13px; line-height: 1.4; cursor: default;
    background: #fff3d6; color: #8a5a00;              /* öffentlich · ansehen */
}
.board-public.edit { background: #ffe0e0; color: #b3261e; } /* öffentlich · bearbeiten */

/* Zugriffszahl-Abzeichen im Ordner-Kopf (inline neben der Board-Anzahl) */
.folder-access {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px 2px 7px;
    background: var(--accent-soft); color: var(--accent-dark);
    border-radius: 999px; font-size: 12px; font-weight: 700;
    line-height: 1.4; cursor: default;
}
.folder-access::before { content: "👥"; font-size: 12px; font-weight: 400; }

/* ==========================================================================
   Gestylte Dialoge (bxConfirm/bxAlert) – ersetzen native confirm/alert
   ========================================================================== */
.bx-modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: rgba(20, 28, 46, .45);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    animation: bx-fade .12s ease-out;
}
.bx-modal-overlay[hidden] { display: none; }
@keyframes bx-fade { from { opacity: 0; } to { opacity: 1; } }
.bx-modal {
    width: 100%; max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 22px 22px 18px;
    animation: bx-pop .14s ease-out;
}
@keyframes bx-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.bx-modal-title {
    margin: 0 0 8px; font-size: 17px; font-weight: 700; color: var(--ink);
}
.bx-modal-msg {
    margin: 0 0 20px; font-size: 14px; line-height: 1.5; color: var(--muted);
    white-space: pre-line; /* respektiert \n aus den Meldungstexten */
}
.bx-modal-input {
    width: 100%; box-sizing: border-box; margin: 0 0 20px;
    padding: 10px 12px; font-size: 15px; font-family: inherit; color: var(--ink);
    border: 1px solid var(--border); border-radius: 9px; outline: none;
    transition: border-color .12s, box-shadow .12s;
}
.bx-modal-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bx-modal-input[hidden] { display: none; }
.bx-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.bx-modal-actions button {
    border: none; border-radius: 9px; padding: 9px 18px;
    font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
    transition: background .12s, transform .05s, box-shadow .12s;
}
.bx-modal-actions button:active { transform: scale(.97); }
.bx-modal-cancel {
    background: var(--panel); color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--border);
}
.bx-modal-cancel:hover { background: var(--bg); }
.bx-modal-ok { background: var(--cta); color: #fff; }
.bx-modal-ok:hover { background: var(--cta-dark); }
.bx-modal-ok.danger { background: #d92020; }
.bx-modal-ok.danger:hover { background: #b71c1c; }
