:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #0f5bd8; --green: #15803d; --red: #b42318; --amber: #b45309;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg); display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; }
.brand span { font-weight: 400; color: var(--muted); }
.filters { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.filters select, .filters input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.filters input { min-width: 220px; }
.whoami { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.whoami form { margin: 0; }
.nav { display: flex; align-items: center; gap: 8px; }
.nav button { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 6px; font-size: 18px; cursor: pointer; }
#position { min-width: 110px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }

.layout { flex: 1; display: grid; grid-template-columns: minmax(340px, 420px) 1fr; min-height: 0; }
.lead { background: var(--panel); border-right: 1px solid var(--line); padding: 20px; overflow-y: auto; }
.lead-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.lead h1 { font-size: 20px; margin: 0 0 12px; line-height: 1.25; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.Angerufen { background: #fef3c7; color: var(--amber); }
.badge.Irrelevant { background: #fee4e2; color: var(--red); }
.badge.Mail { background: #dcfce7; color: var(--green); }
.facts { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; margin: 0 0 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts a { color: var(--accent); text-decoration: none; }
.extra { font-size: 13px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 12px; white-space: pre-wrap; }
.extra:empty { display: none; }
.extra b { display: block; color: var(--muted); font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.notes-label { display: block; font-weight: 600; margin-bottom: 4px; }
.notes-label small { font-weight: 400; color: var(--muted); }
textarea, dialog input { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; background: #fff; }

.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 14px 0 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 8px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.btn.skip { background: #fff; border-color: #f3c3be; color: var(--red); }
.btn.call { background: var(--green); color: #fff; }
.btn.mail { background: var(--accent); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:hover:not(:disabled) { filter: brightness(.95); }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px 0; }
.hint { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.preview { display: flex; flex-direction: column; min-width: 0; }
.browserbar { display: flex; gap: 6px; padding: 6px 8px; background: #e9ecf1; border-bottom: 1px solid var(--line); align-items: center; }
.browserbar button, .browserbar a { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font-size: 16px; display: grid; place-items: center; color: var(--ink); text-decoration: none; }
.browserbar button:hover, .browserbar a:hover { background: #d9dee6; }
#urlForm { flex: 1; }
#urlInput { width: 100%; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; background: #fff; }
.frame-wrap { position: relative; flex: 1; background: #fff; }
iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.loading { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 4px 12px; border-radius: 99px; font-size: 12px; z-index: 1; }

dialog { width: min(720px, 94vw); border: 0; border-radius: 12px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .4); }
dialog label { display: block; font-weight: 600; margin-bottom: 10px; }
dialog label input, dialog label textarea { margin-top: 3px; font-weight: 400; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .btn { padding: 8px 18px; }
.tpl-pick { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.tpl-pick select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; max-width: 220px; }
.dialog-head #tplName { font-weight: 400; color: var(--muted); font-size: 14px; }
.mail-logo { display: block; width: 220px; margin: -2px 0 12px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 10px; }
.suggestions button { font-size: 12px; border: 1px solid var(--line); background: #f8fafc; border-radius: 99px; padding: 2px 10px; cursor: pointer; }
.error { color: var(--red); background: #fee4e2; padding: 8px; border-radius: 6px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 10; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 70vh; }
  .lead { border-right: 0; border-bottom: 1px solid var(--line); }
}
