*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg-0: #06070b;
  --bg-1: #0c0e16;
  --bg-2: #121624;
  --bg-card: rgba(18, 22, 36, 0.78);
  --bg-glass: rgba(255, 255, 255, 0.035);
  --border: rgba(255, 255, 255, 0.08);
  --border-hi: rgba(99, 102, 241, 0.42);
  --text-0: #f8fafc;
  --text-1: #cbd5e1;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --cyan: #06b6d4;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-glow: 0 20px 50px -15px rgba(99, 102, 241, 0.22);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-0);
  color: var(--text-0);
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -15%, rgba(99, 102, 241, 0.22), transparent),
    radial-gradient(ellipse 55% 40% at 88% 15%, rgba(6, 182, 212, 0.14), transparent),
    radial-gradient(ellipse 50% 40% at 12% 75%, rgba(16, 185, 129, 0.1), transparent);
}

a { color: inherit; text-decoration: none; }
code, pre, .mono { font-family: 'JetBrains Mono', monospace; }

/* ── Top Navigation ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(6, 7, 11, 0.82);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 13px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.brand-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-link {
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.18s ease;
}
.nav-link:hover { color: var(--text-0); background: var(--bg-glass); }
.nav-link.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.4);
}
.wallet-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 12.5px;
  font-weight: 600;
}
.wallet-pill .credits-num {
  color: #34d399;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13.5px;
}

/* ── Main Container ── */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 24px 88px;
}

/* ── Hero Header ── */
.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 24px;
  padding: 32px;
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(18, 22, 36, 0.92), rgba(12, 14, 22, 0.92));
  border: 1px solid var(--border-hi);
  box-shadow: var(--shadow-glow);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding: 24px; }
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.38);
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.22;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #c7d2fe 55%, #67e8f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  color: var(--text-1);
  font-size: 14.5px;
  max-width: 680px;
  margin-bottom: 18px;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-1);
}
.chip.emerald { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.32); color: #6ee7b7; }
.chip.cyan { background: rgba(6, 182, 212, 0.12); border-color: rgba(6, 182, 212, 0.32); color: #67e8f9; }
.chip.amber { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.32); color: #fcd34d; }
.chip.purple { background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.35); color: #c4b5fd; }

.hero-wallet-card {
  background: rgba(8, 10, 18, 0.78);
  border: 1px solid rgba(16, 185, 129, 0.32);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}
.wallet-balance-big {
  font-size: 30px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #34d399;
  letter-spacing: -0.02em;
}
.wallet-sub {
  font-size: 12px;
  color: var(--text-2);
}

/* ── View Switcher Tabs ── */
.section-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.section-tab {
  padding: 10px 18px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--text-2);
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.section-tab:hover { color: var(--text-0); border-color: rgba(255,255,255,0.2); }
.section-tab.active {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.32);
}

/* ── Grid Layouts ── */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 22px;
  margin-bottom: 28px;
}
@media (max-width: 1024px) {
  .studio-grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  backdrop-filter: blur(16px);
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-subtitle {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 3px;
}

/* ── Form Controls ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.field label span.hint {
  color: var(--text-3);
  font-weight: 400;
  font-size: 11px;
}
.input, .select, .textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(6, 7, 11, 0.75);
  color: var(--text-0);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
}
.textarea { min-height: 68px; resize: vertical; }

/* ── Harness Selector Pills ── */
.harness-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
@media (max-width: 720px) {
  .harness-grid { grid-template-columns: repeat(2, 1fr); }
}
.harness-btn {
  padding: 10px 8px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-1);
  cursor: pointer;
  text-align: center;
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.harness-btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
}
.harness-btn.active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.16);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.22);
}
.harness-btn .h-icon { font-size: 18px; }
.harness-btn .h-name { font-size: 12px; font-weight: 700; }
.harness-btn .h-cfg { font-size: 10px; color: var(--text-3); font-family: 'JetBrains Mono', monospace; }

/* ── Effort Selector ── */
.effort-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.effort-btn {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-1);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}
.effort-btn.active {
  border-color: #06b6d4;
  background: rgba(6, 182, 212, 0.15);
  color: #fff;
}
.effort-btn .e-name { font-size: 12px; font-weight: 700; display: block; }
.effort-btn .e-mult { font-size: 10.5px; color: var(--text-2); font-family: 'JetBrains Mono', monospace; }

/* ── Auth Mode Selector ── */
.auth-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.auth-mode-tab {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}
.auth-mode-tab.active {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.14);
  color: #fff;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  color: #fff;
  box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.45);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-emerald {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 8px 24px -6px rgba(16, 185, 129, 0.4);
}
.btn-emerald:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-1);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ── Active Cloud Agent Fleet Cards ── */
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}
@media (max-width: 520px) {
  .fleet-grid { grid-template-columns: 1fr; }
}
.agent-card {
  background: rgba(14, 18, 30, 0.88);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.agent-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}
.agent-card.is-host {
  border-color: rgba(6, 182, 212, 0.38);
  background: linear-gradient(160deg, rgba(6, 182, 212, 0.07), rgba(14, 18, 30, 0.92));
}
.agent-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.agent-name {
  font-size: 15.5px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 7px;
}
.agent-id-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #93c5fd;
  margin-top: 2px;
}
.agent-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.agent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── Billing & Token Credits Grid ── */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 26px;
}
@media (max-width: 1080px) {
  .plans-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .plans-grid { grid-template-columns: 1fr; }
}
.plan-card {
  background: rgba(14, 18, 30, 0.88);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  position: relative;
}
.plan-card.featured {
  border-color: #6366f1;
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.14), rgba(14, 18, 30, 0.92));
  box-shadow: 0 16px 40px -12px rgba(99, 102, 241, 0.3);
}
.plan-price {
  font-size: 28px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
}
.plan-rebate-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  font-size: 12px;
  color: #6ee7b7;
}
.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-1);
}
.plan-features li::before {
  content: "✓ ";
  color: #34d399;
  font-weight: 800;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 10, 0.78);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%;
  max-width: 620px;
  background: #0f1320;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 20px;
  padding: 26px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.65);
}

.status-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  display: none;
  word-break: break-all;
}
.status-box.ok {
  display: block;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}
.status-box.err {
  display: block;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fecdd3;
}
table.rate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.rate-table th, table.rate-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table.rate-table th { color: var(--text-2); font-weight: 600; }

/* ── Toasts (non-blocking notifications) ── */
#ui-toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 36px));
}
.ui-toast {
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  background: #0f1320;
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: #e5e7eb;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  word-break: break-word;
}
.ui-toast.ok { border-color: rgba(52, 211, 153, 0.55); }
.ui-toast.err { border-color: rgba(248, 113, 113, 0.65); }
