[hidden] { display: none !important; }
:root {
  --bg: #f4f5f2;
  --card: #ffffff;
  --ink: #1d2320;
  --muted: #69726d;
  --line: #dfe3dd;
  --accent: #1f5f4a;
  --accent-ink: #ffffff;
  --accent-soft: #e3efe9;
  --warn: #9a5b00;
  --warn-soft: #fff3df;
  --danger: #a3261b;
  --danger-soft: #fde8e6;
  --code: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1.2em; margin: 6px 0; }
button { font: inherit; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 14px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover:not(:disabled) { filter: brightness(1.1); }
button.ghost { background: transparent; }
button.big { font-size: 17px; padding: 12px 34px; }
button.link { border: none; background: none; padding: 2px 4px; color: var(--accent); text-decoration: underline; }
button.danger { color: var(--danger); }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; font-family: var(--code); font-size: 13px; margin-bottom: 10px; }
label { display: block; margin: 10px 0; }
label > input { display: block; width: 100%; margin-top: 4px; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 22px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.logo { color: #8fd3b6; font-size: 20px; }
.local { font-weight: 400; font-size: 12px; color: #b9c6bf; border: 1px solid #3c4a43; border-radius: 20px; padding: 1px 8px; }
.status { flex: 1; display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.status .pill { background: #2c3631; border-radius: 20px; padding: 2px 10px; color: #d6e1db; }
.status .pill.bad { background: #5a2a24; color: #ffd9d4; }
.top-actions button { color: #fff; border-color: #3c4a43; }

main { max-width: 1180px; margin: 0 auto; padding: 18px 22px 60px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 16px; color: var(--muted); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card.info { background: var(--accent-soft); border-color: #c8dfd4; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row.right { justify-content: flex-end; }
.row input[type=search] { flex: 1; min-width: 240px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

.options { display: flex; gap: 40px; flex-wrap: wrap; }
.opt-title { font-weight: 600; display: block; margin-bottom: 4px; }
.radio, .check { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0; cursor: pointer; }
.radio input, .check input { margin-top: 4px; width: auto; }
.radio small, .check small { display: block; color: var(--muted); }

.dropzone { border: 2px dashed #bfc8c1; border-radius: var(--radius); padding: 34px; text-align: center; background: #fbfcfa; transition: background .15s, border-color .15s; }
.dropzone.over { background: var(--accent-soft); border-color: var(--accent); }
.dropzone p { margin: 12px 0 0; }

.tiles-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 10px; }
.tiles-head h2 { margin: 0; }
.tiles-head div { display: flex; gap: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.tile .ext { font: 600 11px var(--code); background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 2px 6px; align-self: flex-start; }
.tile .name { font-weight: 600; overflow-wrap: anywhere; }
.tile .src { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.tile .stats { font-size: 13px; }
.tile .warn { font-size: 12px; background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 6px 8px; }
.tile .warn.strong { background: var(--danger-soft); color: var(--danger); }
.tile.error { border-color: #e9b5af; }
.tile.error .stats { color: var(--danger); }
.tile.busy .stats::before { content: ""; display: inline-block; width: 12px; height: 12px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; margin-right: 6px; vertical-align: -2px; animation: spin .8s linear infinite; }
.tile .actions { margin-top: auto; padding-top: 6px; display: flex; justify-content: flex-end; }
.tile.saved .actions button::after { content: " ✓"; }
@keyframes spin { to { transform: rotate(360deg); } }

.table-card { padding: 0; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbf9; }
.groups td:first-child { width: 30px; }
.groups td:last-child { width: 110px; text-align: right; }
.chip { display: inline-block; font: 12px var(--code); background: #eef1ed; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; margin: 2px 4px 2px 0; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.original { font-weight: 600; }
.preview-wrap { overflow: auto; max-height: 300px; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; }
.preview th, .preview td { font-size: 13px; white-space: nowrap; }
.mapping { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }
.mapping label { margin: 0; font-size: 13px; color: var(--muted); }
.mapping select { width: 100%; margin-top: 3px; }
.rules td { padding: 4px; border: none; }
.rules input, .rules select { width: 100%; padding: 5px 7px; font-size: 13px; }
.rules input[type=checkbox] { width: auto; }

.lock { display: grid; place-items: center; min-height: calc(100vh - 60px); }
.lock-card { width: min(420px, 92vw); }
.lock-card .primary { width: 100%; margin-top: 8px; }
.modal { position: fixed; inset: 0; background: rgba(20, 26, 23, .45); display: grid; place-items: center; z-index: 20; }
.modal-card { width: min(520px, 94vw); max-height: 86vh; overflow: auto; }
.modal-card label { margin: 8px 0; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 30; max-width: 80vw; }
.toast.bad { background: var(--danger); }
.goodbye { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 40; }
.pick-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; }
.pick-list div { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.pick-list div:hover, .pick-list div.sel { background: var(--accent-soft); }

/* ---------------------------------------------------------- Vergleichsfenster */
.tile .actions { gap: 8px; }
.compare { position: fixed; inset: 0; z-index: 25; background: #e9ece7; display: flex; flex-direction: column; }
.compare-bar { display: flex; align-items: center; gap: 16px; padding: 8px 14px 8px 20px; background: var(--ink); color: #fff; }
.compare-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-bar .sync { margin: 0; color: #d6e1db; }
.compare-bar .close { background: transparent; color: #fff; border: 1px solid #4a5a52; font-size: 18px; line-height: 1; padding: 6px 12px; }
.compare-bar .close:hover { background: #a3261b; border-color: #a3261b; }
.compare-panes { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; min-height: 0; }
.pane { display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pane-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fafbf9; }
.pane-label { font: 600 11px var(--code); text-transform: uppercase; letter-spacing: .05em; border-radius: 4px; padding: 2px 7px; background: #eceeea; color: var(--muted); }
.pane[data-side=result] .pane-label { background: var(--accent-soft); color: var(--accent); }
.pane-name { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zoom { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.zoom button { padding: 1px 9px; font-size: 15px; }
.zoom-val { min-width: 44px; text-align: center; }
.pane-tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); background: #fafbf9; overflow-x: auto; }
.pane-tabs:empty { display: none; }
.pane-tabs button { border: none; border-radius: 0; border-bottom: 2px solid transparent; background: none; padding: 6px 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pane-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.pane-body { flex: 1; overflow: auto; min-height: 0; background: #f6f7f5; }
.pane-content { padding: 14px; transform-origin: 0 0; }
.pane-loading, .pane-error { padding: 30px; color: var(--muted); }
.pane-error { color: var(--danger); }
mark.ps { background: #d7efe3; color: #15523e; border-radius: 3px; padding: 0 2px; font-family: var(--code); font-size: .92em; }
.pv-page { background: #fff; max-width: 820px; margin: 0 auto; padding: 36px 44px; box-shadow: 0 1px 4px rgba(0,0,0,.08); font-family: Calibri, "Segoe UI", sans-serif; }
.pv-page p { margin: 0 0 6px; }
.pv-page h1, .pv-page h2, .pv-page h3, .pv-page h4, .pv-page h5 { margin: 12px 0 8px; }
.pv-hf, .pv-meta { font-size: 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 4px 8px; margin: 8px 0; }
.pv-doc-table { border-collapse: collapse; margin: 8px 0; }
.pv-doc-table td { border: 1px solid #c9cfc8; padding: 4px 8px; }
.pv-img { color: var(--muted); font-style: italic; }
.pv-grid { border-collapse: collapse; background: #fff; font-size: 13px; }
.pv-grid th, .pv-grid td { border: 1px solid #d6dbd4; padding: 3px 8px; white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: 0; }
.pv-grid thead th { position: sticky; top: 0; background: #eef1ec; color: var(--muted); font-weight: 500; text-align: center; z-index: 1; }
.pv-grid tbody th { background: #eef1ec; color: var(--muted); font-weight: 500; text-align: right; position: sticky; left: 0; }
.pv-grid td.b { font-weight: 700; }
.pv-corner { left: 0; z-index: 2 !important; }
.pv-note { color: var(--warn); font-size: 12px; }
.pv-text { white-space: pre-wrap; font-family: var(--code); font-size: 13px; background: #fff; padding: 16px; border-radius: 6px; margin: 8px 0; }
.pv-mailhead { background: #fff; border-radius: 6px; }
.pv-mailhead th { width: 80px; background: #fafbf9; }
.pv-attach { background: #fff; border-radius: 6px; padding: 8px 12px; margin-top: 8px; font-size: 13px; }
.pv-attach ul { margin: 4px 0 0; padding-left: 18px; }
.pv-muted { color: var(--muted); }
.pv-frame { width: 100%; min-height: 70vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-top: 8px; }
.pv-pdf-page { display: block; margin: 0 auto 14px; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.15); }
.pv-pdf-num { text-align: center; font-size: 11px; color: var(--muted); margin: -8px 0 12px; }
@media (max-width: 900px) { .compare-panes { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } }

/* ---------------------------------------------------------- Serverbetrieb */
.who { color: #d6e1db; font-size: 13px; }
.qr { display: block; width: 220px; height: 220px; margin: 8px auto; image-rendering: pixelated; background: #fff; border-radius: 8px; }
.login-step h1 { margin-bottom: 4px; }
code { font-family: var(--code); background: #eef1ed; border-radius: 4px; padding: 1px 5px; word-break: break-all; }
.users td:last-child { text-align: right; white-space: nowrap; }
.badge { display: inline-block; font-size: 11px; border-radius: 10px; padding: 1px 8px; background: #eef1ed; color: var(--muted); }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
#user-create input:not([type=checkbox]) { flex: 1; min-width: 200px; }
