:root {
  color-scheme: dark;
  --bg: #080b0e;
  --bg-2: #0d1117;
  --panel: rgba(18, 24, 31, .86);
  --panel-solid: #121820;
  --panel-2: #19222c;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .18);
  --text: #f3f7fa;
  --muted: #96a4af;
  --faint: #61707c;
  --accent: #67d4ff;
  --accent-2: #80f0c8;
  --gold: #d8a34a;
  --red: #ff7b7b;
  --violet: #9da7ff;
  --shadow: 0 26px 70px rgba(0, 0, 0, .34);
  --radius: 8px;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", Arial, sans-serif;
  font-family: var(--font-ui);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(103, 212, 255, .08), transparent 28rem),
    linear-gradient(315deg, rgba(216, 163, 74, .08), transparent 26rem),
    var(--bg);
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #071016;
  font-weight: 800;
  padding: 10px 14px;
}
.secondary {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
}
.is-hidden { display: none !important; }
h1, h2, h3, p { margin-top: 0; }

.auth-checking [data-login],
.auth-checking [data-dashboard] {
  display: none !important;
}
.boot-shell {
  min-height: 100vh;
  display: none;
  place-items: center;
  padding: 24px;
}
.auth-checking .boot-shell { display: grid; }
.boot-card {
  width: min(320px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 24, 31, .96), rgba(12, 16, 21, .96));
  box-shadow: var(--shadow);
}
.boot-card strong { font-size: 17px; }
.boot-card span:last-child { color: var(--muted); font-size: 13px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(460px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 24, 31, .96), rgba(12, 16, 21, .96));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-brand,
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-symbol {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(103, 212, 255, .34);
  background:
    radial-gradient(circle at 68% 22%, rgba(128, 240, 200, .3), transparent 22px),
    linear-gradient(145deg, rgba(103, 212, 255, .16), rgba(216, 163, 74, .08));
  box-shadow: 0 12px 28px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255,255,255,.08);
}
.brand-symbol svg {
  width: 38px;
  height: 38px;
  display: block;
}
.mark-frame {
  fill: rgba(8, 13, 18, .72);
  stroke: rgba(103, 212, 255, .84);
  stroke-width: 1.8;
}
.mark-route {
  fill: rgba(103, 212, 255, .2);
  stroke: #eaf8ff;
  stroke-width: 2;
  stroke-linejoin: round;
}
.mark-cut {
  fill: none;
  stroke: #80f0c8;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.mark-pulse {
  fill: #d8a34a;
  filter: drop-shadow(0 0 6px rgba(216, 163, 74, .75));
}
.login-brand strong,
.brand-lockup strong { display: block; letter-spacing: 0; }
.login-brand small,
.brand-lockup small { display: block; color: var(--muted); margin-top: 2px; }
.login-card h1 { margin: 26px 0 10px; font-size: 36px; letter-spacing: 0; }
.login-card p { color: var(--muted); line-height: 1.7; }
label { display: grid; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 13px; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d1218;
  color: var(--text);
  padding: 11px 12px;
}
.login-card button { width: 100%; margin-top: 18px; }
.form-error { display: block; min-height: 22px; margin-top: 12px; color: #ff9b9b; }

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(8, 11, 14, .86);
  backdrop-filter: blur(18px);
}
.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 30px;
}
.side-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
}
.side-nav a:hover,
.side-nav a.is-active {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, .05);
}
.sidebar-card {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  border-radius: var(--radius);
}
.sidebar-card span { display: block; color: var(--muted); font-size: 12px; }
.sidebar-card strong { display: block; margin-top: 8px; font-size: 14px; word-break: break-word; }

.workspace {
  min-width: 0;
  padding: 26px;
}
.topbar {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(620px, auto);
  align-items: start;
  gap: 24px;
  margin-bottom: 20px;
}
.topbar-title { min-width: 0; }
.topbar h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); letter-spacing: 0; }
.topbar p { margin: 8px 0 0; color: var(--muted); }
.topbar-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  justify-self: end;
}
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
}
.toolbar-filters select {
  width: auto;
  min-width: 168px;
}
.toolbar-account {
  justify-content: flex-end;
  border-color: rgba(103, 212, 255, .18);
}
.compact {
  min-height: 42px;
  padding: 10px 13px;
  white-space: nowrap;
}
.danger-ghost {
  color: #ffcfcb;
  border-color: rgba(255, 117, 105, .35);
}
.danger-ghost:hover {
  border-color: rgba(255, 117, 105, .58);
  background: rgba(255, 117, 105, .08);
}

.hero-grid,
.analytics-grid,
.metric-grid,
.site-grid {
  display: grid;
  gap: 14px;
}
.hero-grid {
  grid-template-columns: minmax(0, 1.6fr) 330px;
  margin-bottom: 14px;
}
.hero-panel,
.health-panel,
.metric-grid article,
.site-card,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}
.hero-panel {
  min-height: 260px;
  display: grid;
  grid-template-columns: minmax(0, .72fr) minmax(280px, 1fr);
  gap: 18px;
  padding: 22px;
  overflow: hidden;
}
.hero-copy span,
.health-panel span {
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.hero-copy h2 {
  margin: 16px 0 10px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: .95;
  letter-spacing: 0;
}
.hero-copy p { color: var(--muted); line-height: 1.65; max-width: 520px; }
.hero-chart {
  min-height: 210px;
  align-self: stretch;
}
.health-panel {
  position: relative;
  min-height: 260px;
  padding: 22px;
  overflow: hidden;
}
.health-panel strong {
  display: block;
  margin-top: 18px;
  font-size: 54px;
  line-height: 1;
}
.health-panel p { color: var(--muted); line-height: 1.6; }
.radial {
  position: absolute;
  right: -34px;
  bottom: -52px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0deg, rgba(255,255,255,.08) 0deg);
  opacity: .8;
}
.radial::after {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  background: var(--panel-solid);
}

.metric-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
}
.metric-grid article { padding: 15px; min-height: 116px; }
.metric-grid span { display: block; color: var(--muted); font-size: 12px; }
.metric-grid strong {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  font-size: 30px;
  letter-spacing: 0;
}
.metric-grid strong[data-has-delta]::after {
  content: attr(data-delta);
  color: #80f0c8;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}
.metric-grid small { color: var(--faint); }

.site-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}
.site-card { padding: 16px; }
.site-card h3 { margin: 0 0 8px; font-size: 16px; }
.site-card p { color: var(--muted); line-height: 1.55; font-size: 13px; }
.site-card .site-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.site-card .site-stats span {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
}
.site-card .site-stats strong { display: block; color: var(--text); font-size: 16px; }

.analytics-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, .7fr);
  margin-bottom: 14px;
}
.panel { padding: 18px; overflow: hidden; }
.panel-large { min-height: 330px; }
.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.help-dot {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(103, 212, 255, .08);
  font-size: 13px;
  font-weight: 800;
  cursor: help;
}
.help-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.panel h2 { margin: 0 0 5px; font-size: 18px; }
.panel p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 13px; }

.area-chart svg,
.hero-chart svg { width: 100%; height: 100%; min-height: 220px; display: block; }
.axis-label { fill: var(--faint); font-size: 11px; }
.chart-grid { stroke: rgba(255,255,255,.08); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3; }
.chart-line.sessions { stroke: var(--gold); stroke-width: 2; }
.chart-area { fill: url(#areaFill); opacity: .65; }

.donut-wrap {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px;
  align-items: center;
}
.donut {
  width: 158px;
  height: 158px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0deg, rgba(255,255,255,.08) 0deg);
  position: relative;
}
.donut::after {
  content: "";
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: #121820;
}
.legend,
.rank-list,
.click-list,
.event-stream,
.device-bars,
.browser-bars,
.country-list,
.site-compare {
  display: grid;
  gap: 10px;
}
.business-block {
  display: grid;
  gap: 8px;
}
.business-block > strong,
.business-scope {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}
.business-scope {
  padding: 8px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  background: rgba(255,255,255,.025);
  line-height: 1.5;
}
.business-mini {
  margin-top: 4px;
}
.business-row,
.mini-row {
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.business-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.business-row:hover,
.mini-row:hover {
  border-color: rgba(103, 212, 255, .45);
  background: rgba(103, 212, 255, .075);
}
.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.03);
}
.event-stream {
  max-height: 328px;
  overflow-y: auto;
  padding-right: 2px;
}
.legend-row,
.rank-row,
.click-row,
.event-row,
.device-row,
.browser-row,
.country-row,
.province-row,
.compare-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.035);
}
.country-row-button {
  width: 100%;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.country-row-button:disabled {
  cursor: default;
}
.country-row-button.is-expanded {
  border-color: rgba(103, 212, 255, .42);
  background: rgba(103, 212, 255, .07);
}
.province-list {
  display: grid;
  gap: 8px;
  margin: -2px 0 4px 14px;
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
}
.province-row {
  background: rgba(255,255,255,.025);
}
.lead-filter-row td {
  color: var(--accent);
  background: rgba(103, 212, 255, .08);
}
.legend-row {
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
}
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.08);
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.row-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
}
.row-sub { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.event-row {
  grid-template-columns: 66px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
}
.event-row time { color: var(--faint); font-size: 12px; }
.event-row > div { min-width: 0; }
.event-row strong,
.event-row div span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-row strong { font-size: 13px; }
.event-row span { color: var(--muted); font-size: 12px; }
.event-row > span:last-child {
  max-width: 116px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-self: end;
}

.table-shell { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { border-bottom: 1px solid var(--line); padding: 11px 9px; text-align: left; vertical-align: top; font-size: 13px; }
th { color: var(--muted); font-weight: 700; }
td { color: #dce5eb; }
td span { color: var(--muted); font-size: 12px; }
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.pagination button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.account-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.account-form label { margin-top: 0; }
.account-form fieldset {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.account-form legend { color: var(--muted); padding: 0 6px; }
.site-permissions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.checkbox-line,
.site-permissions label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.checkbox-line input,
.site-permissions input { width: auto; }
.form-actions { display: flex; gap: 10px; }
.account-form .form-error { grid-column: 1 / -1; }

@media (max-width: 1180px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }
  .side-nav { display: flex; margin-top: 0; flex-wrap: wrap; }
  .sidebar-card { position: static; width: 230px; }
  .hero-grid,
  .analytics-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1181px) {
  .topbar h1 { max-width: 720px; }
}

@media (max-width: 1320px) {
  .topbar {
    grid-template-columns: 1fr;
  }
  .topbar-toolbar {
    justify-content: flex-start;
    justify-self: stretch;
  }
  .toolbar-filters {
    flex: 1 1 420px;
  }
  .toolbar-filters select {
    flex: 1 1 168px;
  }
  .toolbar-account {
    margin-left: auto;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .topbar h1 { max-width: 620px; }
}

@media (max-width: 760px) {
  body {
    background:
      linear-gradient(150deg, rgba(103, 212, 255, .1), transparent 18rem),
      linear-gradient(330deg, rgba(128, 240, 200, .08), transparent 20rem),
      var(--bg);
  }
  .login-shell {
    min-height: 100svh;
    place-items: stretch;
    align-content: center;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  }
  .login-card {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 22px;
    border-color: rgba(255, 255, 255, .14);
    background:
      linear-gradient(180deg, rgba(18, 24, 31, .98), rgba(9, 13, 18, .98));
  }
  .login-brand {
    align-items: flex-start;
    gap: 10px;
  }
  .login-brand .brand-symbol {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }
  .login-brand .brand-symbol svg {
    width: 34px;
    height: 34px;
  }
  .login-brand strong { font-size: 14px; }
  .login-brand small {
    max-width: 210px;
    font-size: 11px;
    line-height: 1.35;
  }
  .login-card h1 {
    margin: 24px 0 12px;
    font-size: clamp(28px, 8vw, 34px);
    line-height: 1.12;
  }
  .login-card p {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.72;
  }
  .login-card label {
    margin-top: 14px;
    gap: 7px;
  }
  .login-card input {
    min-height: 46px;
    padding: 12px 13px;
    font-size: 16px;
  }
  .login-card button {
    min-height: 48px;
    margin-top: 20px;
    font-size: 15px;
  }
  .workspace { padding: 16px; }
  .sidebar { align-items: flex-start; display: grid; }
  .sidebar-card { width: 100%; }
  .topbar { gap: 16px; }
  .topbar-toolbar { display: grid; grid-template-columns: 1fr; }
  .toolbar-group {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
  .toolbar-filters select,
  .toolbar-group button { width: 100%; }
  .toolbar-account {
    grid-template-columns: 1fr 1fr;
    margin-left: 0;
  }
  .hero-panel { grid-template-columns: 1fr; }
  .metric-grid,
  .site-grid,
  .account-form,
  .site-permissions { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; }
  .event-row { grid-template-columns: 1fr; }
}

/* Signal Feed interface */
:root {
  --bg: #050607;
  --bg-2: #090b0d;
  --panel: #0b0e11;
  --panel-solid: #0b0e11;
  --panel-2: #11151a;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f5f7f8;
  --muted: #8b949e;
  --faint: #5f6872;
  --accent: #36a9ff;
  --accent-2: #36a9ff;
  --positive: #49d17d;
  --warning: #f2a33c;
  --red: #ff6868;
  --radius: 5px;
}

html { scroll-behavior: auto; }
body { background: var(--bg); }
body {
  font-family: var(--font-ui);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button,
input,
select,
textarea { font-family: inherit; letter-spacing: 0; }
time,
[data-signal-kpi],
[data-signal-delta],
.signal-score,
.result-count,
.refresh-status,
.stage-row strong,
.source-mini-row strong { font-variant-numeric: tabular-nums; }
button { border-radius: 4px; }
input, select, textarea {
  border-radius: 4px;
  background: #090c0f;
}
textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 11px;
  font: inherit;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dashboard { grid-template-columns: 212px minmax(0, 1fr); }
.sidebar {
  padding: 20px 12px;
  background: #060708;
  backdrop-filter: none;
}
.brand-lockup { padding: 0 8px; }
.brand-lockup .brand-symbol { width: 38px; height: 38px; }
.brand-lockup .brand-symbol svg { width: 32px; height: 32px; }
.brand-lockup strong { font-family: var(--font-display); font-size: 14px; font-weight: 650; }
.brand-lockup small { font-size: 11px; }
.side-nav { gap: 3px; margin-top: 28px; }
.side-nav .nav-label {
  margin: 20px 10px 6px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 520;
  line-height: 1.35;
}
.side-nav a img,
.icon-button img {
  width: 18px;
  height: 18px;
  filter: invert(83%) sepia(8%) saturate(209%) hue-rotate(169deg) brightness(87%);
}
.side-nav a:hover,
.side-nav a.is-active {
  border-color: transparent;
  background: #13171b;
}
.side-nav a.is-active { box-shadow: inset 2px 0 0 var(--accent); }
.side-nav a.is-active img { filter: invert(64%) sepia(95%) saturate(3044%) hue-rotate(178deg) brightness(103%); }
.sidebar-card {
  left: 12px;
  right: 12px;
  bottom: 14px;
  padding: 12px;
  background: transparent;
}
.sidebar-card strong { font-size: 12px; }

.workspace { padding: 0 24px 36px; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  margin: 0 -24px 0;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 6, 7, .95);
  backdrop-filter: blur(16px);
}
.topbar-context,
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.context-select { display: flex; align-items: center; gap: 8px; margin: 0; }
.context-select span { color: var(--faint); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.context-select select { width: auto; min-width: 150px; padding: 8px 30px 8px 10px; font-weight: 520; }
.scope-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  background: #090c0f;
  cursor: pointer;
}
.scope-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.scope-toggle span { padding: 5px 10px; font-size: 12px; }
.scope-toggle:has(input:checked) { border-color: rgba(242, 163, 60, .45); color: #ffd291; }
.refresh-status { display: inline-flex; align-items: center; gap: 7px; color: var(--faint); font-size: 11px; }
.refresh-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  background: #090c0f;
}
.icon-button:hover { border-color: var(--line-strong); background: #15191e; }
.icon-button.small { width: 30px; height: 30px; }
.icon-button.small img { width: 15px; height: 15px; }

.view-shell { padding-top: 26px; scroll-margin-top: 66px; }
.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 72px;
  margin-bottom: 18px;
}
.view-heading h1 { margin: 3px 0 6px; font-family: var(--font-display); font-size: 31px; font-weight: 650; line-height: 1.14; letter-spacing: 0; }
.view-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 650; text-transform: uppercase; }
.result-count { color: var(--muted); font-size: 12px; }

.signal-layout {
  display: grid;
  grid-template-columns: 205px minmax(520px, 1fr) 292px;
  min-height: 650px;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: #080a0c;
}
.signal-summary,
.action-center { padding: 18px; background: #090b0e; }
.signal-summary { border-right: 1px solid var(--line); }
.action-center { border-left: 1px solid var(--line); }
.summary-date { display: grid; gap: 4px; }
.summary-date strong,
.section-title h2 { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 650; }
.summary-date span { color: var(--faint); font-size: 11px; }
.signal-kpis { display: grid; gap: 0; margin: 18px 0 0; }
.signal-kpis div { padding: 14px 0; border-top: 1px solid var(--line); }
.signal-kpis dt { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.4; }
.signal-kpis dd { display: flex; align-items: baseline; gap: 7px; margin: 6px 0 0; font-family: var(--font-display); font-size: 28px; font-weight: 620; letter-spacing: 0; }
.signal-kpis dd small { display: none; color: var(--positive); font-size: 11px; font-weight: 750; }
.signal-kpis dd small.is-visible { display: inline; }
.mini-trend,
.top-sources { margin-top: 22px; }
.mini-trend > span,
.top-sources > span,
.action-block > strong { color: var(--muted); font-size: 11px; font-weight: 700; }
.mini-trend svg { display: block; width: 100%; height: 74px; margin-top: 10px; }
.source-mini-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.source-mini-row span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }

.signal-feed { min-width: 0; }
.feed-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 58px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.feed-toolbar select { width: auto; min-width: 112px; padding: 8px 28px 8px 9px; font-size: 11px; font-weight: 500; }
.mobile-filter-trigger,
.mobile-only { display: none; }
.mobile-filter-trigger img { width: 16px; height: 16px; }
.mobile-filter-trigger img { filter: invert(78%) sepia(8%) saturate(277%) hue-rotate(169deg) brightness(89%); }
.mobile-filter-trigger b { display: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; color: #061016; background: var(--accent); font-size: 10px; line-height: 18px; text-align: center; }
.mobile-filter-trigger b:not(:empty) { display: inline-block; }
.filter-check { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 11px; white-space: nowrap; }
.filter-check input { width: auto; }
.text-button { padding: 8px 6px; color: var(--accent); background: transparent; font-size: 11px; font-weight: 650; white-space: nowrap; }
.feed-header,
.signal-row {
  display: grid;
  grid-template-columns: 72px minmax(150px, 1.15fr) minmax(150px, 1fr) 86px 52px 76px;
  gap: 10px;
  align-items: center;
}
.feed-header {
  min-height: 36px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
}
.signal-list { max-height: 555px; overflow: auto; }
.signal-row {
  width: 100%;
  min-height: 64px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  font-weight: 400;
  line-height: 1.35;
}
.signal-row:hover,
.signal-row.is-selected { background: #111820; }
.signal-row.is-selected { box-shadow: inset 2px 0 0 var(--accent); }
.signal-row:focus-visible,
.overdue-row:focus-visible,
.lead-table-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.signal-row time { color: var(--faint); font-size: 11px; }
.signal-event,
.signal-origin { min-width: 0; }
.signal-event strong,
.signal-origin strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.4; }
.signal-event strong { font-weight: 620; }
.signal-origin strong { font-weight: 540; }
.signal-event span,
.signal-origin span,
.signal-region { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.signal-score { color: var(--text); font-size: 12px; text-align: right; }
.signal-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.signal-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.signal-status[data-status="converted"]::before { background: var(--positive); }
.signal-status[data-status="overdue"]::before { background: var(--red); }
.signal-empty { display: grid; place-items: center; min-height: 260px; padding: 28px; color: var(--muted); text-align: center; }

.section-title,
.section-actions { display: flex; align-items: center; justify-content: space-between; }
.section-actions { gap: 7px; }
.action-block { margin-top: 20px; }
.stage-row,
.overdue-row { display: grid; gap: 7px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stage-row { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.stage-row span,
.stage-row strong { font-size: 11px; }
.stage-row i { grid-column: 1 / -1; height: 2px; background: #20262c; }
.stage-row i b { display: block; height: 100%; background: var(--accent); }
.overdue-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--text); background: transparent; text-align: left; }
.overdue-row:hover { background: #12171c; }
.overdue-row strong { font-size: 11px; }
.overdue-row span { color: var(--muted); font-size: 10px; }
.overdue-row em { color: var(--red); font-size: 10px; font-style: normal; }
.lead-table-row { cursor: pointer; }
.lead-table-row:hover { background: #111820; }

[data-view="signals"] .chart-area { fill: rgba(103, 212, 255, .16); opacity: 1; }

.lead-drawer { margin-top: 12px; border: 1px solid var(--line-strong); border-radius: 5px; background: #090c0f; }
.lead-drawer > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.lead-drawer header span { color: var(--accent); font-size: 10px; }
.lead-drawer h2 { margin: 3px 0 0; font-family: var(--font-display); font-size: 18px; font-weight: 650; }
.lead-detail-grid { display: grid; grid-template-columns: 1fr 1.2fr 320px; }
.lead-detail-grid > section,
.lead-detail-grid > form { min-width: 0; padding: 16px; border-right: 1px solid var(--line); }
.lead-detail-grid > form { border-right: 0; }
.lead-detail-grid h3 { margin: 0 0 12px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.detail-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.detail-row span { color: var(--faint); }
.activity-item { position: relative; padding: 0 0 14px 18px; color: var(--muted); font-size: 11px; }
.activity-item::before { content: ""; position: absolute; left: 2px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.activity-item::after { content: ""; position: absolute; left: 4px; top: 14px; bottom: 0; width: 1px; background: var(--line-strong); }
.activity-item:last-child::after { display: none; }
.lead-detail-grid form label { margin-top: 10px; }
.lead-detail-grid form button { margin-top: 12px; width: 100%; }

.hero-panel,
.health-panel,
.metric-grid article,
.site-card,
.panel { background: var(--panel); box-shadow: none; }
.business-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.business-grid > .panel:only-child { grid-column: 1 / -1; }
.bar-fill { background: var(--accent); }
.radial { opacity: .45; }

@media (max-width: 1240px) {
  .signal-layout { grid-template-columns: 190px minmax(480px, 1fr); }
  .action-center { grid-column: 1 / -1; display: grid; grid-template-columns: 180px 1fr 1fr; gap: 20px; align-items: start; border-top: 1px solid var(--line); border-left: 0; }
  .action-block { margin-top: 0; }
  .business-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    top: auto;
    height: auto;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    border-right: 0;
  }
  .brand-lockup,
  .sidebar-card,
  .side-nav .nav-label { display: none; }
  .side-nav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; margin: 0; }
  .side-nav a { display: grid; justify-items: center; gap: 3px; min-height: 48px; padding: 5px 2px; font-size: 9px; }
  .side-nav a.is-active { box-shadow: inset 0 2px 0 var(--accent); }
  .side-nav a img { width: 17px; height: 17px; }
  .workspace { padding: 0 14px 86px; }
  .topbar { margin: 0 -14px; padding: 10px 14px; }
  .refresh-status { display: none; }
  .signal-layout { grid-template-columns: 1fr; }
  .signal-summary { grid-row: 1; border-right: 0; border-bottom: 1px solid var(--line); }
  .action-center { grid-row: 2; }
  .signal-feed { grid-row: 3; }
  .signal-kpis { grid-template-columns: repeat(4, 1fr); }
  .signal-kpis div { padding: 12px 8px; }
  .signal-kpis dd { font-size: 22px; }
  .mini-trend,
  .top-sources { display: none; }
  .action-center { grid-column: auto; grid-template-columns: 1fr; border-top: 0; border-bottom: 1px solid var(--line); }
  .mobile-only { display: inline-grid; }
  .action-center:not(.is-expanded) .action-block { display: none; }
  .action-center.is-expanded [data-action-center-toggle] img { transform: rotate(90deg); }
  .lead-detail-grid { grid-template-columns: 1fr; }
  .lead-detail-grid > section,
  .lead-detail-grid > form { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .topbar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
  .topbar-context { display: grid; grid-column: 1 / -1; grid-template-columns: minmax(0, 1.2fr) minmax(0, .9fr) auto; width: 100%; }
  .context-select { display: block; margin: 0; }
  .context-select span { display: none; }
  .context-select select { width: 100%; min-width: 0; }
  .scope-toggle { grid-column: auto; justify-content: center; min-height: 36px; margin: 0; }
  .scope-toggle span { padding: 4px 7px; font-size: 11px; }
  .topbar-actions { display: grid; grid-column: 2; grid-template-columns: repeat(3, 34px); }
  .topbar-actions .icon-button { width: 34px; height: 34px; }
  .topbar-actions [data-export-events],
  .topbar-actions [data-export-leads] { display: none; }
  .view-shell { padding-top: 18px; }
  .view-heading { align-items: flex-start; min-height: 64px; }
  .view-heading h1 { font-size: 26px; }
  .result-count { margin-top: 8px; }
  .signal-layout { border-right: 0; border-left: 0; margin: 0 -14px; border-radius: 0; }
  .signal-summary { padding: 14px; }
  .signal-kpis dt { font-size: 9px; }
  .signal-kpis dd { font-size: 19px; }
  .feed-toolbar { min-height: 48px; flex-wrap: wrap; overflow: visible; }
  .mobile-filter-trigger { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 7px 9px; border: 1px solid var(--line); color: var(--text); background: #0a0d10; font-size: 11px; }
  .feed-toolbar:not(.is-expanded) > :not(.mobile-filter-trigger) { display: none; }
  .feed-toolbar.is-expanded select { width: calc(50% - 4px); min-width: 0; }
  .feed-toolbar.is-expanded .filter-check { min-height: 32px; flex: 1; }
  .feed-header { display: none; }
  .signal-list { max-height: none; }
  .signal-row { grid-template-columns: 54px minmax(0, 1fr) 68px; gap: 8px; padding: 11px 14px; }
  .signal-origin,
  .signal-region,
  .signal-score { display: none; }
  .action-center { padding: 14px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-grid,
  .analytics-grid,
  .business-grid { grid-template-columns: 1fr; }
}
