/* GameTrackr advertiser portal. Layers on top of /styles.css, which supplies the base
   tokens (--bg, --panel, --line, --text, --muted, --accent) and controls.
   Dark is the default theme; [data-theme="light"] is the toggle, same as the main site. */

:root {
  /* Chart series roles. Validated as a categorical pair against the dark panel surface
     (#1b1a14) and the light panel surface (#ffffff): CVD deltaE 26.8 dark / 24.7 light,
     normal vision 31.8 / 33.6, both above 3:1 contrast. Impressions carry the brand hue. */
  --series-imp: #d95926;
  --series-clk: #3987e5;
  --grid: #2b281f;
  --chart-surface: #1b1a14;
}
:root[data-theme="light"] {
  --series-imp: #eb6834;
  --series-clk: #2a78d6;
  --grid: #e6e0d2;
  --chart-surface: #ffffff;
}

/* ---- portal shell ---------------------------------------------------- */
.pwrap { max-width: 1120px; margin: 0 auto; padding: 22px 18px 70px; }

.ptabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.ptabs a {
  padding: 10px 14px; font-family: var(--display); font-weight: 600; font-size: 13px;
  text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.ptabs a:hover { color: var(--text); }
.ptabs a.on { color: var(--accent); border-bottom-color: var(--accent); }

.phead { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.phead h1 { margin: 0; font-size: 28px; }
.phead .sub { color: var(--muted); font-size: 14px; }
.phead .spacer { flex: 1; }

.pcardbox {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; margin-bottom: 18px;
}
.pcardbox > h2 { margin: 0 0 4px; font-size: 17px; }
.pcardbox > .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* ---- KPI stat tiles -------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px;
}
.kpi .lab {
  font-family: var(--display); text-transform: uppercase; letter-spacing: 1.1px;
  font-size: 11px; color: var(--muted); margin-bottom: 6px;
}
.kpi .val { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi.livekpi .val { color: var(--accent); }

.livedot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-right: 6px; vertical-align: middle;
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .livedot { animation: none; } }

/* ---- charts ---------------------------------------------------------- */
.chartbox { position: relative; }
.chartbox svg { display: block; width: 100%; height: auto; overflow: visible; }
.chartbox .ctitle {
  font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: .4px;
  margin-bottom: 2px;
}
.chartbox .cnote { color: var(--muted); font-size: 12px; margin-bottom: 8px; }

.clegend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.clegend span { display: inline-flex; align-items: center; gap: 6px; }
.clegend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.ctip {
  position: absolute; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 10px; font-size: 12px; color: var(--text); white-space: nowrap;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35); z-index: 5; font-variant-numeric: tabular-nums;
}
.ctip.on { opacity: 1; }
.ctip b { display: block; color: var(--muted); font-weight: 600; font-size: 11px; margin-bottom: 3px; }
.ctip .row { display: flex; align-items: center; gap: 6px; }
.ctip .row i { width: 8px; height: 8px; border-radius: 2px; }

/* ---- tables ---------------------------------------------------------- */
.ptable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ptable th {
  text-align: left; font-family: var(--display); font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.ptable td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ptable tr:last-child td { border-bottom: none; }
.ptable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptable .thumb {
  max-width: 150px; max-height: 46px; border-radius: 5px; border: 1px solid var(--line);
  display: block; background: var(--panel2);
}
.tscroll { overflow-x: auto; }

/* magnitude meter inside a table cell: one hue, more is longer */
.meter { height: 8px; border-radius: 4px; background: var(--panel2); overflow: hidden; min-width: 70px; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--series-imp); }

/* ---- status pills ---------------------------------------------------- */
.st {
  display: inline-block; font-size: 11px; font-family: var(--display); font-weight: 600;
  text-transform: uppercase; letter-spacing: .7px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel2); white-space: nowrap;
}
.st.ok { color: #4ea36f; border-color: rgba(78, 163, 111, .5); background: rgba(78, 163, 111, .12); }
.st.warn { color: #c98500; border-color: rgba(201, 133, 0, .5); background: rgba(201, 133, 0, .12); }
.st.bad { color: #e06a5c; border-color: rgba(224, 106, 92, .5); background: rgba(224, 106, 92, .12); }
.st.info { color: var(--series-clk); border-color: rgba(57, 135, 229, .5); background: rgba(57, 135, 229, .12); }

/* ---- forms / layout helpers ------------------------------------------ */
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .frow { grid-template-columns: 1fr; } }
.finline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fnarrow { max-width: 460px; margin: 40px auto; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.checks label {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel2); border-radius: 9px;
  padding: 9px 12px; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 500;
}
.checks label:has(input:checked) { border-color: var(--accent); color: var(--text); }
.checks input { width: auto; margin: 0; }
.checks .dim { color: var(--muted); font-size: 12px; }

.ticker { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.ticker li {
  display: flex; align-items: center; gap: 9px; padding: 7px 0;
  border-bottom: 1px solid var(--line); color: var(--muted);
}
.ticker li:last-child { border-bottom: none; }
.ticker .k { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.ticker .when { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 12px; }

.banner {
  border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--panel2);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px;
}
.banner.good { border-left-color: #4ea36f; }
.banner.warn { border-left-color: #c98500; }
.banner b { display: block; margin-bottom: 3px; }

.specgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.spec { border: 1px solid var(--line); border-radius: 11px; padding: 13px; background: var(--panel2); }
.spec h4 { margin: 0 0 3px; font-size: 14px; }
.spec .dim { color: var(--muted); font-size: 12px; }
.spec .px { font-family: var(--display); color: var(--accent); font-size: 13px; margin-top: 6px; }
