/* Symneo Insights - Dashboard
   Dunkles, modernes Layout. Keine externen Fonts/CDNs (Privacy + Speed). */

:root {
    --bg:        #0b0e14;
    --bg-2:      #111521;
    --panel:     #151a27;
    --panel-2:   #1b2130;
    --border:    #232b3d;
    --text:      #e6eaf2;
    --muted:     #8a93a8;
    --accent:    #f5c518;   /* Pepper-Gelb */
    --accent-2:  #5b8cff;
    --green:     #3ddc84;
    --radius:    14px;
    --shadow:    0 8px 30px rgba(0,0,0,.35);
    font-synthesis: none;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 80% -10%, #16203a 0%, var(--bg) 55%);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Login ---------- */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 38px 34px; width: 340px;
    box-shadow: var(--shadow); text-align: center;
}
.login-logo { font-size: 22px; font-weight: 700; color: var(--accent); }
.login-sub  { color: var(--muted); margin: 6px 0 24px; }
.login-card input, .login-card button { width: 100%; }
.login-card input {
    background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
    padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 15px;
}
.login-card button {
    background: var(--accent); color: #1a1500; border: 0; padding: 12px;
    border-radius: 10px; font-weight: 700; font-size: 15px; cursor: pointer;
}
.login-error {
    background: #3a1620; color: #ff9aa8; border: 1px solid #5a2230;
    padding: 10px; border-radius: 10px; margin-bottom: 16px; font-size: 13px;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; gap: 18px;
    padding: 14px 24px; background: rgba(13,17,27,.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 700; font-size: 16px; color: var(--accent); white-space: nowrap; }
.tabs { display: flex; gap: 4px; }
.tab {
    background: transparent; border: 0; color: var(--muted);
    padding: 8px 14px; border-radius: 9px; cursor: pointer; font-size: 14px;
    font-weight: 500;
}
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active { color: var(--text); background: var(--panel-2); }
.topbar-controls { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.select {
    background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
    padding: 8px 12px; border-radius: 9px; font-size: 13px; cursor: pointer;
    max-width: 200px;
}
.live-badge {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--panel-2); border: 1px solid var(--border);
    padding: 7px 12px; border-radius: 9px; font-size: 13px; font-variant-numeric: tabular-nums;
}
.live-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--green);
    box-shadow: 0 0 0 0 rgba(61,220,132,.6); animation: pulse 2s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(61,220,132,.5); }
    70%  { box-shadow: 0 0 0 8px rgba(61,220,132,0); }
    100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); }
}
.logout { color: var(--muted); text-decoration: none; font-size: 13px; padding: 6px; }
.logout:hover { color: var(--text); }

/* ---------- Layout ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 24px; }
.view.hidden { display: none; }

/* ---------- KPIs ---------- */
.kpis {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px; margin-bottom: 18px;
}
.kpi {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px;
}
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 30px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-sub   { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- Panels ---------- */
.panel {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.chart-panel canvas { width: 100%; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.lg::before { content: "●"; margin-right: 5px; }
.lg-visitors::before { color: var(--accent-2); }
.lg-views::before    { color: var(--accent); }

.grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 18px;
}
.grid .panel { margin-bottom: 0; }
.panel-wide { grid-column: 1 / -1; }

/* ---------- Barlist ---------- */
.barlist { display: flex; flex-direction: column; gap: 2px; }
.bar-row {
    position: relative; display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px; border-radius: 8px; overflow: hidden; font-size: 13px;
}
.bar-fill {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, rgba(91,140,255,.22), rgba(91,140,255,.07));
    border-radius: 8px; z-index: 0;
}
.bar-label { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 75%; }
.bar-val { position: relative; z-index: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-flag { font-size: 15px; }
.empty { color: var(--muted); font-size: 13px; padding: 14px 10px; text-align: center; }

/* ---------- Live ---------- */
.livelist { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.live-row {
    display: flex; align-items: center; gap: 10px; font-size: 13px;
    padding: 8px 10px; background: var(--bg-2); border-radius: 8px;
}
.live-row .path { font-weight: 500; }
.live-row .meta { color: var(--muted); margin-left: auto; font-size: 12px; }
.tag {
    font-size: 11px; padding: 2px 8px; border-radius: 20px;
    background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
}
.tag-youtube  { color: #ff7a7a; border-color: #5a2a2a; }
.tag-search   { color: #6fd3a8; border-color: #235040; }
.tag-social   { color: #7aa8ff; border-color: #2a3a66; }
.tag-campaign { color: var(--accent); border-color: #5a4a1a; }

/* ---------- Forms ---------- */
.form-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px; align-items: end;
}
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.form-grid input, .form-grid select {
    background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
    padding: 10px 12px; border-radius: 9px; font-size: 14px;
}
.form-grid .check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.form-grid .check input { width: auto; }
.form-grid button, .panel button.primary {
    background: var(--accent); color: #1a1500; border: 0; padding: 11px 18px;
    border-radius: 9px; font-weight: 700; cursor: pointer; font-size: 14px;
    height: fit-content;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
    padding: 10px; border-bottom: 1px solid var(--border); text-transform: uppercase;
    letter-spacing: .03em;
}
.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table a { color: var(--accent-2); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.code-pill {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--bg-2); padding: 3px 9px; border-radius: 7px; border: 1px solid var(--border);
}
.copy-btn, .del-btn {
    background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
    padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 12px;
}
.copy-btn:hover { color: var(--text); }
.del-btn:hover { color: #ff8a9a; border-color: #5a2230; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

/* ---------- Sites list ---------- */
.site-card {
    background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; margin-bottom: 12px;
}
.site-card .site-name { font-weight: 600; font-size: 15px; }
.site-card .site-domain { color: var(--muted); font-size: 13px; }
.snippet-box {
    margin-top: 12px; background: #0a0d14; border: 1px solid var(--border);
    border-radius: 9px; padding: 12px; font-family: ui-monospace, Menlo, monospace;
    font-size: 12px; color: #b9c4dc; white-space: pre-wrap; word-break: break-all; position: relative;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
    padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow);
    opacity: 0; pointer-events: none; transition: all .25s; z-index: 100; font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: #5a2230; color: #ff9aa8; }

@media (max-width: 720px) {
    .topbar { flex-wrap: wrap; gap: 10px; }
    .topbar-controls { width: 100%; margin-left: 0; flex-wrap: wrap; }
    .tabs { order: 3; width: 100%; }
}
