/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f0f6ff;
  --bg-white: #ffffff;
  --bg-card: #ffffff;
  --border: #d4e0f0;
  --text: #1a2b4a;
  --text-dim: #4a6080;
  --text-muted: #7a90aa;
  --accent: #2563eb;
  --accent-dim: #1d4ed8;
  --accent-light: #dbeafe;
  --accent-lighter: #eff6ff;
  --green: #059669;
  --green-light: #d1fae5;
  --red: #dc2626;
  --red-light: #fee2e2;
  --terminal-bg: #1e293b;
  --terminal-border: #334155;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* === Nav === */
nav {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.93);
  backdrop-filter: blur(12px);
  z-index: 100;
}
nav .container { display: flex; align-items: center; justify-content: space-between; }
.logo { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
nav .links { display: flex; gap: 16px; align-items: center; }
nav .links a { color: var(--text-dim); font-size: 14px; transition: color 0.15s; }
nav .links a:hover { color: var(--accent); text-decoration: none; }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; border: none; cursor: pointer;
  transition: all 0.15s; font-family: var(--sans);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dim); text-decoration: none; }
.btn-outline { background: var(--bg-white); border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-dim); padding: 8px 12px; }
.btn-ghost:hover { color: var(--accent); text-decoration: none; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }

/* === Auth nav === */
#auth-nav { display: inline-flex; align-items: center; gap: 16px; }

/* === Profile dropdown === */
.profile-menu-wrap { position: relative; }
.avatar-circle {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-light); color: var(--accent);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.profile-btn { padding: 4px; }
.profile-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  min-width: 180px; overflow: hidden; z-index: 200;
}
.profile-dropdown.open { display: block; }
.profile-info { padding: 12px 16px; font-size: 13px; color: var(--text-dim); border-bottom: 1px solid var(--border); }
.profile-info strong { display: block; color: var(--text); font-size: 14px; }
.profile-dropdown a, .profile-dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 10px 16px; font-size: 14px; color: var(--text-dim);
  background: none; border: none; cursor: pointer; font-family: var(--sans);
  transition: background 0.1s;
}
.profile-dropdown a:hover, .profile-dropdown button:hover { background: var(--accent-lighter); color: var(--accent); text-decoration: none; }
.profile-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* === Hero === */
.hero { padding: 100px 0 80px; text-align: center; }
.hero h1 { font-size: 48px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; margin-bottom: 20px; }
.hero h1 .gradient {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { font-size: 18px; color: var(--text-dim); max-width: 560px; margin: 0 auto 36px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* === Terminal === */
.terminal {
  background: var(--terminal-bg); border: 1px solid var(--terminal-border);
  border-radius: var(--radius-lg); overflow: hidden; text-align: left;
  max-width: 640px; margin: 48px auto 0; box-shadow: var(--shadow-md);
}
.terminal-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--terminal-border); }
.terminal-dot { width: 12px; height: 12px; border-radius: 50%; }
.terminal-dot.r { background: #f87171; }
.terminal-dot.y { background: #fbbf24; }
.terminal-dot.g { background: #34d399; }
.terminal-title { font-family: var(--mono); font-size: 12px; color: #94a3b8; margin-left: 8px; }
.terminal pre { font-family: var(--mono); font-size: 13px; line-height: 1.8; padding: 20px; overflow-x: auto; color: #e2e8f0; }
.terminal .prompt { color: #34d399; }
.terminal .cmd { color: #e2e8f0; }
.terminal .output { color: #94a3b8; }
.terminal .url { color: #38bdf8; }

/* === Sections === */
section { padding: 80px 0; }
section h2 { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 12px; }
section .subtitle { color: var(--text-dim); font-size: 16px; margin-bottom: 48px; }

/* === Steps === */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.step { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; transition: all 0.2s; box-shadow: var(--shadow); }
.step:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.step-number { font-family: var(--mono); font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 12px; }
.step h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--text-dim); line-height: 1.5; }

/* === Features === */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.feature { display: flex; gap: 16px; padding: 20px; border-radius: var(--radius); transition: background 0.15s; }
.feature:hover { background: var(--accent-lighter); }
.feature-icon { font-size: 24px; flex-shrink: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--accent-light); border-radius: var(--radius); }
.feature h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.feature p { font-size: 13px; color: var(--text-dim); }

/* === Code blocks === */
.code-block { background: var(--terminal-bg); border: 1px solid var(--terminal-border); border-radius: var(--radius); padding: 16px 20px; margin: 12px 0; overflow-x: auto; }
.code-block code { font-family: var(--mono); font-size: 13px; color: #e2e8f0; }

/* === Tabs === */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tab { padding: 8px 16px; font-size: 13px; font-weight: 500; color: var(--text-dim); background: transparent; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; font-family: var(--sans); transition: all 0.15s; }
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); background: var(--accent-light); border-color: var(--accent-light); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.install-flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.install-step { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow); }
.install-step span { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-light); color: var(--accent); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.install-step strong { display: block; font-size: 13px; margin-bottom: 3px; }
.install-step p { font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.quick-note { margin-top: 12px; font-size: 13px; color: var(--text-dim); }

/* === Footer === */
footer { border-top: 1px solid var(--border); padding: 32px 0; text-align: center; color: var(--text-muted); font-size: 13px; }

/* === Page layouts === */
.page-section { padding: 48px 0; }
.page-section h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.page-section .page-subtitle { font-size: 14px; color: var(--text-dim); margin-bottom: 32px; }

/* === Cards === */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card p { font-size: 13px; color: var(--text-dim); }

/* === Contact === */
.contact-section { padding: 54px 0 76px; }
.contact-v2 .container { max-width: 1040px; }
.contact-hero { text-align: center; max-width: 680px; margin: 0 auto 34px; }
.contact-kicker { color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 700; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.contact-hero h1 { font-size: 42px; line-height: 1.08; letter-spacing: -0.8px; margin-bottom: 12px; }
.contact-hero p { color: var(--text-dim); font-size: 17px; max-width: 600px; margin: 0 auto; }
.contact-shell { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: start; }
.contact-copy { display: grid; gap: 14px; }
.limit-summary { display: grid; gap: 10px; }
.limit-summary div { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.limit-summary span { display: block; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 5px; }
.limit-summary strong { display: block; font-size: 22px; line-height: 1.2; }
.contact-checklist { background: var(--accent-lighter); border: 1px solid var(--accent-light); border-radius: var(--radius); padding: 18px; }
.contact-checklist h2 { font-size: 15px; margin-bottom: 6px; }
.contact-checklist p { color: var(--text-dim); font-size: 13px; line-height: 1.55; }
.contact-route-list { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.contact-route-list div { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.contact-route-list div:last-child { border-bottom: 0; }
.contact-route-list strong { display: block; font-size: 13px; margin-bottom: 2px; }
.contact-route-list span { display: block; color: var(--text-dim); font-size: 12px; line-height: 1.45; }
.contact-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 30px; box-shadow: var(--shadow-md); display: grid; gap: 16px; }
.form-heading { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 2px; }
.form-heading h2 { font-size: 22px; margin-bottom: 4px; }
.form-heading p { color: var(--text-dim); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contact-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; color: var(--text); }
.contact-form input, .contact-form select, .contact-form textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 13px; font: inherit; font-size: 14px; color: var(--text); background: #fbfdff; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; }
.contact-form textarea { resize: vertical; min-height: 154px; line-height: 1.5; }
.contact-form input::placeholder, .contact-form textarea::placeholder { color: var(--text-muted); }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); background: #fff; }
.contact-submit { width: 100%; justify-content: center; padding: 12px 16px; margin-top: 2px; }
.form-note { font-size: 12px; color: var(--text-muted); text-align: center; }

/* === Artifact rows === */
.artifacts-list { display: flex; flex-direction: column; gap: 12px; }
.artifact-row {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; display: grid; grid-template-columns: 1fr auto; gap: 8px 20px;
  align-items: center; transition: border-color 0.15s; box-shadow: var(--shadow);
}
.artifact-row:hover { border-color: var(--accent); }
.artifact-name { font-weight: 600; font-size: 14px; word-break: break-all; }
.artifact-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.artifact-meta span { margin-right: 14px; }
.artifact-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* === Action buttons === */
.action-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: var(--radius); padding: 5px 10px; font-size: 12px; cursor: pointer;
  font-family: var(--sans); transition: all 0.15s; white-space: nowrap;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.copied { border-color: var(--green); color: var(--green); }
.action-btn.danger:hover { border-color: var(--red); color: var(--red); }

/* === Token display === */
.token-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.token-value { font-family: var(--mono); font-size: 13px; background: var(--bg); padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }

/* === Empty/loading states === */
.empty-state { text-align: center; padding: 64px 20px; }
.empty-state h2 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--text-dim); margin-bottom: 20px; }
.loading { text-align: center; padding: 60px 20px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === Artifact viewer === */
.artifact-page { min-height: calc(100vh - 120px); display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.artifact-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; max-width: 520px; width: 100%; box-shadow: var(--shadow-md); }
.artifact-card h2 { font-size: 20px; margin-bottom: 4px; word-break: break-all; }
.artifact-card .meta { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.artifact-info { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin-bottom: 28px; }
.artifact-info dt { color: var(--text-muted); }
.artifact-info dd { color: var(--text); }
.artifact-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.error-state { text-align: center; padding: 60px 20px; }
.error-state h2 { color: var(--red); font-size: 20px; }
.error-state p { color: var(--text-dim); margin-top: 8px; }

/* === Auth pages === */
.auth-page { min-height: calc(100vh - 120px); display: flex; align-items: center; justify-content: center; }
.auth-card { text-align: center; padding: 60px 40px; max-width: 420px; }
.auth-icon { font-size: 48px; margin-bottom: 20px; }
.auth-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.auth-card p { color: var(--text-dim); font-size: 15px; margin-bottom: 8px; }
.not-authed { min-height: calc(100vh - 120px); display: flex; align-items: center; justify-content: center; text-align: center; }

/* === Admin table === */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-light, #eef4fb); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--accent-lighter); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.admin-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 32px; }
.admin-section-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.admin-section-header h2 { font-size: 16px; font-weight: 600; }
.admin-section-header .count { font-size: 13px; color: var(--text-muted); }

/* === Pricing === */
.billing-toggle { display: flex; align-items: center; justify-content: center; gap: 12px; }
.toggle-label { font-size: 14px; color: var(--text-dim); }
.save-badge { background: var(--green-light); color: var(--green); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; margin-left: 4px; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--accent); border-radius: 24px; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
input:checked + .toggle-slider::before { transform: translateX(20px); }

.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 760px; margin: 0 auto; }
.pricing-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; position: relative; box-shadow: var(--shadow); }
.pricing-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-md); }
.pricing-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; padding: 4px 14px; border-radius: 99px; white-space: nowrap; }
.pricing-plan { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.pricing-price { margin-bottom: 24px; line-height: 1; }
.pricing-price .amount { font-size: 44px; font-weight: 800; letter-spacing: -1.5px; color: var(--text); }
.pricing-price .period { font-size: 15px; color: var(--text-muted); }
.pricing-price .annual-note { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.pricing-features { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pricing-features li { font-size: 14px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.pricing-features li::before { content: '✓'; color: var(--green); font-weight: 700; flex-shrink: 0; }
.pricing-features li.dim { color: var(--text-muted); }
.pricing-features li.dim::before { content: '–'; color: var(--border); }

/* Pro badge in nav/profile */
.badge-pro { background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; letter-spacing: 0.04em; vertical-align: middle; margin-left: 6px; }

/* Upgrade banner */
.upgrade-banner { background: var(--accent-lighter); border: 1px solid var(--accent-light); border-radius: var(--radius); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }

/* === Responsive === */
@media (max-width: 640px) {
  .hero { padding: 60px 0 48px; }
  .hero h1 { font-size: 32px; }
  section { padding: 48px 0; }
  .terminal { margin: 32px -12px 0; border-radius: 0; }
  .artifact-row { grid-template-columns: 1fr; }
  .artifact-actions { flex-wrap: wrap; }
  .data-table { font-size: 12px; }
  .install-flow { grid-template-columns: 1fr; }
  .contact-section { padding: 36px 0 48px; }
  .contact-shell { grid-template-columns: 1fr; gap: 22px; }
  .contact-hero { text-align: left; margin-bottom: 24px; }
  .contact-hero h1 { font-size: 30px; }
  .contact-hero p { font-size: 15px; }
  .form-grid { grid-template-columns: 1fr; }
  .contact-form { padding: 20px; }
}
