:root {
  --bg: #0b0f14;
  --bg-2: #10161d;
  --card: #141b24;
  --card-2: #182130;
  --border: #232f3e;
  --text: #e8eef4;
  --muted: #8fa1b3;
  --turquoise: #2dd4bf;
  --blue: #3b82f6;
  --white: #ffffff;
  --danger: #f87171;
  --radius: 14px;
}

/* Akzentfarben dezenter, aber im gesamten UI sichtbar */
input, select, textarea { accent-color: var(--turquoise); }
.topbar { border-bottom: 2px solid transparent; border-image: linear-gradient(90deg, var(--turquoise), var(--blue), transparent) 1; }
.panel-head h2, .card-head h2 { padding-left: 10px; border-left: 3px solid var(--turquoise); }
.feed li { transition: border-color .15s ease, transform .15s ease; }
.feed li:hover { border-color: var(--turquoise); transform: translateX(2px); }
.widget { transition: border-color .15s ease; }
.widget:hover { border-color: var(--blue); }
.modal-head h2 { padding-bottom: 6px; border-bottom: 2px solid var(--turquoise); }
.views button.active { box-shadow: 0 0 12px rgba(45,212,191,.25); }
.refresh-count { text-shadow: 0 0 10px var(--turquoise); }
.ghost-btn:hover { box-shadow: 0 0 8px rgba(45,212,191,.3); }
.primary-btn { box-shadow: 0 4px 18px rgba(59,130,246,.35); }
.key-indicator.ok { border-color: var(--turquoise); color: var(--turquoise); }
.key-indicator.ok .dot { background: var(--turquoise); box-shadow: 0 0 8px var(--turquoise); }
.event-filters button.active { border-color: var(--turquoise); }
.continent-chips button.active { border-color: var(--turquoise); color: var(--turquoise); }

/* Akzent-Farbschemata (jeweils Akzent + dezente Sekundär-Abstufung wie im Blau-Schema) */
html[data-accent="blau"]  { --turquoise: #2dd4bf; --blue: #3b82f6; }
html[data-accent="rot"]   { --turquoise: #fb7185; --blue: #ef4444; }
html[data-accent="gruen"] { --turquoise: #34d399; --blue: #22c55e; }
html[data-accent="lila"]  { --turquoise: #a78bfa; --blue: #8b5cf6; }
html[data-accent="gelb"]  { --turquoise: #fbbf24; --blue: #f59e0b; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: linear-gradient(180deg, #0e141c, #0b0f14);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 36px; height: 36px; }
.brand h1 {
  margin: 0;
  font-size: 20px;
  background: linear-gradient(90deg, var(--turquoise), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub { font-size: 12px; color: var(--muted); }

.views { display: flex; gap: 6px; flex-wrap: wrap; }
.views button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s ease;
}
.views button:hover { color: var(--text); border-color: var(--turquoise); }
.views button.active {
  background: linear-gradient(90deg, rgba(45,212,191,.18), rgba(59,130,246,.18));
  border-color: var(--turquoise);
  color: var(--turquoise);
  font-weight: 600;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.refresh-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
}
.refresh-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.refresh-count { font-size: 16px; font-weight: 700; color: var(--turquoise); font-variant-numeric: tabular-nums; }

.icon-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
}
.icon-btn:hover { border-color: var(--turquoise); color: var(--turquoise); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 16px;
  padding: 16px 20px;
  max-width: 1500px;
  margin: 0 auto;
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}

.panel-head, .card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.panel-head h2, .card-head h2 { margin: 0; font-size: 17px; }
.panel-head .ghost-btn { margin-left: auto; }

.region-badge {
  background: rgba(45,212,191,.15);
  color: var(--turquoise);
  border: 1px solid var(--turquoise);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
}
.ghost-btn:hover { color: var(--turquoise); border-color: var(--turquoise); }

.primary-btn {
  background: linear-gradient(90deg, var(--turquoise), var(--blue));
  border: none;
  color: #06121a;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 10px;
}
.primary-btn:hover { filter: brightness(1.1); }

/* ---------- Feed ---------- */
.feed-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 60vh;
}
.feed-status { font-size: 12px; color: var(--muted); margin-bottom: 8px; min-height: 16px; }
.feed-status.loading { color: var(--turquoise); }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.feed li {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 10px;
  padding: 12px 14px;
  animation: fadeIn .3s ease;
}
.feed li.cat-politik { border-left-color: #f59e0b; }
.feed li.cat-wirtschaft { border-left-color: var(--turquoise); }
.feed li.cat-technik { border-left-color: #a78bfa; }
.feed li.cat-sport { border-left-color: #34d399; }
.feed li.cat-allgemein { border-left-color: var(--blue); }
.feed li h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.35; }
.feed li h3 a.headline { color: var(--text); text-decoration: none; }
.feed li h3 a.headline:hover { color: var(--turquoise); }
.feed li p { margin: 0 0 8px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.feed-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.feed-meta .src { color: var(--turquoise); font-weight: 600; }
a.src { color: var(--turquoise); text-decoration: none; }
a.src:hover { text-decoration: underline; }
.widget li a { color: var(--text); text-decoration: none; }
.widget li a:hover { color: var(--turquoise); text-decoration: underline; }
.feed-meta .tag {
  background: rgba(59,130,246,.15);
  color: #93c5fd;
  padding: 1px 8px;
  border-radius: 999px;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Side panel ---------- */
.side-panel { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.switch { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; margin-left: auto; }
.switch input { accent-color: var(--turquoise); }

.continent-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.continent-chips button {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.continent-chips button:hover { border-color: var(--blue); color: var(--text); }
.continent-chips button.active {
  background: rgba(45,212,191,.15);
  border-color: var(--turquoise);
  color: var(--turquoise);
  font-weight: 600;
}

.map-wrap { position: relative; background: #0a1420; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
#worldMap { cursor: grab; touch-action: none; }
#worldMap.dragging { cursor: grabbing; }
#worldMap { width: 100%; height: 340px; }
#worldMap svg { display: block; }
#worldMap .jvm-region { cursor: pointer; }
#worldMap .jvm-marker { cursor: pointer; }
.map-fallback { padding: 16px; color: var(--muted); font-size: 13px; }
.map-fallback select { margin-left: 8px; background: var(--bg-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px; }

.map-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.event-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.event-filters button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.event-filters button .cnt { color: var(--muted); font-weight: 700; }
.event-filters button.active { border-color: var(--turquoise); color: var(--text); background: rgba(45,212,191,.12); }
.event-filters button.active .cnt { color: var(--turquoise); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.dot.quake { background: #fbbf24; }
.dot.fire { background: #f97316; }
.dot.storm { background: #38bdf8; }
.dot.volcano { background: #ef4444; }
.dot.flood { background: #60a5fa; }
.event-count { margin-top: 6px; font-size: 11px; color: var(--muted); }

.ev-marker { cursor: default; }
.ev-marker.linked { cursor: pointer; }
.ev-marker circle { stroke: rgba(255,255,255,.7); stroke-width: 1; }
.ev-marker:hover circle { stroke: #fff; stroke-width: 2; }

/* ---------- Widgets ---------- */
.widgets { display: grid; grid-template-columns: 1fr; gap: 10px; }
.widget {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.widget-head { display: flex; align-items: center; margin-bottom: 8px; }
.widget-head h3 { margin: 0; font-size: 13px; color: var(--turquoise); }
.widget-head .remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.widget-head .remove:hover { color: var(--danger); }
.stock-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.stock-row:last-child { border-bottom: none; }
.stock-row .sym { font-weight: 700; }
.stock-row .up { color: #34d399; }
.stock-row .down { color: var(--danger); }
.stock-row .flat { color: var(--muted); }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { font-size: 12px; padding: 5px 0; border-bottom: 1px dashed var(--border); line-height: 1.35; }
.widget li:last-child { border-bottom: none; }
.widget li .t { color: var(--muted); font-size: 10px; margin-right: 6px; }
.widget .empty { font-size: 12px; color: var(--muted); }

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(4,8,12,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-2);
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 16px 18px; }
.modal-body h3 { margin: 18px 0 8px; font-size: 14px; color: var(--turquoise); }
.modal-body h3:first-child { margin-top: 0; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.field input, .field select, .sched-row input {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--turquoise); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.key-status { font-size: 12px; font-weight: 600; }
.key-status.ok { color: #34d399; }
.key-status.bad { color: var(--danger); }
.key-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
}
.key-indicator .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.key-indicator.ok { color: #34d399; border-color: #34d399; }
.key-indicator.ok .dot { background: #34d399; box-shadow: 0 0 8px #34d399; }
.key-indicator.bad { color: var(--danger); border-color: var(--danger); }
.key-indicator.bad .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.key-indicator.checking .dot { background: #fbbf24; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.sched-row { display: flex; gap: 8px; margin-bottom: 8px; }
.sched-row input { flex: 1; }
.sched-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sched-list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sched-list li button { background: none; border: none; color: var(--danger); cursor: pointer; }

.src-group { margin-bottom: 14px; }
.src-group h3 { margin: 0 0 6px; font-size: 13px; color: var(--blue); }
.src-group ul { margin: 0; padding-left: 16px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.src-group a { color: var(--turquoise); text-decoration: none; }
.src-group a:hover { text-decoration: underline; }

/* ---------- Toast & summary ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-2);
  border: 1px solid var(--turquoise);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
  max-width: 90vw;
}
#summaryBody ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
#summaryBody .sum-head { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
