:root {
    --color-bg: #ffffff;
    --color-surface: #fafafa;
    --color-text: #2b2b2b;
    --color-text-muted: #888888;
    --color-border: #e3e3e3;
    --color-accent: #2f6fed;
    --color-accent-soft: #e8efff;
    --color-error: #c0392b;
    --color-hover: #e2e2e2;
    --radius: 6px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

a, button, input, textarea {
    font-family: inherit;
}

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.boot-loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    z-index: 100;
}

.boot-loading[hidden] {
    display: none;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-screen[hidden] {
    display: none;
}

.auth-card {
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 28px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.auth-card h1 {
    margin: 0 0 4px;
    font-size: 20px;
}

.auth-card label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    gap: 4px;
    color: var(--color-text-muted);
}

.auth-card label[hidden] {
    display: none;
}

.auth-card input {
    padding: 9px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.15s;
}

.auth-card input:focus {
    border-color: var(--color-accent);
}

.auth-error {
    color: var(--color-error);
    font-size: 13px;
    min-height: 16px;
    margin: 0;
}

.auth-info {
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
}

.auth-info[hidden] {
    display: none;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.auth-card button[type="submit"] {
    padding: 10px;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: filter 0.15s;
}

.auth-card button[type="submit"]:hover {
    filter: brightness(1.08);
}

.link-btn {
    background: none;
    border: none;
    color: var(--color-accent);
    font-size: 13px;
    padding: 0;
}

.link-btn:hover {
    text-decoration: underline;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-bg);
    z-index: 10;
    flex-wrap: wrap;
}

.brand {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
    flex-wrap: wrap;
}

.main-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}

.main-nav a:hover {
    color: var(--color-text);
    background: var(--color-surface);
}

.main-nav a.active {
    color: var(--color-accent);
    background: var(--color-accent-soft);
    font-weight: 600;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--color-text-muted);
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.workspace-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

.app-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 20px 28px;
    max-width: 900px;
}

.app-main.full-width {
    max-width: none;
}

.empty-hint {
    color: var(--color-text-muted);
    font-size: 14px;
}

.secondary-btn {
    padding: 8px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    transition: background 0.15s, border-color 0.15s;
}

.secondary-btn:hover {
    background: var(--color-hover);
    border-color: var(--color-text-muted);
}

.link-btn.danger {
    color: var(--color-error);
}

/* Workspace-Baum (Sidebar) */

.workspace-sidebar {
    width: 270px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 14px 10px;
    border-right: 1px solid var(--color-border);
}

.tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px 10px;
}

.tree-header-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.tree-level {
    display: flex;
    flex-direction: column;
    min-height: 4px;
}

.tree-node > .tree-level {
    padding-left: 18px;
}

.tree-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 6px;
    border-radius: var(--radius);
    font-size: 13.5px;
    cursor: default;
}

.tree-row:hover {
    background: var(--color-surface);
}

.tree-row.dragging {
    opacity: 0.4;
}

.tree-row.drop-target {
    background: var(--color-accent-soft);
    outline: 1px dashed var(--color-accent);
}

.tree-toggle {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 10px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-toggle-spacer {
    pointer-events: none;
}

.tree-icon {
    flex-shrink: 0;
    font-size: 13px;
    width: 16px;
    text-align: center;
}

.tree-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    color: var(--color-text);
    text-decoration: none;
}

.tree-link.active .tree-title,
.tree-row-folder.active .tree-title {
    color: var(--color-accent);
    font-weight: 600;
}

.tree-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
}

.tree-rename-input {
    flex: 1;
    min-width: 0;
    font-size: 13.5px;
    padding: 1px 3px;
    border: 1px solid var(--color-accent);
    border-radius: 3px;
}

.tree-row-actions {
    flex-shrink: 0;
    display: none;
    align-items: center;
    gap: 2px;
}

.tree-row:hover .tree-row-actions {
    display: flex;
}

.tree-add-btn {
    width: 18px;
    height: 18px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1;
    border-radius: 3px;
    padding: 0;
}

.tree-add-btn:hover {
    background: var(--color-hover);
    color: var(--color-text);
}

/* Freischwebende Popups (Kontextmenues, Add-Menu, Feld-Formular), an body gehaengt - siehe popover.js */

.floating-popover {
    position: fixed;
    z-index: 1000;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.context-menu {
    min-width: 160px;
    padding: 4px;
    display: flex;
    flex-direction: column;
}

.context-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    padding: 7px 10px;
    border: none;
    background: none;
    border-radius: 4px;
    font-size: 13px;
    color: var(--color-text);
}

.context-menu button i {
    width: 14px;
    flex-shrink: 0;
    text-align: center;
    color: var(--color-text-muted);
}

.context-menu button:hover {
    background: var(--color-surface);
}

.context-menu button.danger {
    color: var(--color-error);
}

.context-menu button.danger:hover {
    background: #fbeaea;
}

.context-menu-sep {
    height: 1px;
    background: var(--color-border);
    margin: 4px 2px;
}

.editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-bottom: 8px;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.editor-title-input {
    flex: 1;
    font-size: 20px;
    font-weight: 600;
    border: none;
    border-bottom: 1px solid transparent;
    padding: 4px 0;
}

.editor-title-input:focus {
    outline: none;
    border-bottom-color: var(--color-accent);
}

.editor-status {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.editor-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin: -4px 0 10px;
}

.editor-formatbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px;
    margin-bottom: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    flex-wrap: wrap;
}

.editor-formatbar button {
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border: none;
    background: none;
    border-radius: 4px;
    font-size: 12px;
    color: var(--color-text);
}

.editor-formatbar button:hover {
    background: var(--color-hover);
}

.formatbar-sep {
    width: 1px;
    height: 18px;
    background: var(--color-border);
    margin: 0 4px;
}

.formatbar-spacer {
    flex: 1;
}

.editor-mode-toggle {
    font-size: 12px;
    color: var(--color-text-muted);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 5px 10px;
}

.editor-mode-toggle:hover {
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

.editor-body {
    position: relative;
}

.editor-wysiwyg {
    min-height: 55vh;
    padding: 8px 4px;
    line-height: 1.6;
    font-size: 15px;
}

.editor-wysiwyg:focus {
    outline: none;
}

.editor-wysiwyg :first-child {
    margin-top: 0;
}

.editor-wysiwyg pre {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    overflow-x: auto;
}

.editor-wysiwyg code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.9em;
    background: var(--color-surface);
    padding: 1px 4px;
    border-radius: 3px;
}

.editor-wysiwyg pre code {
    background: none;
    padding: 0;
}

.editor-wysiwyg blockquote {
    margin: 8px 0;
    padding: 4px 14px;
    border-left: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.editor-textarea {
    width: 100%;
    min-height: 55vh;
    resize: vertical;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Inline-Bilder im Editor (Copy/Paste-Upload, siehe editor.js) */

.editor-wysiwyg img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: var(--radius);
    cursor: zoom-in;
}

.editor-image-placeholder {
    display: inline-block;
    padding: 4px 10px;
    margin: 4px 0;
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 12px;
}

/* Lightbox-Zoom-Overlay, siehe lightbox.js */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    cursor: zoom-out;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* Slash-Command-Menu */

.slash-menu {
    position: absolute;
    z-index: 30;
    min-width: 190px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 4px;
    display: flex;
    flex-direction: column;
}

.slash-menu[hidden] {
    display: none;
}

.slash-item {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    padding: 6px 8px;
    border: none;
    background: none;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
}

.slash-item.selected,
.slash-item:hover {
    background: var(--color-accent-soft);
}

.slash-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: var(--color-text-muted);
}

.slash-empty {
    padding: 6px 8px;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Lists */

.item-count {
    float: right;
    font-size: 11px;
    color: var(--color-text-muted);
}

.list-table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.list-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13.5px;
}

.list-table th {
    position: relative;
    text-align: left;
    padding: 8px 10px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    font-weight: 600;
    white-space: nowrap;
}

.list-table th:last-child {
    border-right: none;
}

.list-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    vertical-align: middle;
}

.list-table td:last-child {
    border-right: none;
}

.list-table tbody tr:last-child td {
    border-bottom: none;
}

.list-th-check,
.list-td-check {
    width: 32px;
    text-align: center;
}

.list-th-title {
    min-width: 180px;
}

.list-th-add {
    width: 40px;
}

.field-name {
    cursor: text;
    padding-right: 18px;
}

.field-delete-btn {
    position: absolute;
    top: 6px;
    right: 4px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 12px;
    padding: 2px;
    opacity: 0;
    transition: opacity 0.1s;
}

.list-table th:hover .field-delete-btn {
    opacity: 1;
}

.field-delete-btn:hover {
    color: var(--color-error);
}

.item-content-input {
    width: 100%;
    border: none;
    background: none;
    padding: 6px 4px;
    font-size: 13.5px;
    color: var(--color-text);
}

.item-content-input:focus {
    outline: 1px solid var(--color-accent);
    border-radius: 3px;
}

.item-content-input.checked {
    text-decoration: line-through;
    color: var(--color-text-muted);
}

.field-value-input {
    width: 100%;
    min-width: 90px;
    border: none;
    background: none;
    padding: 6px 4px;
    font-size: 13.5px;
    color: var(--color-text);
    font-family: inherit;
}

.field-value-input:focus {
    outline: 1px solid var(--color-accent);
    border-radius: 3px;
}

input.field-value-input[type="checkbox"] {
    width: auto;
    min-width: 0;
    display: block;
    margin: 0 auto;
}

.list-td-actions {
    width: 32px;
    text-align: center;
}

.item-delete-btn {
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 14px;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.1s;
}

.list-row:hover .item-delete-btn {
    opacity: 1;
}

.item-delete-btn:hover {
    color: var(--color-error);
}

.field-form-popup {
    width: 230px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 400;
    white-space: normal;
}

.field-form-popup label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.field-form-popup input,
.field-form-popup select {
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 13px;
}

.field-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}

.add-item-form {
    display: flex;
    gap: 8px;
}

.add-item-form input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 14px;
}

/* Kanban */

.kanban-board {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
}

.kanban-column {
    width: 240px;
    flex-shrink: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 10px;
}

.kanban-column-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 20px;
}

.kanban-card {
    position: relative;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 8px 24px 8px 8px;
    cursor: grab;
    font-size: 13px;
}

.kanban-card.dragging {
    opacity: 0.4;
}

.kanban-card-title {
    font-weight: 500;
}

.kanban-card-desc {
    color: var(--color-text-muted);
    font-size: 12px;
    margin-top: 4px;
}

.kanban-card-due {
    color: var(--color-accent);
    font-size: 11px;
    margin-top: 4px;
}

.kanban-card-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
}

.kanban-card-delete:hover {
    color: var(--color-error);
}

.kanban-card-fields {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--color-border);
}

.kanban-card-field {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.kanban-card-field-label {
    flex-shrink: 0;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-muted);
}

.kanban-field-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    padding: 2px 3px;
    border-radius: 3px;
    font-size: 11px;
    font-family: inherit;
    color: var(--color-text);
}

.kanban-field-input:focus {
    outline: 1px solid var(--color-accent);
}

input.kanban-field-input[type="checkbox"] {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
}

/* Board-Felder-Verwaltung (Popover, siehe kanban.js renderFieldsPopover) */

.board-fields-list {
    display: flex;
    flex-direction: column;
    max-height: 220px;
    overflow-y: auto;
}

.board-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px;
    font-size: 12px;
}

.board-field-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-field-row-type {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--color-text-muted);
}

.board-field-delete-btn {
    flex-shrink: 0;
    border: none;
    background: none;
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
}

.board-field-delete-btn:hover {
    color: var(--color-error);
}

.kanban-add-card-form input,
.kanban-add-column-form input {
    width: 100%;
    padding: 6px 8px;
    border: 1px dashed var(--color-border);
    border-radius: 4px;
    font-size: 12px;
    margin-top: 8px;
    background: transparent;
}

.kanban-add-column-form {
    width: 200px;
    flex-shrink: 0;
}

/* Attachments / Viewer */

.attachments-section {
    margin-top: 24px;
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
}

.attachments-heading {
    font-size: 14px;
    margin: 0 0 10px;
}

.attachment-dropzone {
    border: 1px dashed var(--color-border);
    border-radius: 6px;
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.attachment-dropzone.dragover {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

.attachment-file-label {
    text-decoration: underline;
}

.attachment-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.attachment-tile {
    width: 140px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
}

.attachment-thumb {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.attachment-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 90px;
    background: var(--color-surface);
    border-radius: 4px;
    color: var(--color-text-muted);
    text-align: center;
    text-decoration: none;
    font-size: 12px;
}

.attachment-meta {
    display: flex;
    flex-direction: column;
    margin-top: 6px;
    gap: 2px;
}

.attachment-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    color: var(--color-text-muted);
    font-size: 11px;
}

.attachment-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
}

/* API Keys */

.keys-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 13px;
}

.keys-table th,
.keys-table td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid var(--color-border);
}

.key-reveal-box {
    margin-top: 12px;
    padding: 12px;
    background: #fff8e1;
    border: 1px solid #ffe08a;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.key-reveal-box code {
    flex: 1;
    overflow-x: auto;
    white-space: nowrap;
}

.key-reveal-box .secondary-btn {
    width: auto;
    flex-shrink: 0;
}

/* Nutzerverwaltung */

.user-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.user-status-active {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.user-status-pending {
    background: #fff8e1;
    color: #8a6d1a;
}

/* Responsive */

@media (max-width: 780px) {
    .app-shell {
        height: auto;
    }

    .workspace-body {
        flex-direction: column;
    }

    .workspace-sidebar {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .app-main {
        max-width: 100%;
    }

    .editor-wysiwyg,
    .editor-textarea {
        min-height: 40vh;
    }

    .app-header {
        gap: 10px;
    }

    .app-main {
        padding: 14px;
    }
}

/* Touch: Aktionsbuttons, die sonst nur per :hover erscheinen, muessen ohne Hover-Faehigkeit
   dauerhaft sichtbar sein (sonst auf Touch-Geraeten unerreichbar). */
@media (hover: none) {
    .tree-row-actions {
        display: flex;
    }

    .field-delete-btn,
    .item-delete-btn {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #1c1c1e;
        --color-surface: #2a2a2d;
        --color-text: #ececec;
        --color-text-muted: #9a9a9d;
        --color-border: #3a3a3d;
        --color-accent: #5b8dff;
        --color-accent-soft: #22314f;
        --color-hover: #333336;
    }

    .kanban-card,
    .attachment-file-icon {
        background: #2f2f32;
    }

    .key-reveal-box {
        background: #3a3320;
        border-color: #6b5b23;
    }

    .user-status-pending {
        background: #3a3320;
        color: #e0c374;
    }

    .context-menu button.danger:hover {
        background: #3a2323;
    }
}
