/* Advercharge Insights — styled after advercharge.eu: black ground, violet
   accent (#742cf2) with a soft glow, dark rounded cards with hairline borders,
   Poppins for headings, Inter for text. Every colour is a token here. */
:root {
  --bg: #000000;
  --glow: rgba(86, 45, 140, 0.45);        /* site: radial #562d8c -> #000 */
  --glow-2: rgba(45, 81, 94, 0.35);       /* site: radial #2d515e -> #000 */
  --panel: #05080f;
  --panel-2: #0d0d0d;
  --border: rgba(204, 204, 204, 0.16);
  --border-strong: rgba(204, 204, 204, 0.3);
  --inset: inset 0 1px 1px 0 rgba(207, 231, 255, 0.14);
  --text: #ffffff;
  --text-2: #cccccc;
  --muted: #919191;
  --accent: #742cf2;
  --accent-soft: #9b6dff;
  --accent-glow: 0 6px 20px -8px #742cf2;
  --heading-grad: linear-gradient(0deg, #7e4ecc 0%, rgba(255, 255, 255, 0.55) 100%);
  --good: #3fd68f;
  --bad: #ff6b6b;
  --warn: #f5b84a;
  --c1: #9b6dff; --c2: #52d6e0; --c3: #0099ff; --c4: #ff6b9d; --c5: #f5b84a; --c6: #7a7a7a;
  --radius: 24px;
  --radius-sm: 8px;
  --font-head: "Poppins", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--text); font: 15px/1.5 var(--font-body);
  background:
    radial-gradient(60% 420px at 50% 0, var(--glow) 0%, transparent 100%),
    radial-gradient(40% 600px at 100% 60%, var(--glow-2) 0%, transparent 100%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 500; margin: 0; }
h2 { font-size: 17px; color: var(--text); margin-bottom: 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent-soft); }

.primary {
  background: var(--accent); color: #fff; border: 0; border-radius: var(--radius-sm);
  padding: 8px 18px; font-family: var(--font-head); font-weight: 600;
  box-shadow: var(--accent-glow);
}
.primary:hover { filter: brightness(1.1); }
.secondary, .presets button {
  background: linear-gradient(#1e1e1e 0%, #141414 100%); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px;
  box-shadow: var(--inset); font-family: var(--font-head); font-weight: 500; font-size: 14px;
}
.outline {
  background: transparent; color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 5px 14px; font-family: var(--font-head);
}
.link { background: none; border: 0; color: var(--accent-soft); padding: 0; }
select, input {
  font: inherit; font-size: 14px; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px;
}
select:focus, input:focus, button:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 1px; }

/* ---------- header ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 24px; max-width: 1400px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { height: 22px; width: auto; display: block; }
.brand .product { font-family: var(--font-head); color: var(--text-2); font-size: 15px;
                  padding-left: 14px; border-left: 1px solid var(--border-strong); }
.user { display: flex; gap: 14px; align-items: center; font-family: var(--font-head); }
.user form { margin: 0; }

.lang { display: flex; gap: 6px; align-items: center; font-family: var(--font-head);
        font-size: 13px; color: var(--muted); }
.lang a { color: var(--muted); text-decoration: none; padding: 2px 4px; border-radius: 4px; }
.lang a:hover { color: var(--text); }
.lang a.active { color: var(--text); background: rgba(116, 44, 242, 0.3); }

/* ---------- filter bar ---------- */
.filterbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap;
  gap: 10px 16px; align-items: center; padding: 12px 24px;
  background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.filterbar label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; }
.presets { display: flex; gap: 6px; }
.presets button.active { background: var(--accent); border-color: var(--accent);
                         box-shadow: var(--accent-glow); }

/* ---------- section switcher ---------- */
.sections { display: flex; gap: 8px; padding: 20px 24px 0; max-width: 1400px; margin: 0 auto;
            overflow-x: auto; }
.sections button {
  background: none; border: 1px solid transparent; border-radius: 999px;
  padding: 7px 16px; color: var(--muted); white-space: nowrap;
  font-family: var(--font-head); font-weight: 500;
}
.sections button:hover { color: var(--text); }
.sections button.active { color: var(--text); border-color: var(--border-strong);
                          background: rgba(116, 44, 242, 0.18); }

main { padding: 16px 24px 40px; max-width: 1400px; margin: 0 auto; }
footer.contact { padding: 16px 24px 32px; max-width: 1400px; margin: 0 auto; color: var(--muted); font-size: 13px; }
.contact a { color: var(--text-2); }
.login-card .contact { font-size: 13px; text-align: center; }
.legal { margin-top: 10px; font-size: 13px; color: var(--muted); }
.legal a { color: var(--text-2); }
.login-card .legal { text-align: center; }
.login-card.imprint { max-width: 640px; }
.imprint h2 { font-size: 16px; margin: 18px 0 6px; }
.imprint p { margin: 0 0 8px; line-height: 1.55; }
.section { display: none; }
.section.active { display: block; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row .section-title { margin-bottom: 12px; }
.live-btn { display: inline-flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; flex: none; }
.live-card { margin-bottom: 20px; }
.live-card img { display: block; width: 100%; max-width: 960px; aspect-ratio: 16 / 9;
  object-fit: contain; background: #000; border-radius: var(--radius-sm); margin-top: 12px; }
.section-title {
  font-family: var(--font-head); font-weight: 500; font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15; margin: 8px 0 20px; letter-spacing: -0.01em;
  background: var(--heading-grad); -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.group-title { font-size: 24px; margin: 36px 0 16px; }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--inset); padding: 20px 22px; display: flex; flex-direction: column; gap: 4px;
}
.kpi-label { color: var(--text-2); font-size: 14px; }
.kpi-value { font-family: var(--font-head); font-size: 34px; font-weight: 600;
             font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi-delta { font-size: 13px; color: var(--muted); min-height: 1.2em; }
.kpi-delta.up { color: var(--good); }
.kpi-delta.down { color: var(--bad); }

/* ---------- cards & grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px;
        margin-bottom: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--inset); padding: 20px 22px; margin-bottom: 16px; min-width: 0;
}
.grid > .card { margin-bottom: 0; }
.card.wide { grid-column: 1 / -1; }
.card .card { border: 0; padding: 0; background: none; box-shadow: none; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chart { position: relative; height: 260px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--border);
         white-space: nowrap; }
th[data-type="text"], th.t, td.t { text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: 13px; cursor: pointer; user-select: none; }
th:hover { color: var(--text); }
th.asc::after { content: " ▲"; color: var(--accent-soft); }
th.desc::after { content: " ▼"; color: var(--accent-soft); }
#camp-table tbody tr { cursor: pointer; }
#camp-table tbody tr:hover { background: rgba(255, 255, 255, 0.04); }
#camp-table tbody tr.sel { background: rgba(116, 44, 242, 0.16); }
#camp-table tbody tr.thin td { color: var(--muted); opacity: 0.6; }

/* ---------- info icons & tooltip ---------- */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 4px; padding: 0; vertical-align: 1px;
  border: 1px solid var(--border-strong); border-radius: 50%; background: none;
  color: var(--text-2); font: italic 600 10px/1 var(--font-head); cursor: help;
}
.info:hover, .info:focus-visible, .info.open { color: var(--text); border-color: var(--accent-soft);
                                               background: rgba(116, 44, 242, 0.25); }
#tooltip {
  position: fixed; z-index: 50; max-width: 260px; padding: 8px 11px; pointer-events: none;
  background: #161616; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6); color: var(--text); font-size: 13px; line-height: 1.4;
  white-space: normal; text-align: left;
}

/* ---------- chips / status ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { border: 1px solid var(--border); border-radius: 10px; padding: 3px 12px;
        font-size: 13px; color: var(--text-2); background: var(--panel); }
.chip.bad { color: var(--bad); border-color: rgba(255, 107, 107, 0.4); }
.chip.warn { color: var(--warn); border-color: rgba(245, 184, 74, 0.4); }
.note { color: var(--muted); font-size: 13px; max-width: 900px; }
.status-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0;
              border-bottom: 1px solid var(--border); color: var(--text-2); }
.status-row:last-child { border-bottom: 0; }
.ok { color: var(--good); font-weight: 600; }
.fail { color: var(--bad); font-weight: 600; }
.idle { color: var(--muted); font-weight: 600; }

/* ---------- accounts (staff) ---------- */
.user a { font-size: 14px; color: var(--muted); text-decoration: none; }
.user a:hover { color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px;
             margin-bottom: 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 14px; }
#acc-search { width: 100%; max-width: 460px; margin-bottom: 6px; }
.camp-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--border);
             border-radius: var(--radius-sm); margin-bottom: 12px; }
.camp-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px;
             border-bottom: 1px solid var(--border); font-size: 14px; cursor: pointer; }
.camp-item:last-child { border-bottom: 0; }
.camp-item:hover { background: rgba(255, 255, 255, 0.04); }
.camp-item input { margin-top: 3px; accent-color: var(--accent); }
.secret { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.secret code { font: 600 22px/1.3 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: 0.04em;
               background: var(--panel-2); border: 1px solid var(--border-strong);
               border-radius: var(--radius-sm); padding: 8px 14px; user-select: all; }
#acc-table td { vertical-align: top; white-space: normal; }
#acc-table th { cursor: default; }
#acc-table td.actions { white-space: nowrap; }
#acc-table td.actions .link { margin-right: 10px; }
.link.danger { color: var(--bad); }
.warn-text { color: var(--warn); }
#acc-error:empty { display: none; }

/* ---------- login ---------- */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--inset); padding: 36px 32px; width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-card img { height: 24px; width: auto; display: block; }
.login-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.login-card h1 { font-size: 26px; background: var(--heading-grad);
                 -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card label { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 14px; }
.login-card .primary { margin-top: 6px; padding: 10px; }
.error { color: var(--bad); margin: 0; }

@media (max-width: 800px) { .grid.two { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .topbar, .filterbar, .sections, main { padding-left: 16px; padding-right: 16px; }
  .filterbar { position: static; }
  .brand .product { display: none; }
  .kpi-value { font-size: 26px; }
  .grid { grid-template-columns: 1fr; }
}
