:root {
  --blue: #175cff;
  --blue-2: #0a8ee8;
  --ink: #07142d;
  --muted: #68758e;
  --line: #dce6f6;
  --green: #91c83e;
  --bg: #eef4fb;
  --panel: rgba(255, 255, 255, .92);
  --soft: #f5f8fd;
  --shadow: 0 24px 70px rgba(7, 20, 45, .12);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 86% 0, #cfe0ff 0, transparent 36%), var(--bg); }
body.booting #loginView { visibility: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-family: "Manrope", sans-serif; font-weight: 800; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; }
.error { min-height: 20px; color: #d92d20; font-size: 13px; margin: 8px 0; font-weight: 700; }
.muted { color: var(--muted); }
.brand-lockup { display: inline-flex; align-items: center; width: 285px; max-width: 100%; text-decoration: none; }
.brand-lockup img { display: block; width: 100%; height: auto; object-fit: contain; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(520px, 1.05fr) minmax(430px, .75fr);
  gap: 22px;
  padding: 22px;
  position: relative;
  z-index: 1;
}

.login-card, .login-art {
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(20px);
  min-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 5vw, 72px);
}

.login-brand {
  display: inline-flex;
  align-items: center;
  width: min(340px, 100%);
  max-width: 100%;
  text-decoration: none;
}

.login-brand img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.login-copy {
  margin: auto 0;
  max-width: 560px;
  padding: 64px 0 44px;
}

.login-copy h1 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(42px, 5vw, 72px);
  line-height: .98;
  letter-spacing: -.06em;
}

.login-copy h1 em { color: var(--blue); font-style: normal; }
.login-copy p { max-width: 450px; margin: 22px 0 0; color: var(--muted); font-size: 17px; line-height: 1.6; }

.app-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 20px;
}

.app-links a, .header-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.app-links a.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  box-shadow: 0 14px 26px rgba(23,92,255,.18);
}

.login-form { display: grid; gap: 8px; max-width: 470px; }
.login-form label { display: grid; gap: 8px; color: var(--ink); font-size: 12px; font-weight: 700; }
label span { display: block; margin-bottom: 8px; color: var(--ink); font-size: 14px; font-weight: 800; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 0 16px; background: #f9fbfe; color: var(--ink); outline: none; font-size: 16px; font-weight: 600; }
.filters select { height: 42px; font-size: 13px; font-weight: 800; }
.password-row { display: flex; align-items: center; position: relative; }
.login-form input { height: 54px; }
.password-row input { width: 100%; padding: 0 70px 0 16px; }
.password-row .icon-button { position: absolute; right: 8px; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(23, 92, 255, .1); }
.login-form > button, .header-actions button {
  border: 0;
  border-radius: 12px;
  min-height: 54px;
  padding: 0 17px;
  background: var(--blue);
  color: white;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(23, 92, 255, .24);
}
.login-form > button { display: flex; justify-content: space-between; align-items: center; }
.login-form > button b { margin-left: auto; font-size: 18px; }
.login-form > button:disabled { opacity: .72; cursor: wait; }
.button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 17px;
  font-weight: 700;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.button.quiet {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: none;
}
.header-actions button {
  min-height: 44px;
  padding: 0 17px;
  font-size: 13px;
  box-shadow: 0 10px 20px rgba(23, 92, 255, .2);
}
.header-actions a {
  min-height: 44px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}
.icon-button {
  min-width: 40px;
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: #edf2f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}
.header-actions .icon-button {
  min-width: 40px;
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: #edf2f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}
.login-foot { margin: 44px 0 0; color: #8290a5; font-weight: 900; font-size: 10px; line-height: 1.65; letter-spacing: .06em; text-transform: uppercase; }
.login-art { position: relative; overflow: hidden; min-height: calc(100vh - 44px); height: auto; background: #07142d; }
.login-art img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center center; }

.app-shell { min-height: 100vh; position: relative; z-index: 1; }
.app-footer { max-width: 1540px; margin: -16px auto 0; padding: 0 24px 24px; color: #8a96a8; font-size: 10px; line-height: 1.6; letter-spacing: .055em; text-align: center; text-transform: uppercase; }
.app-header {
  height: 72px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: auto auto minmax(160px, 1fr) auto;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.script-selector-wrap {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 6px 5px 10px;
  border: 1px solid #d7e2f5;
  border-radius: 999px;
  background: #f8fbff;
}
.script-selector-wrap span {
  color: #7b8799;
  font: 800 9px "Manrope";
  letter-spacing: .08em;
  text-transform: uppercase;
}
.script-selector-wrap select {
  width: min(230px, 24vw);
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--ink);
  padding: 0 28px 0 10px;
  font: 800 11px "Manrope";
  outline: none;
}
.script-selector-wrap select:focus { box-shadow: 0 0 0 3px rgba(23,92,255,.12); }
.header-center { justify-self: center; display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 99px; background: #f2f6fb; color: var(--muted); font-size: 12px; }
.header-center strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #9ba7b8; }
.live-dot.running { background: var(--green); box-shadow: 0 0 0 5px rgba(145,200,62,.18); }
.header-actions { justify-self: end; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.status-panel { margin-bottom: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.72); color: var(--muted); font-weight: 800; }
.status-panel[hidden] { display: none; }

.tracker-layout {
  width: 100%;
  max-width: 1540px;
  min-height: calc(100vh - 72px);
  margin: auto;
  padding: 28px 24px 40px;
  display: grid;
  grid-template-columns: 220px minmax(520px, 1fr) 290px;
  gap: 22px;
  align-items: start;
}

.side-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  scrollbar-width: thin;
}

.main-panel { display: grid; gap: 18px; min-width: 0; }
.panel, .side-panel.left-panel {
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel, .side-panel.left-panel { padding: 18px; overflow: hidden; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading.compact { margin-bottom: 12px; }
.panel-heading h2 { margin: 0; font-family: "Manrope", sans-serif; font-size: 24px; line-height: 1.05; letter-spacing: -.045em; }
.panel-heading > span { color: var(--muted); font-weight: 900; }

.filters { display: grid; gap: 12px; margin-bottom: 10px; }
.kpi-grid { display: grid; gap: 12px; }
.kpi-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
}
.kpi-card span { color: var(--muted); font-family: "Manrope", sans-serif; font-weight: 800; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.kpi-card strong { display: block; margin-top: 5px; font-family: "Manrope", sans-serif; font-size: 30px; line-height: 1; letter-spacing: -.055em; }
.kpi-card em { display: block; margin-top: 5px; color: var(--muted); font-style: normal; font-weight: 800; font-size: 11px; line-height: 1.25; }

.chart-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 18px; }
canvas { width: 100%; display: block; }
.funnel-chart, .output-chart { display: grid; gap: 12px; }
.funnel-row {
  display: grid;
  grid-template-columns: minmax(120px, .9fr) minmax(140px, 1.2fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}
.funnel-row strong, .output-name strong { display: block; color: var(--ink); font: 900 13px/1.1 "Manrope", sans-serif; }
.funnel-row span, .output-name span, .bar-label { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 800; line-height: 1.2; }
.funnel-row b {
  color: var(--ink);
  font: 900 20px/1 "Manrope", sans-serif;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.funnel-track, .output-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef8;
}
.funnel-track i, .output-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  animation: chartGrow .32s ease both;
  animation-delay: var(--delay, 0ms);
}
.insight-card {
  margin-top: 12px;
  padding: 12px 13px;
  border: 1px solid #d7e2f5;
  border-radius: 15px;
  background: #f8fbff;
}
.insight-card strong { display: block; margin-bottom: 5px; color: var(--blue); font: 900 10px "Manrope", sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.insight-card p { margin: 0; color: var(--ink-2); font-size: 12px; font-weight: 750; line-height: 1.45; }
.outcome-mix { margin-top: 12px; }
.stacked-bar { display: flex; height: 16px; overflow: hidden; border-radius: 999px; background: #e8eef8; }
.stacked-bar i { min-width: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.legend i { width: 10px; height: 10px; border-radius: 999px; }
.output-row {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(180px, 1.4fr) minmax(92px, auto);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.output-bars { display: grid; gap: 5px; }
.output-track { position: relative; height: 13px; }
.output-track.slim { height: 10px; }
.output-track .calls { background: #dfe7f4; }
.output-track .connects {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
}
.split-track {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.split-track i {
  display: block;
  height: 10px;
  min-width: 3px;
  border-radius: 999px;
  background: #e8eef8;
}
.split-track .meetings { background: linear-gradient(90deg, var(--green), #74b52b); }
.split-track .mqls { background: linear-gradient(90deg, var(--blue), var(--blue-2)); }
.metric-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  text-align: right;
}
.metric-pair b {
  min-width: 42px;
  color: var(--ink);
  font: 900 22px/.92 "Manrope", sans-serif;
}
.metric-pair b:first-child { color: #5c8f22; }
.metric-pair b:last-child { color: var(--blue); }
.metric-pair b small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }

@keyframes chartGrow {
  from { transform: scaleX(.2); transform-origin: left center; opacity: .45; }
  to { transform: scaleX(1); transform-origin: left center; opacity: 1; }
}

.leaderboard { display: grid; gap: 10px; }
.leader-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}
.rank { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: #07142d; color: white; font-family: "Manrope", sans-serif; font-size: 13px; font-weight: 900; }
.leader-row h3 { margin: 0 0 4px; font-family: "Manrope", sans-serif; font-size: 13px; line-height: 1.1; }
.leader-row p, .mini-item p { margin: 0; color: var(--muted); font-weight: 800; font-size: 11px; line-height: 1.18; }
.score { text-align: right; }
.score strong { display: block; font-family: "Manrope", sans-serif; font-size: 20px; line-height: .95; }
.mini-list { display: grid; gap: 12px; }
.mini-item { padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.mini-item h3 { margin: 0 0 6px; font-family: "Manrope", sans-serif; font-size: 13px; }
.table-wrap { overflow: auto; max-height: 36vh; border: 1px solid var(--line); border-radius: 16px; background: white; }
table { width: 100%; min-width: 940px; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid #edf2f8; text-align: left; vertical-align: top; }
th { position: sticky; top: 0; z-index: 1; background: #f7faff; color: var(--muted); font-family: "Manrope", sans-serif; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td { font-size: 13px; font-weight: 750; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; padding: 12px 16px; border-radius: 999px; background: var(--ink); color: white; font-weight: 900; transition: .18s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (min-width: 921px) {
  html, body { height: 100%; overflow: hidden; }
  .app-shell {
    height: 100vh;
    min-height: 0;
    display: grid;
    grid-template-rows: 72px minmax(0, 1fr) 20px;
    overflow: hidden;
  }
  .app-header { position: relative; }
  .tracker-layout {
    height: 100%;
    min-height: 0;
    padding: 12px 20px 8px;
    overflow: hidden;
  }
  .side-panel {
    position: static;
    max-height: 100%;
    min-height: 0;
    overflow: auto;
  }
  .main-panel {
    min-height: 0;
    max-height: 100%;
    overflow: auto;
    padding-right: 4px;
    scrollbar-width: thin;
  }
  .right-panel {
    min-height: 0;
    max-height: 100%;
    overflow: auto;
    scrollbar-width: thin;
  }
  .table-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .table-wrap {
    flex: 1 1 auto;
    min-height: 180px;
    max-height: none;
  }
  .app-footer {
    margin: 0;
    max-width: none;
    padding: 1px 20px 0;
    line-height: 1.4;
  }
}

@media (max-width: 1220px) {
  .tracker-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .right-panel { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; position: static; }
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .tracker-layout { grid-template-columns: 1fr; }
  .side-panel { position: static; max-height: none; }
  .right-panel { grid-template-columns: 1fr; }
  .app-header { height: auto; min-height: 72px; grid-template-columns: 1fr auto; gap: 10px; padding-block: 10px; }
  .script-selector-wrap { grid-column: 1 / -1; order: 3; width: min(100%, 360px); }
  .script-selector-wrap select { width: 100%; }
  .header-center { justify-self: end; }
  .header-actions { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .login-shell { padding: 0; }
  .login-card { min-height: 100vh; border-radius: 0; padding: 28px 22px; }
  .login-copy { padding: 54px 0 32px; }
  .app-header { height: 64px; padding: 0 14px; grid-template-columns: 1fr auto; }
  .brand-lockup { width: 220px; }
  .header-center { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 15; box-shadow: 0 8px 24px rgba(7,20,45,.14); white-space: nowrap; }
  .tracker-layout { padding: 16px 12px 80px; }
  .app-footer { padding: 0 18px 76px; }
}
