:root {
  --bg: #0b0d11;
  --bg-2: #0f1218;
  --card: #151922;
  --card-2: #10131a;
  --line: #232935;
  --line-2: #2e3644;
  --text: #e9ebf0;
  --muted: #8992a5;
  --accent: #ffb020;
  --ok: #45c47a;
  --err: #ef5f5f;
  --run: #4aa8ff;
  --warn: #ffb020;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 15% -10%, #1a2030 0%, transparent 60%),
    radial-gradient(900px 400px at 95% 0%, #201a26 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--err); min-height: 18px; margin: 6px 0 0; font-size: 13px; }
.ok { color: var(--ok); font-size: 12px; margin-left: 10px; }
.spacer { flex: 1; }
h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.2px; }
h3 { margin: 22px 0 8px; font-size: 14px; color: var(--muted);
     text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
a { color: var(--run); }

/* ---------------- Kopfzeile ---------------- */
header {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 13, 17, .86);
  backdrop-filter: blur(12px);
}
header > strong { color: var(--accent); letter-spacing: .2px; font-size: 15px; }
#tabs { display: flex; gap: 2px; }
#tabs button {
  margin: 0; padding: 7px 14px; border: none; background: none;
  color: var(--muted); border-radius: 8px; font: inherit; font-size: 14px;
  cursor: pointer;
}
#tabs button:hover { color: var(--text); background: #171b24; }
#tabs button.on { color: var(--accent); background: #1d212c; }

main { max-width: 1180px; margin: 0 auto; padding: 22px; }
.view { display: flex; flex-direction: column; gap: 18px; }

/* ---------------- Karten ---------------- */
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card.empty { text-align: center; padding: 46px 22px; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 6px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ---------------- Formulare ---------------- */
label { display: block; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
label.row { display: flex; align-items: center; gap: 8px; }
label.row span { color: var(--text); font-size: 14px; }
input[type=text], input:not([type]), input[type=password], textarea, select {
  width: 100%; margin-top: 5px; padding: 9px 11px;
  background: #0c0f15; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  font: inherit; resize: vertical;
}
select { width: auto; margin-top: 0; cursor: pointer; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

button {
  margin-top: 16px; padding: 9px 16px; border-radius: 9px;
  border: 1px solid var(--line-2); background: #1c212b; color: var(--text);
  font: inherit; cursor: pointer; transition: border-color .12s, background .12s;
}
button:hover { border-color: var(--accent); }
button.primary {
  background: linear-gradient(180deg, #ffc043, var(--accent));
  color: #17191e; border-color: transparent; font-weight: 650;
}
button.primary:disabled { opacity: .35; cursor: not-allowed; }
button.ghost { margin: 0; background: none; border-color: var(--line); }
button.small { margin: 0; padding: 6px 11px; font-size: 13px; }
.link-btn {
  margin: 10px 0 0; padding: 0; border: none; background: none;
  color: var(--run); font-size: 12px; cursor: pointer; text-align: left;
}

.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate .card { width: 100%; max-width: 340px; }
.gate h1 { font-size: 24px; color: var(--accent); margin: 0 0 2px; }

/* ---------------- Kanäle ---------------- */
.targets { display: grid; gap: 10px; margin-top: 12px; }
.target {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px;
  background: #10131a;
}
.target .name { font-weight: 600; }
.target .sub { font-size: 12px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(69,196,122,.6); }
.dot.warn { background: var(--accent); }
.dot.off { background: #333b49; }
.dot.err { background: var(--err); }

.redirects { margin: 12px 0 4px; }
.redirects code {
  display: block; margin: 4px 0; padding: 7px 10px;
  background: #0c0f15; border: 1px solid var(--line); border-radius: 7px;
  font-size: 12px; color: var(--run); overflow-x: auto; white-space: nowrap;
}
.ov-head {
  margin: 18px 0 2px; font-size: 12px; font-weight: 700; color: var(--accent);
  border-bottom: 1px solid var(--line); padding-bottom: 5px;
  text-transform: uppercase; letter-spacing: .5px;
}

/* ---------------- Posten ---------------- */
.drop {
  margin-top: 12px; padding: 30px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line-2); border-radius: 12px; background: #0f131a;
  transition: border-color .12s, background .12s;
}
.drop.over, .drop:hover { border-color: var(--accent); background: #171c26; }
.drop p { margin: 4px 0; }

.pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px; border: 1px solid var(--line-2); border-radius: 20px;
  background: #10131a; cursor: pointer; font-size: 13px; user-select: none;
  margin: 0;
}
.chip.on { border-color: var(--accent); color: var(--accent); background: #1d1a12; }
.chip.disabled { opacity: .35; cursor: not-allowed; }

details { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; font-size: 14px; }
.ov { margin-top: 12px; padding-left: 12px; border-left: 2px solid var(--line); }
.ov strong { font-size: 13px; }

.jobs { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.job { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: #10131a; }
.job .head { display: flex; gap: 10px; align-items: baseline; }
.job .head .when { color: var(--muted); font-size: 12px; }
.res { display: flex; gap: 8px; align-items: center; margin-top: 7px; font-size: 13px; }
.res .lbl { min-width: 130px; }
.st { font-size: 12px; }
.st.done { color: var(--ok); }
.st.error { color: var(--err); }
.st.running, .st.queued { color: var(--run); }
.st.pending { color: var(--accent); }

/* ---------------- KPI-Karten ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.kpi {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.kpi::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--accent);
}
.kpi::after {
  content: ""; position: absolute; top: -40px; right: -40px;
  width: 130px; height: 130px; border-radius: 50%;
  background: var(--accent); opacity: .07;
}
.kpi-name { font-size: 12px; color: var(--muted); text-transform: uppercase;
            letter-spacing: .7px; font-weight: 600; }
.kpi-big { font-size: 32px; font-weight: 700; letter-spacing: -1px; margin-top: 4px; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.kpi-cell { display: flex; flex-direction: column; }
.kpi-cell .k { font-size: 11px; color: var(--muted); }
.kpi-cell .v { font-size: 15px; font-weight: 600; }

/* ---------------- Diagramme ---------------- */
.chart-host { position: relative; margin-top: 14px; }
.chart { width: 100%; display: block; height: auto; }
.chart-empty { color: var(--muted); font-size: 13px; padding: 30px 0; text-align: center; }
.grid { stroke: #1e2430; stroke-width: 1; }
.grid-base { stroke: #2b3342; stroke-width: 1; }
.axis { fill: var(--muted); font-size: 12px; font-family: inherit; }
.crosshair { stroke: #46506a; stroke-width: 1; stroke-dasharray: 3 3; }
.hover-dot { pointer-events: none; }
.drop-band { fill: rgba(239, 95, 95, .13); }
.drop-label { fill: var(--err); font-size: 12px; font-weight: 700; font-family: inherit; }
.hook-line { stroke: var(--run); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .8; }
.hook-label { fill: var(--run); font-size: 11px; font-family: inherit; }
.spark { width: 120px; height: 30px; display: block; }

.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: #0a0c11; border: 1px solid var(--line-2); border-radius: 9px;
  padding: 8px 11px; font-size: 12px; min-width: 140px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .55);
}
.chart-tip b { display: block; margin-bottom: 3px; }
.chart-tip span { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.chart-tip span b { display: inline; color: var(--text); margin: 0; }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 8px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-top: 9px; font-size: 13px; }
.bar-name { min-width: 130px; color: var(--muted); }
.bar-track { flex: 1; height: 9px; background: #0c0f15; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width .4s ease; }
.bar-value { min-width: 60px; text-align: right; font-weight: 600; }

.sync-log { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.sync-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.sync-row .lbl { min-width: 130px; }
.sync-row .when { color: var(--muted); }

/* ---------------- Hinweise ---------------- */
.insights { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.insight {
  border: 1px solid var(--line); border-left: 3px solid var(--muted);
  border-radius: 11px; padding: 13px 15px; background: #10131a;
}
.insight.critical { border-left-color: var(--err); }
.insight.warn { border-left-color: var(--warn); }
.insight.good { border-left-color: var(--ok); }
.insight.info { border-left-color: var(--run); }
.insight-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.insight-head strong { font-size: 14.5px; }
.tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700;
  padding: 3px 7px; border-radius: 5px;
}
.tag.critical { background: rgba(239, 95, 95, .16); color: var(--err); }
.tag.warn { background: rgba(255, 176, 32, .16); color: var(--warn); }
.tag.good { background: rgba(69, 196, 122, .16); color: var(--ok); }
.tag.info { background: rgba(74, 168, 255, .16); color: var(--run); }
.thin, .nchip {
  font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 20px;
}
.thin { color: var(--warn); border-color: rgba(255, 176, 32, .3); }
.insight-detail { margin: 8px 0 0; font-size: 13.5px; color: #c3c9d6; }
.evidence { margin: 9px 0 0; padding-left: 16px; }
.evidence li { font-size: 12.5px; color: var(--muted); margin: 3px 0; font-variant-numeric: tabular-nums; }
.action {
  display: flex; gap: 8px; margin-top: 11px; padding-top: 10px;
  border-top: 1px dashed var(--line); font-size: 13.5px;
}
.action .arrow { color: var(--accent); font-weight: 700; }

.pb-group { margin-top: 18px; }
.pb-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pb-item:last-child { border-bottom: none; }
.pb-item strong { font-size: 14px; }
.pb-item p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

/* ---------------- Video-Kacheln ---------------- */
.filters { display: flex; gap: 8px; }
.video-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px; margin-top: 14px;
}
.vcard {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #10131a; cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.vcard:hover { transform: translateY(-2px); border-color: var(--accent); }
.vthumb {
  position: relative; aspect-ratio: 16 / 10; background: #0a0c11; overflow: hidden;
}
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vbadge {
  position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 5px; background: rgba(0, 0, 0, .65);
  color: var(--accent); text-transform: uppercase; letter-spacing: .4px;
}
.vdur {
  position: absolute; bottom: 8px; right: 8px; font-size: 11px;
  padding: 2px 6px; border-radius: 4px; background: rgba(0, 0, 0, .7);
}
.vbody { padding: 11px 13px 13px; }
.vtitle {
  font-size: 13.5px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.vdate { font-size: 11px; color: var(--muted); margin-top: 3px; }
.vnums { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.vnum { display: flex; flex-direction: column; }
.vnum .n { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.vnum .k { font-size: 10.5px; color: var(--muted); }
.vspark { margin-top: 10px; }

/* ---------------- Detail ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto;
  background: rgba(5, 6, 9, .74); backdrop-filter: blur(4px);
  padding: 30px 16px;
}
.modal-box {
  position: relative; max-width: 900px; margin: 0 auto;
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--line-2); border-radius: 16px; padding: 26px 28px 30px;
}
.modal-close {
  position: absolute; top: 12px; right: 14px; margin: 0;
  width: 34px; height: 34px; padding: 0; font-size: 22px; line-height: 1;
  border-radius: 9px; background: none; border-color: transparent; color: var(--muted);
}
.modal-close:hover { color: var(--text); border-color: var(--line-2); }
.d-head { display: flex; gap: 16px; align-items: flex-start; }
.d-head img { width: 130px; border-radius: 10px; flex: 0 0 130px; }
.d-head h2 { font-size: 20px; }
.d-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px; margin-top: 20px; padding: 14px 0; border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.d-stat { display: flex; flex-direction: column; }
.d-stat .n { font-size: 19px; font-weight: 680; font-variant-numeric: tabular-nums; }
.d-stat .k { font-size: 11px; color: var(--muted); }
.d-block { margin-top: 26px; }
.d-block h3 { margin-top: 0; }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 14px; }
  header { padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
  #tabs { order: 3; width: 100%; overflow-x: auto; }
  .res .lbl { min-width: 100px; }
  .d-head { flex-direction: column; }
  .d-head img { width: 100%; flex: none; }
  .modal { padding: 12px 8px; }
  .modal-box { padding: 20px 16px 24px; }
}

.chart-tip em { font-style: normal; color: var(--muted); font-size: 11px; }

/* ---------------- Briefing über dem Upload ---------------- */
.brief {
  border-color: rgba(255, 176, 32, .35);
  background: linear-gradient(180deg, #1c1a13 0%, #12131a 100%);
}
.brief.thin-data { border-color: var(--line); }
.brief h2 { color: var(--accent); }
.brief-row {
  display: flex; gap: 14px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.brief-row:last-child { border-bottom: none; }
.brief-row.alert .brief-label { color: var(--err); }
.brief-label {
  min-width: 130px; flex: 0 0 130px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
}
.brief-value { font-size: 15px; font-weight: 600; }
.brief-why { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
@media (max-width: 640px) {
  .brief-row { flex-direction: column; gap: 3px; }
  .brief-label { flex: none; }
}
