:root {
  --paper: #eef1f4;
  --sheet: #ffffff;
  --ink: #1e2b38;
  --ink-2: #4a5866;
  --muted: #6b7885;
  --line: #d6dce2;
  --line-2: #e6eaee;
  --accent: #c8102e;      /* BNI-Rot: nur für die nächste Aktion */
  --accent-ink: #ffffff;
  --hot: #a35c00;         /* Bernstein: gescannt / geantwortet */
  --hot-bg: #fff3e0;
  --ok: #24724a;
  --ok-bg: #e7f4ec;
  --err: #a1261d;
  --err-bg: #fdecea;
  --focus: #2457a6;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--ink); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .25rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; font-weight: 650; }
h3 { font-size: .95rem; margin: 0 0 .5rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Kopf */
.top { background: var(--ink); color: #fff; }
.top-inner { max-width: 1320px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 16px; height: 48px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand span { color: #f4a3ae; font-weight: 500; }
.top form { margin-left: auto; }
.top input[type=search] { background: #2d3d4d; border: 1px solid #3d4f61; color: #fff; border-radius: 4px; padding: 5px 10px; width: 220px; font: inherit; font-size: 14px; }
.top input::placeholder { color: #9fb0c0; }
.top-links { display: flex; gap: 14px; font-size: 14px; }
.top-links a { color: #c9d4de; text-decoration: none; }
.top-links a:hover, .top-links a.on { color: #fff; }

/* Prozessleiste: das tragende Element der Oberfläche */
.rail { background: var(--sheet); border-bottom: 1px solid var(--line); }
.rail ol { list-style: none; margin: 0 auto; padding: 0 20px; max-width: 1320px; display: grid; grid-template-columns: repeat(6, 1fr); counter-reset: st; }
.rail li { counter-increment: st; }
.rail a { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px 11px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; position: relative; height: 100%; }
.rail a::before { content: counter(st); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rail li + li a { border-left: 1px solid var(--line-2); }
.rail a:hover { background: #f6f8fa; color: var(--ink); }
.rail a.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.rail .label { font-size: 14.5px; }
.rail .count { margin-left: auto; font-size: 20px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; }
.rail .count.zero { color: #b5bfc8; font-weight: 500; }
.rail .count.act { color: var(--accent); }
.rail .spin { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; align-self: center; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rail .spin { animation: none; } }

/* ------------------------------------------------------------- Layout */
main { max-width: 1320px; margin: 0 auto; padding: 24px 20px 64px; }
.head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head .lead { color: var(--ink-2); margin: 0; max-width: 70ch; }
.head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); }
.pad { padding: 18px 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.split { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 960px) {
  .grid2, .grid3, .split { grid-template-columns: 1fr; }
  .rail ol { grid-template-columns: repeat(3, 1fr); }
  .rail li:nth-child(4) a { border-left: 0; }
  .top input[type=search] { width: 130px; }
}
@media (max-width: 560px) {
  .rail ol { grid-template-columns: repeat(2, 1fr); padding: 0; }
  .rail li a { border-left: 0 !important; border-top: 1px solid var(--line-2); }
  .top-links { display: none; }
  main { padding: 16px 16px 48px; }
}

/* ------------------------------------------------------------ Elemente */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--sheet); color: var(--ink); padding: 7px 14px; border-radius: 5px; font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #a50d26; border-color: #a50d26; color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #2f4152; color: #fff; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); padding-left: 8px; padding-right: 8px; }
.btn.quiet:hover { color: var(--accent); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn kbd { font: 11px var(--font); border: 1px solid currentColor; border-radius: 3px; padding: 0 4px; opacity: .7; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=url], input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 7px 10px;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(36, 87, 166, .15); }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row > .w-s { flex: 0 0 90px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; font-weight: 400; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; color: var(--ink); font-size: 14.5px; }
.check input { margin-top: 4px; }

.flash { padding: 10px 14px; border-radius: 5px; margin-bottom: 14px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: #b9dcc7; color: #18513a; }
.flash.error { background: var(--err-bg); border-color: #f3c3be; color: var(--err); }
.banner { background: var(--hot-bg); border: 1px solid #f0d2a4; color: #6b3d00; padding: 10px 14px; border-radius: 5px; margin-bottom: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner form { margin-left: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f7f9fa; position: sticky; top: 0; z-index: 1; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8fafb; }
tr.sel td { background: #f1f5fb; }
td.c, th.c { width: 34px; text-align: center; }
.tablewrap { max-height: 68vh; overflow: auto; }
.firm { font-weight: 600; text-decoration: none; }
.sub { color: var(--muted); font-size: 13px; }

.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 10px; background: #eef1f4; color: var(--ink-2); white-space: nowrap; }
.tag.hot { background: var(--hot-bg); color: var(--hot); font-weight: 600; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.err { background: var(--err-bg); color: var(--err); }
.tag.dim { background: transparent; border: 1px solid var(--line); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.filters .field { margin: 0; }
.filters input, .filters select { width: auto; min-width: 120px; max-width: 230px; padding: 5px 8px; font-size: 14px; }
.bulkbar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); background: #f7f9fa; position: sticky; bottom: 0; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); }
.bulkbar .count { font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.seg a { padding: 5px 12px; text-decoration: none; font-size: 13.5px; color: var(--ink-2); background: #fff; }
.seg a + a { border-left: 1px solid var(--line); }
.seg a.on { background: var(--ink); color: #fff; }

#map { height: 62vh; min-height: 380px; border-bottom: 1px solid var(--line); }

/* Übersicht */
.next { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.next a { display: block; padding: 16px 20px; text-decoration: none; border-right: 1px solid var(--line-2); }
.next a:last-child { border-right: 0; }
.next .n { font-size: 30px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.next .n.hot { color: var(--hot); }
.next .t { color: var(--ink-2); font-size: 14px; }
@media (max-width: 760px) { .next { grid-template-columns: 1fr; } .next a { border-right: 0; border-bottom: 1px solid var(--line-2); } }
.funnel { display: flex; gap: 0; font-variant-numeric: tabular-nums; }
.funnel div { flex: 1; padding: 10px 14px; border-left: 1px solid var(--line-2); }
.funnel div:first-child { border-left: 0; }
.funnel b { display: block; font-size: 22px; font-weight: 650; }
.funnel span { font-size: 13px; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; align-items: baseline; }
.list li:last-child { border-bottom: 0; }
.list .when { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.setup { border-left: 3px solid var(--accent); }
.setup li { padding: 4px 0; }
.bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--ink); }

/* Prüfen */
.review { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 960px) { .review { grid-template-columns: 1fr; } }
.facts dt { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.facts dd { margin: 1px 0 0; }
.sources { font-size: 13px; padding-left: 18px; margin: 4px 0 0; }
.sources li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper { background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 0 var(--line-2), 0 8px 24px -16px rgba(30, 43, 56, .35); border-radius: 2px; padding: 34px 44px 28px; max-width: 760px; }
.paper .addr { margin: 0 0 22px auto; width: 50%; min-width: 220px; font-size: 14px; line-height: 1.45; }
.paper input.subject { font-weight: 650; border-color: transparent; padding-left: 0; }
.paper input.salut, .paper input.closing { border-color: transparent; padding-left: 0; }
.paper textarea.body { border-color: transparent; padding-left: 0; min-height: 360px; font-size: 15px; }
.paper input:hover, .paper textarea:hover { border-color: var(--line); }
.paper input:focus, .paper textarea:focus { padding-left: 10px; }
.wordcount { font-size: 12.5px; color: var(--muted); }
.stickyactions { position: sticky; bottom: 0; background: var(--paper); padding: 12px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); margin-top: 14px; }
.queue-nav { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--ink-2); }

/* Nachfassen */
.call { display: grid; grid-template-columns: 1.3fr 1fr 1.4fr; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.call:last-child { border-bottom: 0; }
.call .phone { font-size: 17px; font-weight: 650; text-decoration: none; font-variant-numeric: tabular-nums; }
.call form { display: grid; grid-template-columns: 1fr 140px; gap: 6px; }
.call form .full { grid-column: 1 / -1; }
.call form .btn { justify-content: center; }
@media (max-width: 960px) { .call { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 8px; }
.chip { display: inline-flex; gap: 6px; align-items: center; background: var(--ink); color: #fff; border-radius: 14px; padding: 3px 6px 3px 11px; font-size: 13.5px; }
.chip button { border: 0; background: rgba(255,255,255,.18); color: #fff; border-radius: 50%; width: 18px; height: 18px; cursor: pointer; line-height: 1; font-size: 13px; }
.suggest { border: 1px solid var(--line); border-radius: 5px; max-height: 240px; overflow: auto; margin-top: 4px; background: #fff; display: none; }
.suggest button { display: flex; width: 100%; text-align: left; border: 0; background: #fff; padding: 7px 10px; font: inherit; font-size: 14px; cursor: pointer; }
.suggest button:hover, .suggest button.act { background: #eef3f9; }
.suggest button span { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.lfgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 4px 14px; }
@media (max-width: 560px) { .lfgrid { grid-template-columns: 1fr; } }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.empty p { max-width: 52ch; margin: 0 auto 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
details summary { cursor: pointer; color: var(--ink-2); font-size: 14px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--line); margin-left: 4px; }
.timeline li b { font-weight: 600; }
