:root {
  --bg: #f1f6f8; --card: #fff; --text: #13304a; --muted: #5d6f7f; --line: #dfe7ec; --field: #fff;
  --accent: #0d8a82; --accent-strong: #0a6f69; --accent-soft: #e5f4f2; --accent-line: #a9dbd5;
  --chip: #edf1f4; --shadow: 0 1px 2px rgba(19, 48, 74, .04), 0 4px 16px rgba(19, 48, 74, .05);
  --blue: #dfe9fb; --green: #dcf2e3; --yellow: #fdf1cf; --orange: #fde6cf; --red: #fbdcd9; --purple: #ebe1fa; --gray: #eaeef1;
  --warn-bg: #fff6e3; --warn-line: #f5d9a0; --warn-text: #9a6510;
  --ok: #1c7c45; --err: #b3261e; --good: #1c7c45; --bad: #c0392b;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1a22; --card: #16242e; --text: #e6eef3; --muted: #9db0bd; --line: #26384a; --field: #1b2b37;
    --accent: #36b5ab; --accent-strong: #5cc8bf; --accent-soft: #143633; --accent-line: #22625c;
    --chip: #213340; --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --blue: #1f3557; --green: #1d3d2b; --yellow: #45391a; --orange: #4a3020; --red: #4d2422; --purple: #392a52; --gray: #2a3a46;
    --warn-bg: #3a2e14; --warn-line: #6b521f; --warn-text: #f1c46b;
    --ok: #7fd3a0; --err: #ff8a80; --good: #7fd3a0; --bad: #ff8a80;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 2rem; line-height: 1.15; font-weight: 800; margin: 0 0 6px; letter-spacing: -.01em; }
h1 span, .brand .accent { color: var(--accent); }
h2 { font-size: 1.1rem; font-weight: 800; margin: 0 0 12px; }
h3 { font-size: .95rem; font-weight: 800; margin: 18px 0 8px; }
hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .82rem; }
.ok { color: var(--ok); font-weight: 600; }
.error { color: var(--err); font-weight: 600; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.hidden { display: none !important; }
.icon { flex: none; vertical-align: -3px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }

/* Kopfzeile */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 0 20px; min-height: 60px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; }
.top nav { display: flex; gap: 0 22px; flex: 1; align-self: stretch; white-space: nowrap; }
.top nav a { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; padding-top: 3px; }
.top nav a:hover { color: var(--text); }
.top nav a.on { color: var(--text); font-weight: 800; border-bottom-color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; }
.top form { margin: 0; }
.mac { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.mac.online { color: var(--ok); background: var(--green); }
.mac.offline { color: var(--err); background: var(--red); }

/* Seitenkopf */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; margin-bottom: 20px; }
.lead { color: var(--muted); margin: 0; max-width: 760px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; text-decoration: none; font-weight: 700; }

/* Knöpfe */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700;
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--chip); color: var(--text);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover, button:hover { border-color: var(--accent-line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(13, 138, 130, .28); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.big { padding: 12px 22px; font-size: 1rem; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--chip); }
.btn.danger { background: var(--card); color: var(--err); border-color: var(--red); }
.btn.icon-only { padding: 6px; }
button.link { background: none; border: none; padding: 0; color: var(--accent); }

/* Hinweise */
.notice {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; margin-bottom: 16px;
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius); font-size: .9rem;
}
.notice > .icon { color: var(--accent); margin-top: 2px; }
.notice strong { display: block; color: var(--text); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.notice.warn > .icon { color: var(--warn-text); }
.notice.ok { background: var(--green); border-color: transparent; }
.notice.ok > .icon { color: var(--ok); }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice .tags { margin-top: 6px; }

/* Formulare */
label { display: block; margin-bottom: 12px; font-weight: 700; font-size: .9rem; }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; font-weight: 400; color: var(--text);
  background: var(--field); border: 1px solid var(--line); border-radius: 10px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
select {
  appearance: none; padding-right: 36px; font-weight: 600; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235d6f7f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { resize: vertical; line-height: 1.55; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.field-head h2 { margin: 0; }
label h3 { margin-top: 0; }

/* Auswahl-Chips (Checkbox oder Radio, das Feld selbst ist versteckt) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { margin: 0; position: relative; font-size: .95rem; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip > span {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--card); color: var(--muted); font-weight: 600; user-select: none;
}
.chip > span .icon { display: none; }
.chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 800; }
.chip input:checked + span .icon { display: inline; color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips.small { gap: 4px; flex-wrap: nowrap; }
.chips.small .chip > span { padding: 3px 10px; font-size: .8rem; border-width: 1px; }

/* Schalter */
.switch { margin: 0; display: inline-block; position: relative; width: 40px; height: 22px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.center { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: 100%; max-width: 380px; }
.login .lead { margin-bottom: 18px; }
.login .btn { width: 100%; }

/* Reiter */
.tabs { display: flex; flex-wrap: wrap; gap: 4px 26px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 2px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); font-weight: 800; border-bottom-color: var(--accent); }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: var(--chip); color: var(--muted); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }

/* Filter */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 16px; align-items: end; padding: 16px 20px; }
.filters label { margin: 0; }
.filters .clear { justify-self: start; }

/* Vorschläge */
.drafts { list-style: none; margin: 0; padding: 0; }
.drafts li { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; padding: 0 16px 0 0; margin-bottom: 10px; transition: border-color .15s, opacity .25s, transform .25s; }
.drafts li:hover { border-color: var(--accent-line); }
.draft-link { display: flex; flex: 1; min-width: 0; gap: 14px; padding: 16px 0 16px 18px; color: var(--text); text-decoration: none; }
.drafts .body { min-width: 0; flex: 1; }
.line1 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.line1 strong { font-size: 1.02rem; }
.summary { margin: 2px 0 8px; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 32px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none; background: var(--accent-soft); }
.avatar.none { display: grid; place-items: center; color: var(--accent); font-weight: 800; font-size: 1.1rem; }
.avatar.big { width: 72px; height: 72px; font-size: 1.6rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--gray); white-space: nowrap; }
.tag.big { font-size: .9rem; padding: 5px 14px; }
.tag.plain { background: var(--chip); color: var(--muted); font-weight: 600; }
.tag.blue { background: var(--blue); } .tag.green { background: var(--green); } .tag.yellow { background: var(--yellow); }
.tag.orange { background: var(--orange); } .tag.red { background: var(--red); } .tag.purple { background: var(--purple); }
.run-queued { background: var(--yellow); } .run-running { background: var(--accent-soft); color: var(--accent-strong); } .run-done { background: var(--green); }
.run-failed { background: var(--red); } .run-cancelled { background: var(--gray); }

/* Daumen */
.rate { display: flex; gap: 6px; margin: 0; flex: none; }
.thumb { padding: 8px; border-radius: 10px; background: var(--card); color: var(--muted); border: 1.5px solid var(--line); }
.thumb.up:hover, .thumb.up.on { color: var(--good); border-color: var(--good); }
.thumb.down:hover, .thumb.down.on { color: var(--bad); border-color: var(--bad); }
.thumb.up.on { background: var(--green); }
.thumb.down.on { background: var(--red); }
.thumb.on .icon { fill: currentColor; fill-opacity: .25; }
.rate.big .thumb { padding: 10px 16px; }
.rate-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.rate-row h2 { margin-bottom: 2px; }
.rate-row p { margin: 0; }
.reason { flex-basis: 100%; margin: 0; }
.reason label { margin: 0; }
.drafts .reason { padding: 0 18px 16px 78px; }
.drafts li.rejected .draft-link { opacity: .45; }
.drafts li.rejected .reason label > span:first-child { color: var(--bad); }
.drafts li.leaving { opacity: 0; transform: translateX(24px); }
.good { color: var(--good); } .bad { color: var(--bad); }

/* Vorschlag */
.translation { color: var(--muted); font-style: italic; }
.quote { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.decide .notice { margin: 18px 0 0; }
.person { display: flex; gap: 16px; align-items: flex-start; }
.thumb-img { max-width: 100%; max-height: 360px; border-radius: 10px; padding: 0; border: none; }
.link-icon { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; text-decoration: none; }
details { margin-bottom: 8px; }
summary { cursor: pointer; font-weight: 700; }

/* Posten */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-head { display: flex; gap: 14px; align-items: flex-start; }
.post-head .body { flex: 1; min-width: 0; }
.post-head .summary { margin: 0; }
.post-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 14px 0; font-size: .9rem; }
.post-facts dt { color: var(--muted); font-weight: 700; }
.post-facts dd { margin: 0; overflow-wrap: anywhere; }
.reply-box { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.reply-box p { margin: 4px 0 0; font-size: 1rem; }
.post-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.post-actions form { margin: 0; }
.post-now { border-color: var(--accent-line); }

/* Fortschritt eines Laufs */
.run-panel { border-color: var(--accent-line); }
.run-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.run-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.run-title strong { font-size: 1.05rem; }
.run-percent { font-size: 1.5rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); flex: none; position: relative; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--accent); animation: pulse 1.6s ease-out infinite; }
[data-status=queued] .pulse, .run-pill.queued .pulse { background: var(--warn-text); }
[data-status=queued] .pulse::after, .run-pill.queued .pulse::after { border-color: var(--warn-text); }
[data-status=done] .pulse, [data-status=failed] .pulse, [data-status=cancelled] .pulse { background: var(--muted); }
[data-status=done] .pulse { background: var(--ok); }
[data-status=failed] .pulse { background: var(--err); }
[data-status=done] .pulse::after, [data-status=failed] .pulse::after, [data-status=cancelled] .pulse::after { display: none; }
@keyframes pulse { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.bar { height: 10px; border-radius: 999px; background: var(--chip); overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #2bb3a8); transition: width .6s ease; }
.bar.indeterminate > span { width: 35% !important; position: absolute; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { left: -35%; } to { left: 100%; } }
.pf-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.pf-list:empty { display: none; }
.pf { padding: 12px 14px; border-radius: 10px; background: var(--bg); }
.pf-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-bottom: 8px; font-size: .9rem; }
.pf-step { font-weight: 700; color: var(--accent); }
.pf-pct { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.steps { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.steps li { flex: 1; font-size: .7rem; color: var(--muted); padding-top: 8px; position: relative; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 4px; background: var(--line); }
.steps li.done::before { background: var(--accent); }
.steps li.stopped::before { background: var(--muted); opacity: .4; }
.steps li.active { color: var(--text); font-weight: 700; }
.steps li.active::before { background: linear-gradient(90deg, var(--accent) 50%, var(--accent-line) 50%); background-size: 200% 100%; animation: step 1.2s linear infinite; }
@keyframes step { from { background-position: 100% 0; } to { background-position: 0 0; } }
.run-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; text-decoration: none;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 800; font-size: .82rem; border: 1px solid var(--accent-line);
}
.run-pill.queued { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-line); }
.run-pill .pulse { width: 8px; height: 8px; }
.mini-bar { width: 48px; height: 5px; border-radius: 999px; background: var(--card); overflow: hidden; }
.mini-bar > span { display: block; height: 100%; background: var(--accent); transition: width .6s ease; }
.run-pill.queued .mini-bar { display: none; }
#cancel-form { margin: -4px 0 16px; }
.summary-line { font-weight: 700; }

/* Tabellen */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr:last-child td { border-bottom: none; }
table.list th { color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
.keywords input:not([type=checkbox]) { margin: 0; min-width: 160px; }
.keywords .stat { font-weight: 700; white-space: nowrap; }
.others { margin-top: 16px; }
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 20px; }
.limits label { display: flex; flex-direction: column; }
.limits input { margin-top: auto !important; }
.ratings .why { min-width: 220px; max-width: 420px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.save-state {
  position: fixed; right: 16px; bottom: 16px; z-index: 20; padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: .85rem;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.save-state.on { opacity: 1; transform: none; }
.save-state.ok { color: var(--ok); }
.save-state.error { color: var(--err); border-color: var(--red); }
.save-bar { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpis .card { margin: 0; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.kpi strong { font-size: 2rem; font-weight: 800; line-height: 1.2; display: flex; gap: 14px; align-items: center; }
.kpi strong > span { display: inline-flex; align-items: center; gap: 6px; }
.log { background: #0f1d27; color: #cfe0ea; border-radius: 10px; padding: 14px; font-size: .8rem; max-height: 70vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.log:empty::before { content: "Noch keine Zeilen."; color: #7f97a6; }

@media (max-width: 1200px) {
  .top-right .btn span, .mac .label { display: none; }
}
@media (max-width: 720px) {
  h1 { font-size: 1.6rem; }
  .page-head { flex-direction: column; }
  .top { padding: 0 16px; position: static; }  /* auf dem Handy zu hoch zum Stehenbleiben */
  .brand { flex: 1; }
  .ratings thead { display: none; }
  .ratings tr { display: grid; grid-template-columns: 28px 1fr; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .ratings tbody tr:last-child { border-bottom: none; }
  .ratings td { border: none !important; padding: 0 !important; grid-column: 2; }
  .ratings td:first-child { grid-column: 1; grid-row: 1 / span 4; }
  .ratings .why { min-width: 0; max-width: none; font-weight: 700; }
  .top nav { order: 3; width: 100%; flex: none; flex-wrap: wrap; gap: 0 18px; }
  .top nav a { padding: 8px 0; }
  .rate.big { width: 100%; }
  .rate.big .thumb { flex: 1 1 0; min-width: 0; padding: 10px 8px; white-space: normal; }
  .top-right { margin-left: auto; }
  .top-right .btn span { display: none; }
  .card { padding: 16px; }
  .run-head .btn, .run-pill .mini-bar { display: none; }
  .run-percent { font-size: 1.25rem; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi strong { font-size: 1.5rem; }
  .drafts li { flex-direction: column; align-items: stretch; padding: 0; gap: 0; }
  .draft-link { padding: 14px 14px 8px; }
  .drafts .rate { padding: 0 14px 14px 74px; }
  .drafts .reason { padding: 0 14px 14px; }
  .keywords thead { display: none; }
  .keywords tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .keywords td { border: none !important; padding: 0; }
  .keywords td.kw-word { width: 100%; }
  .keywords .stat::before { content: attr(data-label) ": "; font-weight: 400; color: var(--muted); font-size: .8rem; }
  .chips.small { flex-wrap: wrap; }
}
