:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1f1e1c;
  --muted: #6b6a66;
  --border: #e2e0da;
  --accent: #1d5fa5;
  --accent-bg: #e6f1fb;
  --ok: #3b6d11;
  --ok-bg: #eaf3de;
  --bad: #a32d2d;
  --bad-bg: #fcebeb;
  --warn: #854f0b;
  --warn-bg: #faeeda;
  --neutral-bg: #f1efe8;
  --hover: #f7f6f2;
  --radius: 8px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b1a;
    --surface: #242423;
    --text: #ecebe7;
    --muted: #a3a29d;
    --border: #3a3a38;
    --accent: #85b7eb;
    --accent-bg: #0c447c;
    --ok: #c0dd97;
    --ok-bg: #27500a;
    --bad: #f7c1c1;
    --bad-bg: #791f1f;
    --warn: #fac775;
    --warn-bg: #633806;
    --neutral-bg: #2e2e2c;
    --hover: #2a2a29;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
h1 { font-size: 1.35rem; font-weight: 600; margin: 0 0 1rem; }
.muted { color: var(--muted); font-size: 0.9rem; }

.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; margin: 0; text-decoration: none; }
.brand img { display: block; height: 26px; width: auto; }
.brand span { color: var(--muted); font-weight: 400; }
.auth .brand img { height: 40px; }

/* Formulare – Mindest-Tippfläche 44 px */
.stack { display: grid; gap: 1rem; margin-bottom: 1rem; }
label { display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
input {
  min-height: 44px;
  padding: 0 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  min-height: 44px;
  padding: 0 1rem;
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost { border-color: transparent; color: var(--muted); }

.alert {
  background: var(--bad-bg);
  color: var(--bad);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
}

/* Anmeldeseiten */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}
.auth-card .brand { margin-bottom: 1.25rem; }

/* Cockpit */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 16px;
  min-height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar form { margin: 0; }
.topbar .brand { color: var(--text); text-decoration: none; white-space: nowrap; }
.spacer { flex: 1; }
.user { font-size: 0.9rem; color: var(--muted); }
.small { font-size: 0.8rem; }
button.small { min-height: 32px; padding: 0 0.6rem; font-size: 0.8rem; }
.status { font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.bad { background: var(--bad-bg); color: var(--bad); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.neutral { background: var(--neutral-bg); color: var(--muted); }
.fetch-status { display: inline-flex; align-items: center; gap: 0.4rem; }

.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.list-pane {
  border-right: 1px solid var(--border);
  background: var(--surface);
  height: calc(100vh - 52px);
  position: sticky;
  top: 52px;
  overflow-y: auto;
}
.detail-pane { padding: 1.25rem 1.5rem 3rem; min-width: 0; }
.placeholder { padding-top: 2rem; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 12px 8px; }
.chip {
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.chip.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.search { padding: 0 12px 12px; border-bottom: 1px solid var(--border); }
.search input { width: 100%; }
.empty { padding: 1rem; color: var(--muted); font-size: 0.9rem; }

.mail-list { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.35;
}
.row:hover { background: var(--hover); }
.row.sel { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
.row.dim { opacity: 0.6; }
.row-top { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--muted); }
.row-subject { font-weight: 600; overflow-wrap: anywhere; }
.row-from { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 0.7rem; padding: 0 6px; border-radius: 4px; background: var(--neutral-bg); color: var(--muted); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.st-neu { background: var(--accent); }
.dot.st-fehler { background: var(--bad); }
.dot.st-freigegeben, .dot.st-veroeffentlicht { background: var(--ok); }
.st-chip.st-neu { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.st-chip.st-fehler { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }

.back { display: none; margin-bottom: 0.75rem; }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 0.75rem; }
.notice { background: var(--neutral-bg); padding: 0.6rem 0.8rem; border-radius: var(--radius); font-size: 0.9rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.card h2 { font-size: 1rem; margin: 0 0 0.75rem; }
.subject { font-size: 1.2rem; margin: 0 0 0.25rem; overflow-wrap: anywhere; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 0.75rem 0; }
.segmented a { padding: 6px 14px; font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.segmented a + a { border-left: 1px solid var(--border); }
.segmented a.on { background: var(--accent-bg); color: var(--accent); }
.body-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 0.95rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  max-height: 70vh;
  overflow-y: auto;
}
.mail-html { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; }
.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--neutral-bg);
}
.gallery figcaption { font-size: 0.75rem; overflow-wrap: anywhere; margin-top: 4px; }
.docs { margin: 0; padding-left: 1.1rem; }
.docs li { margin: 0.3rem 0; overflow-wrap: anywhere; }

@media (max-width: 767px) {
  .layout { grid-template-columns: 1fr; }
  .list-pane { position: static; height: auto; border-right: 0; }
  .layout.has-detail .list-pane { display: none; }
  .layout:not(.has-detail) .detail-pane { display: none; }
  .detail-pane { padding: 1rem 16px 3rem; }
  .back { display: inline-block; }
  .user, .topbar .status.neutral { display: none; }
  .topbar { gap: 0.4rem; }
}
.tab-heading { font-size: 0.95rem; margin: 0.5rem 0 0.75rem; }
.tab-heading + .gallery + .tab-heading { margin-top: 1.5rem; }

/* Einstufung */
.dot.cat-top { background: var(--ok); }
.dot.cat-normal { background: var(--accent); }
.dot.cat-aussortiert { background: var(--muted); }
.dot.cat-none.st-neu { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.row-status.strong { font-weight: 600; color: var(--text); }
.score-mini { font-variant-numeric: tabular-nums; }
.tag-prio { background: var(--bad-bg); color: var(--bad); }
.tag-fwd { background: var(--accent-bg); color: var(--accent); }
.tag-best { background: var(--ok-bg); color: var(--ok); }
.cat-chip.cat-top { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); font-weight: 600; }
.cat-chip.cat-normal { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.cat-chip.cat-aussortiert { background: var(--neutral-bg); color: var(--muted); }
.class-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 0.5rem; }
.headline-suggestion { font-weight: 600; font-size: 1.05rem; margin: 0.5rem 0 0.25rem; }
.summary { margin: 0 0 0.75rem; }
.score-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 0.5rem 0; }
.score-table th, .score-table td { text-align: left; padding: 5px 8px 5px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.score-table .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.score-table td:first-child { white-space: nowrap; }
.score-table .reason { color: var(--muted); }
select {
  min-height: 44px;
  padding: 0 0.5rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Ausgabekanäle */
.section-title { font-size: 1rem; margin: 1.5rem 0 0.75rem; }
.channel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 0.5rem; }
.channel-head h3 { font-size: 1rem; margin: 0; }
.chip.out-entwurf { background: var(--neutral-bg); }
.chip.out-bearbeitet { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.chip.out-freigegeben, .chip.out-geplant { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.chip.out-fehler { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.chip.out-wird_erzeugt { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.generating { font-style: italic; }
.lint { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 0.5rem 0.75rem 0.5rem 1.75rem; margin: 0 0 0.75rem; font-size: 0.85rem; }
.preview p { margin: 0 0 0.6rem; overflow-wrap: anywhere; }
.preview .kicker { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.75rem; color: var(--muted); margin: 0; }
.p-headline { font-size: 1.15rem; margin: 0.2rem 0 0.5rem; }
.p-lead { font-weight: 500; }
.preview.linkedin .post { white-space: pre-wrap; }
.hashtags { color: var(--accent); }
.card-suggestion { background: var(--neutral-bg); border-radius: var(--radius); padding: 0.5rem 0.75rem; margin-bottom: 0.6rem; }
.card-suggestion p { margin: 0.15rem 0; }
.regenerate { display: flex; gap: 8px; margin-top: 0.75rem; }
.regenerate input { flex: 1; min-width: 0; }
.versions { margin-top: 0.75rem; font-size: 0.85rem; }
.versions summary { cursor: pointer; color: var(--accent); }
.versions ul { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.versions li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
@media (max-width: 767px) {
  .regenerate { flex-direction: column; }
}

/* Modal */
.class-actions { display: flex; justify-content: flex-end; margin-top: 0.5rem; }
.modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}
.modal::backdrop { background: rgba(20, 20, 18, 0.45); backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in 160ms ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-body { display: grid; gap: 1rem; padding: 1.25rem 1.5rem 1.5rem; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 1.15rem; margin: 0; }
.modal-subject { margin: -0.5rem 0 0; }
.icon-button { min-height: 36px; width: 36px; padding: 0; border: 0; font-size: 1.4rem; line-height: 1; color: var(--muted); }
.icon-button:hover { background: var(--hover); }
.choice { border: 0; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.choice legend { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.35rem; }
.choice-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.choice-pill { display: block; cursor: pointer; }
.choice-pill input { position: absolute; opacity: 0; pointer-events: none; }
.choice-pill span {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 600; color: var(--text); transition: background 120ms, border-color 120ms;
}
.choice-pill:hover span { background: var(--hover); }
.choice-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-pill.cat-top input:checked + span { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.choice-pill.cat-normal input:checked + span { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.choice-pill.cat-aussortiert input:checked + span { background: var(--neutral-bg); color: var(--muted); border-color: var(--muted); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.modal-grid select, .modal-body input[type=text] { width: 100%; }
.modal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 0.25rem; border-top: 1px solid var(--border); padding-top: 1rem; }
@media (max-width: 767px) {
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-foot .spacer { display: none; }
  .modal-foot button { flex: 1 1 100%; }
}
.search { display: grid; gap: 8px; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.sort select { flex: 1; min-height: 36px; font-size: 0.85rem; }

/* Icon-Knöpfe oben rechts */
.icon-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; min-height: 40px; padding: 0;
  border: 0; border-radius: var(--radius); background: transparent;
  color: var(--muted); cursor: pointer;
}
.icon-link:hover { background: var(--hover); color: var(--text); }
.icon-link.on { color: var(--accent); background: var(--accent-bg); }

/* Einstellungen */
.settings { max-width: 980px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
.back-link { display: inline-block; margin-bottom: 0.75rem; font-size: 0.9rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 0.75rem; }
.section-head h2 { margin: 0; }
.success { background: var(--ok-bg); color: var(--ok); padding: 0.6rem 0.8rem; border-radius: var(--radius); }
.users { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.users th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.8rem; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); }
.users td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; }
.users tr.locked td { color: var(--muted); }
.users .actions { text-align: right; }
.users .actions form { margin: 0; }
@media (max-width: 767px) {
  .users thead { display: none; }
  .users tr { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .users td { border: 0; padding: 0; }
  .users td[data-label="Letzte Anmeldung"]::before { content: "Letzte Anmeldung: "; color: var(--muted); }
  .users .actions { text-align: left; margin-top: 6px; }
}

/* Detailansicht: Original links, Ausgabekanäle rechts */
.detail-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.col-original, .col-channels { min-width: 0; }
.col-channels .section-title { margin-top: 0; }
@media (min-width: 1180px) {
  .detail-columns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .col-original { position: sticky; top: calc(52px + 1rem); }
  .col-original .card.original { max-height: calc(100vh - 52px - 2rem); overflow-y: auto; margin-bottom: 0; }
  .col-original .mail-html, .col-original .body-text { height: calc(100vh - 330px); max-height: none; }
}
.row:focus { outline: none; }
.row:focus-visible, .row.sel:focus { box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 2px var(--accent); }
.col-channels .classification { margin-bottom: 1rem; }
.col-channels .section-title { margin-top: 1.25rem; }

/* Meilenstein 5: Freigabe, Bearbeiten, Pool, Planung */
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.detail-actions form { margin: 0; }
.progress { display: inline-flex; gap: 3px; }
.pg {
  font-size: 0.65rem; font-weight: 600; width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; background: var(--neutral-bg); color: var(--muted);
}
.pg-bearbeitet { background: var(--accent-bg); color: var(--accent); }
.pg-freigegeben, .pg-geplant, .pg-veroeffentlicht { background: var(--ok-bg); color: var(--ok); }
.pg-fehler { background: var(--bad-bg); color: var(--bad); }
.pg-wird_erzeugt { background: var(--warn-bg); color: var(--warn); }
.row { transition: transform 150ms ease-out, background 150ms; touch-action: pan-y; }
.row.swipe-approve { background: var(--ok-bg); }
.row.swipe-discard { background: var(--bad-bg); }
.row.swiped { opacity: 0.4; }
.list-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px 16px; margin: 0; }
.touch-hint { display: none; }
@media (hover: none) { .touch-hint { display: inline; } }

.channel.is-done { border-color: var(--ok); }
.channel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 0.75rem; }
.edit-form { display: grid; gap: 0.75rem; }
.edit-form textarea, .edit-form input[type=text], .edit-form select { width: 100%; }
textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.75rem; resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.card-fields { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; margin: 0; display: grid; gap: 0.75rem; }
.card-fields legend { font-size: 0.85rem; color: var(--muted); padding: 0 4px; }
.facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.edit-actions { display: flex; align-items: center; gap: 8px; }
.saved { color: var(--ok); }
.card-image { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 0.25rem; }

.schedule { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 0.75rem; }
.schedule label { flex: 1; min-width: 200px; }
.schedule input { width: 100%; }
.scheduled-list { font-size: 0.85rem; margin-top: 0.5rem; }
.scheduled-list summary { cursor: pointer; color: var(--accent); }
.scheduled-list ul { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.scheduled-list li { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.scheduled-list li.current { font-weight: 600; }
.scheduled-list .num { white-space: nowrap; font-variant-numeric: tabular-nums; }

.pool-link { font-size: 0.9rem; color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: var(--radius); white-space: nowrap; }
.pool-link:hover { background: var(--hover); color: var(--text); }
.pool-link.on { background: var(--accent-bg); color: var(--accent); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--neutral-bg); font-size: 0.75rem; text-align: center; }
.pool-group h2 { font-size: 1rem; }
.pool-item { display: flex; gap: 12px; padding: 0.75rem 0; border-top: 1px solid var(--border); }
.pool-item.lead { background: var(--warn-bg); margin: 0 -1.25rem; padding: 0.75rem 1.25rem; }
.pool-text { flex: 1; min-width: 0; }
.pool-text p { margin: 0 0 0.35rem; overflow-wrap: anywhere; }
.pool-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.pool-actions form { margin: 0; display: flex; gap: 4px; }
.pool-actions select { min-height: 32px; font-size: 0.8rem; }
.pool-date select { min-height: 36px; }

.shortcuts { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.shortcuts td { padding: 6px 0; border-bottom: 1px solid var(--border); }
.shortcuts td:first-child { white-space: nowrap; padding-right: 16px; }
kbd {
  font: 0.8rem ui-monospace, monospace; border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; background: var(--surface);
}

@media (max-width: 767px) {
  .pool-item { flex-direction: column; }
  .pool-actions { flex-direction: row; flex-wrap: wrap; align-items: center; }
  /* Aktionen auf dem Smartphone fest am unteren Rand */
  .detail-actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .detail-actions form { flex: 1; }
  .detail-actions button { width: 100%; min-height: 44px; }
  .detail-pane { padding-bottom: 6rem; }
}
.p-figure { margin: 0.25rem 0 0.9rem; }
.p-figure img { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); display: block; background: var(--neutral-bg); }
.p-figure figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }
.p-figure .credit { white-space: nowrap; }
.p-figure .credit { white-space: normal; }
.lint.single { list-style: none; padding-left: 0.75rem; }
.image-source { font-size: 0.85rem; color: var(--muted); }
.tags-card { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.tags-form { display: grid; gap: 0.4rem; }
.tags-form label { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.tags-row { display: flex; gap: 8px; }
.tags-row input { flex: 1; min-width: 0; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tag-chip { font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; background: var(--accent-bg); color: var(--accent); }
.channel-head .primary { margin-left: 4px; }
.detail-actions { flex-wrap: nowrap; }
.detail-actions button { white-space: nowrap; }

/* Aufmacherbild wechseln */
.p-figure-frame { position: relative; }
.p-figure-actions {
  position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px;
  opacity: 0; transition: opacity 120ms;
}
.p-figure-frame:hover .p-figure-actions, .p-figure-frame:focus-within .p-figure-actions { opacity: 1; }
@media (hover: none) { .p-figure-actions { opacity: 1; } }
.p-figure-actions button { background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }
.p-figure-empty {
  width: 100%; min-height: 120px; margin: 0.25rem 0 0.9rem;
  border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); background: transparent;
}
.p-figure-empty:hover { border-color: var(--accent); color: var(--accent); }
.modal-wide { width: min(860px, calc(100vw - 32px)); }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; max-height: 50vh; overflow-y: auto; }
.picker-item { display: grid; gap: 4px; padding: 6px; min-height: 0; border: 2px solid transparent; border-radius: var(--radius); background: var(--neutral-bg); }
.picker-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.picker-item span { font-size: 0.75rem; color: var(--muted); }
.picker-item:hover { border-color: var(--border-strong, var(--accent)); }
.picker-item.on { border-color: var(--accent); }
.upload-form { display: grid; gap: 0.75rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.upload-form h3 { font-size: 0.95rem; margin: 0; }
.choice-pill.cat-portal input:checked + span { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.dot.cat-portal { background: var(--warn); }
.cat-chip.cat-portal { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.media-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 0.6rem; }

/* Newsletter-Ausgabe im Pool */
.section-head form.inline { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.notice.warn { background: var(--warn-bg); color: var(--warn); margin-bottom: 1rem; }
.notice.warn p { margin: 0.15rem 0; }
.job-running { display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; background: var(--accent-bg); color: var(--accent); }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.list-form input[type=text], .list-form input[type=url], .list-form textarea { width: 100%; }
.upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 1rem; }
.upload-row input[type=file] { min-height: 0; font-size: 0.85rem; }
.tip-row { display: grid; grid-template-columns: 9rem 1fr 14rem auto; gap: 6px; align-items: center; }
.events { margin: 0 0 0.75rem; padding-left: 1.1rem; font-size: 0.9rem; }
.events li { margin-bottom: 0.35rem; }
.newsletter-preview { width: 100%; height: 900px; border: 1px solid var(--border); border-radius: var(--radius); background: #f0f0f0; margin-bottom: 0.75rem; }
@media (max-width: 767px) {
  .tip-row { grid-template-columns: 1fr; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
  .newsletter-preview { height: 600px; }
}

/* Hover-Aktionen in der Liste (wie im Web-Outlook): P / N / L immer, Aussortieren + In Arbeit beim Überfahren */
.mail-list li { position: relative; }
.mail-list .row-from { padding-right: 64px; }
.row-actions { position: absolute; right: 10px; bottom: 8px; display: flex; align-items: center; gap: 4px; }
.row-actions button { min-height: 0; padding: 0; border: 0; }
.row-actions .levels { display: inline-flex; gap: 3px; }
.row-actions .pg { cursor: pointer; }
.row-actions .pg:hover { outline: 1px solid var(--accent); }
.pg-off { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); opacity: 0.7; }
.ra-icon { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); background: var(--surface); border-radius: 4px; }
.ra-icon:hover { color: var(--text); background: var(--neutral-bg); }
.ra-icon.on { color: var(--accent); background: transparent; }
.row-actions .hover-only { display: none; }
.mail-list li:hover .hover-only, .mail-list li:focus-within .hover-only { display: inline-flex; }
@media (hover: none) { .mail-list li:not(:focus-within) .hover-only { display: none; } }
button:hover:not(:disabled) { background: var(--hover); }
button.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* Pool: links Ausgabe + Meldungen, rechts Vorschau */
main.pool { max-width: 1500px; }
.pool-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 720px); gap: 24px; align-items: start; }
.pool-side { position: sticky; top: 12px; }
.pool-side .newsletter-preview { height: calc(100vh - 150px); min-height: 500px; }
.save-state { font-size: 0.85rem; }
@media (max-width: 1100px) {
  .pool-layout { grid-template-columns: 1fr; }
  .pool-side { position: static; }
  .pool-side .newsletter-preview { height: 800px; }
}
/* „Wird erzeugt …“ schwebt unten rechts und verschiebt keinen Inhalt */
.job-toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 32px); padding: 0.6rem 0.9rem; border-radius: var(--radius); font-size: 0.9rem;
  background: var(--accent-bg); color: var(--accent); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); }
.job-toast button { min-height: 28px; }
/* Fremdgelesen: Auswahl + Pool */
.tip-row { grid-template-columns: 9rem 1fr 14rem 5.5rem; }
.tip-tools { display: inline-flex; align-items: center; gap: 4px; }
.tip-tools button { min-height: 28px; padding: 0 8px; font-size: 1rem; }
.tip-pool { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.tip-pool h3 { font-size: 0.95rem; margin: 0; }
.tip-pool-list { list-style: none; margin: 0; padding: 0; }
.tip-pool-list li { display: flex; align-items: center; gap: 10px; padding: 0.5rem 0; border-top: 1px solid var(--border); font-size: 0.9rem; }
.tip-pool-list li.taken { opacity: 0.6; }
.tip-pool-list .tip-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tip-pool-list button { min-height: 30px; white-space: nowrap; }

/* Pool-Kopf: KI-Auswahl über dem Ausgabe-Pulldown */
.pool-head-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ai-button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 0.8rem; font-size: 0.9rem;
  font-weight: 600; color: #fff; border: 0; background: linear-gradient(135deg, #6d4aff, #1d5fa5); }
.ai-button:hover:not(:disabled) { background: linear-gradient(135deg, #7d5dff, #2a6fb8); filter: none; }
@media (max-width: 767px) { .pool-head-tools { align-items: stretch; } }

/* Bilder mit width/height-Attributen: Platz ist reserviert, Größe bleibt responsiv */
#channels img, .attachments img, .p-figure-frame img { height: auto; max-width: 100%; }
/* Luft unter den Kanal-Karten: wird eine Karte kürzer (Freigeben, Fertig), muss der Browser nicht nachrücken */
#channels { padding-bottom: 50vh; }

/* CMS-Zeile an der Portal-Karte, Kürzel-Feld in den Einstellungen */
.cms-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.cms-row .alert { flex-basis: 100%; margin: 0; }
.inline-field { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-field input { min-height: 32px; width: 6.5rem; padding: 0 0.5rem; }

/* Eigene Artikel: violett gekennzeichnet (Liste, Detail), Dialog zum Anlegen */
:root { --own: #6d4aff; --own-bg: #efeaff; }
@media (prefers-color-scheme: dark) { :root { --own: #b8a6ff; --own-bg: #33295e; } }
.list-tools { padding: 12px; border-bottom: 1px solid var(--border); }
.own-button {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #6d4aff; border-color: #6d4aff; color: #fff; font-weight: 600;
}
.own-button span { font-size: 1.2rem; line-height: 1; font-weight: 400; }
.own-button:hover:not(:disabled) { background: #5a38ec; border-color: #5a38ec; }
.row.own { box-shadow: inset 4px 0 0 var(--own); background: color-mix(in srgb, var(--own-bg) 45%, transparent); }
.row.own.sel { box-shadow: inset 4px 0 0 var(--own), inset 0 0 0 1px var(--own); background: var(--own-bg); }
.tag-own, .own-chip { background: var(--own-bg); color: var(--own); font-weight: 600; }
.modal-wide { width: min(760px, 96vw); }
.own-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); }
.own-tab { border: 0; border-bottom: 3px solid transparent; border-radius: 0; min-height: 40px; color: var(--muted); }
.own-tab.on { color: var(--own); border-bottom-color: var(--own); font-weight: 600; }
.own-panel input[type=text], .own-panel textarea, .own-panel select { width: 100%; }
.own-channels { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
label.radio { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 0.9rem; }
label.radio input { min-height: 0; width: auto; }

/* hidden gilt immer – auch für Elemente mit eigener display-Regel (z. B. .edit-form) */
[hidden] { display: none !important; }

/* Dialog „Eigener Artikel“: groß, Text links, Angaben rechts */
.modal-own { width: min(1240px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.own-cms { max-width: 640px; }
.own-new { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem 1.5rem; align-items: start; }
.own-main, .own-side { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.own-side fieldset { min-width: 0; }
.own-side input[type=file] { max-width: 100%; }
.own-foot { grid-column: 1 / -1; }
.own-new .rte-area { min-height: 22rem; max-height: 52vh; }
.own-side .own-channels { grid-template-columns: 1fr; }
@media (max-width: 900px) { .own-new { grid-template-columns: 1fr; } .own-new .rte-area { min-height: 14rem; } }

/* Texteditor (data-rte in app.js) */
.rte-field { display: grid; gap: 4px; }
.rte { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.rte:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.rte-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px;
  border-bottom: 1px solid var(--border); background: var(--neutral-bg); border-radius: var(--radius) var(--radius) 0 0;
  position: sticky; top: 0; z-index: 1;
}
.rte-bar button { min-height: 32px; padding: 0 10px; font-size: 0.85rem; background: var(--surface); }
.rte-bar button.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.rte-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
.rte-area { min-height: 16rem; max-height: 70vh; overflow-y: auto; padding: 0.75rem 1rem; line-height: 1.55; outline: none; overflow-wrap: anywhere; }
.rte-area > :first-child { margin-top: 0; }
.rte-area p, .rte-area ul, .rte-area ol, .rte-area blockquote { margin: 0 0 0.8rem; }
.rte-area h3 { font-size: 1rem; font-weight: 700; margin: 1.1rem 0 0.5rem; }
.rte-area blockquote, .sa-body blockquote { border-left: 3px solid var(--border); padding-left: 0.9rem; font-style: italic; }
.rte-area a { color: var(--accent); text-decoration: underline; }

/* Portal-Vorschau im Aussehen der Artikelseite von trvlcounter.de */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
.site-article {
  font-family: "Inter", system-ui, sans-serif; background: #e3e0e0; color: #2c0d0d;
  padding: 1.5rem clamp(1rem, 6%, 3rem) 1.75rem; border-radius: 2px;
}
.sa-over {
  display: flex; justify-content: space-between; gap: 1rem; color: #db2a2a; text-transform: uppercase;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.089em; padding-bottom: 0.6rem; border-bottom: 1px solid #8f8585;
}
.sa-over span:last-child { white-space: nowrap; }
.sa-headline { font-size: 1.875rem; line-height: 2rem; font-weight: 900; text-transform: uppercase; margin: 1.5rem 0 1.4rem; overflow-wrap: anywhere; }
.preview.site-article .sa-lead { font-size: 0.875rem; font-weight: 700; line-height: 1.425; letter-spacing: 0.0179em; margin: 0 0 1.4rem; }
.preview.site-article .sa-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 1.4rem; }
.sa-tags span { background: #b9c6cc; color: #2c0d0d; font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; }
.site-article .p-figure { margin: 0 0 1.4rem; }
.site-article .p-figure img { border-radius: 0; max-height: none; }
.site-article .p-figure figcaption { background: #cfcbcb; color: #5b4f4f; font-size: 0.75rem; letter-spacing: 0.03em; margin: 0; padding: 6px 1.5rem; }
.site-article .p-figure-empty { margin-bottom: 1.4rem; background: transparent; color: #5b4f4f; border-color: #8f8585; }
.site-article .lint.single { margin-bottom: 1.4rem; }
.sa-body { font-size: 0.875rem; line-height: 1.425; letter-spacing: 0.0179em; }
.preview.site-article .sa-body p, .sa-body ul, .sa-body ol, .sa-body blockquote { margin: 0 0 1.25rem; }
.sa-body > :last-child { margin-bottom: 0 !important; }
.sa-body h3 { font-size: 0.875rem; font-weight: 700; margin: 0 0 1.25rem; }
.sa-body a { color: #db2a2a; text-decoration: underline; }
.sa-body blockquote { border-left-color: #8f8585; }
.sa-meta { margin: 0.6rem 0 0; overflow-wrap: anywhere; }
@media (max-width: 700px) { .sa-headline { font-size: 1.5rem; line-height: 1.65rem; } }
