/* Redaktions-Dashboard – Live-Monitor. Orientiert an design/dashboard-layout.html */
:root {
    --bg:        #070b12;
    --panel:     rgba(255, 255, 255, 0.035);
    --panel-2:   rgba(255, 255, 255, 0.06);
    --border:    rgba(255, 255, 255, 0.08);
    --text:      #e8edf5;
    --muted:     #8a93a6;
    --muted-2:   #5b6577;
    --accent:    #3d8bff;
    --up:        #36d399;
    --down:      #ff4d5e;
    --pay:       #3d8bff;
    --nonpay:    rgba(255, 255, 255, 0.16);
    --warn:      #f5b740;
}

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

/* ---- Rotations-Fortschrittsbalken (oberer Bildschirmrand) ----
   Füllt sich über die Standzeit des aktuellen Zeitraums; zeigt an, wann
   umgeschaltet wird. Wird per JS über transform: scaleX() bewegt.
   z-index unter dem Kennwort-Overlay (9999), daher beim Login verdeckt. */
.rotation-bar {
    position: fixed; top: 0; left: 0; right: 0; height: 5px;
    transform: scaleX(0); transform-origin: left center;
    background: linear-gradient(90deg, var(--accent), #6fb0ff);
    box-shadow: 0 0 10px rgba(61, 139, 255, 0.6);
    z-index: 9000; pointer-events: none; will-change: transform;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

.dashboard { max-width: 1840px; margin: 0 auto; padding: 16px 26px; }

/* ---- Kopfbereich ---- */
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.brand__kicker {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; letter-spacing: 0.14em; color: var(--muted); font-weight: 600;
}
.brand__kicker .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--down); box-shadow: 0 0 10px var(--down); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.brand__title { font-size: 30px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -0.01em; }
.brand__meta { font-size: 13px; color: var(--muted); }

.freshness {
    text-align: right; background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px 18px; min-width: 200px;
}
.freshness__label { font-size: 11px; letter-spacing: 0.12em; color: var(--muted-2); font-weight: 600; }
.freshness__value { font-size: 18px; font-weight: 700; margin-top: 4px; }
.freshness__age { font-size: 12px; color: var(--muted); margin-top: 2px; }
.freshness__age.stale { color: var(--warn); }

/* ---- Kennzahlen-Leiste (oben) ---- */
/* Bewusst groß, damit die Zahlen aus einigen Metern Entfernung lesbar bleiben. */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 16px 22px; }
.kpi__title { font-size: 13px; letter-spacing: 0.12em; color: var(--accent); font-weight: 700; margin-bottom: 10px; }
.kpi__row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; }
.kpi__lbl { font-size: 15px; color: var(--muted); }
.kpi__num { display: flex; align-items: baseline; gap: 10px; }
.kpi__val { font-size: 33px; font-weight: 700; line-height: 1; }
.kpi__val.live { color: var(--up); }
.kpi__delta { font-size: 14px; font-weight: 600; white-space: nowrap; }
.kpi__delta.up { color: var(--up); }
.kpi__delta.down { color: var(--down); }
.kpi__delta.flat { color: var(--muted-2); }
.kpi__note {
    font-size: 12px; color: var(--muted-2); margin-top: 11px; padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ---- Zeitraum-Leiste ---- */
.periods { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.periods__label { font-size: 11px; letter-spacing: 0.14em; color: var(--muted-2); font-weight: 600; }
.periods__tabs { display: flex; gap: 8px; }
.tab {
    background: var(--panel); border: 1px solid var(--border); color: var(--muted);
    padding: 9px 18px; border-radius: 9px; font-size: 14px; cursor: pointer;
    transition: all 0.15s ease;
}
.tab:hover { color: var(--text); border-color: rgba(255,255,255,0.16); }
.tab.is-active { background: rgba(61,139,255,0.16); border-color: rgba(61,139,255,0.5); color: #cfe0ff; font-weight: 600; }
.periods__right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.rotation-hint { font-size: 13px; color: var(--muted-2); }

/* Daten-Stand inline in der Zeitraum-Leiste */
.asof { display: inline-flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); }
.asof__label { font-size: 10px; letter-spacing: 0.1em; color: var(--muted-2); font-weight: 600; }
.asof__age { font-size: 12px; color: var(--muted-2); }
.asof__age.stale { color: var(--warn); }
.pause-btn {
    background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
    padding: 9px 16px; border-radius: 9px; font-size: 13px; cursor: pointer;
}
.pause-btn:hover { border-color: rgba(255,255,255,0.2); }

/* ---- Tabelle ---- */
.table { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }

.table__head, .row {
    display: grid;
    grid-template-columns: 52px minmax(240px, 1fr) 92px 72px 440px;
    align-items: center;
    gap: 18px;
    padding: 0 22px;
}
.table__head {
    height: 38px;
    font-size: 11px; letter-spacing: 0.1em; color: var(--muted-2); font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.col-visits, .col-views { text-align: right; }

.row {
    min-height: 58px;
    border-bottom: 1px solid rgba(255,255,255,0.045);
    animation: fadeIn 0.35s ease;
}
.row:last-child { border-bottom: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Rang + Trend */
.cell-rank { display: flex; flex-direction: column; gap: 2px; }
.cell-rank .num { font-size: 21px; font-weight: 700; color: var(--accent); line-height: 1; }
.cell-rank .trend { font-size: 12px; font-weight: 600; }
.trend.up { color: var(--up); }
.trend.down { color: var(--down); }
.trend.same, .trend.new { color: var(--muted-2); }

/* Titel (auf 2 Zeilen begrenzt, damit die Zeilenhöhe stabil bleibt) */
.cell-title .headline {
    font-size: 15.5px; font-weight: 600; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Zahlen */
.cell-visits { text-align: right; font-size: 18px; font-weight: 600; }
/* Aufrufe bewusst dezent: zahlend/nicht-zahlend/ausstehend beziehen sich auf die
   BESUCHE, daher würde ein gleich großer Aufrufe-Wert hier eher verwirren. */
.cell-views { text-align: right; color: var(--muted-2); font-size: 13px; font-weight: 500; }

/* zahlend / nicht zahlend / ausstehend (vergrößerter Balken) */
.cell-split .nums { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; margin-bottom: 6px; }
.cell-split .nums .pay { color: var(--pay); font-weight: 600; white-space: nowrap; }
.cell-split .nums .nonpay { color: var(--muted); white-space: nowrap; }
.cell-split .nums .pending { color: var(--muted-2); white-space: nowrap; }
/* Balken über die GESAMTbesuche: blau = zahlend, hellgrau = nicht zahlend,
   gestreift = ausstehend (vom Archivlauf noch nicht klassifiziert). */
.bar { height: 12px; border-radius: 6px; background: rgba(255,255,255,0.05); overflow: hidden; display: flex; }
.bar .bar-pay { height: 100%; background: var(--pay); }
.bar .bar-nonpay { height: 100%; background: rgba(255,255,255,0.22); }
.bar .bar-pending {
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        rgba(255,255,255,0.10),
        rgba(255,255,255,0.10) 5px,
        rgba(255,255,255,0.03) 5px,
        rgba(255,255,255,0.03) 10px
    );
}
.cell-split .pct { margin-top: 6px; font-size: 11px; color: var(--muted-2); }

/* Paywall-Boxen (Platzhalter bis Tracking steht) */
.cell-paywall { display: flex; gap: 8px; }
.pw-box {
    flex: 1; text-align: center; border: 1px solid var(--border); border-radius: 9px;
    padding: 8px 4px; background: rgba(255,255,255,0.02);
}
.pw-box.abo { background: rgba(61,139,255,0.12); border-color: rgba(61,139,255,0.4); }
.pw-box .v { font-size: 17px; font-weight: 700; }
.pw-box .l { font-size: 9px; letter-spacing: 0.08em; color: var(--muted-2); margin-top: 2px; }
.pw-box.empty .v { color: var(--muted-2); }

/* Engagement (Platzhalter) */
.cell-engagement .score { font-size: 22px; font-weight: 700; }
.cell-engagement .score small { font-size: 12px; color: var(--muted-2); font-weight: 500; }
.cell-engagement .label { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.cell-engagement.empty .score { color: var(--muted-2); }

/* Kennwort-Overlay */
.auth-gate {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
}
.auth-gate.hidden { display: none; }
.auth-box {
    width: 320px; max-width: 90vw;
    background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
    padding: 32px 28px; display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth-box__label { font-size: 13px; color: var(--muted); letter-spacing: 0.04em; text-align: center; }
.auth-input {
    background: rgba(0,0,0,0.25); border: 1px solid var(--border); border-radius: 9px;
    padding: 12px 14px; color: var(--text); font-size: 20px; text-align: center;
    letter-spacing: 0.3em; outline: none;
}
.auth-input:focus { border-color: rgba(61,139,255,0.6); }
.auth-btn {
    background: rgba(61,139,255,0.18); border: 1px solid rgba(61,139,255,0.5); color: #cfe0ff;
    padding: 11px; border-radius: 9px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.auth-btn:hover { background: rgba(61,139,255,0.28); }
.auth-error { min-height: 16px; font-size: 13px; color: var(--down); text-align: center; }

/* Statuszeile */
.status { margin-top: 14px; font-size: 12px; color: var(--muted-2); text-align: right; min-height: 16px; }
.status.error { color: var(--warn); }
