:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel2: #fafbfc;
  --line: #e4e7ec;
  --line2: #eef0f3;
  --text: #1a1d23;
  --muted: #697586;
  --accent: #6c5ce7;
  --accent-soft: #efedfd;
  --accent-ink: #ffffff;
  --teal: #0bb8a0;
  --ok: #16a34a;
  --warn: #b45309;
  --warn-soft: #fdf3e7;
  --err: #dc2626;
  --err-soft: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- buttons ---------- */
.btn {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--panel2); border-color: #d3d8e0; }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #5d4ce0; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel2); color: var(--text); }
.btn.warnbtn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: -.2px; font-size: 15px; }
.brand span { color: var(--accent); }
.brand em { color: var(--muted); font-style: normal; font-weight: 500; font-size: 11px; margin-left: 8px;
  border: 1px solid var(--line); padding: 1px 7px; border-radius: 999px; }
.topactions { display: flex; align-items: center; gap: 8px; }
.who { font-size: 13px; color: var(--muted); margin-right: 4px; }
.who b { color: var(--text); font-weight: 600; }
.pubbadge { font-size: 11px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--warn); color: var(--warn); background: var(--warn-soft); }
.pubbadge.armed { border-color: var(--ok); color: var(--ok); background: #eafaf0; }
.pubbadge:empty { display: none; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 290px 1fr; height: calc(100vh - 57px); }
.sidebar { border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 14px; }

.colswitch { display: flex; gap: 3px; background: var(--panel2); border: 1px solid var(--line); padding: 3px; border-radius: 9px; margin-bottom: 12px; }
.colswitch button { flex: 1; background: none; border: 0; color: var(--muted); padding: 7px 6px; border-radius: 6px; cursor: pointer; font: inherit; font-weight: 500; }
.colswitch button:hover { color: var(--text); }
.colswitch button.active { background: var(--panel); color: var(--accent); box-shadow: var(--shadow); }

.filter { width: 100%; padding: 9px 11px; margin-bottom: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; }
.filter:focus { outline: none; border-color: var(--accent); background: var(--panel); }

.navlabel { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; margin: 4px 2px 8px; }
.settingsnav { display: flex; flex-direction: column; gap: 2px; }
.settingsnav button { text-align: left; background: none; border: 0; color: var(--text); padding: 8px 11px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; }
.settingsnav button:hover { background: var(--panel2); }
.settingsnav button.active { background: var(--accent-soft); color: var(--accent); }

.reflist { list-style: none; margin: 0; padding: 0; }
.reflist li { padding: 9px 11px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.reflist li:hover { background: var(--panel2); }
.reflist li.active { background: var(--accent-soft); }
.reflist li.active .rname { color: var(--accent); }
.reflist .rname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reflist .badges { display: flex; gap: 4px; flex-shrink: 0; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.badge.de, .badge.en { color: var(--text); background: var(--panel2); }
.badge.draft { color: var(--warn); border-color: #f0d9bd; background: var(--warn-soft); }
.badge.missing { opacity: .3; }

/* ---------- editor ---------- */
.editor { overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.empty { display: grid; place-items: center; height: 100%; color: var(--muted); }
#editorBody { display: flex; flex-direction: column; height: 100%; }
.editor-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; background: var(--panel); border-bottom: 1px solid var(--line); }
.editor-head h1 { font-size: 17px; margin: 0; letter-spacing: -.2px; }
.tabs { display: flex; gap: 3px; background: var(--panel2); border: 1px solid var(--line); padding: 3px; border-radius: 8px; }
.tab { background: none; border: 0; color: var(--muted); padding: 6px 16px; border-radius: 6px; cursor: pointer; font: inherit; font-weight: 500; }
.tab.active { background: var(--panel); color: var(--accent); box-shadow: var(--shadow); }

.panes { display: grid; grid-template-columns: 1fr 320px; gap: 0; flex: 1; min-height: 0; }
.form-pane { overflow-y: auto; padding: 20px 22px; }
.side-pane { overflow-y: auto; padding: 18px; background: var(--panel); border-left: 1px solid var(--line); }

.fm { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin-bottom: 8px; }
.field { display: block; margin-bottom: 14px; }
.field.col-full { grid-column: 1 / -1; }
.lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.fm input, .fm select, .fm textarea, .body, .newform input, .newform select, .login-card input {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit;
}
.fm input:focus, .fm select:focus, .fm textarea:focus, .body:focus, .newform input:focus, .login-card input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.fm textarea { resize: vertical; }
.fm .check { display: flex; align-items: center; gap: 8px; flex-direction: row; }
.fm .check input { width: auto; width: 16px; height: 16px; accent-color: var(--accent); }
.fm .check .lbl { margin: 0; }
.locked input { background: var(--panel2); color: var(--muted); }
.imgrow { display: flex; gap: 6px; }
.imgrow input { flex: 1; }
.thumb { margin-top: 6px; }
.thumb img { max-height: 60px; border-radius: 6px; border: 1px solid var(--line); background: #fff; }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line2); }
.savestate { font-size: 12px; color: var(--muted); }

.banner { padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.banner.warn { background: var(--warn-soft); border: 1px solid #f0d9bd; color: var(--warn); }

/* ---------- rich text editor ---------- */
.bodyhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bodyhead .lbl { margin: 0; }
.rtmode { display: flex; gap: 2px; background: var(--panel2); border: 1px solid var(--line); padding: 2px; border-radius: 7px; }
.rtmode .seg { background: none; border: 0; color: var(--muted); padding: 4px 11px; border-radius: 5px; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 500; }
.rtmode .seg.active { background: var(--panel); color: var(--accent); box-shadow: var(--shadow); }

.rt-toolbar { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px; background: var(--panel2); border: 1px solid var(--line); border-bottom: 0; border-radius: 9px 9px 0 0; }
.rt-toolbar button { min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid transparent; background: none; border-radius: 6px; cursor: pointer; color: var(--text); font-size: 13px; }
.rt-toolbar button:hover { background: var(--panel); border-color: var(--line); }
.rt-toolbar .sep { width: 1px; background: var(--line); margin: 4px 3px; }
.rt-editor {
  min-height: 320px; max-height: 56vh; overflow-y: auto; padding: 16px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 9px 9px;
}
.rt-editor:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent-soft); }
.rt-editor:empty::before { content: "Inhalt schreiben…"; color: var(--muted); }
.body { min-height: 320px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6; border-radius: 9px; }

/* prose (editor + previews) */
.prose { color: #1f2329; }
.prose h2 { font-size: 19px; margin: 16px 0 7px; font-weight: 650; }
.prose h3 { font-size: 16px; margin: 14px 0 6px; font-weight: 600; }
.prose p { margin: 9px 0; }
.prose ul, .prose ol { padding-left: 22px; margin: 9px 0; }
.prose li { margin: 3px 0; }
.prose img { max-width: 100%; border-radius: 6px; }
.prose figure { margin: 12px 0; }
.prose a { color: var(--accent); }
.prose table { border-collapse: collapse; }
.prose td, .prose th { border: 1px solid var(--line); padding: 5px 9px; }

/* ---------- lint / copy-check ---------- */
.side-pane h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.lintbody { display: flex; flex-direction: column; gap: 7px; }
.issue { padding: 8px 10px; border-radius: 8px; font-size: 12.5px; border-left: 3px solid var(--line); background: var(--panel2); }
.issue.error { border-left-color: var(--err); background: var(--err-soft); }
.issue.warning { border-left-color: var(--warn); background: var(--warn-soft); }
.issue.fix { border-left-color: var(--ok); background: #eafaf0; }
.issue .ctx { color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; margin-top: 4px; word-break: break-word; }
.issue .tag { font-size: 9.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; opacity: .7; }
.lint.ok h3 { color: var(--ok); }

.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); color: var(--err); }

/* ---------- settings views ---------- */
.settings-body { overflow-y: auto; padding: 20px 24px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.settings-head h1 { font-size: 18px; margin: 0; }
.priceform { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; max-width: 720px; margin-top: 14px; }
.priceform input { width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font: inherit; }
.priceform input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.faq-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: var(--panel); }
.faq-item .faq-row { display: flex; gap: 10px; align-items: start; }
.faq-item input, .faq-item textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font: inherit; background: var(--panel); }
.faq-item textarea { resize: vertical; min-height: 56px; }
.faq-item .faq-cat { max-width: 240px; }
.faq-item .faq-del { color: var(--err); border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; }

.msg-tools { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.msg-table { display: flex; flex-direction: column; gap: 2px; }
.msg-group { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; margin: 14px 0 4px; }
.msg-row { display: grid; grid-template-columns: 230px 1fr 1fr; gap: 8px; align-items: center; padding: 3px 0; }
.msg-row .mk { font-size: 11.5px; color: var(--muted); font-family: ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row input { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; background: var(--panel); }
.msg-row input:focus { outline: none; border-color: var(--accent); }
.msg-row input.changed { border-color: var(--accent); background: var(--accent-soft); }
.msg-row .ro { color: var(--muted); font-style: italic; font-size: 12px; }
.lochead { display: flex; gap: 8px; font-size: 11px; color: var(--muted); padding: 0 0 0 238px; }
.lochead span { flex: 1; }

.legal-list { display: flex; gap: 8px; margin: 12px 0; }
.legal-list button { padding: 8px 16px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; cursor: pointer; font: inherit; }
.legal-list button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- dialogs ---------- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(460px, 92vw); box-shadow: 0 20px 60px rgba(16,24,40,.2); }
dialog::backdrop { background: rgba(16, 24, 40, .35); backdrop-filter: blur(2px); }
.newform h2 { margin: 0 0 16px; font-size: 18px; }
.pubdialog { width: min(820px, 94vw); }
.pubhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pubhead h2 { margin: 0; font-size: 16px; }
.publog { background: #0e1116; color: #d7e0ea; border-radius: 10px; padding: 14px; height: 54vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 500; font-size: 13px; }
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, #f4f5f7, #ecebfb); }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; width: min(380px, 92vw); box-shadow: 0 20px 60px rgba(16,24,40,.12); }
.login-brand { font-weight: 700; font-size: 18px; letter-spacing: -.3px; }
.login-brand span { color: var(--accent); }
.login-sub { color: var(--muted); margin: 4px 0 22px; font-size: 13px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { margin-top: 6px; }
.login-err { color: var(--err); font-size: 13px; min-height: 18px; margin: 12px 0 0; }
