:root {
  --ink: #07142e;
  --muted: #65728a;
  --line: #dce7f6;
  --panel: rgba(255, 255, 255, 0.92);
  --soft: #f4f8fd;
  --blue: #175cff;
  --blue-dark: #07142e;
  --green: #9bd038;
  --warn: #ef4444;
  --shadow: 0 24px 70px rgba(7, 20, 45, 0.12);
  --radius: 24px;
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 86% 0, #cfe0ff 0, transparent 36%), #eef4fb;
}

body.booting {
  opacity: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

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

.login-card,
.login-art {
  min-height: calc(100vh - 44px);
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

.login-brand img {
  width: min(340px, 100%);
  display: block;
  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(40px, 4.7vw, 66px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.login-copy em {
  color: var(--blue);
  font-style: normal;
}

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

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

.app-links a.active {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.login-form {
  display: grid;
  gap: 8px;
  max-width: 470px;
}

.login-form label,
.lead-form label > span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.password-row {
  display: flex;
  align-items: center;
  position: relative;
}

.password-row input {
  flex: 1;
  width: 100%;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  padding: 0 70px 0 16px;
  color: var(--ink);
  background: #f9fbfe;
}

.password-row .icon-button {
  position: absolute;
  right: 8px;
}

.error {
  min-height: 20px;
  color: var(--warn);
  font-size: 13px;
  margin: 8px 0;
  font-weight: 800;
}

.button,
.icon-button {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 17px;
  font-weight: 700;
}

.icon-button {
  min-width: 40px;
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  box-shadow: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.button.primary {
  min-height: 54px;
  background: var(--blue);
  color: white;
  box-shadow: 0 12px 24px rgba(23, 92, 255, 0.24);
}

.button.quiet {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  box-shadow: none;
}

.icon-button {
  color: var(--ink);
  background: #eef4fb;
  border: 1px solid var(--line);
}

.button.full {
  width: 100%;
}

.login-foot,
.app-footer {
  color: #8290a5;
  font-weight: 900;
  font-size: 10px;
  line-height: 1.65;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-foot {
  margin: 44px 0 0;
}

.login-art img {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 44px);
  object-fit: cover;
  display: block;
}

.app-shell {
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 72px auto 1fr 30px;
}

.app-header {
  display: grid;
  grid-template-columns: auto auto minmax(160px, 1fr) auto;
  align-items: center;
  gap: 14px;
  height: 72px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

.brand-lockup img {
  width: 285px;
  display: block;
}

.script-selector-wrap {
  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,
.eyebrow {
  color: #7b8799;
  font: 800 9px "Manrope", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.script-selector-wrap select {
  width: min(250px, 24vw);
  height: 30px;
  border: 0;
  outline: 0;
  background: #eef4ff;
  border-radius: 999px;
  padding: 0 28px 0 10px;
  color: var(--ink);
  font: 800 11px "Manrope", sans-serif;
}

.form-selector-wrap select {
  background: #eef4ff;
  color: var(--ink);
}

.header-center {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f2f7fd;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(155, 208, 56, 0.18);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.header-actions .button {
  min-height: 44px;
  font-size: 13px;
}

.status-panel {
  margin: 0;
  padding: 12px 24px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tracker-layout {
  min-height: 0;
  display: grid;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
  grid-template-columns: 290px minmax(520px, 1fr) 290px;
  gap: 22px;
  padding: 24px 24px 34px;
}

.side-panel,
.main-panel {
  min-height: 0;
  overflow: auto;
}

.panel,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.side-panel {
  padding: 18px;
}

.right-panel,
.left-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.right-panel {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.right-panel .panel {
  padding: 18px;
}

.main-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.form-panel {
  min-height: 100%;
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-heading h2,
.sheet-card h3 {
  margin: 4px 0 0;
  font-family: "Manrope", sans-serif;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.025em;
}

.panel-heading .eyebrow,
.sheet-card .eyebrow {
  margin: 0;
}

#connectionStatus {
  border-radius: 12px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

#connectionStatus.good {
  color: #3f6910;
  background: #eaf7cf;
}

#connectionStatus.warn {
  color: #8a331a;
  background: #fff1eb;
}

.source-list {
  display: grid;
  gap: 12px;
}

.source-button {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 14px;
  text-align: left;
  align-items: start;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fbff;
  padding: 16px;
  color: var(--ink);
}

.source-button.active {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.source-button strong {
  display: block;
  font-size: 16px;
  font-weight: 900;
}

.source-button small {
  display: block;
  margin-top: 6px;
  color: inherit;
  opacity: 0.7;
  line-height: 1.35;
  font-weight: 800;
}

.source-dot {
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 99px;
  background: var(--green);
}

.source-dot.blue {
  background: var(--blue);
}

.source-dot.navy {
  background: var(--ink);
}

.stats-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-card,
.stat-note,
.access-mini,
.source-breakdown {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: #fbfdff;
}

.stat-card.hero {
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}

.stat-card.hero {
  background: linear-gradient(135deg, rgba(155, 208, 56, 0.18), rgba(255, 255, 255, 0.96));
}

.stat-card span,
.stat-note span,
.mini-stats span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  font-family: "Manrope", sans-serif;
  font-size: 46px;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.stat-card small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.mini-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-stats div {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: white;
}

.mini-stats strong,
.stat-note strong {
  display: block;
  margin-top: 8px;
  font-family: "Manrope", sans-serif;
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.mini-stats .name-stat {
  font-size: 14px;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.mini-stats small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-weight: 800;
}

.stat-note {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}

.stat-note strong {
  margin: 0;
}

.access-mini {
  color: #8a331a;
  background: #fff7f2;
  border-color: #ffd6c7;
  font-weight: 900;
  line-height: 1.4;
}

.source-breakdown {
  display: grid;
  gap: 8px;
}

.source-breakdown .eyebrow {
  margin: 0 0 4px;
}

.source-breakdown div {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: white;
}

.source-breakdown span {
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
  line-height: 1.2;
}

.source-breakdown strong {
  font-family: "Manrope", sans-serif;
  font-size: 18px;
}

.access-warning {
  margin-bottom: 14px;
  border: 1px solid #ffd6c7;
  border-radius: 14px;
  padding: 12px 14px;
  color: #8a331a;
  background: #fff7f2;
  font-size: 13px;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-section {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fbfdff;
}

.form-section + .form-section {
  margin-top: 12px;
}

.form-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e9f0fa;
}

.form-section-title span {
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.form-section-title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.lead-form label {
  display: block;
}

.lead-form input,
.lead-form select,
.lead-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  min-height: 42px;
  padding: 10px 12px;
  background: #fbfdff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.lead-form select[multiple] {
  min-height: 96px;
}

.lead-form textarea {
  min-height: 92px;
  resize: vertical;
}

.lead-form input:focus,
.lead-form select:focus,
.lead-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(23, 92, 255, 0.1);
}

.lead-form .wide {
  grid-column: 1 / -1;
}

.check-field {
  display: flex !important;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #fbfdff;
}

.check-field input {
  width: 20px;
  height: 20px;
}

.check-field span {
  margin: 0 !important;
}

.lead-form footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.guide-list {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.last-action {
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  padding: 13px 20px;
  color: white;
  background: var(--ink);
  font-weight: 900;
  transition: 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1300px) {
  .tracker-layout {
    grid-template-columns: 310px 1fr;
  }

  .right-panel {
    display: none;
  }

  .app-header {
    grid-template-columns: 250px 340px 1fr auto;
  }

  .brand-lockup img {
    width: 235px;
  }
}

@media (max-width: 980px) {
  .login-shell,
  .tracker-layout,
  .app-header {
    display: block;
    height: auto;
    min-height: auto;
  }

  .login-shell {
    padding: 14px;
  }

  .login-card,
  .login-art {
    min-height: auto;
    margin-bottom: 14px;
  }

  .login-art img {
    min-height: 420px;
  }

  .app-shell {
    height: auto;
    overflow: visible;
    display: block;
  }

  .app-header,
  .tracker-layout {
    padding: 14px;
  }

  .script-selector-wrap,
  .header-center,
  .header-actions,
  .side-panel,
  .main-panel {
    margin-top: 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
