/* BGYHub — design tokens and layout. Dark-first, developer-tool aesthetic. */
:root {
  --bg: #0a0e1a;
  --bg-2: #0d1322;
  --surface: #101828;
  --surface-2: #131c30;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --text: #e6e9f0;
  --text-2: #b6bdcc;
  --muted: #8791a5;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --container: 1120px;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 10px 40px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
code, pre, kbd { font-family: var(--mono); }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.ic { width: 1em; height: 1em; flex: 0 0 auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 14, 26, 0.78);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 28px; height: 60px; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; display: inline-flex; }
.brand-a { color: #fff; }
.brand-b { color: var(--accent-2); }
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 6px 10px; border-radius: 6px; font-size: 14px; color: var(--text-2);
}
.nav-link:hover, .nav-link[aria-current="page"] { color: #fff; background: rgba(255,255,255,0.04); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-toggle {
  display: none; margin-left: auto; background: none; border: 1px solid var(--border);
  border-radius: 8px; width: 40px; height: 40px; align-items: center; justify-content: center; cursor: pointer;
}
.nav-toggle .ic { width: 20px; height: 20px; }
.nav-toggle .ic:last-child { display: none; }
.nav-toggle[aria-expanded="true"] .ic:first-child { display: none; }
.nav-toggle[aria-expanded="true"] .ic:last-child { display: block; }
.mobile-menu { border-top: 1px solid var(--border); background: var(--bg); }
.mobile-menu .container { display: flex; flex-direction: column; padding-top: 12px; padding-bottom: 20px; gap: 2px; }
.mobile-menu .nav-link { padding: 12px 10px; font-size: 16px; }
.mobile-actions { display: flex; flex-direction: column; gap: 14px; padding: 16px 10px 0; border-top: 1px solid var(--border); margin-top: 10px; }

.lang { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lang .ic { width: 16px; height: 16px; }
.lang-opt { padding: 2px 4px; border-radius: 4px; color: var(--muted); }
.lang-opt:hover { color: #fff; }
.lang-opt.is-active { color: #fff; font-weight: 600; }
.lang-sep { opacity: 0.5; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 8px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-lg { padding: 13px 22px; font-size: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2f74e8; color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.03); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Sections ---------- */
.section { padding: 88px 0; border-top: 1px solid var(--border); }
.section-tight { padding: 64px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 40px; }
.section-head.center { flex-direction: column; align-items: center; text-align: center; }
.eyebrow { color: var(--accent-2); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; margin: 0 0 12px; }
.h1 { font-size: clamp(38px, 6vw, 60px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.h2 { font-size: clamp(26px, 3.4vw, 34px); }
.h3 { font-size: 18px; }
.lead { color: var(--text-2); font-size: 17px; max-width: 60ch; margin: 12px 0 0; }
.link-more { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-2); font-size: 14px; font-weight: 500; white-space: nowrap; }
.link-more:hover { color: #fff; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 96px 0 80px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(700px 360px at 18% 20%, rgba(59,130,246,0.14), transparent 60%),
    radial-gradient(500px 300px at 85% 70%, rgba(59,130,246,0.08), transparent 60%);
}
.hero .container { position: relative; display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero-title .accent { color: var(--accent-2); }
.hero-sub { color: var(--text-2); font-size: 18px; max-width: 48ch; margin: 22px 0 30px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-points { display: flex; gap: 22px; flex-wrap: wrap; margin: 30px 0 0; padding: 0; list-style: none; color: var(--text-2); font-size: 14px; }
.hero-points li { display: inline-flex; align-items: center; gap: 8px; }
.hero-points .ic { color: var(--accent-2); width: 18px; height: 18px; }
.hero-caption { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- Code window ---------- */
.codewin { background: #0b101d; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.codewin-bar { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.02); }
.codewin-tab { background: none; border: 0; padding: 6px 10px; border-radius: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.codewin-tab[aria-selected="true"] { color: #fff; background: rgba(255,255,255,0.07); }
.codewin-bar .code-copy { margin-left: auto; }
.codewin pre { margin: 0; padding: 18px 18px 20px; overflow-x: auto; font-size: 13px; line-height: 1.65; color: #d7dce8; }
.codewin [role="tabpanel"][hidden] { display: none; }
.code { position: relative; background: #0b101d; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin: 14px 0 22px; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: 13px; line-height: 1.65; color: #d7dce8; }
.code-copy {
  position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 6px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer;
}
.code-copy:hover { color: #fff; }
.code-copy.is-done { color: var(--success); }
.codewin-bar .code-copy { position: static; }
.tok-k { color: #93c5fd; } .tok-s { color: #86efac; } .tok-c { color: #6b7280; } .tok-u { color: #c4b5fd; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
  transition: border-color .15s, background .15s;
}
a.card:hover, .card.is-link:hover { border-color: var(--border-strong); background: var(--surface-2); color: inherit; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head .h3 { flex: 1; }
.card-icon { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-2); }
.card-icon .ic { width: 20px; height: 20px; }
.card p { color: var(--text-2); font-size: 15px; margin: 0; }
.card .link-more { margin-top: 18px; }
.pmark { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.05); border: 1px solid var(--border); }
.pmark svg { width: 20px; height: 20px; }
.pmark-claude { color: #f5a97f; }
.pmark-openai { color: #e6e9f0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); color: var(--text-2); background: rgba(255,255,255,0.03); }
.pill-accent { color: var(--accent-2); border-color: rgba(96,165,250,0.35); background: var(--accent-soft); }
.pill-success { color: var(--success); border-color: rgba(52,211,153,0.35); background: var(--success-soft); }
.pill-warn { color: var(--warn); border-color: rgba(251,191,36,0.35); background: var(--warn-soft); }
.pill-danger { color: var(--danger); border-color: rgba(248,113,113,0.35); background: var(--danger-soft); }
.model-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.model-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; }
.model-list code { font-size: 12.5px; color: var(--muted); background: rgba(255,255,255,0.04); padding: 2px 7px; border-radius: 5px; }

/* Features */
.feature .card-icon { margin-bottom: 18px; }
.feature .h3 { margin-bottom: 8px; }
.feature { background: transparent; border-color: transparent; padding: 8px 0; }

/* Pricing preview */
.price-card { display: flex; flex-direction: column; gap: 14px; }
.price-lines { display: flex; flex-direction: column; gap: 6px; }
.price-line { display: flex; align-items: baseline; gap: 8px; font-size: 15px; color: var(--text-2); }
.price-line strong { color: #fff; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.price-line .contact { color: var(--accent-2); font-weight: 600; font-size: 15px; }
.price-card .blurb { color: var(--muted); font-size: 14px; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step-num { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.step .h3 { margin-bottom: 4px; }
.step p { color: var(--text-2); font-size: 15px; margin: 0; }

/* CTA */
.cta { border: 1px solid var(--border); border-radius: 16px; padding: 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: linear-gradient(180deg, rgba(59,130,246,0.08), rgba(59,130,246,0.02)); }
.cta .h2 { margin-bottom: 8px; }
.cta p { color: var(--text-2); margin: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 44px 0; margin-top: 88px; }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 16px 40px; align-items: center; }
.footer-brand p { margin: 8px 0 0; font-size: 14px; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.footer-copy { grid-column: 1 / -1; font-size: 13px; margin: 8px 0 0; }

/* ---------- Generic pages ---------- */
.page { padding: 64px 0 0; }
.page-head { margin-bottom: 40px; max-width: 70ch; }
.page-head .lead { margin-top: 10px; }
.prose { max-width: 76ch; color: var(--text-2); }
.prose h2 { color: var(--text); font-size: 22px; margin: 40px 0 12px; }
.prose h3 { color: var(--text); font-size: 17px; margin: 28px 0 10px; }
.prose p, .prose li { font-size: 15.5px; }
.prose code:not(pre code) { font-size: 0.9em; background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 5px; color: #dbe3f5; }
.prose ol, .prose ul { padding-left: 22px; }
.callout { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface); color: var(--text-2); font-size: 14.5px; margin: 18px 0; }
.callout-warn { border-left-color: var(--warn); }
.docs-layout { display: grid; grid-template-columns: 240px 1fr; gap: 56px; align-items: start; }
.docs-side { position: sticky; top: 84px; }
.docs-side .h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 10px; }
.docs-side a { display: block; padding: 6px 10px; border-radius: 6px; font-size: 14px; color: var(--text-2); }
.docs-side a:hover, .docs-side a[aria-current="page"] { color: #fff; background: rgba(255,255,255,0.05); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; background: rgba(255,255,255,0.02); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .contact { color: var(--accent-2); font-weight: 600; }
.pricing-notes { margin-top: 24px; color: var(--muted); font-size: 14px; max-width: 76ch; }
.pricing-notes li { margin-bottom: 6px; }

/* Forms */
.form { max-width: 560px; }
.field { margin-bottom: 20px; }
.field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.field .hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.input, .textarea, .select {
  width: 100%; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 15px; font-family: inherit;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { min-height: 120px; resize: vertical; }
.checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 14.5px; cursor: pointer; }
.check:hover { border-color: var(--border-strong); }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check code { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.alert { border-radius: var(--radius-sm); padding: 14px 16px; font-size: 14.5px; border: 1px solid var(--border); margin-bottom: 20px; display: flex; gap: 10px; align-items: flex-start; }
.alert .ic { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; }
.alert-info { background: var(--accent-soft); border-color: rgba(96,165,250,0.35); color: #dbeafe; }
.alert-success { background: var(--success-soft); border-color: rgba(52,211,153,0.35); color: #d1fae5; }
.alert-warn { background: var(--warn-soft); border-color: rgba(251,191,36,0.35); color: #fef3c7; }
.alert-danger { background: var(--danger-soft); border-color: rgba(248,113,113,0.35); color: #fee2e2; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Status */
.status-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; max-width: 720px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.status-row:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 10px; background: var(--muted); }
.dot-ok { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.dot-down { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }

/* ---------- Portal ---------- */
.portal-body { background: var(--bg); }
.portal-header { border-bottom: 1px solid var(--border); background: var(--bg-2); position: sticky; top: 0; z-index: 40; }
.portal-nav { display: flex; align-items: center; gap: 8px; height: 58px; }
.portal-nav .brand { margin-right: 20px; }
.portal-nav .nav-link { display: inline-flex; align-items: center; gap: 8px; }
.portal-nav .nav-link .ic { width: 16px; height: 16px; opacity: .8; }
.portal-main { padding: 36px 0 80px; }
.portal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.portal-head .h2 { font-size: 26px; }
.portal-head .lead { font-size: 15px; margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.stat-warn { border-color: rgba(251,191,36,0.4); }
.stat-danger { border-color: rgba(248,113,113,0.45); }
.meter { height: 6px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; margin-top: 12px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter-warn > span { background: var(--warn); }
.meter-danger > span { background: var(--danger); }
.portal-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { font-family: var(--mono); font-size: 13px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--text); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 14.5px; margin-top: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.badge-credit { background: var(--success-soft); color: var(--success); }
.badge-refund { background: var(--accent-soft); color: var(--accent-2); }
.badge-adjustment { background: var(--warn-soft); color: var(--warn); }
.badge-chat { background: rgba(255,255,255,0.06); color: var(--text-2); }
.amt-pos { color: var(--success); }
.amt-neg { color: var(--danger); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }
.amounts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 6px 0 18px; }
.amount { position: relative; }
.amount input { position: absolute; opacity: 0; inset: 0; }
.amount span { display: flex; align-items: center; justify-content: center; height: 52px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-weight: 600; cursor: pointer; }
.amount input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: #fff; box-shadow: 0 0 0 1px var(--accent) inset; }
.amount input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Utilities */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero .container { grid-template-columns: 1fr; gap: 40px; }
  .hero { padding: 72px 0 64px; }
  .docs-layout { grid-template-columns: 1fr; gap: 24px; }
  .docs-side { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .docs-side .h3 { width: 100%; }
  .portal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-links, .nav-right { display: none; }
  .nav-toggle { display: inline-flex; }
  .grid-3, .grid-2, .steps, .stats { grid-template-columns: 1fr; }
  .section { padding: 64px 0; }
  .section-head { flex-direction: column; align-items: flex-start; margin-bottom: 28px; }
  .cta { flex-direction: column; align-items: flex-start; padding: 28px; }
  .footer-grid { grid-template-columns: 1fr; }
  .checks { grid-template-columns: 1fr; }
  .amounts { grid-template-columns: repeat(3, 1fr); }
  .portal-nav { gap: 2px; overflow-x: auto; }
  .portal-nav .nav-link span { display: none; }
  .portal-nav .nav-link .ic { width: 18px; height: 18px; }
  th, td { padding: 12px 14px; }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .hero-actions .btn { width: 100%; }
  .h1 { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn { transition: none; } }

/* ---------- Fixes: prevent grid children from expanding past the viewport ---------- */
.grid > *, .hero .container > *, .portal-grid > *, .docs-layout > *, .steps > *, .stats > * { min-width: 0; }
html[lang="zh-CN"] .h1 { font-size: clamp(32px, 4.8vw, 50px); letter-spacing: -0.01em; }
html[lang="zh-CN"] .hero-title { max-width: 14em; }
.check > span { flex: 1; }
.check input { margin: 0; }
.check code { white-space: nowrap; }

/* ---------- Top-up (Beta manual, Alipay / WeChat Pay) ---------- */
.topup-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; }
.pay-methods { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.pay-method { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border: 1px solid var(--border-strong); border-radius: 8px; font-weight: 600; font-size: 14px; background: rgba(255,255,255,0.03); }
.pay-mark { width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; }
.pay-alipay { background: #1677ff; }
.pay-wechat { background: #07c160; }
.topup-steps { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 14.5px; }
.topup-steps li { margin-bottom: 6px; }
.topup-compact { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
@media (max-width: 768px) { .topup-grid { grid-template-columns: 1fr; gap: 20px; } .topup-compact { flex-direction: column; align-items: flex-start; } }

/* ---------- Consumer Chat (portal /chat) ---------- */
.chat-cta { align-items: center; }
.chat-cta .ic { width: 20px; height: 20px; margin-top: 0; }
body.chat-page { overflow: hidden; }
.chat-shell { display: flex; height: 100vh; height: 100dvh; width: 100%; background: var(--bg); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.icon-btn .ic { width: 20px; height: 20px; }

/* Sidebar */
.chat-side { flex: 0 0 272px; width: 272px; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; background: var(--bg-2); border-right: 1px solid var(--border); min-height: 0; }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 6px; }
.chat-side-head .brand { display: inline-flex; align-items: baseline; gap: 6px; }
.brand-chat { color: var(--muted); font-weight: 500; font-size: 14px; }
.chat-side-close { display: none; }
.chat-new { justify-content: center; gap: 8px; }
.chat-new .ic { width: 16px; height: 16px; }
.chat-side-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; padding: 10px 8px 0; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-item { display: flex; align-items: center; border-radius: 8px; }
.chat-item:hover, .chat-item.is-active { background: rgba(255,255,255,0.05); }
.chat-item.is-active { background: var(--accent-soft); }
.chat-item-title { flex: 1 1 auto; min-width: 0; text-align: left; background: none; border: 0; color: var(--text-2); font: inherit; font-size: 14px; padding: 9px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.is-active .chat-item-title { color: var(--text); }
.chat-item-del { flex: 0 0 auto; background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; opacity: 0; margin-right: 4px; }
.chat-item:hover .chat-item-del, .chat-item.is-active .chat-item-del, .chat-item-del:focus-visible { opacity: 1; }
.chat-item-del:hover { color: var(--danger); background: var(--danger-soft); }
.chat-list-empty { font-size: 13px; padding: 6px 10px; margin: 0; }
.chat-side-foot { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.chat-link { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text-2); font: inherit; font-size: 13.5px; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.chat-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.chat-link .ic { width: 16px; height: 16px; opacity: .8; }
.chat-privacy { font-size: 12px; margin: 6px 10px 0; line-height: 1.4; }
.chat-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 55; }

/* Main column */
.chat-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-top { flex: 0 0 auto; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 18px; border-bottom: 1px solid var(--border); background: var(--bg); }
.chat-menu { display: none; }
.chat-top-title { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-top-right { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.chat-balance { display: inline-flex; align-items: baseline; gap: 8px; font-size: 13px; }
.chat-balance strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.chat-topup .ic { width: 15px; height: 15px; }
.chat-banner { padding: 14px 20px 0; max-width: 860px; margin: 0 auto; width: 100%; }
.chat-banner .alert { margin-bottom: 0; }
.chat-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 28px 0 12px; scroll-behavior: smooth; }
.chat-thread { max-width: 820px; margin: 0 auto; padding: 0 20px; display: flex; flex-direction: column; gap: 22px; }

/* Empty state */
.chat-empty { max-width: 720px; margin: 8vh auto 0; padding: 0 20px; text-align: center; }
.chat-empty[hidden] { display: none; }
.chat-empty-mark { display: inline-flex; width: 52px; height: 52px; border-radius: 14px; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-2); margin-bottom: 18px; }
.chat-empty-mark .ic { width: 26px; height: 26px; }
.chat-welcome { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 24px; }
.chat-suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 560px; margin: 0 auto; }
.chat-suggest-card { text-align: left; font: inherit; font-size: 14px; color: var(--text-2); padding: 13px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.chat-suggest-card:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }

/* Messages */
.chat-msg { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.chat-user { align-self: flex-end; align-items: flex-end; max-width: 76%; }
.chat-assistant { align-self: stretch; align-items: flex-start; }
.chat-who { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.chat-bubble { font-size: 15.5px; line-height: 1.6; overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
.chat-user .chat-bubble { padding: 11px 15px; border-radius: 16px; border-bottom-right-radius: 5px; background: var(--accent); color: #fff; white-space: pre-wrap; }
.chat-assistant .chat-bubble { padding: 14px 18px; border-radius: 16px; border-bottom-left-radius: 5px; background: var(--surface); border: 1px solid var(--border); color: var(--text); width: 100%; }
.chat-bubble p { margin: 0; white-space: pre-wrap; }
.chat-bubble p + p { margin-top: 12px; }
.chat-bubble code { font-family: var(--mono); font-size: 0.9em; background: rgba(255,255,255,0.07); padding: 1px 6px; border-radius: 5px; color: #dbe3f5; }
.chat-code { margin: 12px 0; border-radius: 10px; background: #0b1020; border: 1px solid var(--border); overflow: hidden; }
.chat-code:first-child { margin-top: 0; }
.chat-code:last-child { margin-bottom: 0; }
.chat-code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 6px 4px 12px; background: rgba(255,255,255,0.04); border-bottom: 1px solid var(--border); font-family: var(--font); }
.chat-code-lang { font-size: 11.5px; color: var(--muted); letter-spacing: 0.04em; }
.chat-code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; }
.chat-code code { background: none; padding: 0; color: #e6e9f0; font-size: inherit; white-space: pre; }
.chat-copy { font: inherit; font-family: var(--font); font-size: 11.5px; font-weight: 500; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 9px; cursor: pointer; white-space: nowrap; }
.chat-copy:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.chat-copy.is-done { color: var(--success); }
.chat-foot { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.chat-foot .chat-copy { margin-left: -6px; }
.chat-msg:not(:hover) .chat-foot .chat-copy:not(.is-done):not(:focus-visible) { opacity: .55; }
/* Markdown blocks inside assistant bubbles */
.chat-bubble > :first-child { margin-top: 0; }
.chat-bubble > :last-child { margin-bottom: 0; }
.chat-bubble .md-h { margin: 16px 0 6px; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
.chat-bubble .md-h1 { font-size: 19px; } .chat-bubble .md-h2 { font-size: 17px; } .chat-bubble .md-h3, .chat-bubble .md-h4, .chat-bubble .md-h5, .chat-bubble .md-h6 { font-size: 15.5px; }
.chat-bubble ul, .chat-bubble ol { margin: 8px 0; padding-left: 22px; }
.chat-bubble li { margin: 3px 0; white-space: pre-wrap; }
.chat-bubble li > ul, .chat-bubble li > ol { margin: 4px 0; }
.chat-bubble blockquote { margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--accent); background: rgba(255,255,255,0.03); border-radius: 0 8px 8px 0; color: var(--text-2); }
.chat-bubble hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.chat-bubble a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.chat-bubble strong { font-weight: 600; color: #fff; }
.chat-bubble s { opacity: .7; }
.chat-meta { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; }
.chat-dots { display: inline-flex; gap: 5px; align-items: center; width: auto; }
.chat-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: chat-bounce 1.2s infinite ease-in-out; }
.chat-dots span:nth-child(2) { animation-delay: .15s; }
.chat-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-4px); opacity: 1; } }
.chat-error { align-self: center; display: flex; align-items: center; gap: 12px; max-width: 64ch; font-size: 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--danger-soft); border: 1px solid rgba(248,113,113,0.35); color: #fee2e2; }
.chat-retry { font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); border-radius: 6px; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.chat-retry:hover { background: rgba(255,255,255,0.2); }

/* Composer */
.chat-compose-wrap { flex: 0 0 auto; padding: 8px 20px 14px; max-width: 860px; width: 100%; margin: 0 auto; }
.chat-compose { border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface); padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, box-shadow .15s; }
.chat-compose:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-input { width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15.5px; line-height: 1.5; resize: none; padding: 6px 4px; min-height: 26px; max-height: 220px; outline: none; }
.chat-input::placeholder { color: var(--muted); }
.chat-compose-bar { display: flex; align-items: center; gap: 10px; }
.chat-models { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); }
.chat-model-btn { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 5px 13px; border-radius: 999px; cursor: pointer; }
.chat-model-btn:hover { color: var(--text); }
.chat-model-btn[aria-checked="true"] { background: var(--accent-soft); color: #fff; box-shadow: 0 0 0 1px rgba(96,165,250,0.35) inset; }
.chat-status { font-size: 13px; margin-left: 4px; }
.chat-send { margin-left: auto; gap: 8px; border-radius: 10px; padding: 9px 16px; }
.chat-send .ic { width: 16px; height: 16px; }
.chat-disclaimer { margin: 8px 4px 0; font-size: 12px; text-align: center; }
.chat-shell.is-busy .chat-input { opacity: .8; }

@media (max-width: 900px) {
  .chat-side { position: fixed; top: 0; bottom: 0; left: 0; width: 284px; z-index: 60; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,0.5); }
  .chat-shell.side-open .chat-side { transform: none; }
  .chat-side-close, .chat-menu { display: inline-flex; }
  .chat-top { padding: 0 10px 0 8px; gap: 8px; }
  .chat-top-right { gap: 8px; }
  .chat-top-right .lang { display: none; }
  .chat-topup span { display: none; }
  .chat-topup { padding: 8px 10px; }
  .chat-log { padding-top: 18px; }
  .chat-thread { padding: 0 14px; gap: 18px; }
  .chat-user { max-width: 88%; }
  .chat-assistant .chat-bubble { padding: 12px 14px; }
  .chat-empty { margin-top: 4vh; }
  .chat-welcome { font-size: 24px; }
  .chat-suggest { grid-template-columns: 1fr; }
  .chat-compose-wrap { padding: 6px 10px 10px; }
  .chat-model-btn { padding: 5px 10px; font-size: 12.5px; }
  .chat-send span { display: none; }
  .chat-send { padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) { .chat-dots span { animation: none; opacity: .7; } .chat-log { scroll-behavior: auto; } .chat-side { transition: none; } }

/* ---------- Consumer sign-in (chat.bgyhub.com) ---------- */
.chat-login-body { min-height: 100vh; }
.chat-login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: radial-gradient(900px 500px at 50% -10%, rgba(59,130,246,0.14), transparent 60%), var(--bg); }
.chat-login-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 32px 30px 22px; box-shadow: var(--shadow); }
.chat-login-brand { display: flex; align-items: baseline; gap: 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 26px; }
.chat-login-card .h2 { font-size: 24px; }
.chat-login-card .eyebrow { margin-bottom: 8px; }
.chat-login-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; }
.chat-login-card .card { background: var(--surface-2); }
.chat-logout { margin: 0; }
.chat-logout .chat-link { width: 100%; }
.chat-email { margin-top: 2px; word-break: break-all; }

/* Streaming (consumer chat): caret while text arrives; dimmed when interrupted */
.chat-partial .chat-bubble > :last-child:not(.chat-code)::after, .chat-partial .chat-bubble:empty::after { content: "▍"; margin-left: 2px; color: var(--accent-2); animation: chat-caret 1s steps(2, start) infinite; }
@keyframes chat-caret { to { visibility: hidden; } }
.chat-interrupted { opacity: .7; }
@media (prefers-reduced-motion: reduce) { .chat-partial .chat-bubble > :last-child::after { animation: none; } }

/* ---------- Consumer landing (chat.bgyhub.com, signed out) ---------- */
.chat-landing-body { background: radial-gradient(1100px 560px at 50% -12%, rgba(59,130,246,0.16), transparent 62%), var(--bg); }
.landing-top { border-bottom: 1px solid var(--border); }
.landing-top-in { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.landing-top .brand { display: inline-flex; align-items: baseline; gap: 6px; }
.landing-top-right { display: flex; align-items: center; gap: 16px; }
.landing-hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: center; padding: 72px 24px 48px; }
.landing-h1 { font-size: clamp(38px, 5.2vw, 60px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.04; margin: 8px 0 18px; }
.landing-sub { font-size: 18px; line-height: 1.55; color: var(--text-2); max-width: 46ch; margin: 0; }
.landing-badges { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.landing-badges li { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.landing-badges .ic { width: 15px; height: 15px; color: var(--success); }
.landing-form-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 26px 26px 20px; box-shadow: var(--shadow); }
.landing-form-card .h3 { margin: 0 0 14px; font-size: 20px; }
.landing-form-card .field { margin-bottom: 12px; }
.input-lg { padding: 13px 14px; font-size: 16px; }
.landing-note { font-size: 13px; line-height: 1.5; margin: 14px 0 0; text-align: center; }
.landing-benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-top: 8px; padding-bottom: 8px; }
.landing-benefit .h3 { margin: 0 0 6px; font-size: 16px; }
.landing-benefit p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.landing-section { padding-top: 56px; }
.landing-h2 { font-size: 26px; margin: 0 0 22px; letter-spacing: -0.02em; }
.landing-steps .step p { color: var(--text-2); font-size: 15px; padding-top: 7px; }
.landing-pricing { border: 1px solid var(--border); border-radius: 16px; padding: 32px; background: linear-gradient(180deg, rgba(59,130,246,0.08), rgba(59,130,246,0.02)); display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.landing-pricing .landing-h2 { margin-bottom: 10px; grid-column: 1; }
.landing-pricing p { grid-column: 1; margin: 0; color: var(--text-2); font-size: 15.5px; line-height: 1.6; }
.landing-pricing .btn { grid-column: 2; grid-row: 1 / span 2; }
.landing-disclosure { font-size: 13px; line-height: 1.5; margin: 36px auto 0; max-width: 70ch; text-align: center; }
.landing-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 28px 24px 36px; margin-top: 28px; border-top: 1px solid var(--border); font-size: 13px; }
.landing-foot-links { display: flex; gap: 18px; }
.landing-foot a { color: var(--text-2); }
@media (max-width: 900px) {
  .landing-hero { grid-template-columns: 1fr; gap: 28px; padding: 36px 20px 20px; }
  .landing-h1 { font-size: clamp(32px, 9vw, 40px); }
  .landing-sub { font-size: 16px; }
  .landing-badges { margin-top: 18px; gap: 8px; }
  .landing-badges li { font-size: 12.5px; padding: 5px 10px; }
  .landing-form-card { padding: 20px 18px 16px; }
  .landing-benefits { grid-template-columns: 1fr; }
  .landing-section { padding-top: 40px; }
  .landing-h2 { font-size: 22px; }
  .landing-pricing { grid-template-columns: 1fr; padding: 24px 20px; }
  .landing-pricing .btn { grid-column: 1; grid-row: auto; justify-self: start; }
  .landing-top-right .btn { display: none; }
  .landing-foot { flex-direction: column; align-items: flex-start; }
}
.landing .lang { font-size: 13px; }
