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

:root {
  --bg: #0f0f0f;
  --card: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --muted-dim: #666;
  --green: #4ade80;
  --green-dim: #0a1a0a;
  --red: #f87171;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(ellipse 70% 45% at 50% -10%, rgba(74, 222, 128, 0.10), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; }

/* ── Top nav (persistent across all SPA pages) ─────────────────────────── */

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
}
.site-nav .brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: #fff; text-decoration: none; }
.site-nav .brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }
.site-nav .right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a.link { font-size: 13px; color: var(--muted); text-decoration: none; padding: 8px 10px; white-space: nowrap; }
.site-nav a.link:hover { color: #ccc; }
.btn-nav {
  font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 8px;
  background: #fff; color: #000; text-decoration: none; border: none; cursor: pointer; white-space: nowrap;
}
.btn-nav.ghost { background: none; color: var(--text); border: 1px solid var(--border); }
.nav-lang-select {
  font-size: 12px; color: var(--muted); background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; cursor: pointer;
}
.nav-lang-select:hover { color: #ccc; }
.nav-lang-select option { background: var(--card); color: var(--text); }

.avatar-menu { position: relative; }
.avatar-btn {
  position: relative;
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #333, #1c1c1c);
  border: 1px solid var(--border);
  color: #ddd; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.avatar-pro-badge {
  position: absolute; top: -5px; right: -8px;
  background: var(--green); color: #06240f;
  font-size: 8px; font-weight: 800; line-height: 1;
  padding: 2px 4px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .03em;
  pointer-events: none;
  box-shadow: 0 0 0 2px var(--bg);
}
.avatar-dropdown {
  position: absolute; right: 0; top: 44px; width: 220px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; display: none; z-index: 20;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.avatar-dropdown.open { display: block; }
.avatar-dropdown .email-row { padding: 10px 12px; font-size: 13px; color: var(--muted); word-break: break-all; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.avatar-dropdown button, .avatar-dropdown a {
  display: block; width: 100%; text-align: left; padding: 9px 12px; font-size: 13px;
  background: none; border: none; color: var(--text); border-radius: 6px; cursor: pointer; text-decoration: none;
}
.avatar-dropdown button:hover, .avatar-dropdown a:hover { background: #242424; }
.avatar-dropdown .danger { color: var(--red); }

/* ── Page shell ──────────────────────────────────────────────────────────── */

.page { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
}
.card.wide { max-width: 640px; }

.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-dim); text-decoration: none; margin-bottom: 24px; }
.back:hover { color: #aaa; }

h1 { font-size: 22px; font-weight: 600; color: #fff; margin-bottom: 6px; }
.subtitle { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.5; }

label { display: block; font-size: 13px; font-weight: 500; color: #aaa; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: #111;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
select option { background: #111; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: #555; }
.field-hint { font-size: 12px; color: var(--muted-dim); margin: -10px 0 16px; }
.field-group-hint { font-size: 12px; color: var(--muted-dim); margin: -6px 0 14px; }

/* ── Custom select (replaces native <option> lists, which can't be themed
   or reliably kept from opening upward) ───────────────────────────────── */
.custom-select { position: relative; width: 100%; margin-bottom: 16px; }
.custom-select-trigger {
  width: 100%; text-align: left; font-family: inherit; font-size: 13px;
  padding: 9px 34px 9px 12px; background: #111; border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); cursor: pointer;
  appearance: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.custom-select-trigger.placeholder { color: var(--muted-dim); }
.custom-select-trigger:focus { outline: none; border-color: #555; }
.custom-select.open .custom-select-trigger { border-color: #555; }
.custom-select-panel {
  display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: #111; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5); z-index: 60; overflow: hidden;
}
.custom-select.open .custom-select-panel { display: block; }
.custom-select.drop-up .custom-select-panel { top: auto; bottom: calc(100% + 4px); }
.custom-select-search {
  margin: 0; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  font-size: 13px; padding: 9px 12px;
}
.custom-select-options { max-height: 220px; overflow-y: auto; }
.custom-select-option { padding: 8px 12px; font-size: 13px; color: var(--text); cursor: pointer; }
.custom-select-option:hover, .custom-select-option.active { background: rgba(255,255,255,.06); }
.custom-select-option.selected { color: var(--green); font-weight: 600; }
.custom-select-empty { padding: 10px 12px; font-size: 12px; color: var(--muted-dim); }

/* Nav language switcher reuses the themed custom-select instead of the
   native <select> popup, whose option list can't be reliably restyled
   across browsers - override the form-field defaults (full width, bottom
   margin) for this compact, inline-in-a-flex-row usage. */
.site-nav .custom-select { width: auto; margin-bottom: 0; }
.site-nav .custom-select-trigger {
  width: auto; font-size: 12px; padding: 8px 30px 8px 10px;
  background-color: transparent; color: var(--muted);
}
.site-nav .custom-select-trigger:hover { color: #ccc; }
.site-nav .custom-select-panel { left: auto; right: 0; min-width: 150px; }

button { font-family: inherit; }
button[type=submit], .btn-primary {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 12px; border: none; border-radius: 8px;
  background: #fff; color: #000; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: opacity 0.15s; margin-top: 4px;
}
button[type=submit]:hover, .btn-primary:hover { opacity: 0.9; }
button[type=submit]:disabled, .btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  display: block; width: 100%; text-align: center; margin-top: 12px;
  background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 6px;
}
.btn-secondary:hover { color: #ccc; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.error, .notice {
  border-radius: 8px; padding: 12px 14px; font-size: 13px; margin-bottom: 16px; line-height: 1.5;
}
.error { background: #2a1010; border: 1px solid #5a2020; color: var(--red); }
.notice { background: var(--green-dim); border: 1px solid #1a4a1a; color: var(--green); }

.toggle { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.toggle a { color: var(--green); text-decoration: none; cursor: pointer; }
.toggle a:hover { text-decoration: underline; }

.code-input {
  letter-spacing: .5em;
  text-align: center;
  font-size: 22px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(0,0,0,.15);
  border-top-color: #000;
  border-radius: 50%;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 8px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 48px 20px; color: var(--muted);
}
.loader-ring {
  width: 28px; height: 28px;
  border: 2px solid rgba(74, 222, 128, 0.15);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.loader-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-dim); }
.loader-compact {
  flex-direction: row;
  padding: 10px 0;
  gap: 10px;
}
.loader-compact .loader-ring { width: 18px; height: 18px; }

.success-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--green-dim); border: 1px solid #1a4a1a; color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin: 0 auto 20px;
}

/* ── Landing ─────────────────────────────────────────────────────────────── */

.hero { padding: 90px 24px 60px; text-align: center; max-width: 720px; margin: 0 auto; }
.hero h1 { font-size: 40px; margin-bottom: 16px; }
.hero p { font-size: 17px; color: var(--muted); line-height: 1.6; margin-bottom: 32px; }
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta-row a { padding: 13px 24px; border-radius: 8px; font-size: 15px; font-weight: 600; text-decoration: none; }
.cta-row a.primary { background: #fff; color: #000; }
.cta-row a.secondary { border: 1px solid var(--border); color: var(--text); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; max-width: 900px; margin: 0 auto 60px; padding: 0 24px; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 22px; }
.feature-card h3 { font-size: 15px; color: #fff; margin-bottom: 8px; }
.feature-card p { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── Account page ────────────────────────────────────────────────────────── */

.account-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.account-row:last-child { border-bottom: none; }
.account-row .label { color: var(--muted); }
.account-row .value { color: var(--text); font-family: 'SF Mono', 'Fira Code', monospace; }

.key-box {
  background: #0a0a0a; border: 1px solid #333; border-radius: 8px; padding: 12px 14px;
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; color: var(--green);
  word-break: break-all; line-height: 1.6; margin-bottom: 10px;
}
.warn { font-size: 12px; color: var(--muted-dim); margin-top: 10px; text-align: center; }

/* ── Footer (persistent across all pages) ──────────────────────────────── */

.site-footer { border-top: 1px solid var(--border); padding: 48px 28px 24px; margin-top: 40px; }
.footer-inner { display: flex; gap: 48px; max-width: 1100px; margin: 0 auto; flex-wrap: wrap; }
.footer-brand { flex: 2; min-width: 240px; }
.footer-brand .brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: #fff; text-decoration: none; }
.footer-brand .brand img { width: 24px; height: 24px; border-radius: 6px; }
.footer-brand p { font-size: 13px; color: var(--muted); margin-top: 12px; line-height: 1.6; max-width: 340px; }
.footer-col { min-width: 140px; }
.footer-col-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-dim); margin-bottom: 10px; }
.footer-col a { display: block; font-size: 13px; color: var(--muted); text-decoration: none; padding: 5px 0; }
.footer-col a:hover { color: #ccc; }
.footer-bottom { text-align: center; font-size: 12px; color: var(--muted-dim); margin-top: 40px; }

/* ── Marketing sections (landing / pricing) ─────────────────────────────── */

.section { max-width: 1100px; margin: 0 auto; padding: 72px 24px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-head h2 { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -.01em; margin-bottom: 12px; }
.section-head p { font-size: 15px; color: var(--muted); line-height: 1.6; }

.compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.compare-col { border: 1px solid var(--border); border-radius: 16px; padding: 28px; background: var(--card); }
.compare-col.mcp { border-color: rgba(74, 222, 128, 0.4); background: linear-gradient(180deg, rgba(74,222,128,.06), transparent 40%), var(--card); }
.compare-col h3 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.compare-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.compare-list li { font-size: 14px; color: var(--text); line-height: 1.5; padding-left: 26px; position: relative; }
.compare-list li.no { color: var(--muted); }
.compare-list li.yes::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.compare-list li.no::before { content: "✕"; position: absolute; left: 0; color: var(--red); opacity: .8; }

.mcp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.mcp-step { text-align: center; padding: 8px; }
.mcp-step .step-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--green-dim); border: 1px solid rgba(74,222,128,.3); color: var(--green); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; margin: 0 auto 16px; }
.mcp-step h3 { font-size: 14px; color: #fff; margin-bottom: 8px; }
.mcp-step p { font-size: 13px; color: var(--muted); line-height: 1.6; }

.cta-band { text-align: center; padding: 80px 24px; border-top: 1px solid var(--border); }
.cta-band h2 { font-size: 26px; font-weight: 700; color: #fff; margin-bottom: 12px; }
.cta-band p { font-size: 15px; color: var(--muted); margin-bottom: 28px; }

/* ── Pricing ─────────────────────────────────────────────────────────────── */

.price-toggle { display: flex; justify-content: center; gap: 4px; margin-bottom: 40px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 4px; width: fit-content; margin-left: auto; margin-right: auto; }
.price-toggle button { background: none; border: none; color: var(--muted); font-size: 13px; font-weight: 600; padding: 8px 18px; border-radius: 7px; cursor: pointer; font-family: inherit; }
.price-toggle button.active { background: #fff; color: #000; }
.price-toggle .save-badge { font-size: 10px; color: var(--green); font-weight: 700; margin-left: 6px; }

.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 780px; margin: 0 auto; }
.price-card { position: relative; border: 1px solid var(--border); border-radius: 16px; padding: 32px; background: var(--card); }
.price-card.featured { border-color: var(--green); }
.price-card .badge-featured { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--green); color: #06240f; font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.price-card h3 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.price-card .price-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.price-card .price { font-size: 38px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.price-card .price .period { font-size: 14px; color: var(--muted); font-weight: 500; }
.price-card .price-note { font-size: 12px; color: var(--muted-dim); margin-bottom: 24px; min-height: 16px; }
.price-feature-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: 24px 0 28px; }
.price-feature-list li { font-size: 13px; color: var(--text); padding-left: 24px; position: relative; line-height: 1.5; }
.price-feature-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }

.modal-loss-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.modal-loss-list li { font-size: 13px; color: var(--muted); padding-left: 22px; position: relative; line-height: 1.5; }
.modal-loss-list li::before { content: "×"; position: absolute; left: 0; color: var(--red); font-weight: 700; }

.faq-list { max-width: 680px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--border); padding: 18px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; font-size: 14px; color: #fff; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+"; display: inline-block; width: 18px; color: var(--green); font-weight: 700; }
.faq-item[open] summary::before { content: "−"; }
.faq-item p { font-size: 13px; color: var(--muted); line-height: 1.6; margin-top: 10px; padding-left: 18px; }

.pricing-preview-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; max-width: 640px; margin: 0 auto 32px; }
.pricing-preview-card { border: 1px solid var(--border); border-radius: 14px; padding: 28px 24px; background: var(--card); text-align: center; }
.pricing-preview-card.featured { border-color: var(--green); }
.pricing-preview-card .preview-plan { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.pricing-preview-card .preview-price { font-size: 32px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.pricing-preview-card .preview-price-secondary { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 10px; }
.pricing-preview-card .preview-period { font-size: 14px; color: var(--muted); font-weight: 500; }
.pricing-preview-card p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.pricing-preview-cta { max-width: 640px; margin: 0 auto; text-align: center; }
.pricing-preview-cta .btn-primary { width: 100%; text-decoration: none; }

.upgrade-panel { border: 1px solid var(--border); border-radius: 14px; padding: 24px; background: rgba(255,255,255,.02); max-width: 420px; }
.upgrade-panel h3 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.upgrade-panel-lead { font-size: 13px; color: var(--muted); margin-bottom: 20px; line-height: 1.55; }
.upgrade-panel .price-toggle { margin-bottom: 20px; margin-left: 0; }
.upgrade-panel .upgrade-price { font-size: 32px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.upgrade-panel .upgrade-price .period { font-size: 14px; color: var(--muted); font-weight: 500; }
.upgrade-panel .price-note { font-size: 12px; color: var(--muted-dim); margin-bottom: 20px; min-height: 16px; }
.upgrade-panel .btn-primary { width: 100%; margin-bottom: 14px; }
.upgrade-panel-foot { font-size: 12px; color: var(--muted-dim); line-height: 1.6; margin: 0; }
.upgrade-panel-foot a { color: var(--green); }

/* ── Docs: Getting started ──────────────────────────────────────────────── */

.docs-page { max-width: 760px; margin: 0 auto; padding: 56px 24px 90px; }
.docs-page h1 { font-size: 32px; font-weight: 800; color: #fff; letter-spacing: -.02em; margin-bottom: 12px; }
.docs-page > p.lead { font-size: 16px; color: var(--muted); margin-bottom: 40px; line-height: 1.7; max-width: 600px; }
.docs-page h2 { font-size: 20px; font-weight: 700; color: #fff; margin: 48px 0 20px; padding-top: 40px; border-top: 1px solid var(--border); }
.docs-page h2:first-of-type { margin-top: 0; border-top: none; padding-top: 0; }

.flow-tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.flow-tabs a { background: var(--card); border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 8px; cursor: pointer; font-family: inherit; text-decoration: none; }
.flow-tabs a.active { background: #fff; color: #000; border-color: #fff; }

.step { display: flex; gap: 18px; margin-bottom: 28px; }
.step-num { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--green-dim); border: 1px solid rgba(74,222,128,.3); color: var(--green); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.step-body { flex: 1; min-width: 0; }
.step-body h3 { font-size: 15px; font-weight: 600; color: #fff; margin-bottom: 6px; }
.step-body p { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 10px; }

.docs-page pre { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; overflow-x: auto; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; color: var(--text); margin-bottom: 12px; line-height: 1.6; }
.docs-page code { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; background: #0a0a0a; border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; color: var(--green); }
.docs-page pre code { background: none; border: none; padding: 0; color: inherit; }

.example-box { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--green); border-radius: 0 10px 10px 0; padding: 14px 16px; margin-bottom: 10px; }
.example-label { font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.example-box p { font-size: 13px; color: var(--text); margin: 0; font-style: italic; }

.docs-callout { background: var(--green-dim); border: 1px solid rgba(74,222,128,.3); border-radius: 10px; padding: 14px 16px; font-size: 13px; color: #86efac; margin-bottom: 16px; line-height: 1.6; }
details.advanced-ref { margin-top: 8px; }
details.advanced-ref summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 0; }

/* ── Legal (privacy / terms / refunds) ─────────────────────────────────── */

.pricing-page { padding-bottom: 24px; }
.pricing-page .pricing-page-section { padding-top: 56px; border-top: none; }

.legal-page { max-width: 720px; margin: 0 auto; padding: 56px 24px 90px; }
.legal-page h1 { font-size: 30px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.legal-page a { color: var(--green); }
.legal-page .updated { font-size: 13px; color: var(--muted-dim); margin-bottom: 36px; }
.legal-page h2 { font-size: 17px; font-weight: 700; color: #fff; margin: 32px 0 12px; }
.legal-page p, .legal-page li { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 10px; }
.legal-page ul { padding-left: 20px; margin-bottom: 12px; }

/* ── Dashboard shell ─────────────────────────────────────────────────────── */

.dash-layout { display: flex; max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; gap: 32px; align-items: flex-start; }
.dash-sidebar { width: 200px; flex-shrink: 0; position: sticky; top: 88px; }
.dash-sidebar a { display: block; padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; margin-bottom: 2px; }
.dash-sidebar a:hover { color: var(--text); background: var(--card); }
.dash-sidebar a.active { color: #fff; background: var(--card); }
.dash-content { flex: 1; min-width: 0; }
.dash-content h1 { font-size: 24px; font-weight: 700; color: #fff; margin-bottom: 4px; }
.dash-content > .dash-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

.dash-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-bottom: 20px; }
.dash-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.dash-row h2 { font-size: 16px; font-weight: 700; color: #fff; }
.search-input { padding: 9px 12px; background: #0a0a0a; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; font-family: inherit; min-width: 200px; }

.btn-sm {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; box-sizing: border-box;
  font-size: 13px; font-weight: 600; padding: 0 14px; border-radius: 7px;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
  background: #fff; color: #000; white-space: nowrap; margin: 0;
  width: auto;
}
.btn-sm.ghost { background: none; border-color: var(--border); color: var(--text); }
.btn-sm.primary { background: var(--green); color: #0a1a0a; border-color: var(--green); }
.btn-sm.primary:hover { opacity: 0.9; }
.btn-sm.danger { background: none; border-color: rgba(248,113,113,.35); color: var(--red); }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-dim); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text); }
.data-table th.sorted { color: var(--green); }
.data-table th .sort-arrow { font-size: 9px; margin-left: 4px; opacity: .8; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.data-table .actions { text-align: right; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.table-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
}
.pager-info, .pager-page { font-size: 12px; color: var(--muted-dim); }
.pager-btns { display: flex; align-items: center; gap: 8px; }
.pager-btns .btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted-dim); font-size: 13px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 5px 8px; border-radius: 6px; font-size: 13px;
}
.icon-btn:hover { color: var(--text); background: #242424; }
.icon-btn.danger:hover { color: var(--red); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; overflow-y: auto; }
.modal { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px; max-width: 460px; width: 100%; }
.modal.wide { max-width: 620px; }
.modal h2 { font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 18px; padding-right: 24px; }
.modal-close-btn {
  position: absolute; top: 18px; right: 18px; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 6px;
  color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer;
}
.modal-close-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.modal-actions {
  display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 20px;
}
.modal-actions .btn-sm,
.modal-actions button[type=submit],
.modal-actions button[type=button] {
  width: auto; margin-top: 0; height: 36px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }

.composer-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.composer-head {
  display: grid; grid-template-columns: 1fr 100px 36px; gap: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted-dim); padding: 0 2px 4px;
}
.ingredient-row, .set-row {
  display: grid; grid-template-columns: 1fr 100px 36px; gap: 8px; align-items: center;
}
.ingredient-row select, .set-row select,
.ingredient-row input, .set-row input {
  width: 100%; margin-bottom: 0; font-size: 13px; padding: 9px 12px;
}
.ingredient-row .custom-select, .set-row .custom-select { margin-bottom: 0; }
.ingredient-row .icon-btn, .set-row .icon-btn { justify-self: center; }
.add-row-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--green);
  background: rgba(74,222,128,.06); border: 1px dashed rgba(74,222,128,.35);
  border-radius: 8px; cursor: pointer; padding: 10px 14px; font-family: inherit;
  width: 100%; justify-content: center; margin-bottom: 4px;
}
.add-row-btn:hover { background: rgba(74,222,128,.1); }

.key-row { display: flex; gap: 8px; align-items: stretch; }
.key-row .key-box { flex: 1; margin-bottom: 0; }
.key-copy-btn {
  flex-shrink: 0; width: 40px; height: auto; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #111; border: 1px solid #333; border-radius: 8px;
  color: var(--muted); cursor: pointer;
}
.key-copy-btn:hover { color: var(--green); border-color: rgba(74,222,128,.4); }
.key-copy-btn.copied { color: var(--green); }

.date-filter-bar { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.date-filter-custom { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.date-filter-custom label { margin: 0; font-size: 12px; color: var(--muted-dim); white-space: nowrap; }
.date-filter-custom input[type=date] {
  /* Override the global `input { width: 100% }` - on a flex item that makes
     each date input claim the whole row's width, forcing label+input pairs
     to wrap onto their own line instead of sitting side by side. */
  width: auto; margin: 0; min-width: 140px; padding: 8px 10px; font-size: 13px;
}

.day-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-nav input[type=date] { width: auto; margin: 0; min-width: 150px; }
.day-nav .btn-sm { padding: 8px 12px; }
.day-nav .btn-sm:disabled { opacity: .4; cursor: not-allowed; }

.progress-block { margin-bottom: 18px; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.progress-label { font-size: 13px; color: var(--muted); }
.progress-value { font-size: 13px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.progress-track { height: 8px; background: #0a0a0a; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); border-radius: 999px; transition: width .3s ease; }
.progress-fill.near { background: #fbbf24; }
.progress-fill.over { background: var(--red); }
.today-section-title { font-size: 14px; font-weight: 700; color: #fff; margin: 0 0 12px; }
.today-list { display: flex; flex-direction: column; gap: 0; }
.today-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.today-item:last-child { border-bottom: none; }
.today-item-name { color: #fff; font-weight: 500; }
.today-item-meta { font-size: 12px; color: var(--muted-dim); margin-top: 2px; }
.today-item-stats { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: #111; border: 1px solid #333; border-radius: 8px;
  padding: 8px 10px; font-size: 12px; color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,.45); white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
  opacity: 0; transition: opacity .1s;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip .tt-date { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 6px; }
.chart-tooltip .tt-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.chart-hit { cursor: pointer; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-tile-actionable { position: relative; }
.stat-tile-btn {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: #242424; color: var(--text);
  font-size: 18px; font-weight: 600; line-height: 1;
  cursor: pointer;
}
.stat-tile-btn:hover { background: #2e2e2e; border-color: #3a3a3a; color: #fff; }
.stat-tile-btn svg { display: block; }
.stat-tile .stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-tile .stat-value { font-size: 22px; font-weight: 700; color: #fff; }
.stat-tile .stat-value .unit { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 0.2em; }

.badge-pro { background: var(--green-dim); color: var(--green); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em; }
.badge-free { background: #242424; color: var(--muted); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em; }

.meal-tag { display: inline-block; background: color-mix(in srgb, var(--tag-color) 16%, transparent); color: var(--tag-color); border: 1px solid color-mix(in srgb, var(--tag-color) 40%, transparent); font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.meal-tag-empty { color: var(--muted-dim); }
.upsell-note { font-size: 12px; color: var(--muted); background: rgba(74,222,128,.05); border: 1px dashed rgba(74,222,128,.3); padding: 10px 12px; border-radius: 8px; margin: 14px 0; line-height: 1.6; }
.upsell-note a { color: var(--green); }

/* ── Charts ──────────────────────────────────────────────────────────────── */

.chart-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.range-tabs { display: flex; gap: 4px; background: #0a0a0a; border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.range-tabs button { background: none; border: none; color: var(--muted); font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-family: inherit; }
.range-tabs button.active { background: var(--card); color: #fff; }
.chart-container { width: 100%; position: relative; overflow: visible; }
.chart-container svg { display: block; max-width: 100%; height: auto; }
.chart-container text { font-size: 10px; fill: var(--muted); font-family: inherit; }
.chart-legend { display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-dot { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.chart-empty { text-align: center; padding: 60px 20px; color: var(--muted-dim); font-size: 13px; }

/* ── Workout calendar ────────────────────────────────────────────────────── */

.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.calendar-header h2 { font-size: 16px; font-weight: 700; color: #fff; }
.calendar-nav { display: flex; gap: 6px; }
.calendar-wrap { width: 100%; }
/* Columns flex to fill the card's width but stop growing past 76px each -
   without that cap, on a wide dashboard card a plain `repeat(7, 1fr)` makes
   every day cell huge; without `justify-content: center`, capping the
   columns instead leaves the whole grid stranded on the left with a big
   dead gap on the right. This keeps cells reasonably sized on any width
   and centers the leftover space instead of dumping it on one side. */
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 76px)); justify-content: center; gap: 4px; }
.weekday-label { text-align: center; font-size: 10px; color: var(--muted-dim); text-transform: uppercase; letter-spacing: .04em; padding-bottom: 4px; }
.calendar-day {
  aspect-ratio: 1; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 5px; font-size: 11px; color: var(--text); cursor: pointer;
  position: relative; background: #0a0a0a; line-height: 1;
}
.calendar-day:hover { border-color: #444; }
.calendar-day.other-month { opacity: .3; }
.calendar-day.today { border-color: var(--green); }
.calendar-day .workout-dot { position: absolute; bottom: 4px; left: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.calendar-day .workout-count { position: absolute; bottom: 3px; right: 4px; font-size: 9px; color: var(--green); font-weight: 700; }

@media (max-width: 760px) {
  .dash-layout { flex-direction: column; }
  .dash-sidebar { width: 100%; position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .dash-sidebar a { white-space: nowrap; }
  .footer-inner { gap: 32px; }
}

@media (max-width: 520px) {
  .site-nav { padding: 14px 18px; }
  .hero h1 { font-size: 30px; }
}
