/* ── Documentation layout ── */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  max-width: 960px;
  margin: 0 auto;
}

.docs-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
}

.docs-sidebar h4 {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.docs-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-sidebar-nav a {
  display: block;
  padding: 6px 12px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}

.docs-sidebar-nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.docs-sidebar-nav a.current {
  color: var(--text);
  background: var(--surface);
  border-left-color: var(--accent);
  font-weight: 500;
}

.docs-main {
  min-width: 0;
}

.docs-breadcrumb {
  font-size: 0.875rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.docs-breadcrumb a {
  color: var(--text-secondary);
}

.docs-breadcrumb a:hover {
  color: var(--text);
}

.docs-content {
  line-height: 1.7;
}

.docs-content h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 16px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.docs-content h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.docs-content h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 12px;
}

.docs-content p {
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.docs-content ul,
.docs-content ol {
  margin-bottom: 14px;
  padding-left: 20px;
}

.docs-content li {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 6px;
  line-height: 1.6;
}

.docs-content code {
  font-family: var(--mono);
  font-size: 0.8125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}

.docs-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.docs-content strong {
  color: var(--text);
  font-weight: 600;
}

.cmd-ref {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.cmd-ref code {
  color: var(--accent-hover);
  background: var(--accent-glow);
  border-color: rgba(99, 102, 241, 0.2);
}

.cmd-ref p {
  margin-bottom: 0;
  margin-top: 8px;
}

/* Prev / Next navigation */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.docs-pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.2s;
  min-width: 0;
  flex: 1;
  max-width: 50%;
}

.docs-pager a:hover {
  border-color: var(--accent);
  color: var(--text);
}

.docs-pager a.next {
  text-align: right;
  margin-left: auto;
}

.docs-pager-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.docs-pager-title {
  font-size: 0.9375rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .docs-sidebar {
    position: static;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
    margin-bottom: 32px;
  }

  .docs-sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .docs-sidebar-nav a {
    border-left: none;
    padding: 6px 10px;
    font-size: 0.8125rem;
  }

  .docs-pager {
    flex-direction: column;
  }

  .docs-pager a {
    max-width: 100%;
  }
}

/* ── Enterprise gate ── */
.enterprise-gate {
  text-align: center;
  padding: 64px 24px;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}

.enterprise-gate-icon {
  color: var(--text-dim);
  margin-bottom: 16px;
}

.enterprise-gate h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.enterprise-gate p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  max-width: 400px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

.enterprise-gate-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ── Shared page styles (pricing, signin, dashboard) ── */

/* Page hero */
.page-hero {
  padding: 140px 0 40px;
  text-align: center;
}

.page-hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-sub {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  margin-top: 8px;
}

/* Active nav link */
.nav-links a.active {
  color: var(--text);
}

/* ── Pricing ── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 780px;
  margin: 0 auto;
}

.pricing-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
  max-width: 960px;
}

.pricing-grid.four-col {
  grid-template-columns: repeat(4, 1fr);
  max-width: 1200px;
}

/* Free tier banner */
.free-tier-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 720px;
  margin: 0 auto;
}

.free-tier-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.free-tier-content p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.free-tier-content strong {
  color: var(--text);
}

/* Credits explainer */
.credits-explainer {
  max-width: 960px;
  margin: 64px auto 0;
}

.credits-explainer h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}

.explainer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.explainer-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.explainer-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9375rem;
}

.explainer-item p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 100px;
  white-space: nowrap;
}

.pricing-header {
  margin-bottom: 24px;
}

.pricing-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.pricing-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}

.price-amount {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.price-period {
  color: var(--text-dim);
  font-size: 0.9375rem;
}

.pricing-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.pricing-features {
  flex: 1;
  margin-bottom: 28px;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.pricing-features .check {
  color: var(--green);
  font-weight: 700;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.btn-full {
  width: 100%;
  text-align: center;
}

.pricing-faq {
  max-width: 640px;
  margin: 80px auto 0;
}

.pricing-faq h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}

/* ── Sign In ── */
.signin-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
}

.signin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.signin-header {
  margin-bottom: 32px;
}

.signin-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 16px;
  margin-bottom: 8px;
}

.signin-header p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 24px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-google:hover {
  background: var(--surface-hover);
  border-color: var(--border-light);
  color: var(--text);
}

.signin-note {
  margin-top: 20px;
  font-size: 0.8125rem;
  color: var(--text-dim);
}

/* ── Dashboard ── */
.dash-loading,
.dash-noauth {
  text-align: center;
  padding: 40px 0;
  color: var(--text-secondary);
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.dash-card h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.dash-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dash-value.plan-pro {
  color: var(--accent-hover);
}

.dash-warning {
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--yellow);
}

.dash-action {
  font-size: 0.875rem;
  font-weight: 500;
}

.dash-meta {
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Usage bar */
.usage-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 12px;
  margin-bottom: 8px;
}

.usage-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.usage-fill.usage-warn {
  background: var(--yellow);
}

.usage-fill.usage-crit {
  background: var(--red);
}

/* Wide card */
.dash-card-wide {
  margin-top: 0;
  margin-bottom: 20px;
}

/* ── Auto-Reload Card ── */
.reload-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

.reload-controls {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.reload-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reload-field label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.reload-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: border-color 0.2s;
}

.reload-input-wrap:focus-within {
  border-color: var(--accent);
}

.reload-input-wrap span {
  color: var(--text-dim);
  font-size: 0.9375rem;
}

.reload-input-wrap input {
  width: 52px;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
}

.reload-input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.reload-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

.reload-toggle-btn {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  background: var(--border);
  padding: 0;
  flex-shrink: 0;
}

.reload-toggle-btn.active {
  background: var(--accent);
}

.reload-toggle-btn::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}

.reload-toggle-btn.active::after {
  transform: translateX(20px);
}

.reload-status {
  font-size: 0.8125rem;
  color: var(--text-dim);
}

.reload-status.on {
  color: var(--green);
}

.reload-actions {
  display: flex;
  gap: 8px;
}

.reload-setup-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
}

.reload-setup-text {
  flex: 1;
}

.reload-setup-text p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.reload-setup-text p strong {
  color: var(--text);
}

/* ── Charge History ── */
.charge-table {
  width: 100%;
  margin-top: 12px;
}

.charge-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.charge-row:last-child {
  border-bottom: none;
}

.charge-date {
  flex: 1;
  color: var(--text-secondary);
}

.charge-amount {
  font-weight: 600;
  margin-right: 20px;
}

.charge-status {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 100px;
}

.charge-status.succeeded {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
}

.charge-status.failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

.charge-empty {
  text-align: center;
  padding: 24px 0;
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* ── License Key ── */
.key-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.key-value {
  flex: 1;
  font-size: 0.8125rem;
  word-break: break-all;
  background: none;
  border: none;
  padding: 0;
}

/* ── Sign Out ── */
.dash-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .pricing-grid,
  .pricing-grid.three-col,
  .pricing-grid.four-col {
    grid-template-columns: 1fr;
  }

  .free-tier-banner {
    flex-direction: column;
    text-align: center;
  }

  .explainer-grid {
    grid-template-columns: 1fr;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .signin-card {
    padding: 32px 24px;
  }

  .key-display {
    flex-direction: column;
    align-items: stretch;
  }

  .reload-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .reload-setup-cta {
    flex-direction: column;
    text-align: center;
  }

  .reload-actions {
    flex-wrap: wrap;
  }
}
