/* Dark-only palette, ported verbatim from LlamaNexus-Docs's app/globals.css :root block (itself
   seeded from LlamaNexus-WebUI's own dark theme) - this part was already plain CSS custom
   properties, not Tailwind, so no translation needed. Everything below this block is a hand-port
   of what was previously ~10 small Tailwind-styled React components - see README.md/the plan for
   why this isn't a frozen compiled-Tailwind stylesheet. */
:root {
  --bg: #1e1e1e;
  --bg-sidebar: #181818;
  --bg-elevated: #262624;
  --border: #3a3835;
  --text: #e8e6e1;
  --text-muted: #a19d95;
  --accent: #d88a5c;
  --accent-hover: #e5996a;
  --danger: #e57373;
  --success: #81c995;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

a { color: inherit; text-decoration: none; }
.link-strong { color: var(--accent); font-weight: 600; }
.link-strong:hover { text-decoration: underline; }

.btn {
  display: inline-block;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: none; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-elevated); }
.btn-submit { width: 100%; margin-top: 4px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

/* Header / nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(6px);
}
.site-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-brand { font-weight: 700; letter-spacing: -0.01em; }
.site-nav { display: flex; align-items: center; gap: 24px; font-size: 14px; color: var(--text-muted); }
.site-nav a:hover { color: var(--text); }

.account-menu { position: relative; }
.account-menu-trigger { background: none; border: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.account-menu-trigger:hover { color: var(--accent); }
.account-menu-popup {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  width: 160px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  z-index: 20;
}
.account-menu.open .account-menu-popup { display: block; }
.account-menu-popup a,
.account-menu-popup .link-button {
  display: block;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}
.account-menu-popup a:hover,
.account-menu-popup .link-button:hover { background: var(--bg-sidebar); }

/* Landing page */
.hero { max-width: 760px; margin: 0 auto; padding: 80px 24px 40px; text-align: center; }
.hero h1 { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.hero-subtitle { margin: 16px auto 0; max-width: 560px; color: var(--text-muted); font-size: 17px; }
.hero-actions { margin-top: 28px; }

.product-grid {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.product-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 22px;
  transition: border-color 0.15s;
}
.product-card:hover { border-color: var(--accent); }
.product-card-kicker { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.product-card h3 { margin: 8px 0 0; font-size: 17px; }
.product-card-tagline { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.product-card-description { margin: 10px 0 0; font-size: 13px; color: var(--text-muted); flex: 1; }
.product-card-link { margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--accent); }
.product-card:hover .product-card-link { text-decoration: underline; }

/* Auth pages */
.auth-shell { max-width: 420px; margin: 0 auto; padding: 64px 24px; min-height: 55vh; display: flex; flex-direction: column; justify-content: center; }
.auth-shell h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.auth-subtitle { margin: 8px 0 0; font-size: 14px; color: var(--text-muted); }
.auth-body { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-footer { margin-top: 22px; font-size: 14px; color: var(--text-muted); }
.auth-footer-links { display: flex; flex-direction: column; gap: 8px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.form-field input {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
}
.form-field input:focus { outline: none; border-color: var(--accent); }

.form-message { border-radius: 8px; padding: 9px 12px; font-size: 14px; margin: 0; }
.form-message-error { border: 1px solid rgba(229, 115, 115, 0.4); background: rgba(229, 115, 115, 0.1); color: var(--danger); }
.form-message-success { border: 1px solid rgba(129, 201, 149, 0.4); background: rgba(129, 201, 149, 0.1); color: var(--success); }

.account-fields { display: flex; flex-direction: column; gap: 14px; font-size: 14px; margin: 0; }
.account-fields dt { color: var(--text-muted); }
.account-fields dd { margin: 4px 0 0; }
.account-fields + form { margin-top: 28px; }

.account-section { max-width: 760px; margin: 0 auto; padding: 40px 24px; }
.account-section h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 24px; }
.account-section h2 { font-size: 18px; margin: 0 0 16px; }
.account-section-subtitle { font-size: 13px; color: var(--text-muted); margin: -10px 0 16px; }

.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan-card { border: 1px solid var(--border); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.plan-card:hover { border-color: var(--accent); }
.plan-card h3 { margin: 0; font-size: 15px; }
.plan-card-limits { font-size: 13px; color: var(--text-muted); flex: 1; }
.plan-card-actions { display: flex; gap: 8px; margin-top: 4px; }
.plan-card-actions form { flex: 1; }
.plan-card-actions .btn { width: 100%; }
.plan-card-actions .btn:hover { border-color: var(--accent); }
.plan-manage-billing { margin-top: 16px; }

.license-key-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  word-break: break-all;
  font-size: 13px;
}

.installs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.installs-table th, .installs-table td { border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: left; }
.installs-table td:last-child, .installs-table th:last-child { text-align: right; }
.installs-table .btn { padding: 4px 10px; font-size: 12px; }

/* Docs */
.docs-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 180px;
  gap: 40px;
  flex: 1;
}
/* Sidebar/TOC are each conditionally rendered (see docroot/docs.php) - without these, an absent
   <aside> leaves a 3-column grid with only 1-2 real children, and CSS Grid auto-placement fills
   whichever fixed-width column comes first in DOM order rather than the middle 1fr one, squashing
   .docs-content into a 200px sliver. Explicit placement + narrower templates for the reduced cases
   keep content readable-width regardless of which asides exist for a given page. */
.docs-sidebar { grid-column: 1; }
.docs-content { grid-column: 2; }
.docs-toc { grid-column: 3; }
.docs-layout.docs-layout--no-sidebar { grid-template-columns: minmax(0, 1fr) 180px; }
.docs-layout.docs-layout--no-sidebar .docs-content { grid-column: 1; }
.docs-layout.docs-layout--no-sidebar .docs-toc { grid-column: 2; }
.docs-layout.docs-layout--no-toc { grid-template-columns: 200px minmax(0, 1fr); }
.docs-layout.docs-layout--no-sidebar.docs-layout--no-toc {
  max-width: 760px;
  grid-template-columns: minmax(0, 1fr);
}
.docs-layout.docs-layout--no-sidebar.docs-layout--no-toc .docs-content { grid-column: 1; }
.docs-sidebar { font-size: 13px; }
.docs-sidebar-title { font-weight: 700; margin-bottom: 10px; }
.docs-sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.docs-sidebar nav a { padding: 5px 8px; border-radius: 6px; color: var(--text-muted); }
.docs-sidebar nav a:hover { color: var(--text); background: var(--bg-elevated); }
.docs-sidebar nav a.active { color: var(--text); background: var(--bg-elevated); font-weight: 600; }

.docs-content { min-width: 0; font-size: 15px; }
.docs-content h1 { font-size: 28px; margin: 0 0 20px; letter-spacing: -0.01em; }
.docs-content h2 { font-size: 20px; margin: 36px 0 12px; }
.docs-content h3 { font-size: 16px; margin: 26px 0 10px; }
.docs-content p { color: var(--text); }
.docs-content a { color: var(--accent); }
.docs-content a:hover { text-decoration: underline; }
.docs-content ul, .docs-content ol { padding-left: 22px; }
.docs-content li { margin: 4px 0; }
.docs-content code { background: var(--bg-elevated); border-radius: 4px; padding: 1px 5px; font-size: 0.9em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.docs-content pre { background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; overflow-x: auto; }
.docs-content pre code { background: none; padding: 0; }
.docs-content table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 13.5px; }
.docs-content th, .docs-content td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.docs-content th { background: var(--bg-elevated); }
.docs-content blockquote { margin: 16px 0; padding: 4px 16px; border-left: 3px solid var(--border); color: var(--text-muted); }
.docs-content hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

.docs-toc { font-size: 13px; }
.docs-toc-title { font-weight: 700; margin-bottom: 10px; }
.docs-toc nav { display: flex; flex-direction: column; gap: 4px; }
.docs-toc nav a { color: var(--text-muted); }
.docs-toc nav a:hover { color: var(--text); }
.docs-toc nav a.toc-depth-3 { padding-left: 12px; }

@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-toc { display: none; }
}

/* 404 */
.not-found { max-width: 480px; margin: 0 auto; padding: 100px 24px; text-align: center; flex: 1; }
.not-found h1 { font-size: 56px; margin: 0; color: var(--text-muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: auto; }
.site-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}
