:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2a2d3e;
  --text: #e2e8f0;
  --muted: #64748b;
  --accent: #6366f1;
  --queued: #f59e0b;
  --processing: #3b82f6;
  --done: #22c55e;
  --error: #ef4444;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
}

/* Nav */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}
nav h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
nav h1 span {
  color: var(--muted);
}
.live-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--done);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* Layout */
main {
  max-width: 1340px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}
section {
  margin-bottom: 20px;
}

/* Process control */
.proc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) {
  .proc-grid {
    grid-template-columns: 1fr;
  }
}

.proc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.proc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.proc-name {
  font-weight: 600;
  font-size: 13px;
}
.proc-pid {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.proc-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status-dot.running {
  background: var(--done);
  animation: pulse 2s ease-in-out infinite;
}

.proc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
}
.btn {
  border: none;
  border-radius: 7px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.btn-start {
  background: rgba(34, 197, 94, 0.15);
  color: var(--done);
}
.btn-start:not(:disabled):hover {
  background: rgba(34, 197, 94, 0.25);
}
.btn-stop {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}
.btn-stop:not(:disabled):hover {
  background: rgba(239, 68, 68, 0.25);
}

.log-toggle {
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  padding: 7px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.log-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}
.log-box {
  display: none;
  background: #0b0d14;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  line-height: 1.55;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px 14px;
}
.log-box.open {
  display: block;
}
.log-line {
  white-space: pre-wrap;
  word-break: break-all;
}
.log-line.err {
  color: #f87171;
}
.log-line.sys {
  color: var(--muted);
  font-style: italic;
}
.log-line.out {
  color: #a5f3a0;
}

/* Danger zone */
.export-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
}
.export-zone p {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
}
.btn-export {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.btn-export:hover {
  background: var(--border);
}
.danger-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  padding: 14px 18px;
}
.danger-zone p {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
}
.btn-reset {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 7px;
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-reset:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* Stats */
.cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
@media (max-width: 900px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 560px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}
.card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.card-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.card-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.card.total .card-value {
  color: var(--text);
}
.card.queued .card-value {
  color: var(--queued);
}
.card.proc .card-value {
  color: var(--processing);
}
.card.done .card-value {
  color: var(--done);
}
.card.errors .card-value {
  color: var(--error);
}

/* Progress */
.progress-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.progress-header strong {
  color: var(--text);
  font-size: 13px;
}
.progress-track {
  height: 7px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--done));
  border-radius: 4px;
  transition: width 0.6s ease;
}
.progress-eta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

/* State chips */
.state-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.state-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--muted);
}
.state-chip b {
  color: var(--text);
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.tabs {
  display: flex;
  gap: 5px;
}
.tab {
  padding: 6px 13px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
.tab:hover {
  color: var(--text);
  border-color: var(--accent);
}
.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.search-wrap {
  margin-left: auto;
  position: relative;
}
.search-wrap input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 7px 12px 7px 30px;
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}
.search-wrap input:focus {
  border-color: var(--accent);
}
.search-wrap::before {
  content: '⌕';
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  padding: 9px 13px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
tbody tr:last-child {
  border-bottom: none;
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.skipped-row-open {
  background: rgba(99, 102, 241, 0.08) !important;
  outline: 1px solid var(--accent);
}
td {
  padding: 10px 13px;
  vertical-align: middle;
}
.td-id {
  color: var(--muted);
  font-size: 11px;
  width: 70px;
  font-variant-numeric: tabular-nums;
}
.td-title {
  max-width: 320px;
}
.td-title a {
  color: var(--text);
  text-decoration: none;
}
.td-title a:hover {
  text-decoration: underline;
}
.td-date {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.td-dur {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  text-align: right;
}
.td-links a {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  margin-right: 4px;
  transition: all 0.15s;
}
.td-links a:hover {
  color: var(--text);
  border-color: var(--accent);
}
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.badge-queued {
  background: rgba(245, 158, 11, 0.15);
  color: var(--queued);
}
.badge-processing {
  background: rgba(59, 130, 246, 0.15);
  color: var(--processing);
}
.badge-done {
  background: rgba(34, 197, 94, 0.15);
  color: var(--done);
}
.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}
.badge-skipped {
  background: rgba(100, 116, 139, 0.15);
  color: var(--muted);
}
.error-reason {
  font-size: 11px;
  color: var(--error);
  margin-top: 3px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border);
}
.page-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
}
.page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.page-info {
  font-size: 12px;
  color: var(--muted);
  min-width: 80px;
  text-align: center;
}

/* Review items ("Nacharbeiten") */
.review-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.review-chip-count {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--border);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}
.review-chip.active .review-chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.review-error {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 7px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
  font-size: 12px;
}
.review-type {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  white-space: nowrap;
}
.review-content {
  max-width: 460px;
}
.review-text,
.review-url {
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-url {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
a.review-url:hover {
  color: var(--text);
}
.review-done-cell {
  width: 80px;
  text-align: center;
}
.review-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--done);
}
.review-row-done td {
  opacity: 0.5;
}

/* Confirm dialog */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.overlay.open {
  display: flex;
}
.dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  max-width: 380px;
  width: 90%;
}
.dialog h2 {
  font-size: 16px;
  margin-bottom: 10px;
}
.dialog p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.5;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-cancel {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
}
.btn-confirm-reset {
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Navigation between the pages */
.page[hidden] {
  display: none;
}
.nav-left {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links {
  display: flex;
  gap: 4px;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
}
.nav-links a:hover {
  color: var(--text);
}
.nav-links a.active {
  color: var(--text);
  background: var(--surface2);
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.page-intro h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}
.page-intro p {
  color: var(--muted);
  max-width: 720px;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Editorial work list: one row per post */
.work-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.work-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.work-row:hover {
  border-color: var(--accent);
}
.work-row-done {
  opacity: 0.6;
}
.work-title {
  font-weight: 500;
  margin-bottom: 6px;
}
.work-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.work-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.work-go {
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
}
.more-btn {
  margin-top: 6px;
  padding: 10px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}
.more-btn:hover {
  color: var(--text);
}

/* Type chips, coloured by urgency */
.type-chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.type-red {
  color: #fca5a5;
  border-color: #7f1d1d;
  background: rgba(239, 68, 68, 0.12);
}
.type-orange {
  color: #fcd34d;
  border-color: #78350f;
  background: rgba(245, 158, 11, 0.12);
}
.type-blue {
  color: #a5b4fc;
  border-color: #312e81;
  background: rgba(99, 102, 241, 0.12);
}
.type-done {
  color: var(--done);
}

/* Post detail */
.detail-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.detail-nav a,
.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.detail-nav a:hover {
  color: var(--text);
}
.detail-steps {
  display: flex;
  gap: 16px;
  align-items: center;
}
.detail-head h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}
.action-btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.action-btn:hover {
  border-color: var(--accent);
}
.action-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
  line-height: 1.5;
}
.alert-warn {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid #78350f;
  color: #fcd34d;
}
.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #7f1d1d;
  color: #fca5a5;
}
.checklist-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 0 10px;
}
.checklist-head h3 {
  font-size: 15px;
  font-weight: 600;
}
.btn-all {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--done);
  background: none;
  color: var(--done);
  cursor: pointer;
  font-size: 12px;
}
.btn-all:disabled {
  opacity: 0.5;
}
.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.check-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.check-item input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--done);
  flex-shrink: 0;
}
.check-done {
  opacity: 0.55;
}
.check-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.check-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.check-text {
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.check-url {
  font-size: 12px;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.skipped-details {
  margin-top: 22px;
  color: var(--muted);
}
.skipped-details summary {
  cursor: pointer;
  font-size: 13px;
}
.skipped-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
@media (max-width: 640px) {
  .work-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .nav-left {
    gap: 12px;
  }
}

.queue-limit {
  width: 150px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 12px;
}

.queue-date {
  width: 140px;
  color-scheme: dark light;
}
