.topstep-panel {
  position: relative;
  overflow: hidden;
  scroll-margin-top: 150px;
}

.topstep-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .72), rgba(0, 229, 138, .55), transparent);
  pointer-events: none;
}

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

.topstep-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.topstep-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(34, 211, 238, .3);
  border-radius: 8px;
  color: #22d3ee;
  background: rgba(34, 211, 238, .08);
  box-shadow: inset 0 1px rgba(255, 255, 255, .04);
}

.topstep-mark svg {
  width: 20px;
  height: 20px;
}

.topstep-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.topstep-sub {
  max-width: 620px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.topstep-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, .025);
  font: 600 11px/1 'Geist Mono', monospace;
  white-space: nowrap;
}

.topstep-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
}

.topstep-status.connected {
  border-color: rgba(0, 229, 138, .28);
  color: var(--accent);
  background: rgba(0, 229, 138, .06);
}

.topstep-status.connected::before {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(0, 229, 138, .55);
}

.topstep-status.syncing {
  border-color: rgba(34, 211, 238, .3);
  color: #22d3ee;
}

.topstep-status.syncing::before {
  background: #22d3ee;
  animation: topstep-pulse 1.1s ease-in-out infinite;
}

.topstep-status.error {
  border-color: rgba(255, 77, 109, .35);
  color: var(--red);
}

.topstep-status.error::before { background: var(--red); }

@keyframes topstep-pulse {
  50% { opacity: .35; transform: scale(.75); }
}

.topstep-connect-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.topstep-field {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.topstep-field-wide { grid-column: 1 / -1; }

.topstep-key-wrap {
  position: relative;
}

.topstep-key-wrap .input {
  width: 100%;
  padding-right: 43px;
}

.topstep-key-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
}

.topstep-key-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .05);
}

.topstep-key-toggle svg {
  width: 16px;
  height: 16px;
}

.topstep-options {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.topstep-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, .018);
}

.topstep-option-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.topstep-option-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

.topstep-option .input {
  width: 132px;
  flex: 0 0 auto;
}

.topstep-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.topstep-connected {
  display: grid;
  gap: 12px;
}

.topstep-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, .018);
}

.topstep-stat {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--border);
}

.topstep-stat:last-child { border-right: 0; }

.topstep-stat span {
  display: block;
  color: var(--text-muted);
  font: 600 9px/1.25 'Geist Mono', monospace;
  text-transform: uppercase;
}

.topstep-stat strong {
  display: block;
  overflow: hidden;
  margin-top: 7px;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topstep-message {
  min-height: 18px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.topstep-message.error { color: var(--red); }
.topstep-message.success { color: var(--accent); }

.topstep-security-note {
  display: flex;
  gap: 9px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(34, 211, 238, .18);
  border-radius: 7px;
  color: var(--text-muted);
  background: rgba(34, 211, 238, .035);
  font-size: 10px;
  line-height: 1.55;
}

.topstep-security-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: #22d3ee;
}

@media (max-width: 760px) {
  .topstep-head,
  .topstep-option {
    align-items: stretch;
    flex-direction: column;
  }
  .topstep-connect-grid,
  .topstep-stats {
    grid-template-columns: 1fr;
  }
  .topstep-field-wide { grid-column: auto; }
  .topstep-stat {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .topstep-stat:last-child { border-bottom: 0; }
  .topstep-option .input { width: 100%; }
  .topstep-actions .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .topstep-status.syncing::before { animation: none; }
}
