:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #64748b;
  --line: #e2e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --sky: #0284c7;
  --sky-soft: #e0f2fe;
  --emerald: #059669;
  --emerald-soft: #d1fae5;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Header */
.ax-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.ax-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 18px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ax-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.06rem;
  color: var(--ink) !important;
  text-decoration: none !important;
  letter-spacing: -0.02em;
}
.ax-brand img { width: 32px; height: 32px; border-radius: 9px; }

.ax-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ax-nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none !important;
  transition: background 150ms ease, color 150ms ease;
}
.ax-nav a:hover, .ax-nav a.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.ax-header-right { display: flex; align-items: center; gap: 10px; }
.ax-menu-btn {
  display: none;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .ax-menu-btn { display: inline-flex; align-items: center; }
  .ax-nav {
    display: none;
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 18px;
    box-shadow: var(--shadow-md);
  }
  .ax-nav.open { display: flex; }
}

/* Buttons */
.ax-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 120ms ease, background 150ms ease, border-color 150ms ease;
}
.ax-btn:active { transform: scale(0.98); }
.ax-btn-primary {
  background: var(--primary);
  color: #ffffff !important;
}
.ax-btn-primary:hover { background: var(--primary-hover); }
.ax-btn-secondary {
  background: var(--surface);
  color: var(--ink) !important;
  border-color: #cbd5e1;
}
.ax-btn-secondary:hover { background: var(--surface-soft); border-color: #94a3b8; }
.ax-btn-danger {
  background: var(--danger);
  color: #ffffff !important;
}
.ax-btn-sm { padding: 7px 13px; font-size: 0.83rem; }
.ax-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Main Container */
.ax-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 18px 64px;
  min-height: calc(100vh - 180px);
  animation: axFade 180ms ease;
}
@keyframes axFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Hero */
.ax-hero {
  background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 52%, #ecfdf5 100%);
  border: 1px solid #dbeafe;
  border-radius: 18px;
  padding: 36px 28px;
  margin-bottom: 28px;
}
.ax-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: #ffffff;
  color: var(--primary);
  border: 1px solid #c7d2fe;
  margin-bottom: 14px;
}
.ax-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.85rem, 4.5vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.ax-hero p {
  margin: 0 0 22px;
  max-width: 600px;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.6;
}
.ax-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Stats strip */
.ax-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.ax-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.ax-stat-label { font-size: 0.78rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.ax-stat-val { font-size: 1.55rem; font-weight: 800; color: var(--ink); margin-top: 4px; }
.ax-stat-indigo { border-top: 3px solid var(--primary); }
.ax-stat-sky { border-top: 3px solid var(--sky); }
.ax-stat-emerald { border-top: 3px solid var(--emerald); }

/* Cards & Grids */
.ax-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.ax-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}
.ax-section-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.02em; }

.ax-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* Plugin Card */
.ax-plugin-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--ink) !important;
  text-decoration: none !important;
  box-shadow: var(--shadow);
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.ax-plugin-card:hover {
  border-color: #a5b4fc;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.ax-plugin-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  flex: none;
}
.ax-plugin-title { font-weight: 700; font-size: 0.98rem; color: var(--ink); }
.ax-plugin-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }

/* Badges */
.ax-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
.ax-badge-indigo { background: var(--primary-soft); color: var(--primary); }
.ax-badge-emerald { background: var(--emerald-soft); color: var(--emerald); }
.ax-badge-sky { background: var(--sky-soft); color: var(--sky); }
.ax-badge-amber { background: var(--amber-soft); color: var(--amber); }
.ax-badge-gray { background: #f1f5f9; color: var(--ink-2); }

/* Forms */
.ax-form-card { max-width: 460px; margin: 16px auto; }
.ax-field { margin-bottom: 16px; }
.ax-field label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.ax-input, .ax-select, .ax-textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.94rem;
  font-family: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.ax-input:focus, .ax-select:focus, .ax-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}
.ax-textarea { min-height: 92px; resize: vertical; }

.ax-oauth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.ax-divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-3); font-size: 0.8rem; margin: 18px 0 4px;
}
.ax-divider::before, .ax-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Search & Filter Bar */
.ax-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.ax-toolbar .ax-input { flex: 1; min-width: 210px; }

/* Alert / Toast */
.ax-alert {
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 14px;
}
.ax-alert-err { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.ax-alert-ok { background: var(--emerald-soft); color: #065f46; border: 1px solid #a7f3d0; }
.ax-alert-info { background: var(--sky-soft); color: #075985; border: 1px solid #bae6fd; }

.ax-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #ffffff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-md);
}

/* Ads Slot (kept intact per user request) */
.ax-ad-slot {
  margin: 22px 0;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  color: var(--ink-3);
  font-size: 0.8rem;
}

/* Markdown & Readme */
.ax-readme {
  line-height: 1.7;
  color: var(--ink-2);
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Table */
.ax-table-wrap { overflow-x: auto; }
.ax-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ax-table th, .ax-table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.ax-table th { background: var(--surface-soft); font-weight: 600; color: var(--ink-2); }

/* Footer */
.ax-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 18px;
  color: var(--ink-3);
  font-size: 0.86rem;
}
.ax-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ax-footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.ax-footer-links a { color: var(--ink-2); }

/* === Axiom v16 Rich Content & Docs Styles === */
.ax-section { margin: 28px 0; }
.ax-section-head { margin-bottom: 16px; }
.ax-section-head h2 { margin: 0 0 6px; font-size: 1.45rem; letter-spacing: -0.02em; }
.ax-section-head p { margin: 0; color: var(--ink-3); font-size: 0.94rem; }

.ax-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.ax-feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.ax-feature-card:hover { transform: translateY(-2px); border-color: #c7d2fe; }
.ax-feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 11px;
}
.ax-fi-indigo { background: #eef2ff; color: #4338ca; }
.ax-fi-emerald { background: #ecfdf5; color: #047857; }
.ax-fi-sky { background: #f0f9ff; color: #0369a1; }
.ax-fi-amber { background: #fffbeb; color: #b45309; }
.ax-fi-rose { background: #fff1f2; color: #be123c; }
.ax-fi-violet { background: #f5f3ff; color: #6d28d9; }

.ax-feature-card h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--ink); }
.ax-feature-card p { margin: 0; color: var(--ink-2); font-size: 0.89rem; line-height: 1.55; }

.ax-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.ax-step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.ax-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #4f46e5;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.ax-docs-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.ax-doc-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.ax-doc-tab.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

.ax-code-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.83rem;
  line-height: 1.55;
  overflow-x: auto;
  margin: 12px 0;
}

.ax-faq-list { display: flex; flex-direction: column; gap: 10px; }
.ax-faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.ax-faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.ax-faq-item summary::after { content: "+"; font-size: 1.15rem; color: #4f46e5; font-weight: 700; }
.ax-faq-item[open] summary::after { content: "−"; }
.ax-faq-item p { margin: 10px 0 0; color: var(--ink-2); font-size: 0.92rem; line-height: 1.65; }

.ax-prose h2 { margin: 22px 0 8px; font-size: 1.2rem; color: var(--ink); }
.ax-prose h3 { margin: 16px 0 6px; font-size: 1.02rem; color: var(--ink); }
.ax-prose p, .ax-prose li { color: var(--ink-2); font-size: 0.94rem; line-height: 1.7; }
.ax-prose ul, .ax-prose ol { padding-left: 20px; margin: 8px 0 14px; }

.ax-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
