:root {
  color-scheme: light;
}
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Avenir Next", "Avenir", "Helvetica Neue", sans-serif;
  color: var(--ink);
  min-height: 100vh;
}

body.page-public {
  --ink: #0b1f32;
  --muted: #52606f;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --accent: #0b5fa5;
  --accent-strong: #083e6b;
  --accent-soft: #e3f1ff;
  --line: #d8e3ef;
  --shadow: 0 18px 45px rgba(8, 31, 60, 0.12);
  background:
    radial-gradient(circle at 15% 10%, #e9f4ff, transparent 45%),
    radial-gradient(circle at 85% 20%, #dff0ff, transparent 40%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 65%);
}

body.page-admin {
  --ink: #0b1f32;
  --muted: #5a6b7b;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --accent: #0b5fa5;
  --accent-strong: #083e6b;
  --accent-soft: #e3f1ff;
  --line: #d8e3ef;
  --danger: #b23b3b;
  --danger-strong: #8c2c2c;
  --shadow: 0 18px 45px rgba(8, 31, 60, 0.12);
  background:
    radial-gradient(circle at 20% 0%, #e9f4ff, transparent 40%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 70%);
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 22px 90px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.addon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid #d6dbe6;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(8, 31, 60, 0.08);
}

.addon-link img {
  height: 26px;
  width: auto;
  display: block;
}

.brand-logo {
  width: 140px;
  height: auto;
}

h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.4px;
}

.subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.search {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search input {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  min-width: 220px;
  background: #f7faff;
}

.search select {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  min-width: 180px;
  background: #f7faff;
  color: var(--ink);
}

.search button {
  border: none;
  background: var(--accent);
  color: white;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.search button:hover { background: var(--accent-strong); }

.section {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  animation: rise 0.6s ease both;
}

.grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 14px 30px rgba(8, 31, 60, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card h2 {
  margin: 0;
  font-size: 18px;
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

.preview {
  font-size: 14px;
  line-height: 1.5;
  color: #233447;
}

.card a,
a.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

.card a:hover,
a.link:hover { color: var(--accent-strong); }

.source-link {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.source-link:hover {
  color: var(--accent-strong);
}

.empty {
  margin-top: 30px;
  padding: 26px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.note {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.news-load-trigger {
  height: 1px;
}

.news-load-trigger.is-loading::after {
  content: "Weitere News werden geladen...";
  display: block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.admin-nav {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  position: relative;
  z-index: 20;
}

.nav-link,
.nav-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid #c3d5ea;
  background: linear-gradient(180deg, #1c67ba 0%, #0b5fa5 100%);
  color: white;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(8, 31, 60, 0.14);
  cursor: pointer;
}

.nav-link:hover,
.nav-trigger:hover,
.nav-dropdown:hover .nav-trigger,
.nav-dropdown:focus-within .nav-trigger {
  background: linear-gradient(180deg, #0f5eaf 0%, #084d8d 100%);
  border-color: #0f5eaf;
}

.nav-dropdown {
  position: relative;
  padding-bottom: 12px;
  margin-bottom: -12px;
}

.nav-trigger {
  border: 1px solid #c3d5ea;
  font-family: inherit;
}

.nav-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
}

.nav-menu {
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  min-width: 220px;
  padding: 8px 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(8, 31, 60, 0.16);
  display: none;
  overflow: hidden;
}

.nav-dropdown:hover .nav-menu,
.nav-dropdown:focus-within .nav-menu {
  display: block;
}

.nav-menu-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-menu-item:hover,
.nav-menu-item:focus-visible {
  background: linear-gradient(180deg, #1c67ba 0%, #0b5fa5 100%);
  color: white;
}

.nav-dropdown-danger .nav-trigger {
  background: linear-gradient(180deg, #d35b5b 0%, #b23b3b 100%);
  border-color: rgba(178, 59, 59, 0.5);
}

.nav-link-danger {
  background: linear-gradient(180deg, #d35b5b 0%, #b23b3b 100%);
  border-color: rgba(178, 59, 59, 0.5);
}

.nav-link-danger:hover,
.nav-link-danger.active {
  background: linear-gradient(180deg, #c24b4b 0%, #9f3030 100%);
  border-color: #9f3030;
}

.nav-dropdown-danger .nav-trigger:hover,
.nav-dropdown-danger:hover .nav-trigger,
.nav-dropdown-danger:focus-within .nav-trigger {
  background: linear-gradient(180deg, #c24b4b 0%, #9f3030 100%);
  border-color: #9f3030;
}

.nav-menu-item-danger {
  color: var(--danger);
}

.tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--accent-strong);
  background: #f7faff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.tab-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.tab-danger:hover {
  background: #fdeceb;
}

.tab-danger.active {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.panel {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 14px 30px rgba(8, 31, 60, 0.08);
}

.grid > .panel {
  margin-top: 0;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.panel h2.section-title {
  margin-top: 0;
  padding-top: 0;
}

.panel.narrow {
  max-width: 540px;
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #f7faff;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.button {
  margin-top: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.button:hover { background: var(--accent-strong); }

.button-row {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.button-danger {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
}

.button-danger:hover { background: var(--danger-strong); }

.button-success {
  margin-top: 12px;
  background: #1f7a4a;
  color: white;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
}

.button-success:hover { background: #155c37; }

.danger {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.news-item {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.news-item:last-child { border-bottom: none; }

.news-title { font-weight: 600; margin-bottom: 6px; }

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.actions .button,
.actions .danger,
.actions .button-danger,
.actions .button-success {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
}

.actions a.link {
  font-size: 12px;
  line-height: 1.2;
}

.table {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child { border-bottom: none; }

.row.row-rss {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  align-items: stretch;
  gap: 14px;
}

.row-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  flex: 1;
}

.row-form input {
  min-width: 180px;
  flex: 1;
}

.rss-edit-block {
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: 8px;
}

.rss-row-form {
  gap: 8px;
}

.rss-row-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
  grid-row: 3;
}

.rss-row-actions form {
  margin: 0;
}

.rss-row-actions .button,
.rss-row-actions .button-danger,
.rss-row-actions .button-success,
.rss-row-actions .danger {
  margin-top: 0;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cell {
  min-width: 180px;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7faff;
  font-size: 14px;
  color: var(--ink);
}

.header-row {
  padding: 6px 0 10px;
  border-bottom: 1px solid var(--line);
}

.header-cell {
  flex: 1;
  min-width: 180px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.row .button,
.row .danger {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
}

.row .button-danger {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
}

.row .button-success {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
}

.row-inactive {
  opacity: 0.75;
}

.input-inactive {
  color: var(--danger);
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-row input {
  flex: 1;
}

.panel .search {
  margin-bottom: 12px;
}

.warning {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #f1c7a6;
  background: #fff3e8;
  color: #8a4b1f;
  font-weight: 600;
  font-size: 13px;
}

.spacer-bottom {
  margin-bottom: 16px;
}

.alert {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #f1c7a6;
  background: #fff3e8;
  color: #8a4b1f;
  font-weight: 600;
  font-size: 13px;
}

.success {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #b9e0c7;
  background: #e9f7ef;
  color: #1e5c3f;
  font-weight: 600;
  font-size: 13px;
}

.danger-text {
  color: var(--danger);
  border-color: #f2b3b3;
  background: #fdeaea;
}

.spacer-top {
  margin-top: 24px;
}

.spacer-bottom-lg {
  margin-bottom: 16px;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0 18px;
  font-size: 13px;
  color: var(--muted);
}

.checkbox input { margin-top: 2px; }

.checkbox-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.checkbox-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7faff;
}

.checkbox-item input {
  margin-top: 2px;
}

.checkbox-item-inactive {
  opacity: 0.6;
}

.checkbox-item .meta {
  display: block;
}

.checkbox-item-compact {
  padding: 8px 10px;
  margin-bottom: 8px;
}

.routing-table {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 12px 16px;
  align-items: start;
}

.routing-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.routing-feed {
  padding-top: 4px;
}

.routing-feed-name {
  font-weight: 700;
  color: var(--ink);
}

.routing-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.routing-badge-inactive {
  color: #8c2c2c;
  background: #fdeaea;
  border: 1px solid #f2b3b3;
}

.routing-feed-url {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.routing-channels {
  display: block;
}

.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.stat:last-child { border-bottom: none; }

.stat.api-stat {
  display: block;
}

.stat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
  width: 100%;
}

.stat-gap {
  height: 18px;
}

.stat-link .label {
  color: var(--muted);
}

.stat-link .value {
  color: var(--accent-strong);
}

.stat-link:hover .label,
.stat-link:hover .value {
  color: var(--accent);
}

.label {
  font-size: 13px;
  color: var(--muted);
}

.value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-strong);
}

.row.is-alert .cell {
  color: #cc1f1a;
  font-weight: 800;
}

.stat.is-alert .label,
.stat.is-alert .value {
  color: #cc1f1a;
  font-weight: 800;
}

.rss-status-card {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f9fbfe;
}

.rss-status-card-compact {
  width: 100%;
  padding: 10px 12px;
}

.rss-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.rss-status-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.rss-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: lowercase;
}

.rss-badge-ok,
.rss-badge-filtered {
  color: #1e5c3f;
  background: #e9f7ef;
  border: 1px solid #b9e0c7;
}

.rss-badge-fetch_error,
.rss-badge-parse_error,
.rss-badge-unsafe,
.rss-badge-unknown {
  color: #8c2c2c;
  background: #fdeaea;
  border: 1px solid #f2b3b3;
}

.rss-status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.rss-status-error {
  margin-top: 8px;
  font-size: 11px;
  color: var(--danger);
  word-break: break-word;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 760px) {
  .search { width: 100%; }
  .search input { flex: 1; min-width: 0; }
  .search select { min-width: 0; }
  .routing-table { grid-template-columns: 1fr; }
  .row.row-rss { grid-template-columns: 1fr; }
  .admin-nav {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-link,
  .nav-dropdown,
  .nav-trigger {
    width: 100%;
  }
  .nav-dropdown {
    padding-bottom: 0;
    margin-bottom: 0;
  }
  .nav-menu {
    position: static;
    width: 100%;
    margin-top: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .section,
  .grid { animation: none; }
}
