:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #191919;
  --text-2: #666666;
  --text-3: #8a8f98;
  --line: rgba(20, 30, 60, 0.08);
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.9);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 32px rgba(31, 52, 99, 0.08);
  --accent: #257de0;
  --good: #0a8f3c;
  --warn: #b7791f;
  --bad: #d23b3b;
  --radius: 18px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }

/* soft background blobs that the glass blurs */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #fbfcfe; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.55; }
.b1 { width: 520px; height: 520px; background: #cfe2ff; top: -140px; left: -120px; }
.b2 { width: 460px; height: 460px; background: #e5dcff; top: 30%; right: -140px; }
.b3 { width: 520px; height: 520px; background: #d4f5ec; bottom: -200px; left: 30%; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hidden { display: none !important; }
.muted { color: var(--text-3); font-size: 12px; }

/* top bar */
.topbar {
  position: sticky; top: 12px; z-index: 10;
  margin: 12px auto 0; max-width: 1360px; width: calc(100% - 32px);
  display: flex; align-items: center; gap: 20px; padding: 10px 14px 10px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 14px;
  background: linear-gradient(135deg, #4f8ff0, #7a5cf0); box-shadow: 0 4px 14px rgba(79, 143, 240, 0.35); }
.title { font-weight: 650; letter-spacing: -0.01em; }
.subtitle { font-size: 11.5px; color: var(--text-3); }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tab { border: 0; background: transparent; padding: 7px 14px; border-radius: 10px; color: var(--text-2); cursor: pointer; font-weight: 500; }
.tab:hover { background: rgba(255, 255, 255, 0.7); }
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08); }
.controls { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: rgba(20, 30, 60, 0.05); }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.seg button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1); }
.seg.small { margin: 4px 0 10px; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass-strong); cursor: pointer; font-size: 16px; }
.icon-btn.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main { max-width: 1360px; margin: 0 auto; padding: 20px 16px 60px; }
.view { display: none; }
.view.active { display: block; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi { padding: 16px 18px; min-height: 104px; }
.kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.05); } }

/* cards */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.span-2 { grid-column: span 2; }
.card { padding: 16px 18px; margin-bottom: 14px; }
.grid-2 .card { margin-bottom: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 290px; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 11.5px; font-weight: 500; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.6); }
.table .num { text-align: right; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 500; background: rgba(20, 30, 60, 0.05); color: var(--text-2); }
.pill.good { color: var(--good); background: rgba(10, 143, 60, 0.08); }
.pill.bad { color: var(--bad); background: rgba(210, 59, 59, 0.08); }
.pill.warn { color: var(--warn); background: rgba(183, 121, 31, 0.1); }

.alert { padding: 10px 14px; margin-bottom: 10px; border-radius: 12px; background: rgba(210, 59, 59, 0.07); color: #9b2c2c; border: 1px solid rgba(210, 59, 59, 0.15); font-size: 13px; }

.empty { padding: 48px; text-align: center; max-width: 560px; margin: 60px auto; }
.empty h2 { margin: 0 0 6px; }
.empty p { color: var(--text-2); margin: 0 0 18px; }

/* buttons & forms */
.btn { border: 1px solid transparent; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 550; }
.btn.primary { background: var(--text); color: #fff; }
.btn.primary:hover { background: #333; }
.btn.ghost { background: rgba(255, 255, 255, 0.7); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--bad); border-color: rgba(210, 59, 59, 0.2); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: default; }
label { display: block; font-size: 12px; color: var(--text-2); font-weight: 500; margin-bottom: 10px; }
input:not([type=checkbox]) { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.9); outline: none; }
input:focus { border-color: #9cc3f5; box-shadow: 0 0 0 3px rgba(37, 125, 224, 0.12); }
.hint { font-size: 11.5px; color: var(--text-3); margin: 2px 0 6px; }

/* settings */
.settings-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; gap: 20px; }
.settings-head h2 { margin: 0 0 4px; }
.settings-head p { margin: 0; }
.platform-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.pcard { padding: 16px 18px; }
.pcard-top { display: flex; align-items: center; gap: 10px; }
.pcard-top h4 { margin: 0; font-size: 15px; }
.pcard .url { font-size: 12px; color: var(--text-3); margin: 4px 0 10px; word-break: break-all; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; min-height: 22px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: rgba(37, 125, 224, 0.08); color: #1b5fae; }
.pcard-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.test-result { font-size: 12px; margin-top: 8px; }

/* modals */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(20, 30, 50, 0.18); backdrop-filter: blur(4px); padding: 20px; }
.modal-card { width: 100%; max-width: 440px; padding: 22px; background: var(--glass-strong); }
.modal-card.wide { max-width: 720px; }
.modal-card h3 { margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 14px; }
.modal-actions .muted { margin-right: auto; }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row input { margin-top: 0; }
.pick-list { max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.6); margin-top: 8px; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; margin: 0; color: var(--text); font-weight: 400; font-size: 13px; }
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: #fff; }
.pick-item input { width: 16px; height: 16px; accent-color: var(--text); }
.pick-main { flex: 1; min-width: 0; }
.pick-name { font-weight: 550; }
.pick-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: #191919; color: #fff; font-size: 13px; z-index: 60; box-shadow: var(--shadow); }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .topbar { flex-wrap: wrap; }
}

/* login */
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(251, 252, 254, 0.6); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.login-card { width: 340px; padding: 30px 28px; text-align: center; background: var(--glass-strong); }
.login-card .logo { margin: 0 auto 12px; width: 44px; height: 44px; font-size: 18px; }
.login-card h2 { margin: 0 0 4px; }
.login-card p { margin: 0 0 18px; }
.login-card input { margin-bottom: 12px; text-align: center; }
.login-card .btn { width: 100%; padding: 10px; }
.login-error { color: var(--bad); font-size: 12.5px; min-height: 18px; margin-top: 10px; }
