@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #08090c;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-border: rgba(255, 255, 255, 0.06);
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-tertiary: rgba(255, 255, 255, 0.30);
  --accent: rgba(255, 170, 50, 0.9);
  --accent-glow: rgba(255, 170, 50, 0.15);
  --warm: rgba(255, 170, 50, 0.9);
  --green: rgba(63, 185, 80, 0.9);
  --green-bg: rgba(63, 185, 80, 0.08);
  --yellow: rgba(210, 153, 34, 0.9);
  --yellow-bg: rgba(210, 153, 34, 0.08);
  --red: rgba(248, 81, 73, 0.9);
  --red-bg: rgba(248, 81, 73, 0.08);
  --glass-gradient: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 50%, rgba(255,255,255,0.04) 100%);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* === Ambient === */
.ambient {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient::before {
  content: '';
  position: absolute;
  top: -30%;
  left: 40%;
  width: 600px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(255, 170, 50, 0.04) 0%, transparent 70%);
  animation: drift 10s ease-in-out infinite;
}

@keyframes drift {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* === Glass edges === */
.glass-edges {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glass-edge {
  position: absolute;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
}

.glass-edge:nth-child(1) {
  width: 1px; height: 35vh; top: 0; left: 15%;
  transform: rotate(10deg); opacity: 0.5;
}

.glass-edge:nth-child(2) {
  width: 1px; height: 45vh; top: 8%; right: 20%;
  transform: rotate(-7deg); opacity: 0.35;
  background: linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.025) 40%, transparent 100%);
}

.glass-edge:nth-child(3) {
  width: 60px; height: 1px; top: 45%; left: 10%;
  transform: rotate(-4deg); opacity: 0.2;
  background: linear-gradient(90deg, transparent, rgba(255, 170, 50, 0.05), transparent);
}

/* === Layout === */
#app {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#content { flex: 1; }

/* === Header === */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  margin-bottom: 24px;
}

header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

header h1 a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-weight: 400;
  letter-spacing: 0.08em;
  font-size: 13px;
  margin-right: 8px;
  transition: color 0.2s;
}

header h1 a:hover { color: var(--text-secondary); }

#nav-auth {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  font-size: 13px;
  color: var(--text-secondary);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: rgba(255, 170, 50, 0.12);
  border: 1px solid rgba(255, 170, 50, 0.2);
  color: var(--accent);
}

.btn-primary:hover {
  background: rgba(255, 170, 50, 0.18);
  border-color: rgba(255, 170, 50, 0.3);
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover { color: var(--text-primary); }

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-danger {
  background: var(--red-bg);
  border: 1px solid rgba(248, 81, 73, 0.15);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.12);
}

/* === Landing === */
.landing { padding: 60px 0 40px; }

.landing-hero {
  text-align: center;
  margin-bottom: 60px;
}

.landing-hero h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.6) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-hero p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto 32px;
}

.landing-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.feature {
  background: var(--glass-gradient);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
}

.feature::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 170, 50, 0.1), transparent);
}

.feature-icon { font-size: 24px; display: block; margin-bottom: 12px; }

.feature h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.feature p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* === Auth === */
.auth-page {
  max-width: 360px;
  margin: 60px auto;
}

.auth-page h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.auth-page form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-page input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.auth-page input:focus {
  border-color: rgba(255, 170, 50, 0.3);
}

.auth-page input::placeholder { color: var(--text-tertiary); }

.auth-switch {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
}

.error-msg {
  font-size: 13px;
  color: var(--red);
  min-height: 20px;
}

.success-msg {
  font-size: 13px;
  color: var(--green);
  min-height: 20px;
}

.loading {
  text-align: center;
  padding: 60px 0;
  color: var(--text-tertiary);
  font-size: 14px;
}

.loading-text {
  color: var(--text-tertiary);
  font-size: 13px;
}

/* === Dashboard === */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

h2 {
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 24px 0 12px;
}

.empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--text-tertiary);
  font-size: 14px;
}

.empty-state .btn { margin-top: 16px; }

/* === Agent cards === */
.agents-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.agent-card {
  background: var(--glass-gradient);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

.agent-card:hover {
  border-color: rgba(255, 170, 50, 0.15);
  background: rgba(255, 255, 255, 0.04);
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.agent-name {
  font-weight: 600;
  font-size: 15px;
}

.agent-host {
  font-size: 13px;
  color: var(--text-tertiary);
  font-family: monospace;
}

.agent-card-status {
  display: flex;
  gap: 8px;
}

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}

.tag-active { background: var(--green-bg); color: var(--green); }
.tag-inactive { background: var(--red-bg); color: var(--red); }

/* === Services === */
#services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.service-card {
  background: var(--glass-gradient);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 10%, rgba(255, 170, 50, 0.12) 50%, transparent 90%);
}

.service-card:hover {
  border-color: rgba(255, 170, 50, 0.15);
}

.service-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.service-icon { font-size: 18px; }

.service-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.service-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.service-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.service-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.service-status-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.service-status-tag.active { background: var(--green-bg); color: var(--green); }
.service-status-tag.coming_soon { background: var(--surface); color: var(--text-tertiary); }
.service-status-tag.available { background: rgba(255, 170, 50, 0.08); color: var(--accent); }

/* === Agent detail === */
.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--surface-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.info-card {
  background: var(--bg);
  padding: 14px 18px;
}

.info-card .label {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  font-weight: 500;
}

.info-card .value {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

#checks-grid {
  display: grid;
  gap: 1px;
  background: var(--surface-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg);
  padding: 12px 18px;
}

.check-icon { font-size: 16px; }
.check-name { font-weight: 500; flex: 1; font-size: 14px; }
.check-message { color: var(--text-tertiary); font-size: 13px; }

.webhook-info {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 24px;
}

.webhook-info label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 6px;
}

.webhook-info code {
  display: block;
  font-size: 13px;
  color: var(--accent);
  word-break: break-all;
  margin-bottom: 6px;
}

.webhook-info .hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.agent-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

#action-result {
  min-height: 24px;
  font-size: 13px;
}

/* === Wizard (add agent) === */
.wizard {
  max-width: 480px;
  margin: 24px auto;
}

.wizard h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 24px;
}

.wizard form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wizard-step {
  margin-bottom: 8px;
}

.wizard label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.wizard input, .wizard textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.wizard input:focus, .wizard textarea:focus {
  border-color: rgba(255, 170, 50, 0.3);
}

.wizard input::placeholder, .wizard textarea::placeholder {
  color: var(--text-tertiary);
}

.wizard textarea {
  font-family: monospace;
  font-size: 12px;
  resize: vertical;
}

.wizard .btn { margin-top: 16px; }

/* === Footer === */
footer {
  margin-top: 40px;
  padding: 20px 0 32px;
  border-top: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover { color: var(--text-primary); }

/* === Responsive === */
@media (max-width: 640px) {
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  #services-grid { grid-template-columns: 1fr; }
  .landing-features { grid-template-columns: 1fr; }
  .landing-cta { flex-direction: column; align-items: center; }
  footer { flex-direction: column; gap: 8px; text-align: center; }
  header { flex-wrap: wrap; gap: 12px; }
  .agent-card-header { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* === Spinner === */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading {
  text-align: center;
  padding: 60px 0;
  color: var(--text-tertiary);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-loading {
  opacity: 0.6;
  cursor: wait;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* === Select === */
.wizard select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  cursor: pointer;
}

.wizard select:focus {
  border-color: rgba(255, 170, 50, 0.3);
}

.wizard select option {
  background: #161b22;
  color: var(--text-primary);
}

/* === Hint text === */
.hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  line-height: 1.4;
}

/* === Frameworks === */
.landing-frameworks {
  text-align: center;
  margin-top: 48px;
}

.frameworks-label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.frameworks-list {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.framework-tag {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-secondary);
}
