:root{ --blue:#9fb2ff; --blue-700:#1d4ed8; --blue-800:#1e40af; --bg:#0b1020; --panel:#111733; --border:#243056; --text:#e7ecff; --muted:#9aa4c0; }

*{ box-sizing:border-box }

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif
}
a{color:#9fb2ff;text-decoration:none}
.th {color:var(--blue);text-decoration:none}
a:hover{text-decoration:underline}

header{border-bottom:1px solid #223}
.wrap{ max-width:1200px; margin:0 auto; padding-inline:clamp(10px,2vw,24px) }
.container{ max-width:1260px; margin:24px auto; padding-inline:clamp(10px,2vw,16px) }

.header-inner{ padding:16px 0; display:flex; align-items:center; gap:12px; flex-wrap:nowrap }
.spacer{ flex:1 }

/* Badges + Buttons */
.badge{ font-size:12px; padding:2px 8px; border-radius:999px; background:#1d2747; border:1px solid #2d3a62; white-space:nowrap; color:#e7ecff }
.badge-ok{ background:#0b1220; border-color:#1f6b45; color:#8ee0b1 }

/* Info „i“ — jetzt kleiner & komplett blau */
.tt{
  display:inline-flex; align-items:center; justify-content:center;
  width:16px; height:16px; border-radius:50%;
  background:var(--blue-800); color:#fff; border:1px solid var(--blue);
  font-style:italic; font-weight:700; font-size:11px; line-height:1;
  margin-left:8px; cursor:help; user-select:none;
}
.tt-bubble{
  position:fixed; transform:translate(-50%, calc(-100% - 8px));
  max-width:360px; background:#0b1220; color:#cfe2ff;
  border:1px solid var(--blue); padding:10px 12px; border-radius:10px;
  font-size:13px; box-shadow:0 8px 24px rgba(0,0,0,.35); z-index:50;
}

/* Cards / Panels */
.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:14px 16px;
  box-shadow:0 8px 32px rgba(0,0,0,.35)
}
.card-muted{ opacity:.6 }

.card-h{ display:flex; align-items:center; gap:10px; margin-bottom:8px }
.card-h h3{ color:#e2e8f0; font-size:16px; font-weight:700; margin:0 }

.kv{ display:flex; justify-content:space-between; font-size:14px; color:#cbd5e1; padding:2px 0 }
.kv .k{ color:#93a4b5 }

/* Grids */
.status-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:20px }
.grid-2{ display:grid; grid-template-columns:49.4% 49.4%; gap:16px }

/* Tabellenlose Listen für die Panels unten */
.list{ display:flex; flex-direction:column; gap:8px }
.list-head{ display:grid; gap:8px; padding:8px 12px; border-top:0px none var(--border); border-bottom:1px solid var(--border); color:#93a4b5; font-weight:600; font-size:13px }
.list-row{ display:grid; gap:0px; padding:10px 12px; border-bottom:1px solid var(--border); font-size:14px; color:#d1d9e6 }

/* Spaltentemplates */
.list--entities .list-head, .list--entities .list-row { grid-template-columns:1fr .6fr .6fr .6fr 1fr }
.list--buckets  .list-head, .list--buckets  .list-row { grid-template-columns:1.2fr .7fr .7fr .6fr 1fr }
.grid-latest{ grid-template-columns:1.3fr 1fr 4fr }
.grid-sources{ grid-template-columns:2fr 3fr .7fr 1.6fr }

/* Responsive */
@media (max-width:1199px){
  .status-grid{ grid-template-columns:repeat(2,1fr) }
  .grid-2{ grid-template-columns:1fr }
}
@media (max-width:780px){
  .list-row{ font-size:13.5px }
}
@media (max-width:640px){
  .status-grid{ grid-template-columns:1fr }
  .list-head, .list-row{ padding:10px }
  .card-h h3{ font-size:15px }
}
/* kompakter Rand auf Phone */
.container { max-width:1200px; margin:24px auto; padding:0 16px; }
@media (max-width: 480px){
  .container { padding: 0 10px; }
}

/* Tooltip-Icon (kleiner, vollblau) */
.tooltip-dot{
  display:inline-flex; align-items:center; justify-content:center;
  width:18px; height:18px; border-radius:999px;
  background:#2563eb; color:#fff; font-style:italic; font-weight:600;
  font-size:12px; line-height:1;
}

/* 4-spaltig auf Desktop, 1-spaltig auf Phone */
.cards-grid{
  display:grid; gap:12px;
  grid-template-columns: repeat(4, minmax(0,1fr));
}
@media (max-width: 1024px){
  .cards-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px){
  .cards-grid{ grid-template-columns: 1fr; }
}
/* ===== Card-Listen ohne Tabellen ===== */
.card-list { display: block; width: 100%; }

.card-list .head,
.card-list .row {
  display: grid;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  border-top: 1px solid var(--line, #1e293b);
}

/* Top Entities: Entity | Score | Events | Eff. score | Last seen */
.grid-entities { 
  grid-template-columns: 1fr 110px 100px 120px 200px;
}

/* Top Buckets: Bucket | Avg score (30d) | Events (30d) | Entities | Last seen */
.grid-buckets { 
  grid-template-columns: 1fr 140px 120px 100px 200px;
}

.card-list .head {
  color: var(--muted, #93a4b5);
  font-weight: 600;
  font-size: .9rem;
}

.card-list .row { color: var(--fg, #d1d9e6); }

/* Sortierbare Header */
.sortable { cursor: pointer; user-select: none; position: relative; }
.sortable .sort-ico { opacity: .55; font-size: .85em; margin-left: .25rem; }
.sortable[data-sort-dir="asc"] .sort-ico::after  { content: "▲"; }
.sortable[data-sort-dir="desc"] .sort-ico::after { content: "▼"; }

/* Links in den Listen */
.card-list a { color: #60a5fa; text-decoration: none; }
.card-list a:hover { text-decoration: underline; }

/* Responsive Reduktion: Header bleibt sauber, Spalten werden reduziert */
@media (max-width: 1100px) {
  .grid-entities { grid-template-columns: 1fr 90px 90px 110px 160px; }
  .grid-buckets  { grid-template-columns: 1fr 120px 100px 90px 160px; }
}
@media (max-width: 900px) {
  .grid-entities { grid-template-columns: 1fr 90px 90px 160px; }
  .grid-entities .col-eff { display: none; }

  .grid-buckets  { grid-template-columns: 1fr 120px 100px 160px; }
  .grid-buckets .col-entities { display: none; }
}
@media (max-width: 680px) {
  .grid-entities { grid-template-columns: 1fr 90px 160px; }
  .grid-entities .col-events { display: none; }

  .grid-buckets  { grid-template-columns: 1fr 120px 160px; }
  .grid-buckets .col-events { display: none; }
}
.list-head .th { font-weight: 600; opacity: .9; }


/* ===========================================================
   GRID / LIST HEADER FIX
   (stellt sicher, dass Header-Zeilen über Inhalt sauber sitzen)
   =========================================================== */

.list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Header-Zeile (Top Entities / Top Buckets etc.) */
.list-head {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 5 Spalten, passe ggf. an */
  align-items: center;        /* vertikal mittig */
  /* background-color: rgba(255,255,255,0.05); */
  /* border-bottom: 1px solid rgba(255,255,255,0.08);*/
  padding: 6px 10px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #cbd5e1;
}

/* Die Spaltenköpfe selbst */
.list-head .th {
  text-align: left;
  padding: 6px 8px; 
  line-height: 1.3;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

/* Hover- oder Sortierzustand */
.list-head .th:hover {
  color: #60a5fa;
}

/* Optional: aktives Sortier-Icon */
.list-head .th[data-dir="asc"]::after {
  content: " ▲";
  font-size: 0.75em;
}
.list-head .th[data-dir="desc"]::after {
  content: " ▼";
  font-size: 0.75em;
}

/* Body-Zeilen */
.list-body .list-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Zellen */
.list-body .cell {
  padding: 4px 8px;
  line-height: 1.3;
}

/* Zahlen und Datum rechtsbündig */
.list-body .num,
.list-body .ts {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Erste Spalte (z. B. Entity/Bucket) leicht hervorheben */
.list-body .entity a,
.list-body .bucket a {
  color: #60a5fa;
  text-decoration: underline;
}
.list-body .entity a:hover,
.list-body .bucket a:hover {
  text-decoration: underline;
}

/* Mobil: Header als kompakter Stack */
@media (max-width: 768px) {
  .list-head {
    grid-template-columns: repeat(3, 1fr);
    font-size: 0.8rem;
  }
  .list-body .list-row {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* Gemeinsame Basis */
.list-head,
.list > * {                 /* jede Zeile */
  display: grid;
  align-items: center;
  column-gap: .75rem;
  box-sizing: border-box;
}

.list-head > *,
.list > * > * {             /* Zellen */
  padding: 10px 12px;
  box-sizing: border-box;
}

/* ===== Top Entities ===== */
.list-head.list--entities,
.list.list--entities > * {
  /*grid-template-columns: 3fr 1fr 1fr 1.3fr 2fr; /* Entity | Score | Events | Eff.score | Last seen */
}

/* ===== Top Buckets ===== */
.list-head.list--buckets,
.list.list--buckets > * {
  grid-template-columns: 3fr 1fr 1fr 1fr 2fr;   /* Bucket | Avg score | Events | Entities | Last seen */
}

/* ===== Latest Events ===== */
.list-head.latest,
#latest_rows > * {
  grid-template-columns: 1.2fr 1fr 4fr;         /* Published | Source | Title */
}

/* ===== Sources Glossary ===== */
.list-head.sources,
#sources_rows > * {
  grid-template-columns: 2fr 3fr 1fr 2fr;   /* Name | URL | Status | Score | Tags */
}

/* Breiten Quellen Glossar */
.th .head_sources_name{ min-width:90px; }
#panel_sources .col1 { min-width:100px; }
#panel_sources .col2 { width:225px; }

/* Breiten Latest events */
#panel_latest .th { min-width:110px; }
#latest_rows .col1 { min-width:100px; }
#latest_rows .col2 { min-width:125px; }


/* Optik: Header klarer als Daten */
.list-head > * {
  font-weight: 600;
  /* background: rgba(255,255,255,0.06);*/
  border-radius: 6px;
}

/* Optional: gleiche Zeilenhöhe & Trennlinien */
.list > * {
  min-height: 44px;
  /*border-bottom: 1px solid rgba(255,255,255,0.06);*/
}
.list > *:last-child { border-bottom: 0; }

/* Responsive Feinschnitt (nur Header/Zeilen, rest bleibt unberührt) */
@media (max-width: 900px) {
  .list-head.list--entities,
  .list.list--entities > * { grid-template-columns: 2fr .9fr .9fr 1.1fr 1.7fr; }

  .list-head.list--buckets,
  .list.list--buckets > *   { grid-template-columns: 2fr .9fr .9fr .9fr 1.7fr; }
}
@media (max-width: 640px) {
  .list-head.list--entities,
  .list.list--entities > *,
  .list-head.list--buckets,
  .list.list--buckets > * { column-gap: .5rem; padding-left: 6px; padding-right: 6px; }
}

/* Links in Listen gut sichtbar + klickbar */
.list .td a.link,
.list-row a.link {
  color: #60a5fa;
  text-decoration: none;
}
.list .td a.link:hover,
.list-row a.link:hover {
  text-decoration: underline;
}

/* Klickbare Header optisch markieren (ohne Layoutänderungen) */
.list-head .th,
.list-head.list--buckets > div {
  user-select: none;
}
.link { color: var(--blue-400); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Explore event insight cards */
.explore-event-card {
  display: block;
  margin: 12px 0;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.28);
}

.explore-event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.88rem;
  opacity: 0.88;
}

.explore-event-title {
  margin: 0 0 10px 0;
  line-height: 1.35;
  font-size: 1.03rem;
}

.explore-event-summary {
  margin: 0 0 12px 0;
  line-height: 1.5;
  opacity: 0.92;
}

.explore-insight,
.explore-terms {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
  margin-top: 8px;
  line-height: 1.45;
}

.terms-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-badge,
.score-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.10);
}

.muted {
  opacity: 0.72;
}

@media (max-width: 760px) {
  .explore-insight,
  .explore-terms {
    grid-template-columns: 1fr;
  }
}

/* Explore event insight cards v2 */
#panel_explore .list {
  display: block;
}

.explore-event-card {
  margin: 14px 0;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.34);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.explore-event-card:hover {
  border-color: rgba(148, 163, 184, 0.38);
  background: rgba(15, 23, 42, 0.42);
}

.explore-event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  opacity: 0.9;
}

.explore-event-meta > span {
  display: inline-flex;
  align-items: center;
}

.explore-event-title {
  margin: 0 0 12px 0;
  font-size: 1.08rem;
  line-height: 1.35;
  font-weight: 700;
}

.explore-event-title a {
  color: inherit;
  text-decoration: none;
}

.explore-event-title a:hover {
  text-decoration: underline;
}

.explore-event-summary {
  margin: 0 0 14px 0;
  padding: 10px 12px;
  border-left: 3px solid rgba(148, 163, 184, 0.42);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  line-height: 1.52;
  opacity: 0.95;
}

.explore-insight,
.explore-terms {
  display: grid;
  grid-template-columns: 125px minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.22);
  line-height: 1.45;
}

.explore-insight strong,
.explore-terms strong {
  opacity: 0.78;
  font-size: 0.86rem;
}

.terms-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-badge,
.score-pill,
.explore-event-meta .badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.78rem;
  line-height: 1.2;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.12);
  white-space: nowrap;
}

.score-pill {
  font-weight: 700;
}

.muted {
  opacity: 0.68;
}

@media (max-width: 760px) {
  .explore-event-card {
    padding: 14px;
    border-radius: 15px;
  }

  .explore-insight,
  .explore-terms {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .explore-event-title {
    font-size: 1rem;
  }
}

/* Explore compact insight rows v3 */
#panel_explore .list {
  display: block;
}

.explore-event-item {
  margin: 9px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.explore-event-item:last-child {
  border-bottom: 0;
}

.explore-event-item > summary {
  list-style: none;
}

.explore-event-item > summary::-webkit-details-marker {
  display: none;
}

.explore-event-row {
  display: grid;
  grid-template-columns: 22px 128px 145px minmax(240px, 1fr) 190px;
  gap: 10px;
  align-items: center;
  padding: 11px 8px;
  cursor: pointer;
  border-radius: 10px;
}

.explore-event-row:hover {
  background: rgba(148, 163, 184, 0.08);
}

.explore-toggle {
  opacity: 0.65;
  transition: transform 0.15s ease;
}

.explore-event-item[open] .explore-toggle {
  transform: rotate(90deg);
}

.explore-row-date,
.explore-row-source,
.explore-row-meta {
  font-size: 0.82rem;
  opacity: 0.78;
}

.explore-row-title {
  font-weight: 650;
  line-height: 1.35;
}

.explore-row-meta {
  text-align: right;
  white-space: nowrap;
}

.explore-event-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.8fr);
  gap: 18px;
  padding: 6px 12px 18px 40px;
}

.explore-detail-main {
  display: grid;
  gap: 12px;
}

.explore-section {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.30);
}

.explore-section-important {
  background: rgba(30, 41, 59, 0.42);
}

.explore-section h4 {
  margin: 0 0 6px 0;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
  opacity: 0.84;
}

.explore-section p {
  margin: 0;
  line-height: 1.55;
  opacity: 0.96;
}

.explore-detail-side {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.22);
  font-size: 0.88rem;
}

.explore-detail-side div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  line-height: 1.35;
}

.explore-detail-side strong {
  opacity: 0.62;
  font-weight: 600;
}

.explore-detail-side span {
  opacity: 0.93;
}

.explore-article-link {
  display: inline-flex;
  margin-top: 4px;
  text-decoration: none;
  font-weight: 650;
}

.explore-article-link:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .explore-event-row {
    grid-template-columns: 22px 110px minmax(0, 1fr);
  }

  .explore-row-source,
  .explore-row-meta {
    grid-column: 2 / -1;
    text-align: left;
  }

  .explore-event-detail {
    grid-template-columns: 1fr;
    padding-left: 12px;
  }
}

@media (max-width: 560px) {
  .explore-event-row {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .explore-row-date,
  .explore-row-source,
  .explore-row-meta {
    grid-column: 2 / -1;
  }

  .explore-detail-side div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Explore compact layout v4: left meta box, text aligned with title column */
@media (min-width: 901px) {
  .explore-event-detail {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 13px;
    padding: 6px 12px 18px 40px;
  }

  .explore-detail-side {
    order: 1;
    width: 280px;
    max-width: 280px;
    padding: 10px 12px;
    font-size: 0.84rem;
    background: rgba(2, 6, 23, 0.18);
  }

  .explore-detail-main {
    order: 2;
    min-width: 0;
  }

  .explore-detail-side div {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
  }

  .explore-detail-side span {
    overflow-wrap: anywhere;
  }

  .explore-article-link {
    margin-left: 82px;
    align-self: start;
  }
}

/* More restrained tags and score display */
.explore-row-meta {
  opacity: 0.74;
  font-weight: 500;
}

.explore-detail-side {
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.explore-detail-side strong {
  opacity: 0.58;
}

.explore-detail-side span {
  opacity: 0.88;
}

.score-pill,
.mini-badge,
.explore-event-meta .badge {
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.terms-wrap {
  gap: 4px;
}

.mini-badge:not(:last-child)::after {
  content: "·";
  margin-left: 4px;
  opacity: 0.55;
}

/* Explore layout v5: quiet left metadata column */
@media (min-width: 901px) {
  .explore-event-detail {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 13px;
    padding: 6px 12px 18px 40px;
  }

  .explore-detail-side {
    order: 1;
    width: 280px;
    max-width: 280px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 0.86rem;
    line-height: 1.42;
  }

  .explore-detail-main {
    order: 2;
    min-width: 0;
  }
}

.explore-detail-side {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.explore-detail-side div {
  display: block !important;
  grid-template-columns: none !important;
}

.explore-side-line {
  margin: 0 0 7px 0;
  opacity: 0.82;
}

.explore-side-bucket {
  opacity: 0.94;
  font-weight: 650;
}

.explore-side-score {
  opacity: 0.94;
  font-weight: 650;
}

.explore-side-muted {
  margin-top: 10px;
  opacity: 0.62;
  font-size: 0.82rem;
}

.explore-article-row {
  margin-top: 10px !important;
}

.explore-article-link {
  margin-left: 0 !important;
  align-self: auto !important;
  font-weight: 650;
}

@media (max-width: 900px) {
  .explore-detail-side {
    padding: 0;
    border: 0;
    background: transparent;
  }
}

/* Explore layout v6 refinements */
.explore-side-score {
  font-weight: 400 !important;
}

.explore-side-bucket {
  font-weight: 650 !important;
}

.explore-section-important {
  background: transparent !important;
  padding-top: 4px;
}

.explore-article-link {
  color: rgba(205, 225, 255, 0.92) !important;
}

.explore-article-link:hover {
  color: rgba(225, 238, 255, 0.98) !important;
}

.explore-side-muted {
  line-height: 1.58 !important;
  margin-top: 12px !important;
}

/* Explore layout v7 final spacing refinements */
.explore-event-row {
  padding: 12px 8px 15px 8px !important;
}

.explore-event-detail {
  padding-top: 12px !important;
}

.explore-side-line,
.explore-side-block {
  margin: 0 0 7px 0;
}

.explore-side-block {
  display: block !important;
}

.explore-side-label {
  display: block;
  margin: 0 0 3px 0;
  opacity: 0.62;
  font-size: 0.82rem;
  line-height: 1.35;
}

.explore-side-text {
  display: block;
  opacity: 0.86;
  line-height: 1.55;
}

.explore-side-muted {
  margin-top: 7px !important;
  opacity: 0.76 !important;
}

.explore-side-muted .explore-side-text {
  line-height: 1.62;
  opacity: 0.72;
}
